Esempio n. 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;
                    }
                }
            }
        }
Esempio n. 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;
                    }
                }
            }
        }
Esempio n. 3
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);
                        }
                    }
                }
            }
        }
Esempio n. 4
0
        private static void markNotPossibleTimeSlotsRelGroup(ArrayList lessonsInOneTimeSlot, TimeSlotPanel tsp, Course dragedCourse, ArrayList notPossibleTimeSlots)
        {
            if (lessonsInOneTimeSlot != null)
            {
                int n = 0;
                foreach (Object [] courseAndRoomPair in lessonsInOneTimeSlot)
                {
                    n++;
                    Course edu_program_group = (Course)courseAndRoomPair[0];
                    if (!edu_program_group.getIsGroup())
                    {
                        ArrayList subLabels = tsp.getAllSubLabels();
                        foreach (Label [] courseRoomLabel in subLabels)
                        {
                            Label courseLabel = courseRoomLabel[0];
                            Label roomLabel   = courseRoomLabel[1];

                            if (courseLabel.Tag != null)
                            {
                                if (dragedCourse.getCoursesToHoldTogetherList().Count > 0)
                                {
                                    courseLabel.BackColor = System.Drawing.Color.DarkSalmon;
                                    roomLabel.BackColor   = System.Drawing.Color.DarkSalmon;
                                }
                                else
                                {
                                    Course courseTag = (Course)courseLabel.Tag;
                                    if (courseTag == dragedCourse)
                                    {
                                        courseLabel.BackColor = System.Drawing.Color.DarkSalmon;
                                        roomLabel.BackColor   = System.Drawing.Color.DarkSalmon;
                                    }
                                    else
                                    {
                                        courseLabel.BackColor = System.Drawing.Color.DarkSalmon;
                                        roomLabel.BackColor   = System.Drawing.Color.DarkSalmon;
                                    }
                                }
                            }
                            else
                            {
                                if (edu_program_group != dragedCourse)
                                {
                                    courseLabel.BackColor = System.Drawing.Color.DarkSalmon;
                                    roomLabel.BackColor   = System.Drawing.Color.DarkSalmon;
                                }
                                else
                                {
                                    courseLabel.BackColor = System.Drawing.Color.DarkSalmon;
                                    roomLabel.BackColor   = System.Drawing.Color.DarkSalmon;
                                }
                            }
                        }

                        tsp.BackColor = System.Drawing.Color.DarkSalmon;
                        tsp.AllowDrop = false;
                        notPossibleTimeSlots.Add(tsp);
                    }
                    else
                    {
                        if (!dragedCourse.getIsGroup())
                        {
                            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;
                            }

                            tsp.BackColor = System.Drawing.Color.DarkSalmon;
                            tsp.AllowDrop = false;
                            notPossibleTimeSlots.Add(tsp);
                        }
                        else
                        {
                            if (edu_program_group.getGroupName() == dragedCourse.getGroupName())
                            {
                                ArrayList subLabels = tsp.getAllSubLabels();
                                int       stepIn    = 0;
                                foreach (Label [] courseRoomLabel in subLabels)
                                {
                                    stepIn++;

                                    Label courseLabel = courseRoomLabel[0];
                                    Label roomLabel   = courseRoomLabel[1];

                                    if (courseLabel.Tag != null)
                                    {
                                        if (dragedCourse.getCoursesToHoldTogetherList().Count > 0)
                                        {
                                            courseLabel.BackColor = System.Drawing.Color.DarkSalmon;
                                            roomLabel.BackColor   = System.Drawing.Color.DarkSalmon;
                                        }
                                        else
                                        {
                                            Course courseTag = (Course)courseLabel.Tag;
                                            if (courseTag == dragedCourse)
                                            {
                                                courseLabel.BackColor = System.Drawing.Color.DarkSalmon;
                                                roomLabel.BackColor   = System.Drawing.Color.DarkSalmon;
                                            }
                                            else
                                            {
                                                courseLabel.BackColor = System.Drawing.Color.DarkSalmon;
                                                roomLabel.BackColor   = System.Drawing.Color.DarkSalmon;
                                            }
                                        }
                                    }
                                    else
                                    {
                                        if (stepIn != n)
                                        {
                                            courseLabel.BackColor = System.Drawing.Color.DarkSalmon;
                                            roomLabel.BackColor   = System.Drawing.Color.DarkSalmon;
                                        }
                                        else
                                        {
                                            if (edu_program_group != dragedCourse)
                                            {
                                                courseLabel.BackColor = System.Drawing.Color.DarkSalmon;
                                                roomLabel.BackColor   = System.Drawing.Color.DarkSalmon;
                                            }
                                            else
                                            {
                                                courseLabel.BackColor = System.Drawing.Color.DarkSalmon;
                                                roomLabel.BackColor   = System.Drawing.Color.DarkSalmon;
                                            }
                                        }
                                    }
                                }

                                tsp.BackColor = System.Drawing.Color.DarkSalmon;
                                tsp.AllowDrop = false;
                                notPossibleTimeSlots.Add(tsp);
                            }
                        }
                    }
                }
            }
        }
        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);
                        }
                    }
                }
            }
        }