示例#1
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;
                    }
                }
            }
        }
示例#2
0
        private void courseLabelForCoursesView_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            Label label = (Label)sender;

            DRAG_DROP_START_PANEL = this;
            int subIndex = this.getSubLabelIndex(label);

            Course       dragedCourse = (Course)label.Tag;
            ListViewItem lvi          = new ListViewItem();

            lvi.Tag = dragedCourse;

            ArrayList notAllowedTimeSlots = HardConstraintChecks.findAllFreeTimeSlots(dragedCourse);

            //if drag-drop was successfull, delete label from old location
            if (DragDropEffects.Move == label.DoDragDrop(lvi, DragDropEffects.Move))
            {
                TSPCoursesViewDragDropSuccessfullCmd sddsCmd = new TSPCoursesViewDragDropSuccessfullCmd(dragedCourse, this, subIndex);
                DRAG_DROP_MACRO_CMD.addInList(sddsCmd);
                CommandProcessor.getCommandProcessor().doCmd(DRAG_DROP_MACRO_CMD);
            }

            DRAG_DROP_START_PANEL = null;
            AppForm.getAppForm().doBackTimeSlotPanelGUI(notAllowedTimeSlots);
        }
示例#3
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;
                    }
                }
            }
        }
 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;
 }
        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
 private bool checkIfDropCanBeDone(TimeSlotPanel tsp)
 {
     if (tsp == DRAG_DROP_START_PANEL)
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
示例#8
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;
        }
示例#9
0
 private static void markNotPossibleTimeSlotsRelEduProgram(EduProgram ep, TimeSlotPanel tsp, ArrayList notPossibleTimeSlots)
 {
     if (!notPossibleTimeSlots.Contains(tsp))
     {
         if (ep.getAllowedTimeSlots()[tsp.getIndexRow(), tsp.getIndexCol()] == false)
         {
             tsp.BackColor = System.Drawing.Color.DarkSalmon;
             tsp.AllowDrop = false;
             notPossibleTimeSlots.Add(tsp);
         }
     }
 }
示例#10
0
        private void courseLabelForRoom_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            Label label = (Label)sender;

            DRAG_DROP_START_PANEL = this;

            Course     courseForMove = (Course)label.Tag;
            EduProgram epInMove      = (EduProgram)courseForMove.Parent;

            ArrayList [,] mytt = epInMove.getTimetable();
            ArrayList lessonsInOneTimeSlot = mytt[_indexRow, _indexCol];

            Object [] courseAndRoomPair = null;
            foreach (Object [] courseAndRoomPairInList in lessonsInOneTimeSlot)
            {
                Course thisCourse = (Course)courseAndRoomPairInList[0];
                if (thisCourse == courseForMove)
                {
                    courseAndRoomPair = courseAndRoomPairInList;
                    break;
                }
            }

            CURR_ROOM = (Room)courseAndRoomPair[1];
            Course       dragedCourse = (Course)courseAndRoomPair[0];
            ListViewItem lvi          = new ListViewItem();

            lvi.Tag = dragedCourse;

            ArrayList notAllowedTimeSlots = HardConstraintChecks.findAllFreeTimeSlotsForRoomsView(dragedCourse, CURR_ROOM);

            //if drag-drop was successfull, delete label from old location
            if (DragDropEffects.Move == label.DoDragDrop(lvi, DragDropEffects.Move))
            {
                TSPRoomsViewDragDropSuccessfullCmd uddsCmd = new TSPRoomsViewDragDropSuccessfullCmd(dragedCourse, this, lessonsInOneTimeSlot, courseAndRoomPair);
                DRAG_DROP_MACRO_CMD.addInList(uddsCmd);
                CommandProcessor.getCommandProcessor().doCmd(DRAG_DROP_MACRO_CMD);
            }

            DRAG_DROP_START_PANEL = null;
            AppForm.getAppForm().doBackTimeSlotPanelGUI(notAllowedTimeSlots);
        }
示例#11
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);
                            }
                        }
                    }
                }
            }
        }