tbf/TestBenchFramework/Entities/Procedure.cs
Milan Hanajik 6d6b322fb5 Process screen and Procedure (dlg, DB) changes to suport combined meters, virtual bench.
TODO: Visualize changes of pump/valve, diverter, tank
2014-12-12 12:13:43 +01:00

80 lines
2.9 KiB
C#

using System;
using System.Collections.Generic;
using TBF.Resources;
namespace TBF.Entities
{
/// <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; }
public virtual MetersKind MetersKind { 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 string Watermeters { get; set; } /// Water meter name or Id
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()
{
CreationUser = (User.CurrentUser != null) ? User.CurrentUser.Name : null;
CreationTime = DateTime.Now;
LastChgUser = CreationUser;
LastChgTime = CreationTime;
MoreParams = new List<ComponentProcedure>();
Tests = new List<Test>();
//WMTypes = new List<WMType>();
}
public Procedure(string name, int itemNr)
: this()
{
Name = name;
ItemNr = itemNr;
}
public virtual Procedure Clone()
{
Procedure result = new Procedure();
result.Name = Name;
result.Description = Description;
result.CreationUser = CreationUser;
result.CreationTime = CreationTime;
result.LastChgUser = LastChgUser;
result.LastChgTime = LastChgTime;
result.LongDescription = LongDescription;
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;
}
}
}