using System; using System.Collections.Generic; namespace MonitoringDB.Entities { public class Process { 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; } public virtual ReleaseStatus ReleaseStatus { get; set; } public virtual DateTime TimeStamp { get; set; } public virtual string UserName { get; set; } public virtual IList Parts { get; set; } public virtual IList Worksteps { get; set; } /// /// Default (private) constructor inicializing lists /// protected Process() { Parts = new List(); Worksteps = new List(); } /// /// Constructor used when this process is created /// /// public Process(string name) : this() { Name = name; Description = string.Empty; ReleaseStatus = ReleaseStatus.In_preparation; TimeStamp = DateTime.Now; UserName = "admin"; } /// /// Create a copy of a process with a new name /// /// /// public virtual Process Clone(string name) { Process rslt = new Process(name); rslt.Description = Description; foreach (var part in Parts) rslt.Parts.Add(part.Clone(rslt)); foreach (var workstep in Worksteps) rslt.Worksteps.Add(workstep.Clone(rslt)); return rslt; } public override string ToString() { return string.Format("{0} '{1}' ({2}) {3} {4}", ItemNr, Name, TimeStamp.Date.ToShortDateString(), (Description == null) ? string.Empty : Description, ReleaseStatus); } } }