tbf/TracingDB/Entities/Part.cs

90 lines
2.6 KiB
C#

using System;
using System.Collections.Generic;
namespace TracingDB.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 CodeType CodeType { get; set; }
public virtual CodeForm 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; }
/// <summary>
/// Create a copy of a part (1) belongig to another process, (2) not assigned to any workstep yet.
/// </summary>
/// <param name="process">Process owning the cloned part</param>
/// <returns>Cloned part</returns>
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;
}
/// <summary>
/// Constructor used when the part is added to a process
/// </summary>
/// <param name="name"></param>
/// <param name="codeType"></param>
/// <param name="codeForm"></param>
/// <param name="process"></param>
public Part(string name, Process process, CodeType codeType, CodeForm codeForm, CodeLocation codeLocation)
{
Name = name;
OraDBType = string.Empty;
Description = string.Empty;
CodeType = codeType;
CodeForm = 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);
}
}
}