Example #1
0
        }//----------------------------

        //################################################END BUTTON btnLoadScheduleDetails EVENTS####################################################

        //################################################BUTTON btnRecord EVENTS####################################################
        //event is raised when btnRecord is Clicked
        private void btnRecordClick(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;

            try
            {
                String strMsg = "Are you sure you want to record the new teacher load?";

                DialogResult msgResult = MessageBox.Show(strMsg, "Confirm Record", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (msgResult == DialogResult.Yes)
                {
                    strMsg = "The teacher load has been successfully recorded.";

                    _teacherLoadingManager.InsertDeleteTeacherLoad(_userInfo);

                    _teacherLoadingManager.SelectByDateStartEndForTeacherLoadingTeacherLoad(_userInfo,
                                                                                            _teacherLoadingManager.GetSchoolYearDateStart(
                                                                                                _teacherLoadingManager.GetSchoolYearYearId(this.cboYear.SelectedIndex)).ToShortDateString() + " 12:00:00 AM",
                                                                                            _teacherLoadingManager.GetSchoolYearDateEnd(
                                                                                                _teacherLoadingManager.GetSchoolYearYearId(this.cboYear.SelectedIndex)).ToShortDateString() + " 11:59:59 PM");

                    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));
                        }
                        else
                        {
                            _teacherLoadingManager.InitializeSubjectServiceLoadListView(this.lsvSubjectServiceLoad, this.lstDeloadedSchedule,
                                                                                        this.tblLoadedSchedule, this.tblDeloadedSchedule,
                                                                                        _teacherLoadingManager.GetEmployeeScheduleSysId(this.trvEmployee.SelectedNode.Text),
                                                                                        _teacherLoadingManager.GetSchoolYearYearId(this.cboYear.SelectedIndex), String.Empty);
                        }
                    }

                    this.btnRecord.Enabled = false;

                    this.btnPrintAll.Enabled = this.btnPrintTeacherLoad.Enabled = true;

                    MessageBox.Show(strMsg, "Success", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
            }
            catch (Exception ex)
            {
                RemoteClient.ProcStatic.ShowErrorDialog(ex.Message, "Error in Recording");
            }
            finally
            {
                this.Cursor = Cursors.Arrow;
            }
        }//-----------------------