Exemplo n.º 1
0
        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);
                }
            }
        }