Example #1
0
        public SchoolYearView(CommonExchange.SchoolYear yearInfo)
        {
            this.InitializeComponent();

            _yearInfo = yearInfo;

            this.Load          += new EventHandler(ClassLoad);
            this.btnDone.Click += new EventHandler(btnDoneClick);
        }
Example #2
0
        } //---------------------------------

        //this function gets the next opened school year
        public CommonExchange.SchoolYear GetNextOpenedSchoolYearInformation(CommonExchange.SysAccess userInfo)
        {
            CommonExchange.SchoolYear nextYearInfo = new CommonExchange.SchoolYear();

            nextYearInfo.DateStart   = this.GetSchoolYearDateStart(userInfo, false).ToString();
            nextYearInfo.DateEnd     = this.GetSchoolYearDateEnd(DateTime.Parse(nextYearInfo.DateStart), false).ToString();
            nextYearInfo.Description = this.GetSchoolYearDescription(DateTime.Parse(nextYearInfo.DateStart),
                                                                     DateTime.Parse(nextYearInfo.DateEnd), false);
            nextYearInfo.IsSummer = false;

            return(nextYearInfo);
        } //-----------------------------------
Example #3
0
        } //-----------------------------------

        //this function gets the school year information details
        public CommonExchange.SchoolYear GetDetailsSchoolYearInformation(String yearId)
        {
            CommonExchange.SchoolYear yearInfo = new CommonExchange.SchoolYear();

            if (_schoolYearTable != null)
            {
                String    strFilter = "year_id = '" + yearId + "'";
                DataRow[] selectRow = _schoolYearTable.Select(strFilter, "year_id DESC");

                foreach (DataRow yearRow in selectRow)
                {
                    yearInfo.YearId      = RemoteServerLib.ProcStatic.DataRowConvert(yearRow, "year_id", "");
                    yearInfo.Description = RemoteServerLib.ProcStatic.DataRowConvert(yearRow, "year_description", "");
                    yearInfo.DateStart   = RemoteServerLib.ProcStatic.DataRowConvert(yearRow, "date_start", "");
                    yearInfo.DateEnd     = RemoteServerLib.ProcStatic.DataRowConvert(yearRow, "date_end", "");
                }
            }

            return(yearInfo);
        } //----------------------------
Example #4
0
        } //------------------------------------

        //this procedure inserts a school year
        public void InsertSchoolYearSummer(CommonExchange.SysAccess userInfo, CommonExchange.SchoolYear baseYearInfo, ref CommonExchange.SchoolYear yearInfo)
        {
            using (RemoteClient.RemCntSchoolYearSemesterManager remClient = new RemoteClient.RemCntSchoolYearSemesterManager())
            {
                remClient.InsertSchoolYearSummer(userInfo, baseYearInfo, ref yearInfo);
            }

            if (_schoolYearTable != null)
            {
                DataRow newRow = _schoolYearTable.NewRow();

                newRow["year_id"]          = yearInfo.YearId;
                newRow["year_description"] = yearInfo.Description;
                newRow["date_start"]       = yearInfo.DateStart;
                newRow["date_end"]         = yearInfo.DateEnd;
                newRow["is_summer"]        = yearInfo.IsSummer;

                _schoolYearTable.Rows.Add(newRow);
                _schoolYearTable.AcceptChanges();
            }
        } //------------------------------------
Example #5
0
        }     //-----------------------

        #endregion

        #region Programmer-Defined Void Procedures

        //this function returns the last opened semeter information
        public CommonExchange.SemesterInformation GetNextOpenedSemesterInformation(CommonExchange.SysAccess userInfo, CommonExchange.SchoolYear yearInfo,
                                                                                   CommonExchange.SchoolSemester semesterId)
        {
            CommonExchange.SemesterInformation nextSemInfo = new CommonExchange.SemesterInformation();

            nextSemInfo.SchoolYearInfo.YearId = yearInfo.YearId;
            nextSemInfo.SemesterId            = (Byte)semesterId;
            nextSemInfo.DateStart             = this.GetSemesterInformationDateStart(userInfo).ToString();
            nextSemInfo.DateEnd = this.GetSemesterInformationDateEnd(DateTime.Parse(nextSemInfo.DateStart),
                                                                     nextSemInfo.SemesterId).ToString();
            nextSemInfo.SchoolYearDescription     = this.GetSchoolYearInformationDescription(nextSemInfo.SchoolYearInfo.YearId);
            nextSemInfo.SchoolSemesterDescription = this.GetSchoolSemesterDescription(nextSemInfo.SemesterId);

            return(nextSemInfo);
        } //---------------------------------
        } //------------------------------

        //############################################END BUTTON btnCancel EVENTS######################################################

        //################################################BUTTON btnOpen EVENTS########################################################
        //event is raised when the button is clicked
        private void btnOpenClick(object sender, EventArgs e)
        {
            try
            {
                String strMsg = "Are you sure you want to officially open a new school year?";

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

                if (msgResult == DialogResult.Yes)
                {
                    strMsg = "The following has been officially opened:\n\nSchool Year: " +
                             _yearInfo.Description + "\nSchool Year (SUMMER): " + _yearInfo.Description +
                             "\n\nSemester: First Semester\nSemester: Second Semester\nSemester: Summer";

                    this.Cursor = Cursors.WaitCursor;

                    //inserts the regular school year
                    _yearSemManager.InsertSchoolYear(_userInfo, ref _yearInfo);
                    //------------------------------------

                    //inserts the first semester
                    CommonExchange.SemesterInformation firstSemInfo = _yearSemManager.GetNextOpenedSemesterInformation(_userInfo,
                                                                                                                       _yearInfo, CommonExchange.SchoolSemester.FirstSemester);

                    _yearSemManager.InsertSemesterInformation(_userInfo, firstSemInfo);
                    //--------------------------------------

                    //inserts the second semester
                    CommonExchange.SemesterInformation secondSemInfo = _yearSemManager.GetNextOpenedSemesterInformation(_userInfo,
                                                                                                                        _yearInfo, CommonExchange.SchoolSemester.SecondSemester);

                    _yearSemManager.InsertSemesterInformation(_userInfo, secondSemInfo);

                    //inserts the school year SUMMER
                    CommonExchange.SchoolYear summerYearInfo = _yearSemManager.GetNextOpenedSchoolYearInformation(_userInfo, _yearInfo);

                    _yearSemManager.InsertSchoolYearSummer(_userInfo, _yearInfo, ref summerYearInfo);
                    //-----------------------------------

                    //inserts the summer semester
                    CommonExchange.SemesterInformation summerSemInfo = _yearSemManager.GetNextOpenedSemesterInformation(_userInfo,
                                                                                                                        summerYearInfo, CommonExchange.SchoolSemester.Summer);

                    _yearSemManager.InsertSemesterInformation(_userInfo, summerSemInfo);
                    //----------------------------------------

                    this.Cursor = Cursors.Arrow;

                    MessageBox.Show(strMsg, "Success", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);

                    _hasCreated = true;

                    this.Close();
                }
                else if (msgResult == DialogResult.Cancel)
                {
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                RemoteClient.ProcStatic.ShowErrorDialog(ex.Message, "Error in Opening A School Year");
            }
            finally
            {
                this.Cursor = Cursors.Arrow;
            }
        } //------------------------------------