public override void doit() { foreach (int n in _toAddList) { AppForm.CURR_OCTT_DOC.setIsDayIncluded(n, true); int dayIndexInModel = AppForm.CURR_OCTT_DOC.getDayIndexInModel(n); ModelOperations.addDayInModel(dayIndexInModel); } AppForm.getAppForm().refreshGUIAfterDaysTermsChange(true); }
public override void redo() { foreach (int n in _toAddList) { AppForm.CURR_OCTT_DOC.setIsDayIncluded(n, true); int dayIndexInModel = AppForm.CURR_OCTT_DOC.getDayIndexInModel(n); ModelOperations.addDayInModel(dayIndexInModel); } AppForm.getAppForm().getTreeTabControl().SelectedIndexChanged -= new System.EventHandler(AppForm.getAppForm().treeTabControl_SelectedIndexChanged); AppForm.getAppForm().getTreeTabControl().SelectedIndex = _tabIndex; AppForm.getAppForm().getTreeTabControl().SelectedIndexChanged += new System.EventHandler(AppForm.getAppForm().treeTabControl_SelectedIndexChanged); //AppForm.getAppForm().refreshGUIAfterDaysTermsChange(false); AppForm.getAppForm().refreshGUIAfterDaysTermsChange(_calledFromMainForm); if (_tabIndex == 0) { AppForm.CURR_OCTT_DOC.CTVSelectedNode = _workingNode; AppForm.getAppForm().ctvRefreshTimetablePanel(_workingNode, true, true); AppForm.getAppForm().getCoursesTreeView().AfterSelect -= new System.Windows.Forms.TreeViewEventHandler(AppForm.getAppForm().coursesTreeView_AfterSelect); AppForm.getAppForm().getCoursesTreeView().SelectedNode = _workingNode; AppForm.getAppForm().getCoursesTreeView().AfterSelect += new System.Windows.Forms.TreeViewEventHandler(AppForm.getAppForm().coursesTreeView_AfterSelect); } else if (_tabIndex == 1) { AppForm.getAppForm().getTeachersTreeView().AfterSelect -= new System.Windows.Forms.TreeViewEventHandler(AppForm.getAppForm().teachersTreeView_AfterSelect); AppForm.getAppForm().getTeachersTreeView().SelectedNode = _workingNode; AppForm.getAppForm().getTeachersTreeView().AfterSelect += new System.Windows.Forms.TreeViewEventHandler(AppForm.getAppForm().teachersTreeView_AfterSelect); AppForm.CURR_OCTT_DOC.TTVSelectedNode = _workingNode; AppForm.getAppForm().ttvRefreshTimetablePanel(_workingNode, true); } else if (_tabIndex == 2) { AppForm.getAppForm().getRoomsTreeView().AfterSelect -= new System.Windows.Forms.TreeViewEventHandler(AppForm.getAppForm().roomsTreeView_AfterSelect); AppForm.getAppForm().getRoomsTreeView().SelectedNode = _workingNode; AppForm.getAppForm().getRoomsTreeView().AfterSelect += new System.Windows.Forms.TreeViewEventHandler(AppForm.getAppForm().roomsTreeView_AfterSelect); AppForm.CURR_OCTT_DOC.RTVSelectedNode = _workingNode; AppForm.getAppForm().rtvRefreshTimetablePanel(_workingNode, true); } }
public override void undo() { AppForm.CURR_OCTT_DOC.setIsDayIncluded(_guiIndex, true); ModelOperations.addDayInModel(_dayIndexInModel); ArrayList epgURList = _undoRedoLists[0]; ArrayList epURList = _undoRedoLists[1]; ArrayList teachersURList = _undoRedoLists[2]; ArrayList roomsURList = _undoRedoLists[3]; foreach (object [] oneItem in epgURList) { EduProgramGroup epg = (EduProgramGroup)oneItem[0]; bool [,] epgAllowedTimeSlotsUR = (bool[, ])oneItem[1]; for (int j = 0; j < AppForm.CURR_OCTT_DOC.IncludedTerms.Count; j++) { epg.getAllowedTimeSlots()[j, _dayIndexInModel] = epgAllowedTimeSlotsUR[j, 0]; } } foreach (object [] oneItem in epURList) { EduProgram ep = (EduProgram)oneItem[0]; bool [,] epAllowedTimeSlotsUR = (bool[, ])oneItem[1]; for (int j = 0; j < AppForm.CURR_OCTT_DOC.IncludedTerms.Count; j++) { ep.getAllowedTimeSlots()[j, _dayIndexInModel] = epAllowedTimeSlotsUR[j, 0]; } } foreach (object [] oneItem in teachersURList) { Teacher teacher = (Teacher)oneItem[0]; bool [,] teacherAllowedTimeSlotsUR = (bool[, ])oneItem[1]; for (int j = 0; j < AppForm.CURR_OCTT_DOC.IncludedTerms.Count; j++) { teacher.getAllowedTimeSlots()[j, _dayIndexInModel] = teacherAllowedTimeSlotsUR[j, 0]; } } foreach (object [] oneItem in roomsURList) { Room room = (Room)oneItem[0]; bool [,] roomAllowedTimeSlotsUR = (bool[, ])oneItem[1]; for (int j = 0; j < AppForm.CURR_OCTT_DOC.IncludedTerms.Count; j++) { room.getAllowedTimeSlots()[j, _dayIndexInModel] = roomAllowedTimeSlotsUR[j, 0]; } } AppForm.getAppForm().getTreeTabControl().SelectedIndexChanged -= new System.EventHandler(AppForm.getAppForm().treeTabControl_SelectedIndexChanged); AppForm.getAppForm().getTreeTabControl().SelectedIndex = _tabIndex; AppForm.getAppForm().getTreeTabControl().SelectedIndexChanged += new System.EventHandler(AppForm.getAppForm().treeTabControl_SelectedIndexChanged); AppForm.getAppForm().refreshGUIAfterDaysTermsChange(false); if (_tabIndex == 0) { AppForm.CURR_OCTT_DOC.CTVSelectedNode = _workingNode; AppForm.getAppForm().ctvRefreshTimetablePanel(_workingNode, true, true); AppForm.getAppForm().getCoursesTreeView().AfterSelect -= new System.Windows.Forms.TreeViewEventHandler(AppForm.getAppForm().coursesTreeView_AfterSelect); AppForm.getAppForm().getCoursesTreeView().SelectedNode = _workingNode; AppForm.getAppForm().getCoursesTreeView().AfterSelect += new System.Windows.Forms.TreeViewEventHandler(AppForm.getAppForm().coursesTreeView_AfterSelect); } else if (_tabIndex == 1) { AppForm.getAppForm().getTeachersTreeView().AfterSelect -= new System.Windows.Forms.TreeViewEventHandler(AppForm.getAppForm().teachersTreeView_AfterSelect); AppForm.getAppForm().getTeachersTreeView().SelectedNode = _workingNode; AppForm.getAppForm().getTeachersTreeView().AfterSelect += new System.Windows.Forms.TreeViewEventHandler(AppForm.getAppForm().teachersTreeView_AfterSelect); AppForm.CURR_OCTT_DOC.TTVSelectedNode = _workingNode; AppForm.getAppForm().ttvRefreshTimetablePanel(_workingNode, true); } else if (_tabIndex == 2) { AppForm.getAppForm().getRoomsTreeView().AfterSelect -= new System.Windows.Forms.TreeViewEventHandler(AppForm.getAppForm().roomsTreeView_AfterSelect); AppForm.getAppForm().getRoomsTreeView().SelectedNode = _workingNode; AppForm.getAppForm().getRoomsTreeView().AfterSelect += new System.Windows.Forms.TreeViewEventHandler(AppForm.getAppForm().roomsTreeView_AfterSelect); AppForm.CURR_OCTT_DOC.RTVSelectedNode = _workingNode; AppForm.getAppForm().rtvRefreshTimetablePanel(_workingNode, true); } }