public override void AddLogic(ICoatingScheduleLogic newController = null) { CoatingScheduleLine newLogic; if (newController != null) { newLogic = (CoatingScheduleLine)newController; newLogic.Connect(this); if (Control != null) { Control.AddControlToBottom(newLogic); } } else { newLogic = new CoatingScheduleLine(); newLogic.Shift = GetNextShift(); newLogic.Connect(this); if (Control != null) { Control.AddControlToBottom(newLogic); } newLogic.AddLogic(); } ChildrenLogic.Add(newLogic); }
public override void AddControlToTop(ICoatingScheduleLogic newController) { CoatingScheduleLine newLogic; if (newController != null) { if (newController.GetType() == typeof(CoatingScheduleLine)) { newLogic = (CoatingScheduleLine)newController; newLogic.Shift = GetNextShift(); ChildrenLogic.Add(newLogic); newLogic.Connect(this); Control.AddControlToTop(newLogic); newLogic.AddLogic(); } else if (ChildrenLogic.Count > 0) { ChildrenLogic[0].AddControlToTop(newController); } else { newLogic = new CoatingScheduleLine(); newLogic.Date = Date; newLogic.Shift = GetNextShift(); ChildrenLogic.Add(newLogic); newLogic.Connect(this); Control.AddControlToTop(newLogic); newLogic.AddLogic(); newLogic.AddControlToTop(newController); } } else { newLogic = new CoatingScheduleLine(); newLogic.Date = Date; newLogic.Shift = GetNextShift(); ChildrenLogic.Add(newLogic); newLogic.Connect(this); Control.AddControlToTop(newLogic); newLogic.AddLogic(); } }