예제 #1
0
        private void LoadClasses()
        {
            var mCourseClassList = new clsSchool.CourseClassDB().ListByAllOpenClass();

            foreach (var item in mCourseClassList)
            {
                string Name = string.Format("{0}: - {1} : {2}", item.CourseName, item.StartDate.ToString("dd MMM yyyy"), item.StartTimeLabel);
                cboClasses.Items.Add(new ListItem(Name, item.CourseClassId.ToString()));
            }
        }
예제 #2
0
        private void RemoveCourseClass(int CourseClassId)
        {
            var mClass = new clsSchool.CourseClassDB().GetById(CourseClassId);

            if (mClass != null)
            {
                mClass.IsComplete = false;
                bool ok = new clsSchool.CourseClassDB().Update(mClass);
            }

            LoadGrid();
        }
예제 #3
0
        private void AddEnrollment(int StudentId)
        {
            int CourseClassId = cboClasses.SelectedValue.ToInt();

            var mCourseClass = new clsSchool.CourseClassDB().GetById(CourseClassId);

            var mEnrollment = new clsSchool.EnrollmentBase();

            mEnrollment.ClassId      = CourseClassId;
            mEnrollment.Completed    = false;
            mEnrollment.CourseId     = mCourseClass.CourseId;
            mEnrollment.EnrollmentId = 0;
            mEnrollment.HasPaid      = false;
            mEnrollment.StartDate    = mCourseClass.StartDate;
            mEnrollment.StudentId    = StudentId;

            int Id = new clsSchool.EnrollmentDB().Add(mEnrollment);
        }
예제 #4
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (!ValidateInput())
            {
                return;
            }

            mCourseClassId = 0;
            if (!string.IsNullOrEmpty(hdfCourseClassId.Value))
            {
                mCourseClassId = Convert.ToInt32(hdfCourseClassId.Value);
            }

            UnloadForm(mCourseClassId);

            if (mCourseClassId > 0)
            {
                bool ok = new clsSchool.CourseClassDB().Update(mCourseClassBase);
                if (!ok)
                {
                    mCourseClassId = -1;
                }
            }
            else
            {
                mCourseClassId         = new clsSchool.CourseClassDB().Add(mCourseClassBase);
                hdfCourseClassId.Value = mCourseClassId.ToString();
            }

            if (mCourseClassId < 0)
            {
                InputFailed("The database update failed, please try again.");
            }
            else
            {
                LoadGrid();

                ResetForm();
                InputSucceeded();
            }
        }