using System; using System.Collections.Generic; namespace SharedDatabase.Entities { public class Part { public virtual int Id { get; protected set; } public virtual string Name { get; set; } public virtual string OraDBType { get; set; } public virtual string Description { get; set; } public virtual sbyte CodeType { get; set; } public virtual sbyte CodeForm { get; set; } public virtual CodeLocation CodeLocation { get; set; } public virtual string DefaultCode { get; set; } public virtual LifetimeManagement LifetimeManagement { get; set; } public virtual int StepNumber { get; set; } public virtual Process Process { get; set; } public virtual Workstep Workstep { get; set; } /// /// Create a copy of a part (1) belongig to another process, (2) not assigned to any workstep yet. /// /// Process owning the cloned part /// Cloned part public virtual Part Clone(Process owningProcess) { Part rslt = new Part(); rslt.Name = Name; rslt.OraDBType = OraDBType; rslt.Description = Description; rslt.CodeType = CodeType; rslt.CodeForm = CodeForm; rslt.CodeLocation = CodeLocation; rslt.DefaultCode = DefaultCode; rslt.LifetimeManagement = LifetimeManagement; rslt.StepNumber = StepNumber; rslt.Process = owningProcess; rslt.Workstep = null; return rslt; } public Part() { Name = string.Empty; Description = string.Empty; } public Part(string name, Process process, string description) { Name = name; Description = description; Process = process; Workstep = null; } /// /// Constructor used when the part is added to a process /// /// /// /// /// public Part(string name, Process process, CodeType codeType, CodeForm codeForm, CodeLocation codeLocation) { Name = name; OraDBType = string.Empty; Description = string.Empty; CodeType = (sbyte)codeType; CodeForm = (sbyte)codeForm; CodeLocation = codeLocation; DefaultCode = string.Empty; StepNumber = 0; Process = process; Workstep = null; } public override string ToString() { return string.Format("{0} ({1}: {2})", Name, StepNumber, Description); } } }