Beispiel #1
0
        public override void doit()
        {
            _forUndoRedoList = new ArrayList();

            _lessonsInOneTimeSlot.Remove(_courseAndRoomPair);

            _forUndoRedoList.Add(_courseAndRoomPair);

            _tsp.Controls.Clear();
            _tsp.getAllSubLabels().Clear();

            _tsp.putLabelsOnThePanel();

            if (_dragedCourse.getCoursesToHoldTogetherList().Count > 0)
            {
                foreach (Course courseHT in _dragedCourse.getCoursesToHoldTogetherList())
                {
                    EduProgram epHT = (EduProgram)courseHT.Parent;
                    ArrayList [,] myttHT = epHT.getTimetable();
                    ArrayList lessonsInOneTimeSlotHT = myttHT[_indexRow, _indexCol];
                    if (lessonsInOneTimeSlotHT != null)
                    {
                        Object[] courseAndRoomPairForDel = null;
                        foreach (Object[] courseAndRoomPairHT in lessonsInOneTimeSlotHT)
                        {
                            Course courseToCheck = (Course)courseAndRoomPairHT[0];
                            if (courseToCheck == courseHT)
                            {
                                courseAndRoomPairForDel = courseAndRoomPairHT;
                                break;
                            }
                        }
                        if (courseAndRoomPairForDel != null)
                        {
                            lessonsInOneTimeSlotHT.Remove(courseAndRoomPairForDel);

                            _forUndoRedoList.Add(courseAndRoomPairForDel);
                        }
                    }
                }
            }
        }
        public override void doit()
        {
            _forUndoRedoList = new ArrayList();

            EduProgram ep = (EduProgram)_dragedCourse.Parent;

            ArrayList [,] mytt = ep.getTimetable();
            ArrayList   lessonsInOneTimeSlot = mytt[_tsp.getIndexRow(), _tsp.getIndexCol()];
            IEnumerator enumModel            = lessonsInOneTimeSlot.GetEnumerator();

            IEnumerator enumGUI = _tsp.getAllSubLabels().GetEnumerator();

            for (int n = 0; n <= _subIndex; n++)
            {
                enumModel.MoveNext();
                enumGUI.MoveNext();
            }

            Object [] courseAndRoomPair = (Object [])enumModel.Current;
            lessonsInOneTimeSlot.Remove(courseAndRoomPair);

            _forUndoRedoList.Add(courseAndRoomPair);


            Label[] oneSubLabel = (Label [])enumGUI.Current;
            Label   courseLabel = oneSubLabel[0];
            Label   roomLabel   = oneSubLabel[1];

            _tsp.getAllSubLabels().Remove(oneSubLabel);

            courseLabel.Parent = null;
            roomLabel.Parent   = null;

            _tsp.putLabelsOnThePanel();

            if (_dragedCourse.getCoursesToHoldTogetherList().Count > 0)
            {
                foreach (Course courseHT in _dragedCourse.getCoursesToHoldTogetherList())
                {
                    EduProgram epHT = (EduProgram)courseHT.Parent;
                    ArrayList [,] myttHT = epHT.getTimetable();
                    ArrayList lessonsInOneTimeSlotHT = myttHT[_tsp.getIndexRow(), _tsp.getIndexCol()];
                    if (lessonsInOneTimeSlotHT != null)
                    {
                        Object[] courseAndRoomPairForDel = null;
                        foreach (Object[] courseAndRoomPairHT in lessonsInOneTimeSlotHT)
                        {
                            Course courseToCheck = (Course)courseAndRoomPairHT[0];
                            if (courseToCheck == courseHT)
                            {
                                courseAndRoomPairForDel = courseAndRoomPairHT;
                                break;
                            }
                        }
                        if (courseAndRoomPairForDel != null)
                        {
                            lessonsInOneTimeSlotHT.Remove(courseAndRoomPairForDel);

                            _forUndoRedoList.Add(courseAndRoomPairForDel);
                        }
                    }
                }
            }
        }