Beispiel #1
0
 public override void doit()
 {
     if (_cmdType == Constants.ATSF_TIME_SLOT_TYPE_TEACHER)
     {
         Teacher teacher = (Teacher)_workingObject;
         teacher.setAllowedTimeSlots(_newAllowedTimeSlots);
         AppForm.getAppForm().getTeachersTreeView().SelectedNode = teacher;
         AppForm.getAppForm().getTreeTabControl().SelectedIndex  = 1;
     }
     else if (_cmdType == Constants.ATSF_TIME_SLOT_TYPE_EDU_PROGRAM)
     {
         EduProgram ep = (EduProgram)_workingObject;
         ep.setAllowedTimeSlots(_newAllowedTimeSlots);
         AppForm.getAppForm().getCoursesTreeView().SelectedNode = ep;
         AppForm.getAppForm().getTreeTabControl().SelectedIndex = 0;
     }
     else if (_cmdType == Constants.ATSF_TIME_SLOT_TYPE_EDU_PROGRAM_GROUP)
     {
         EduProgramGroup epg = (EduProgramGroup)_workingObject;
         epg.setAllowedTimeSlots(_newAllowedTimeSlots);
         AppForm.getAppForm().getCoursesTreeView().SelectedNode = epg;
         AppForm.getAppForm().getTreeTabControl().SelectedIndex = 0;
     }
     else if (_cmdType == Constants.ATSF_TIME_SLOT_TYPE_ROOM)
     {
         Room room = (Room)_workingObject;
         room.setAllowedTimeSlots(_newAllowedTimeSlots);
         AppForm.getAppForm().getRoomsTreeView().SelectedNode   = room;
         AppForm.getAppForm().getTreeTabControl().SelectedIndex = 2;
     }
 }
Beispiel #2
0
        public override void doit()
        {
            AppForm.CURR_OCTT_DOC.incrUnallocatedLessonsCounter(1);
            Course     course    = (Course)_lviDroped.Tag;
            Teacher    myTeacher = course.getTeacher();
            EduProgram ep        = (EduProgram)course.Parent;

            string [] courseTeacher = new string[2];
            courseTeacher[0] = course.getFullName();
            courseTeacher[1] = myTeacher.getLastName() + " " + myTeacher.getName();

            ListViewItem lviNew = new ListViewItem(courseTeacher);

            lviNew.Tag = course;

            _ullv.Items.Add(lviNew);
            _ullv.EnsureVisible(_ullv.Items.IndexOf(lviNew));

            ep.getUnallocatedLessonsList().Add(lviNew);

            if (course.getCoursesToHoldTogetherList().Count > 0)
            {
                foreach (Course courseHT in course.getCoursesToHoldTogetherList())
                {
                    EduProgram   epHT        = (EduProgram)courseHT.Parent;
                    Teacher      myTeacherHT = courseHT.getTeacher();
                    ListViewItem lviNewHT    = new ListViewItem();
                    lviNewHT.Tag = courseHT;

                    epHT.getUnallocatedLessonsList().Add(lviNewHT);
                }
            }

            AppForm.getAppForm().getStatusBarPanel2().Text = AppForm.CURR_OCTT_DOC.getNumOfUnallocatedLessonsStatusText();
        }
Beispiel #3
0
        public override void doit()
        {
            _roomLabel.Text       = _newRoom.getName();
            _roomLabel.Tag        = _newRoom;
            _courseAndRoomPair[1] = _newRoom;

            if (_course.getCoursesToHoldTogetherList().Count > 0)
            {
                foreach (Course courseHT in _course.getCoursesToHoldTogetherList())
                {
                    EduProgram epHT = (EduProgram)courseHT.Parent;
                    ArrayList [,] myttHT = epHT.getTimetable();
                    ArrayList lessonsInOneTimeSlotHT = myttHT[_indexRow, _indexCol];
                    foreach (Object [] courseAndRoomPairHT in lessonsInOneTimeSlotHT)
                    {
                        Course courseFromModelHT = (Course)courseAndRoomPairHT[0];
                        if (courseFromModelHT == courseHT)
                        {
                            courseAndRoomPairHT[1] = _newRoom;
                            break;
                        }
                    }
                }
            }
        }
        public override void undo()
        {
            _ullv.Items.Remove(_lviDroped);
            Course     dropedCourse = (Course)_lviDroped.Tag;
            EduProgram ep           = (EduProgram)dropedCourse.Parent;

            ep.removeOneLessonFromUnallocatedLessonsModel(dropedCourse);
            AppForm.CURR_OCTT_DOC.decrUnallocatedLessonsCounter(1);

            if (dropedCourse.getCoursesToHoldTogetherList().Count > 0)
            {
                foreach (Course courseHT in dropedCourse.getCoursesToHoldTogetherList())
                {
                    EduProgram epHT = (EduProgram)courseHT.Parent;
                    epHT.removeOneLessonFromUnallocatedLessonsModel(courseHT);
                }
            }

            AppForm.getAppForm().getStatusBarPanel2().Text = AppForm.CURR_OCTT_DOC.getNumOfUnallocatedLessonsStatusText();

            if (AppForm.getAppForm().getTreeTabControl().SelectedIndex != 1)
            {
                AppForm.getAppForm().getTreeTabControl().SelectedIndexChanged -= new System.EventHandler(AppForm.getAppForm().treeTabControl_SelectedIndexChanged);
                AppForm.getAppForm().getTreeTabControl().SelectedIndex         = 1;
                AppForm.getAppForm().getTreeTabControl().SelectedIndexChanged += new System.EventHandler(AppForm.getAppForm().treeTabControl_SelectedIndexChanged);
            }

            AppForm.getAppForm().getTeachersTreeView().AfterSelect -= new System.Windows.Forms.TreeViewEventHandler(AppForm.getAppForm().teachersTreeView_AfterSelect);
            AppForm.getAppForm().getTeachersTreeView().SelectedNode = _selectedNode;
            AppForm.getAppForm().getTeachersTreeView().AfterSelect += new System.Windows.Forms.TreeViewEventHandler(AppForm.getAppForm().teachersTreeView_AfterSelect);

            AppForm.getAppForm().ttvRefreshTimetablePanel(_selectedNode, false);
        }
        public override void doit()
        {
            AppForm.CURR_OCTT_DOC.decrUnallocatedLessonsCounter(1);
            _unallocatedLessonsTeacherListView.Items.Remove(_dragedLvi);
            Course dragedCourse = (Course)_dragedLvi.Tag;

            EduProgram epInDrag = (EduProgram)dragedCourse.Parent;

            epInDrag.removeOneLessonFromUnallocatedLessonsModel(dragedCourse);


            if (dragedCourse.getCoursesToHoldTogetherList().Count > 0)
            {
                foreach (Course courseHT in dragedCourse.getCoursesToHoldTogetherList())
                {
                    EduProgram epHT = (EduProgram)courseHT.Parent;
                    epHT.removeOneLessonFromUnallocatedLessonsModel(courseHT);

                    ListViewItem itemForDel = null;
                    foreach (ListViewItem listViewItem in _unallocatedLessonsTeacherListView.Items)
                    {
                        Course tagCourse = (Course)listViewItem.Tag;
                        if (tagCourse == courseHT)
                        {
                            itemForDel = listViewItem;
                            break;
                        }
                    }

                    _unallocatedLessonsTeacherListView.Items.Remove(itemForDel);
                }
            }

            AppForm.getAppForm().getStatusBarPanel2().Text = AppForm.CURR_OCTT_DOC.getNumOfUnallocatedLessonsStatusText();
        }
        public ChangeCourseDataCmd(Course course, string newName, string newShortName, string newGroupName, int newNumOfLessonsPerWeek, int newNumOfEnrolledStudents, bool newIsGroup, Teacher newTeacher, string newExtID, string newCourseType)
        {
            _course = course;
            _ep     = (EduProgram)_course.Parent;

            _oldName                  = _course.getName();
            _oldShortName             = _course.getShortName();
            _oldGroupName             = _course.getGroupName();
            _oldNumOfLessonsPerWeek   = _course.getNumberOfLessonsPerWeek();
            _oldNumOfEnrolledStudents = _course.getNumberOfEnrolledStudents();
            _oldIsGroup               = _course.getIsGroup();
            _oldTeacher               = _course.getTeacher();
            _oldExtID                 = _course.ExtID;
            _oldCourseType            = _course.CourseType;

            _newName                  = newName;
            _newShortName             = newShortName;
            _newGroupName             = newGroupName;
            _newNumOfLessonsPerWeek   = newNumOfLessonsPerWeek;
            _newNumOfEnrolledStudents = newNumOfEnrolledStudents;
            _newIsGroup               = newIsGroup;
            _newTeacher               = newTeacher;
            _newExtID                 = newExtID;
            _newCourseType            = newCourseType;
        }
        public override void undo()
        {
            foreach (Object [] oneItem in _forUndoRedoList)
            {
                Course course = (Course)oneItem[0];

                EduProgram thisEP = (EduProgram)course.Parent;
                ArrayList [,] mytt = thisEP.getTimetable();
                ArrayList lessonsInOneTimeSlot = mytt[_indexRow, _indexCol];
                lessonsInOneTimeSlot.Remove(oneItem);
            }

            if (AppForm.getAppForm().getTreeTabControl().SelectedIndex != 1)
            {
                AppForm.getAppForm().getTreeTabControl().SelectedIndexChanged -= new System.EventHandler(AppForm.getAppForm().treeTabControl_SelectedIndexChanged);
                AppForm.getAppForm().getTreeTabControl().SelectedIndex         = 1;
                AppForm.getAppForm().getTreeTabControl().SelectedIndexChanged += new System.EventHandler(AppForm.getAppForm().treeTabControl_SelectedIndexChanged);
            }

            AppForm.getAppForm().getTeachersTreeView().AfterSelect -= new System.Windows.Forms.TreeViewEventHandler(AppForm.getAppForm().teachersTreeView_AfterSelect);
            AppForm.getAppForm().getTeachersTreeView().SelectedNode = _selectedNode;
            AppForm.getAppForm().getTeachersTreeView().AfterSelect += new System.Windows.Forms.TreeViewEventHandler(AppForm.getAppForm().teachersTreeView_AfterSelect);

            AppForm.getAppForm().ttvRefreshTimetablePanel(_selectedNode, false);
        }
Beispiel #8
0
        public OCTTDocument()
        {
            if (RES_MANAGER == null)
            {
                RES_MANAGER = new System.Resources.ResourceManager("OpenCTT.MyStrings.OCTTDocument", this.GetType().Assembly);
            }

            _courseTypesList     = new ArrayList();
            _teacherTitlesList   = new ArrayList();
            _teacherEduRanksList = new ArrayList();

            _totalNumberOfUnallocatedLessons = 0;

            _includedDays  = new bool[7];
            _includedTerms = new ArrayList();

            _coursesRootNode  = new TreeNode();
            _teachersRootNode = new TreeNode();
            _roomsRootNode    = new TreeNode();

            _shownEduProgram = null;

            _ctvSelectedNode = null;
            _ttvSelectedNode = null;
            _rtvSelectedNode = null;
        }
Beispiel #9
0
        public override void undo()
        {
            AppForm.CURR_OCTT_DOC.CoursesRootNode.Nodes.Add(_epg);

            foreach (EduProgram ep in _epg.Nodes)
            {
                foreach (Course course in ep.Nodes)
                {
                    foreach (Course deepCourse in course.getCoursesToHoldTogetherList())
                    {
                        EduProgram      deepEP  = (EduProgram)deepCourse.Parent;
                        EduProgramGroup deepEPG = (EduProgramGroup)deepEP.Parent;

                        if (deepEPG != _epg)
                        {
                            deepCourse.getCoursesToHoldTogetherList().Add(course);
                        }
                    }
                }
            }

            AppForm.getAppForm().getCoursesTreeView().SelectedNode = _epg;
            AppForm.CURR_OCTT_DOC.incrUnallocatedLessonsCounter(_numOfUnallocatedLessonsStep);
            AppForm.getAppForm().getStatusBarPanel2().Text = AppForm.CURR_OCTT_DOC.getNumOfUnallocatedLessonsStatusText();

            AppForm.getAppForm().getTreeTabControl().SelectedIndex = 0;
        }
Beispiel #10
0
        public EduProgramPropertiesForm(EduProgram ep) : this()
        {
            _ep    = ep;
            _isNew = false;

            this._codeTextBox.Text     = _ep.getCode();
            this._nameTextBox.Text     = _ep.getName();
            this._semesterTextBox.Text = _ep.getSemester();
            this._extIDTextBox.Text    = _ep.ExtID;
        }
Beispiel #11
0
        public ArrayList getTimeSlotsOfMyAllocatedLessons()
        {
            ArrayList atsList = new ArrayList();

            EduProgram ep = (EduProgram)this.Parent;

            int numOfAlreadyAllocatedLessons = this.getNumberOfLessonsPerWeek() - this.getNumberOfUnallocatedLessons();

            //if (this.getReportName() == "MATEMATIKA 2 - gr. 1") Console.WriteLine("MAT FIXED " + numOfAlreadyAllocatedLessons);

            ArrayList[,] epTimetable = ep.getTimetable();
            int foundCounter = 0;

            int numOfSlotsPerRoom = AppForm.CURR_OCTT_DOC.getNumberOfDays() * AppForm.CURR_OCTT_DOC.IncludedTerms.Count;
            int wtutsEp           = 0;

            for (int k = 0; k < AppForm.CURR_OCTT_DOC.getNumberOfDays(); k++)
            {
                for (int j = 0; j < AppForm.CURR_OCTT_DOC.IncludedTerms.Count; j++)
                {
                    wtutsEp++;

                    ArrayList lessonsInOneTimeSlot = epTimetable[j, k];

                    if (lessonsInOneTimeSlot != null && lessonsInOneTimeSlot.Count > 0)
                    {
                        IEnumerator enumerator = lessonsInOneTimeSlot.GetEnumerator();

                        for (int step = 0; step < lessonsInOneTimeSlot.Count; step++)
                        {
                            enumerator.MoveNext();
                            Object[] courseAndRoomPair = (Object[])enumerator.Current;
                            Course   course            = (Course)courseAndRoomPair[0];
                            if (course == this)
                            {
                                foundCounter++;
                                Room room      = (Room)courseAndRoomPair[1];
                                int  roomIndex = AppForm.CURR_OCTT_DOC.RoomsRootNode.Nodes.IndexOf(room);
                                int  cts       = roomIndex * numOfSlotsPerRoom + wtutsEp;
                                atsList.Add(cts);
                                //if (this.getReportName() == "MATEMATIKA 2 - gr. 1") Console.WriteLine("FOUND " + cts);

                                if (foundCounter == numOfAlreadyAllocatedLessons)
                                {
                                    break;
                                }
                            }
                        }
                    }
                }
            }


            return(atsList);
        }
        public override void doit()
        {
            AppForm.CURR_OCTT_DOC.incrUnallocatedLessonsCounter(1);
            Course     course  = (Course)_lviDroped.Tag;
            EduProgram eduProg = (EduProgram)course.Parent;

            string [] ulsEPSem = new string[3];
            ulsEPSem[0] = course.getFullName();
            string epText = "";

            if (eduProg.getCode() != null)
            {
                epText = eduProg.getCode() + ", ";
            }
            epText     += eduProg.getName();
            ulsEPSem[1] = epText;
            ulsEPSem[2] = eduProg.getSemester();
            ListViewItem newLvi = new ListViewItem(ulsEPSem);

            newLvi.Tag = course;
            _ullv.Items.Add(newLvi);
            _ullv.EnsureVisible(_ullv.Items.IndexOf(newLvi));

            eduProg.getUnallocatedLessonsList().Add(_lviDroped);
            if (course.getCoursesToHoldTogetherList().Count > 0)
            {
                foreach (Course courseHT in course.getCoursesToHoldTogetherList())
                {
                    EduProgram epHT = (EduProgram)courseHT.Parent;

                    ListViewItem lviNew = new ListViewItem();
                    lviNew.Tag = courseHT;

                    epHT.getUnallocatedLessonsList().Add(lviNew);

                    //add in ListView
                    string [] ulsEPSemHT = new string[3];
                    ulsEPSemHT[0] = courseHT.getFullName();
                    string epTextHT = "";
                    if (epHT.getCode() != null)
                    {
                        epTextHT = epHT.getCode() + ", ";
                    }
                    epTextHT     += epHT.getName();
                    ulsEPSemHT[1] = epTextHT;
                    ulsEPSemHT[2] = epHT.getSemester();
                    ListViewItem newLviHT = new ListViewItem(ulsEPSemHT);
                    newLviHT.Tag = courseHT;
                    _ullv.Items.Add(newLviHT);
                }
            }

            AppForm.getAppForm().getStatusBarPanel2().Text = AppForm.CURR_OCTT_DOC.getNumOfUnallocatedLessonsStatusText();
        }
Beispiel #13
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);
         }
     }
 }
 private bool isEduProgramInWorkingList(EduProgram thisEP)
 {
     foreach (Course course in _thtWorkingList)
     {
         EduProgram ep = (EduProgram)course.Parent;
         if (ep == thisEP)
         {
             return(true);
         }
     }
     return(false);
 }
Beispiel #15
0
        public ChangeEduProgramDataCmd(EduProgram ep, string newName, string newCode, string newSemester, string newExtID)
        {
            _ep          = ep;
            _oldName     = _ep.getName();
            _oldCode     = _ep.getCode();
            _oldSemester = _ep.getSemester();
            _oldExtID    = _ep.ExtID;

            _newName     = newName;
            _newCode     = newCode;
            _newSemester = newSemester;
            _newExtID    = newExtID;
        }
        public ConvertStandardCourseToGroupsCmd(Course course, TextBox [,] tbs, int nog)
        {
            _course       = course;
            _ep           = (EduProgram)_course.Parent;
            _allTextBoxes = tbs;
            _numbOfGroups = nog;

            _groupsList = new ArrayList();
            for (int n = 0; n < nog; n++)
            {
                int    numOfEnrSt = System.Convert.ToInt32(((TextBox)_allTextBoxes[n, 2]).Text);
                string groupName  = ((TextBox)_allTextBoxes[n, 1]).Text;
                Course newCourse  = new Course(_course.getName(), _course.getShortName(), _course.getTeacher(), _course.getNumberOfLessonsPerWeek(), numOfEnrSt, true, groupName, _course.ExtID, _course.CourseType);
                _groupsList.Add(newCourse);
            }
        }
        public ChangeSoftConsEPSettingsCmd(EduProgram ep, int newMaxHContinuously, int newMaxHDaily, int newMaxDaysPerWeek, int newGapIndicator, int newPreferredStartTimePeriod)
        {
            _ep = ep;

            _newMaxHContinuously         = newMaxHContinuously;
            _newMaxHDaily                = newMaxHDaily;
            _newMaxDaysPerWeek           = newMaxDaysPerWeek;
            _newGapIndicator             = newGapIndicator;
            _newPreferredStartTimePeriod = newPreferredStartTimePeriod;

            _oldMaxHContinuously         = _ep.SCStudentMaxHoursContinuously;
            _oldMaxHDaily                = _ep.SCStudentMaxHoursDaily;
            _oldMaxDaysPerWeek           = _ep.SCStudentMaxDaysPerWeek;
            _oldGapIndicator             = _ep.SCStudentNoGapsGapIndicator;
            _oldPreferredStartTimePeriod = _ep.SCStudentPreferredStartTimePeriod;
        }
Beispiel #18
0
        public int getNumberOfUnallocatedLessons()
        {
            int        myCounter = 0;
            EduProgram ep        = (EduProgram)this.Parent;

            foreach (ListViewItem lvi in ep.getUnallocatedLessonsList())
            {
                Course course = (Course)lvi.Tag;
                if (course == this)
                {
                    myCounter++;
                }
            }

            return(myCounter);
        }
Beispiel #19
0
        private void Form_Closing(Object sender, CancelEventArgs e)
        {
            if (this.DialogResult == DialogResult.OK)
            {
                if (_isNew)
                {
                    if (EduProgram.getIsEduProgramDataOK(null, _codeTextBox.Text.Trim(), _nameTextBox.Text.Trim(), _semesterTextBox.Text.Trim()))
                    {
                        e.Cancel = false;
                    }
                    else
                    {
                        e.Cancel = true;

                        string message1 = RES_MANAGER.GetString("Form_Closing.msb.epnotcreated.message");

                        string caption1 = RES_MANAGER.GetString("Form_Closing.msb.epnotcreated.caption");

                        MessageBoxButtons buttons1 = MessageBoxButtons.OK;

                        MessageBox.Show(this, message1, caption1, buttons1,
                                        MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                    }
                }
                else
                {
                    if (EduProgram.getIsEduProgramDataOK(_ep, _codeTextBox.Text.Trim(), _nameTextBox.Text.Trim(), _semesterTextBox.Text.Trim()))
                    {
                        e.Cancel = false;
                    }
                    else
                    {
                        e.Cancel = true;

                        string message2 = RES_MANAGER.GetString("Form_Closing.msb.epdatanotchanged.message");

                        string caption2 = RES_MANAGER.GetString("Form_Closing.msb.epdatanotchanged.caption");

                        MessageBoxButtons buttons2 = MessageBoxButtons.OK;

                        MessageBox.Show(this, message2, caption2, buttons2,
                                        MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                    }
                }
            }
        }
Beispiel #20
0
        public ChangeAllowedTimeSlotsCmd(Object workingObject, int cmdType, AllowedTimeSlotsForm atsf)
        {
            _atsf          = atsf;
            _cmdType       = cmdType;
            _workingObject = workingObject;

            if (_cmdType == Constants.ATSF_TIME_SLOT_TYPE_TEACHER)
            {
                Teacher teacher = (Teacher)_workingObject;
                _oldAllowedTimeSlots = teacher.getAllowedTimeSlots();
            }
            else if (_cmdType == Constants.ATSF_TIME_SLOT_TYPE_EDU_PROGRAM)
            {
                EduProgram ep = (EduProgram)_workingObject;
                _oldAllowedTimeSlots = ep.getAllowedTimeSlots();
            }
            else if (_cmdType == Constants.ATSF_TIME_SLOT_TYPE_EDU_PROGRAM_GROUP)
            {
                EduProgramGroup epg = (EduProgramGroup)_workingObject;
                _oldAllowedTimeSlots = epg.getAllowedTimeSlots();
            }
            else if (_cmdType == Constants.ATSF_TIME_SLOT_TYPE_ROOM)
            {
                Room room = (Room)_workingObject;
                _oldAllowedTimeSlots = room.getAllowedTimeSlots();
            }

            _newAllowedTimeSlots = (bool [, ])_oldAllowedTimeSlots.Clone();

            foreach (Label edotlW in _atsf.getMainPanel().Controls)
            {
                if (edotlW.GetType().FullName == "OpenCTT.EnableDisableOneTermLabel")
                {
                    EnableDisableOneTermLabel edotl = (EnableDisableOneTermLabel)edotlW;

                    if (edotl.getIsTermEnabled())
                    {
                        _newAllowedTimeSlots[edotl.getIndexRow(), edotl.getIndexCol()] = true;
                    }
                    else
                    {
                        _newAllowedTimeSlots[edotl.getIndexRow(), edotl.getIndexCol()] = false;
                    }
                }
            }
        }
Beispiel #21
0
        private void roomLabelForTeacherView_DoubleClick(object sender, System.EventArgs e)
        {
            Label       roomLabel  = (Label)sender;
            IEnumerator enumerator = _allSubLabels.GetEnumerator();

            enumerator.MoveNext();
            Label[]    oneSubLabel  = (Label [])enumerator.Current;
            Label      courseLabel1 = oneSubLabel[0];
            Course     course       = (Course)courseLabel1.Tag;
            EduProgram ep           = (EduProgram)course.Parent;

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

            Object [] courseAndRoomPair = null;
            foreach (Object [] courseAndRoomPairCC in lessonsInOneTimeSlot)
            {
                Course courseCheck = (Course)courseAndRoomPairCC[0];
                if (courseCheck == course)
                {
                    courseAndRoomPair = courseAndRoomPairCC;
                    break;
                }
            }

            Room      currRoom     = (Room)roomLabel.Tag;
            ArrayList allowedRooms = calculateAllAllowedRooms(course, _indexRow, _indexCol);

            allowedRooms.Add(currRoom);

            roomLabel.BackColor = System.Drawing.Color.DarkOrange;

            RoomSelectionForm cu = new RoomSelectionForm(roomLabel, allowedRooms, currRoom, course, courseAndRoomPair);

            cu.ShowDialog(AppForm.getAppForm());
            if (cu.DialogResult == DialogResult.OK)
            {
                Room newRoom = cu.getSelectedRoom();

                ChooseRoomTSPTeachersViewCmd cuCmd = new ChooseRoomTSPTeachersViewCmd(courseAndRoomPair, course, currRoom, newRoom, roomLabel, _indexRow, _indexCol);
                CommandProcessor.getCommandProcessor().doCmd(cuCmd);
            }

            cu.Dispose();
            roomLabel.BackColor = System.Drawing.SystemColors.ControlLight;
        }
Beispiel #22
0
        public override void undo()
        {
            AppForm.CURR_OCTT_DOC.decrUnallocatedLessonsCounter(_numOfUnallocatedLessonsUndoRedoCounter);

            foreach (Object [] onePair in _epAndLviForUndoRedoList)
            {
                EduProgram   ep  = (EduProgram)onePair[0];
                ListViewItem lvi = (ListViewItem)onePair[1];
                ArrayList    lessonsInOneTimeSlot = (ArrayList)onePair[2];
                Object []    courseAndRoomPair    = (Object [])onePair[3];

                ep.getUnallocatedLessonsList().Remove(lvi);
                lessonsInOneTimeSlot.Add(courseAndRoomPair);
            }

            AppForm.getAppForm().getCoursesTreeView().SelectedNode = _ep;

            if (AppForm.getAppForm().getTreeTabControl().SelectedIndex != 0)
            {
                AppForm.getAppForm().getTreeTabControl().SelectedIndex = 0;
            }
            else
            {
                AppForm.getAppForm().updateTimeSlotPanel(1, _ep, false);

                AppForm.getAppForm().getUnallocatedLessonsListView().BeginUpdate();
                AppForm.getAppForm().getUnallocatedLessonsListView().Items.Clear();

                foreach (ListViewItem lvi in _ep.getUnallocatedLessonsList())
                {
                    Course    courseTag        = (Course)lvi.Tag;
                    string [] courseAndTeacher = new string[2];
                    courseAndTeacher[0] = courseTag.getFullName();

                    string teacherStr = courseTag.getTeacher().getLastName() + " " + courseTag.getTeacher().getName();
                    courseAndTeacher[1] = teacherStr;
                    ListViewItem newLvi = new ListViewItem(courseAndTeacher);
                    newLvi.Tag = courseTag;
                    AppForm.getAppForm().getUnallocatedLessonsListView().Items.Add(newLvi);
                }
                AppForm.getAppForm().getUnallocatedLessonsListView().EndUpdate();
            }

            AppForm.getAppForm().getStatusBarPanel2().Text = AppForm.CURR_OCTT_DOC.getNumOfUnallocatedLessonsStatusText();
        }
Beispiel #23
0
        public string getTSPTeachersAndRoomsTextForStatusBar()
        {
            string     textForStatusBar = this.getFullName();
            EduProgram ep = (EduProgram)this.Parent;

            if (AppForm.CURR_OCTT_DOC.DocumentType == Constants.OCTT_DOC_TYPE_UNIVERSITY)
            {
                textForStatusBar += ", " + ep.getName() + " " + ep.getCode() + "/" + ep.getSemester() + RES_MANAGER.GetString("getTSPTeachersAndRoomsTextForStatusBar.semester.university.text");
            }
            else
            {
                textForStatusBar += ", " + ep.getName() + " " + ep.getCode() + "/" + ep.getSemester() + RES_MANAGER.GetString("getTSPTeachersAndRoomsTextForStatusBar.semester.school.text");
            }



            return(textForStatusBar);
        }
Beispiel #24
0
        public static bool getIsEduProgramDataOK(EduProgram currEP, string epcode, string name, string semester)
        {
            foreach (EduProgramGroup epg in AppForm.CURR_OCTT_DOC.CoursesRootNode.Nodes)
            {
                foreach (EduProgram ep in epg.Nodes)
                {
                    if (ep != currEP)
                    {
                        if ((ep.getName() + ep.getSemester()).ToUpper() == (name + semester).ToUpper())
                        {
                            return(false);
                        }
                    }
                }
            }


            return(true);
        }
Beispiel #25
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);
        }
Beispiel #26
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()
        {
            _unallocatedLessonsListView.Items.Remove(_dragedLvi);
            Course     dragedCourse = (Course)_dragedLvi.Tag;
            EduProgram ep           = (EduProgram)dragedCourse.Parent;

            ep.removeOneLessonFromUnallocatedLessonsModel(dragedCourse);
            AppForm.CURR_OCTT_DOC.decrUnallocatedLessonsCounter(1);

            if (dragedCourse.getCoursesToHoldTogetherList().Count > 0)
            {
                foreach (Course courseHT in dragedCourse.getCoursesToHoldTogetherList())
                {
                    EduProgram epHT = (EduProgram)courseHT.Parent;
                    epHT.removeOneLessonFromUnallocatedLessonsModel(courseHT);
                }
            }

            AppForm.getAppForm().getStatusBarPanel2().Text = AppForm.CURR_OCTT_DOC.getNumOfUnallocatedLessonsStatusText();
        }
        private void checkChangeEduProgram(CancelEventArgs e)
        {
            EduProgram ep = (EduProgram)_workingObject;

            ArrayList [,] mytt = ep.getTimetable();
            bool allowed = true;

            foreach (Label edotlW in _mainPanel.Controls)
            {
                if (edotlW.GetType().FullName == "OpenCTT.EnableDisableOneTermLabel")
                {
                    EnableDisableOneTermLabel edotl = (EnableDisableOneTermLabel)edotlW;
                    if (!edotl.getIsTermEnabled())
                    {
                        if (!(mytt[edotl.getIndexRow(), edotl.getIndexCol()] == null || mytt[edotl.getIndexRow(), edotl.getIndexCol()].Count == 0))
                        {
                            allowed = false;
                            break;
                        }
                    }
                }
            }

            if (!allowed)
            {
                e.Cancel = true;
                string message1 = RES_MANAGER.GetString("checkChangeEduProgram.msb.notsuccessfull.message");
                string caption1 = RES_MANAGER.GetString("checkChangeEduProgram.msb.notsuccessfull.caption");

                MessageBoxButtons buttons1 = MessageBoxButtons.OK;

                MessageBox.Show(this, message1, caption1, buttons1,
                                MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
            }
            else
            {
                e.Cancel = false;
            }
        }
        private void Form_Load(object sender, System.EventArgs e)
        {
            _topLabel.Text = RES_MANAGER.GetString("Form_Load._topLabel.Text1") + " '" + _course.getFullName() + "' " + RES_MANAGER.GetString("Form_Load._topLabel.Text2");

            if (_course.getCoursesToHoldTogetherList() != null)
            {
                _thtWorkingList = (ArrayList)_course.getCoursesToHoldTogetherList().Clone();
            }

            foreach (Course tempCourse in _thtWorkingList)
            {
                string [] epgAndEpAndCourse = new string[3];

                EduProgram      ep  = (EduProgram)tempCourse.Parent;
                EduProgramGroup epg = (EduProgramGroup)ep.Parent;

                String textEduProgram = ep.getName() + ", " + ep.getCode() + ", " + ep.getSemester() + ". " + RES_MANAGER.GetString("Form_Load.listView.textEduProgram.sem");

                epgAndEpAndCourse[0] = epg.getName();
                epgAndEpAndCourse[1] = textEduProgram;
                epgAndEpAndCourse[2] = tempCourse.getFullName();

                ListViewItem newLvi = new ListViewItem(epgAndEpAndCourse);
                newLvi.Tag = tempCourse;
                _thtCoursesListView.Items.Add(newLvi);
            }

            this.fillPickListView();

            if (_isFormDisabled)
            {
                this._thtPickListView.DoubleClick    -= new System.EventHandler(this._thtPickListView_DoubleClick);
                this._thtCoursesListView.DoubleClick -= new System.EventHandler(this._thtCoursesListView_DoubleClick);


                this.Text        += " - READ ONLY";
                _okButton.Enabled = false;
            }
        }
Beispiel #30
0
        public override void undo()
        {
            foreach (Object [] oneItem in _forUndoRedoList)
            {
                Course course = (Course)oneItem[0];

                EduProgram thisEP = (EduProgram)course.Parent;
                ArrayList [,] mytt = thisEP.getTimetable();
                ArrayList lessonsInOneTimeSlot;
                if (mytt[_indexRow, _indexCol] == null)
                {
                    lessonsInOneTimeSlot = new ArrayList();
                }
                else
                {
                    lessonsInOneTimeSlot = mytt[_indexRow, _indexCol];
                }

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