示例#1
0
        private static void markNotPossibleTimeSlotsRelTeacher(TimeSlotPanel tsp, Teacher dragedTeacher, ArrayList notPossibleTimeSlots)
        {
            if (!notPossibleTimeSlots.Contains(tsp))
            {
                if (dragedTeacher.getAllowedTimeSlots()[tsp.getIndexRow(), tsp.getIndexCol()])
                {
                    foreach (EduProgramGroup epg in AppForm.CURR_OCTT_DOC.CoursesRootNode.Nodes)
                    {
                        foreach (EduProgram ep in epg.Nodes)
                        {
                            ArrayList [,] eptt = ep.getTimetable();
                            ArrayList lessonsInOneTimeSlot = eptt[tsp.getIndexRow(), tsp.getIndexCol()];
                            if (lessonsInOneTimeSlot != null)
                            {
                                foreach (Object [] courseAndRoomPair in lessonsInOneTimeSlot)
                                {
                                    Course  edu_program_group = (Course)courseAndRoomPair[0];
                                    Teacher teacher           = edu_program_group.getTeacher();
                                    if (teacher == dragedTeacher)
                                    {
                                        tsp.BackColor = System.Drawing.Color.DarkSalmon;
                                        tsp.AllowDrop = false;
                                        notPossibleTimeSlots.Add(tsp);

                                        ArrayList subLabels = tsp.getAllSubLabels();
                                        foreach (Label [] courseRoomLabel in subLabels)
                                        {
                                            Label courseLabel = courseRoomLabel[0];
                                            Label roomLabel   = courseRoomLabel[1];

                                            courseLabel.BackColor = System.Drawing.Color.DarkSalmon;
                                            roomLabel.BackColor   = System.Drawing.Color.DarkSalmon;
                                        }

                                        goto stop;
                                    }
                                }
                            }
                        }
                    }
                    stop :;
                }
                else
                {
                    tsp.BackColor = System.Drawing.Color.DarkSalmon;
                    tsp.AllowDrop = false;
                    notPossibleTimeSlots.Add(tsp);

                    ArrayList subLabels = tsp.getAllSubLabels();
                    foreach (Label [] courseRoomLabel in subLabels)
                    {
                        Label courseLabel = courseRoomLabel[0];
                        Label roomLabel   = courseRoomLabel[1];

                        courseLabel.BackColor = System.Drawing.Color.DarkSalmon;
                        roomLabel.BackColor   = System.Drawing.Color.DarkSalmon;
                    }
                }
            }
        }
示例#2
0
        private static void markNotPossibleTimeSlotsRelRoom(TimeSlotPanel tsp, ArrayList possibleRooms, ArrayList notPossibleTimeSlots)
        {
            if (!notPossibleTimeSlots.Contains(tsp))
            {
                int       indexRow          = tsp.getIndexRow();
                int       indexCol          = tsp.getIndexCol();
                ArrayList possibleRoomsCopy = HardConstraintChecks.getPossibleRoomsRelTimeSlot(possibleRooms, indexRow, indexCol);


                //
                if (possibleRoomsCopy.Count == 0)
                {
                    tsp.BackColor = System.Drawing.Color.DarkSalmon;
                    tsp.AllowDrop = false;
                    notPossibleTimeSlots.Add(tsp);

                    ArrayList subLabels = tsp.getAllSubLabels();
                    foreach (Label [] courseRoomLabel in subLabels)
                    {
                        Label courseLabel = courseRoomLabel[0];
                        Label roomLabel   = courseRoomLabel[1];

                        courseLabel.BackColor = System.Drawing.Color.DarkSalmon;
                        roomLabel.BackColor   = System.Drawing.Color.DarkSalmon;
                    }
                }
            }
        }
 public TSPTeachersViewDragDropCmd(Course dropedCourse, TimeSlotPanel tsp)
 {
     _dropedCourse = dropedCourse;
     _tsp          = tsp;
     _indexRow     = _tsp.getIndexRow();
     _indexCol     = _tsp.getIndexCol();
     _selectedNode = AppForm.getAppForm().getTeachersTreeView().SelectedNode;
 }
 public TSPRoomsViewDragDropCmd(Course dropedCourse, TimeSlotPanel tsp, Room currRoom)
 {
     _dropedCourse = dropedCourse;
     _tsp          = tsp;
     _indexRow     = _tsp.getIndexRow();
     _indexCol     = _tsp.getIndexCol();
     _currRoom     = currRoom;
     _selectedNode = AppForm.getAppForm().getRoomsTreeView().SelectedNode;
 }
示例#5
0
 private static void markNotPossibleTimeSlotsRelEduProgramGroup(EduProgramGroup epg, TimeSlotPanel tsp, ArrayList notPossibleTimeSlots)
 {
     if (epg.getAllowedTimeSlots()[tsp.getIndexRow(), tsp.getIndexCol()] == false)
     {
         tsp.BackColor = System.Drawing.Color.DarkSalmon;
         tsp.AllowDrop = false;
         notPossibleTimeSlots.Add(tsp);
     }
 }
        public TSPCoursesViewDragDropSuccessfullCmd(Course dragedCourse, TimeSlotPanel tsp, int subIndex)
        {
            _dragedCourse = dragedCourse;
            _tsp          = tsp;
            _subIndex     = subIndex;

            _indexRow     = _tsp.getIndexRow();
            _indexCol     = _tsp.getIndexCol();
            _selectedNode = AppForm.getAppForm().getCoursesTreeView().SelectedNode;
        }
示例#7
0
        public TSPTeachersViewDragDropSuccessfullCmd(Course dragedCourse, TimeSlotPanel tsp, ArrayList lessonsInOneTimeSlot, Object [] courseAndRoomPair)
        {
            _dragedCourse         = dragedCourse;
            _tsp                  = tsp;
            _lessonsInOneTimeSlot = lessonsInOneTimeSlot;
            _courseAndRoomPair    = courseAndRoomPair;

            _indexRow     = _tsp.getIndexRow();
            _indexCol     = _tsp.getIndexCol();
            _selectedNode = AppForm.getAppForm().getTeachersTreeView().SelectedNode;
        }
        public override void doit()
        {
            _forUndoRedoList = new ArrayList();

            //find all rooms which are possible
            //for this lection (capacity, are they free in the term,...)
            ArrayList possibleRooms = _tsp.calculateAllAllowedRooms(_dropedCourse, _tsp.getIndexRow(), _tsp.getIndexCol());

            //i take the room which has the first bigger capacity than
            //the number of enrolled students for the course(s) that is draged
            IEnumerator prEnum          = possibleRooms.GetEnumerator();
            Room        minCapacityRoom = null;

            for (int n = 0; n < possibleRooms.Count; n++)
            {
                prEnum.MoveNext();
                Room room = (Room)prEnum.Current;
                if (n == 0)
                {
                    minCapacityRoom = room;
                }
                else
                {
                    if (room.getRoomCapacity() < minCapacityRoom.getRoomCapacity())
                    {
                        minCapacityRoom = room;
                    }
                }
            }

            _tsp.makeSubLabel(_dropedCourse, minCapacityRoom);

            EduProgram thisEP = (EduProgram)_dropedCourse.Parent;

            ArrayList [,] mytt = thisEP.getTimetable();
            ArrayList lessonsInOneTimeSlot;

            if (mytt[_indexRow, _indexCol] == null)
            {
                lessonsInOneTimeSlot = new ArrayList();
            }
            else
            {
                lessonsInOneTimeSlot = mytt[_indexRow, _indexCol];
            }


            Object [] courseAndRoomPair = new Object[2];
            courseAndRoomPair[0] = _dropedCourse;
            courseAndRoomPair[1] = minCapacityRoom;

            lessonsInOneTimeSlot.Add(courseAndRoomPair);
            mytt[_indexRow, _indexCol] = lessonsInOneTimeSlot;

            _forUndoRedoList.Add(courseAndRoomPair);

            if (_dropedCourse.getCoursesToHoldTogetherList().Count > 0)
            {
                foreach (Course courseHT in _dropedCourse.getCoursesToHoldTogetherList())
                {
                    EduProgram epHT = (EduProgram)courseHT.Parent;
                    ArrayList [,] myttHT = epHT.getTimetable();

                    ArrayList lessonsInOneTimeSlotHT;
                    if (myttHT[_indexRow, _indexCol] == null)
                    {
                        lessonsInOneTimeSlotHT = new ArrayList();
                    }
                    else
                    {
                        lessonsInOneTimeSlotHT = myttHT[_indexRow, _indexCol];
                    }


                    Object [] courseAndRoomPairHT = new Object[2];

                    courseAndRoomPairHT[0] = courseHT;
                    courseAndRoomPairHT[1] = minCapacityRoom;

                    lessonsInOneTimeSlotHT.Add(courseAndRoomPairHT);
                    myttHT[_indexRow, _indexCol] = lessonsInOneTimeSlotHT;

                    _forUndoRedoList.Add(courseAndRoomPairHT);
                }
            }
        }
        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);
                        }
                    }
                }
            }
        }