public override void SwapChildUp(ICoatingScheduleLogic upChild, ICoatingScheduleLogic lastParent)
        {
            if (lastParent.GetType() == typeof(CoatingScheduleDay))
            {
                Int32 indexOfParent = ChildrenLogic.IndexOf((CoatingScheduleDay)lastParent);

                if (indexOfParent > 0) // if not at the top
                {
                    lastParent.RemoveLogic(upChild);
                    ChildrenLogic[indexOfParent - 1].AddControlToBottom(upChild);
                }
                else if (indexOfParent == 0)
                {
                    //must add back the child
                    ICoatingScheduleLogic child  = ChildrenLogic[0];
                    ICoatingScheduleLogic child2 = child.ChildrenLogic[0];
                    ICoatingScheduleLogic child3 = child2.ChildrenLogic.First(x => x.CoatingLine == upChild.CoatingLine);
                    child3.AddLogic(upChild);
                }
                else
                {
                    throw new Exception("Invoking object not a member of current object");
                }
            }
            else
            {
                throw new Exception("Call received by a non-child control.");
            }
        }
Exemple #2
0
        public override void SwapChildUp(ICoatingScheduleLogic upChild, ICoatingScheduleLogic lastParent)
        {
            if (lastParent.GetType() == typeof(CoatingScheduleLine))
            {
                Int32 indexOfParent = ChildrenLogic.IndexOf((CoatingScheduleLine)lastParent);

                if (indexOfParent > 0) // if not at the top
                {
                    lastParent.RemoveLogic(upChild);
                    ChildrenLogic[indexOfParent - 1].AddControlToBottom(upChild);
                }
                else if (indexOfParent == 0)
                {
                    ParentLogic.SwapChildUp(upChild, this);
                }
                else
                {
                    throw new Exception("Invoking object not a member of current object");
                }
            }
            else
            {
                throw new Exception("Call received by a non-child control.");
            }
        }
        public override void SwapChildDown(ICoatingScheduleLogic downChild, ICoatingScheduleLogic lastParent)
        {
            if (lastParent.GetType() == typeof(CoatingScheduleDay))
            {
                Int32 indexOfParent = ChildrenLogic.IndexOf((CoatingScheduleDay)lastParent);

                if (indexOfParent < ChildrenLogic.Count - 1) // if not at the bottom
                {
                    lastParent.RemoveLogic(downChild);
                    ChildrenLogic[indexOfParent + 1].AddControlToTop(downChild);
                }
                else if (indexOfParent == ChildrenLogic.Count - 1)
                {
                    //must add back the child
                    var day   = ChildrenLogic.Last();
                    var line  = day.ChildrenLogic.Last();
                    var shift = line.ChildrenLogic.First(x => x.CoatingLine == downChild.CoatingLine);
                    shift.AddControlToBottom(downChild);
                }
                else
                {
                    throw new Exception("Invoking object not a member of current object");
                }
            }
            else
            {
                throw new Exception("Call received by a non-child control.");
            }
        }