69 lines
1.8 KiB
C#
69 lines
1.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace TracingDB.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<Part> Parts { get; set; }
|
|
public virtual IList<Workstep> Worksteps { get; set; }
|
|
|
|
/// <summary>
|
|
/// Default (private) constructor inicializing lists
|
|
/// </summary>
|
|
protected Process()
|
|
{
|
|
Parts = new List<Part>();
|
|
Worksteps = new List<Workstep>();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Constructor used when this process is created
|
|
/// </summary>
|
|
/// <param name="name"></param>
|
|
public Process(string name)
|
|
: this()
|
|
{
|
|
Name = name;
|
|
Description = string.Empty;
|
|
ReleaseStatus = ReleaseStatus.In_preparation;
|
|
TimeStamp = DateTime.Now;
|
|
UserName = "admin";
|
|
}
|
|
|
|
/// <summary>
|
|
/// Create a copy of a process with a new name
|
|
/// </summary>
|
|
/// <param name="name"></param>
|
|
/// <returns></returns>
|
|
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);
|
|
}
|
|
}
|
|
}
|