private void label_Click(object sender, System.EventArgs e) { if (_isTermEnabled) { _isTermEnabled = false; this.BackColor = System.Drawing.Color.DarkSalmon; } else { _isTermEnabled = true; this.BackColor = System.Drawing.Color.DarkSeaGreen; } if (_isTermEnabled == AllowedTimeSlotsForm.getATSForm().getAllowedTimeSlots()[_indexRow, _indexCol]) { AllowedTimeSlotsForm.getATSForm().decrTimeSlotChangeCounter(); } else { AllowedTimeSlotsForm.getATSForm().incrTimeSlotChangeCounter(); } if (AllowedTimeSlotsForm.getATSForm().getTimeSlotChangeCounter() > 0) { AllowedTimeSlotsForm.getATSForm().getOKButton().Enabled = true; } else { AllowedTimeSlotsForm.getATSForm().getOKButton().Enabled = false; } }
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; } } } }
public AllowedTimeSlotsForm(bool [,] allowedTimeSlots, int atsFormType, Object workingObject) { InitializeComponent(); if (AppForm.CURR_OCTT_DOC.DocumentType == Constants.OCTT_DOC_TYPE_UNIVERSITY) { RES_MANAGER = new System.Resources.ResourceManager("OpenCTT.MyStrings.ATSFormUniversity", this.GetType().Assembly); } else { RES_MANAGER = new System.Resources.ResourceManager("OpenCTT.MyStrings.ATSFormSchool", this.GetType().Assembly); } _cancelButton.Text = RES_MANAGER.GetString("_cancelButton.Text"); this.Text = RES_MANAGER.GetString("formtitle.Text"); ATS_FORM = this; _allowedTimeSlots = allowedTimeSlots; MAIN_PANEL = _mainPanel; _atsFormType = atsFormType; _workingObject = workingObject; this.Closing += new CancelEventHandler(this.Form_Closing); }
private void RCButton_Click(object sender, System.EventArgs e) { foreach (Label edotlW in AllowedTimeSlotsForm.MAIN_PANEL.Controls) { if (edotlW.GetType().FullName == "OpenCTT.EnableDisableOneTermLabel") { EnableDisableOneTermLabel edotl = (EnableDisableOneTermLabel)edotlW; if (_isForRow) { if (edotl.getIndexRow() == _row) { if (_isForEnable && !edotl.getIsTermEnabled()) { edotl.setIsTermEnabled(true); if (edotl.getIsTermEnabled() == AllowedTimeSlotsForm.getATSForm().getAllowedTimeSlots()[edotl.getIndexRow(), edotl.getIndexCol()]) { AllowedTimeSlotsForm.getATSForm().decrTimeSlotChangeCounter(); } else { AllowedTimeSlotsForm.getATSForm().incrTimeSlotChangeCounter(); } } else if (!_isForEnable && edotl.getIsTermEnabled()) { edotl.setIsTermEnabled(false); if (edotl.getIsTermEnabled() == AllowedTimeSlotsForm.getATSForm().getAllowedTimeSlots()[edotl.getIndexRow(), edotl.getIndexCol()]) { AllowedTimeSlotsForm.getATSForm().decrTimeSlotChangeCounter(); } else { AllowedTimeSlotsForm.getATSForm().incrTimeSlotChangeCounter(); } } } } else { if (edotl.getIndexCol() == _col) { if (_isForEnable && !edotl.getIsTermEnabled()) { edotl.setIsTermEnabled(true); if (edotl.getIsTermEnabled() == AllowedTimeSlotsForm.getATSForm().getAllowedTimeSlots()[edotl.getIndexRow(), edotl.getIndexCol()]) { AllowedTimeSlotsForm.getATSForm().decrTimeSlotChangeCounter(); } else { AllowedTimeSlotsForm.getATSForm().incrTimeSlotChangeCounter(); } } else if (!_isForEnable && edotl.getIsTermEnabled()) { edotl.setIsTermEnabled(false); if (edotl.getIsTermEnabled() == AllowedTimeSlotsForm.getATSForm().getAllowedTimeSlots()[edotl.getIndexRow(), edotl.getIndexCol()]) { AllowedTimeSlotsForm.getATSForm().decrTimeSlotChangeCounter(); } else { AllowedTimeSlotsForm.getATSForm().incrTimeSlotChangeCounter(); } } } } } } if (AllowedTimeSlotsForm.getATSForm().getTimeSlotChangeCounter() > 0) { AllowedTimeSlotsForm.getATSForm().getOKButton().Enabled = true; } else { AllowedTimeSlotsForm.getATSForm().getOKButton().Enabled = false; } }