/// /// Copyright (c) 2013-2015 Sensus Metering Systems /// using System; using System.Collections.Generic; namespace Config.Entities { /// /// Stores one test procedure, supports revisions and history log /// public class Procedure : IHasItemNr { public virtual int Id { get; protected set; } public virtual int ItemNr { get; set; } public virtual string Name { get; set; } public virtual string Description { get; set; } /// Short description 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) 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; } public virtual string Watermeters { get; set; } /// Water meter name or Id public virtual string ProtocolTitle { get; set; } /// Title of the printed and saved protocol 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 MoreParams { get; set; } public virtual IList Tests { get; set; } ////public virtual string MetrologicalClass { get; set; } ////public virtual IList WMTypes { get; set; } /// ------------- Additional stuff not mapped into the database ------------- public Procedure() { MoreParams = new List(); Tests = new List(); /// /// Default values /// CreationUser = (User.CurrentUser != null) ? User.CurrentUser.Name : null; CreationTime = DateTime.Now; LastChgUser = CreationUser; LastChgTime = CreationTime; MetersKind = Entities.MetersKind.Single; ProtocolTitle = "Watermeter test protocol"; } public Procedure(string name, int itemNr) : this() { Name = name; ItemNr = itemNr; } public virtual Procedure Clone() { Procedure result = new Procedure(); result.Name = Name; result.MetersKind = MetersKind; result.Description = Description; result.CreationUser = CreationUser; result.CreationTime = CreationTime; result.LastChgUser = LastChgUser; result.LastChgTime = LastChgTime; result.LongDescription = LongDescription; result.ProcedureState = ProcedureState.Active; result.PredecessorId = Id; result.Watermeters = Watermeters; result.DataEntry = DataEntry; result.ResultsPrinter = ResultsPrinter; result.ResultsWriter = ResultsWriter; result.TransitionStart = TransitionStart; result.TransitionEnd = TransitionEnd; 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; } } }