コード例 #1
0
        }//-------------------------

        //event is raised when the control index is change
        private void cboYearSelectedIndexChanged(object sender, EventArgs e)
        {
            if (_hasUpdated && !_hasRepeated)
            {
                String strMsg = "There has been changes made in the current School Fee Module. \nChanging the school year will not save this changes." +
                                "\n\nAre you sure you want to change the school year?";
                DialogResult msgResult = MessageBox.Show(strMsg, "Confirm Exit", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (msgResult == DialogResult.No)
                {
                    _hasRepeated = true;

                    this.cboYear.SelectedIndex = _cboYearIndex;
                }
                else
                {
                    _schoolFeeManager.ClearCachedData();

                    _feeInfo.SchoolYearInfo.YearId = _schoolFeeManager.GetSchoolYearYearId(this.cboYear.SelectedIndex);

                    _schoolFeeManager.SelectByDateStartEndSchoolFeeDetails(_userInfo,
                                                                           _schoolFeeManager.GetSchoolYearDateStart(_feeInfo.SchoolYearInfo.YearId).ToShortDateString() + " 12:00:00 AM",
                                                                           _schoolFeeManager.GetSchoolYearDateEnd(_feeInfo.SchoolYearInfo.YearId).ToShortDateString() + " 11:59:59 PM",
                                                                           _schoolFeeManager.GetSysIdSchoolFeeInformation(_feeInfo.SchoolYearInfo.YearId));

                    _dateEnd = _schoolFeeManager.GetSchoolYearDateEnd(_feeInfo.SchoolYearInfo.YearId);

                    _hasUpdated = false;
                }
            }
            else if (!_hasUpdated && !_hasRepeated)
            {
                _feeInfo.SchoolYearInfo.YearId = _schoolFeeManager.GetSchoolYearYearId(this.cboYear.SelectedIndex);

                _schoolFeeManager.SelectByDateStartEndSchoolFeeDetails(_userInfo,
                                                                       _schoolFeeManager.GetSchoolYearDateStart(_feeInfo.SchoolYearInfo.YearId).ToShortDateString() + " 12:00:00 AM",
                                                                       _schoolFeeManager.GetSchoolYearDateEnd(_feeInfo.SchoolYearInfo.YearId).ToShortDateString() + " 11:59:59 PM",
                                                                       _schoolFeeManager.GetSysIdSchoolFeeInformation(_feeInfo.SchoolYearInfo.YearId));

                _dateEnd = _schoolFeeManager.GetSchoolYearDateEnd(_feeInfo.SchoolYearInfo.YearId);
            }

            this.PopulateListViewControl();

            this.lblStatus.Visible = true;

            if (this.cboYear.SelectedIndex >= 0 &&
                RemoteClient.ProcStatic.IsRecordLocked(_dateEnd, DateTime.Parse(_schoolFeeManager.ServerDateTime), (Int32)CommonExchange.SystemRange.MonthAllowance))
            {
                this.lblStatus.Text = "This record is LOCKED";

                this.pbxLocked.Visible = true;
                this.pbxUnlock.Visible = false;

                this.btnRecord.Visible = this.lnkSchoolFeeMaintenance.Visible = this.lnkCreateFee.Visible = false;
            }
            else
            {
                this.lblStatus.Text = "This record is OPEN";

                this.pbxLocked.Visible = false;
                this.pbxUnlock.Visible = true;

                this.btnRecord.Visible = true;

                this.lnkSchoolFeeMaintenance.Visible = _schoolFeeManager.IsExistsYearIDSchoolFeeInformation(_feeInfo.SchoolYearInfo.YearId) ? true : false;
            }

            this.tabSchoolFeeList.Focus();

            _hasRepeated = false;
        }//-------------------------------------