public override void AddControlToTop(ICoatingScheduleLogic newLogic) { if (newLogic.GetType() == typeof(CoatingScheduleShift)) { CoatingScheduleShift newController = (CoatingScheduleShift)newLogic; bool foundLineMatch = false; for (Int32 index = 0; !foundLineMatch && index < ChildrenLogic.Count; index++) { var shift = ChildrenLogic[index]; if (newController.CoatingLine == shift.CoatingLine) { foundLineMatch = true; shift.AddControlToTop(newController); } } } else if (ChildrenLogic.Count > 0) { var foundShift = ChildrenLogic.FirstOrDefault( shift => shift.CoatingLine == newLogic.CoatingLine); if (foundShift != null) { foundShift.AddControlToTop(newLogic); } } }
public override void AddControlToBottom(ICoatingScheduleLogic upChild) { if (upChild.GetType() == typeof(CoatingScheduleShift)) { CoatingScheduleShift newController = (CoatingScheduleShift)upChild; bool foundLineMatch = false; for (Int32 index = 0; !foundLineMatch && index < ChildrenLogic.Count; index++) { var shift = ChildrenLogic[index]; if (newController.CoatingLine == shift.CoatingLine) { foundLineMatch = true; shift.AddControlToBottom(newController); } } } else if (ChildrenLogic.Count > 0) { var foundShift = ChildrenLogic.Last( shift => shift.CoatingLine == upChild.CoatingLine); if (foundShift != null) { foundShift.AddControlToBottom(upChild); } } }
public override void AddLogic(ICoatingScheduleLogic newController = null) { if (newController == null) { foreach (string coatingLine in StaticFactoryValuesManager.CoatingLines) { CoatingScheduleShift newLogic = new CoatingScheduleShift(); newLogic.CoatingLine = coatingLine; ChildrenLogic.Add(newLogic); newLogic.Connect(this); if (Control != null) { Control.AddControlToBottom(newLogic); } } } else { ChildrenLogic.Add(newController); newController.Connect(this); if (Control != null) { Control.AddControlToBottom(newController); } } }
public double UnitsConsumed(ProductMasterItem item) { double consumed = 0; foreach (var coatingScheduleLogic in ChildrenLogic) { CoatingScheduleShift shift = coatingScheduleLogic as CoatingScheduleShift; consumed += shift.UnitsConsumed(item); } return(consumed); }
public List <Machine> GetMachinesOnShift() { List <Machine> machines = new List <Machine>(); foreach (var coatingScheduleLogic in ChildrenLogic) { CoatingScheduleShift shift = coatingScheduleLogic as CoatingScheduleShift; if (shift != null) { machines.AddRange(shift.GetMachinesUsed()); } } return(machines); }
public void AddProduct(CoatingScheduleProduct next, CoatingScheduleShift coatingScheduleShift) { }