2015-04-15 18:32:56 +00:00
|
|
|
|
///
|
|
|
|
|
|
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
|
|
|
|
|
///
|
|
|
|
|
|
using System;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
2015-12-04 16:17:20 +00:00
|
|
|
|
namespace Config.Entities
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Stores one test procedure, supports revisions and history log
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public class Procedure : IHasItemNr
|
|
|
|
|
|
{
|
|
|
|
|
|
public virtual int Id { get; protected set; }
|
|
|
|
|
|
public virtual int ItemNr { get; set; }
|
|
|
|
|
|
public virtual string Name { get; set; }
|
2015-11-26 22:51:49 +00:00
|
|
|
|
|
2014-12-11 21:35:16 +00:00
|
|
|
|
public virtual string Description { get; set; } /// Short description
|
2014-07-28 07:54:35 +00:00
|
|
|
|
public virtual string CreationUser { get; set; } /// Name of the user who has created or changed this procedure
|
|
|
|
|
|
public virtual DateTime CreationTime { get; set; } /// Date and time of the creation or change
|
|
|
|
|
|
public virtual string LastChgUser { get; set; } /// Name of the user who has created or changed this procedure
|
|
|
|
|
|
public virtual DateTime LastChgTime { get; set; } /// Date and time of the creation or change
|
|
|
|
|
|
public virtual string LongDescription { get; set; } /// Long description (notes)
|
2015-11-26 22:51:49 +00:00
|
|
|
|
|
|
|
|
|
|
public virtual ProcedureState ProcedureState { get; set; }
|
|
|
|
|
|
public virtual int Revision { get; set; }
|
|
|
|
|
|
public virtual int PredecessorId { get; set; }
|
|
|
|
|
|
public virtual bool ObtainedByCopy { get; set; }
|
|
|
|
|
|
///
|
|
|
|
|
|
public virtual MetersKind MetersKind { get; set; }
|
2014-07-28 07:54:35 +00:00
|
|
|
|
public virtual string Watermeters { get; set; } /// Water meter name or Id
|
2015-01-25 22:43:17 +00:00
|
|
|
|
public virtual string ProtocolTitle { get; set; } /// Title of the printed and saved protocol
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
public virtual string DataEntry { get; set; } /// Component to use for data entry
|
|
|
|
|
|
public virtual string ResultsPrinter { get; set; } /// Component to use for printing the results
|
|
|
|
|
|
public virtual string ResultsWriter { get; set; } /// Component to use for saving the results into the file
|
|
|
|
|
|
public virtual string TransitionStart { get; set; }
|
|
|
|
|
|
public virtual string TransitionEnd { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public virtual IList<ComponentProcedure> MoreParams { get; set; }
|
|
|
|
|
|
public virtual IList<Test> Tests { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
////public virtual string MetrologicalClass { get; set; }
|
|
|
|
|
|
////public virtual IList<WMType> WMTypes { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
/// ------------- Additional stuff not mapped into the database -------------
|
|
|
|
|
|
|
|
|
|
|
|
public Procedure()
|
|
|
|
|
|
{
|
2015-02-02 13:45:06 +00:00
|
|
|
|
MoreParams = new List<ComponentProcedure>();
|
|
|
|
|
|
Tests = new List<Test>();
|
|
|
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
/// Default values
|
|
|
|
|
|
///
|
2014-07-28 07:54:35 +00:00
|
|
|
|
CreationUser = (User.CurrentUser != null) ? User.CurrentUser.Name : null;
|
|
|
|
|
|
CreationTime = DateTime.Now;
|
|
|
|
|
|
LastChgUser = CreationUser;
|
|
|
|
|
|
LastChgTime = CreationTime;
|
2015-03-25 04:35:05 +00:00
|
|
|
|
MetersKind = Entities.MetersKind.Single;
|
2015-02-02 13:45:06 +00:00
|
|
|
|
ProtocolTitle = "Watermeter test protocol";
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Procedure(string name, int itemNr)
|
|
|
|
|
|
: this()
|
|
|
|
|
|
{
|
|
|
|
|
|
Name = name;
|
|
|
|
|
|
ItemNr = itemNr;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public virtual Procedure Clone()
|
|
|
|
|
|
{
|
|
|
|
|
|
Procedure result = new Procedure();
|
|
|
|
|
|
|
|
|
|
|
|
result.Name = Name;
|
2015-01-09 08:01:08 +00:00
|
|
|
|
result.MetersKind = MetersKind;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
result.Description = Description;
|
|
|
|
|
|
result.CreationUser = CreationUser;
|
|
|
|
|
|
result.CreationTime = CreationTime;
|
|
|
|
|
|
result.LastChgUser = LastChgUser;
|
|
|
|
|
|
result.LastChgTime = LastChgTime;
|
|
|
|
|
|
result.LongDescription = LongDescription;
|
2015-11-26 22:51:49 +00:00
|
|
|
|
|
|
|
|
|
|
result.ProcedureState = ProcedureState.Active;
|
|
|
|
|
|
result.PredecessorId = Id;
|
|
|
|
|
|
|
2015-01-09 08:01:08 +00:00
|
|
|
|
result.Watermeters = Watermeters;
|
|
|
|
|
|
result.DataEntry = DataEntry;
|
|
|
|
|
|
result.ResultsPrinter = ResultsPrinter;
|
|
|
|
|
|
result.ResultsWriter = ResultsWriter;
|
|
|
|
|
|
result.TransitionStart = TransitionStart;
|
|
|
|
|
|
result.TransitionEnd = TransitionEnd;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
foreach (var prms in MoreParams) { result.MoreParams.Add(prms.Clone()); }
|
|
|
|
|
|
foreach (var test in Tests) { result.Tests.Add(test.Clone()); }
|
|
|
|
|
|
|
|
|
|
|
|
//result.MetrologicalClass = MetrologicalClass;
|
|
|
|
|
|
//result.WMType = WMType.Clone();
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
2016-01-10 11:39:20 +00:00
|
|
|
|
|
|
|
|
|
|
public override string ToString()
|
|
|
|
|
|
{
|
|
|
|
|
|
return string.Format("{0}, rev.{1}", Name, Revision);
|
|
|
|
|
|
}
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|