}//-------------------- //##################################END PICTUREBOX pbxChecked EVENTS###################################################### //##################################PICTUREBOX pbxInsertSubjects EVENTS###################################################### //event is raised when the picture box is clicked private void pbxInsertSubjectsClick(object sender, EventArgs e) { Boolean hasInserted = false; Boolean hasErrors = false; this.dgvList.EndEdit(); this.dgvList.ShowCellErrors = true; DataTable conflictSchduleTable = _teacherLoadingManager.SelectByScheduleDetailsListConflictsWithAnotherScheduleTeacherLoad(_userInfo, (DataTable)this.dgvList.DataSource, _employeeId); for (Int32 x = 0; x < this.dgvList.Rows.Count; x++) { if ((Boolean)this.dgvList.Rows[x].Cells["checkbox_column"].Value) { if (!_teacherLoadingManager.HasConflictSchedule(conflictSchduleTable, dgvList.Rows[x].Cells["sysid_schedule"].Value.ToString())) { _teacherLoadingManager.InsertTeacherLoadCached(_employeeId, dgvList.Rows[x].Cells["sysid_schedule"].Value.ToString()); hasInserted = true; } else { this.dgvList.Rows[x].Cells["checkbox_column"].Value = false; DataGridViewCell dgvCell = this.dgvList.Rows[x].Cells["sysid_schedule"]; CommonExchange.Employee empInfo = _teacherLoadingManager.GetEmployeeInformation(_userInfo, _employeeId); dgvCell.ErrorText = "This schedule conflicts with another schedule that has been loaded to " + RemoteClient.ProcStatic.GetCompleteNameFullMiddleName(empInfo.PersonInfo.LastName, empInfo.PersonInfo.FirstName, empInfo.PersonInfo.MiddleName) + " from another department."; ToolTip errToolTip = new ToolTip(); errToolTip.Show(dgvCell.ErrorText, this.dgvList, 10); hasErrors = true; } } } if (hasInserted) { _hasSelected = true; this.Close(); } else if (!hasErrors) { MessageBox.Show("There is no subject schedule / service that has been selected!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }//-------------------------
}//---------------------------- //this procedure will initialize instructor information upon selected index in the treeview control private void InitializeInsturctorInfomation() { this.pbxIntructor.Image = null; if (!String.IsNullOrEmpty(_teacherLoadingManager.GetEmployeeScheduleSysId(this.trvEmployee.SelectedNode.Text))) { if (this.cboSemester.SelectedIndex >= 0) { _teacherLoadingManager.InitializeSubjectServiceLoadListView(this.lsvSubjectServiceLoad, this.lstDeloadedSchedule, this.tblLoadedSchedule, this.tblDeloadedSchedule, _teacherLoadingManager.GetEmployeeScheduleSysId(this.trvEmployee.SelectedNode.Text), _teacherLoadingManager.GetSchoolYearYearId(this.cboYear.SelectedIndex), _teacherLoadingManager.GetSemesterSystemId(this.cboYear.SelectedIndex, this.cboSemester.SelectedIndex)); _teacherLoadingManager.SetInstructorInformationControls(_teacherLoadingManager.GetEmployeeScheduleSysId(this.trvEmployee.SelectedNode.Text), this.lblUnitsLabHoursLoaded, this.lblUnitsLabHoursDeloaded, _teacherLoadingManager.GetSchoolYearYearId(this.cboYear.SelectedIndex), _teacherLoadingManager.GetSemesterSystemId(this.cboYear.SelectedIndex, this.cboSemester.SelectedIndex)); this.lblPreperation.Text = _teacherLoadingManager.GetNumberOfPreperation(_teacherLoadingManager.GetEmployeeScheduleSysId( this.trvEmployee.SelectedNode.Text), _teacherLoadingManager.GetSchoolYearYearId(this.cboYear.SelectedIndex), _teacherLoadingManager.GetSemesterSystemId(this.cboYear.SelectedIndex, this.cboSemester.SelectedIndex)).ToString(); } else { _teacherLoadingManager.InitializeSubjectServiceLoadListView(this.lsvSubjectServiceLoad, this.lstDeloadedSchedule, this.tblLoadedSchedule, this.tblDeloadedSchedule, _teacherLoadingManager.GetEmployeeScheduleSysId(this.trvEmployee.SelectedNode.Text), _teacherLoadingManager.GetSchoolYearYearId(this.cboYear.SelectedIndex), String.Empty); _teacherLoadingManager.SetInstructorInformationControls(_teacherLoadingManager.GetEmployeeScheduleSysId(this.trvEmployee.SelectedNode.Text), this.lblUnitsLabHoursLoaded, this.lblUnitsLabHoursDeloaded, _teacherLoadingManager.GetSchoolYearYearId(this.cboYear.SelectedIndex), String.Empty); this.lblPreperation.Text = _teacherLoadingManager.GetNumberOfPreperation(_teacherLoadingManager.GetEmployeeScheduleSysId( this.trvEmployee.SelectedNode.Text), _teacherLoadingManager.GetSchoolYearYearId(this.cboYear.SelectedIndex), String.Empty).ToString(); } _teacherLoadingManager.InitializeSpecialClassLoadedWithdrawnListView(this.lstSpecialClass, this.lblSpecialClass, this.tblSpecialClass, _teacherLoadingManager.GetEmployeeScheduleSysId(this.trvEmployee.SelectedNode.Text), false); _teacherLoadingManager.InitializeSpecialClassLoadedWithdrawnListView(this.lstWithdrawnSpecialClass, this.lblWithdrawn, this.tblWithdrawnSpecialClass, _teacherLoadingManager.GetEmployeeScheduleSysId(this.trvEmployee.SelectedNode.Text), true); CommonExchange.Employee empInfo = _teacherLoadingManager.GetEmployeeInformation(_userInfo, _teacherLoadingManager.GetEmployeeScheduleSysId(this.trvEmployee.SelectedNode.Text)); this.lblEmpId.Text = empInfo.EmployeeId; this.lblInstructor.Text = RemoteClient.ProcStatic.GetCompleteNameFullMiddleName(empInfo.PersonInfo.LastName, empInfo.PersonInfo.FirstName, empInfo.PersonInfo.MiddleName); this.lblStatusType.Text = empInfo.SalaryInfo.EmployeeStatusInfo.StatusDescription + " - " + empInfo.SalaryInfo.EmploymentTypeInfo.TypeDescription; this.lblEmpDepartment.Text = empInfo.SalaryInfo.DepartmentInfo.DepartmentName; if (!String.IsNullOrEmpty(empInfo.PersonInfo.PersonImagesFolder(Application.StartupPath) + empInfo.PersonInfo.PersonSysId)) { if (File.Exists(empInfo.PersonInfo.PersonImagesFolder(Application.StartupPath) + empInfo.PersonInfo.PersonSysId + ".jpg")) { this.pbxIntructor.Image = Image.FromFile(empInfo.PersonInfo.PersonImagesFolder(Application.StartupPath) + empInfo.PersonInfo.PersonSysId + ".jpg"); } } } this.tabScheduleDetails.Enabled = true; this.btnPrintTeacherLoad.Enabled = this.lsvSubjectServiceLoad.Items.Count == 0 ? false : true; if (RemoteServerLib.ProcStatic.IsSystemAccessAdmin(_userInfo) || RemoteServerLib.ProcStatic.IsSystemAccessOfficeUser(_userInfo)) { this.btnLoadScheduleDetails.Enabled = !_isRecordLocked ? true : false; } }//-------------------------------