using System;
using System.Collections.Generic;
namespace MonitoringDB.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 LifetimeManagement LifetimeManagement { get; set; }
public virtual int StepNumber { get; set; }
public virtual Process Process { get; set; }
public virtual Workstep Workstep { get; set; }
protected Part()
{
Name = string.Empty;
Description = string.Empty;
}
///
/// 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 = codeType;
CodeForm = codeForm;
CodeLocation = codeLocation;
StepNumber = 0;
Process = process;
Workstep = null;
}
///
/// 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(Name, owningProcess, CodeType, CodeForm, CodeLocation);
rslt.OraDBType = OraDBType;
rslt.Description = Description;
rslt.LifetimeManagement = LifetimeManagement;
return rslt;
}
public override string ToString()
{
return string.Format("{0} step={1} ({2})", Name, StepNumber, Description);
}
}
}