Пример #1
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            if (!clsValidation.ValidateTextBoxForNumeric(txtCourseID))
            {
                txtCourseID.Focus();
                return;
            }

            clsCourse objCourse = new clsCourse(Convert.ToInt32(txtCourseID.Text));

            bool valid = objCourse.Search();

            if (valid)
            {
                txtCourseName.Text     = objCourse.CourseName;
                cmbSuburbID.Text       = objCourse.SuburbID.ToString();
                cmbSuburbName.Text     = objCourse.SuburbName.ToString();
                txtCourseDuration.Text = objCourse.CourseDuration.ToString();
                cmbSemesterID.Text     = objCourse.SemesterID.ToString();
                dtpStartDate.Value     = DateTime.Parse(objCourse.StartDate);
                dtpEndDate.Value       = DateTime.Parse(objCourse.EndDate);
                if (objCourse.CourseDelivery == "FaceToFace")
                {
                    rdbFaceToFace.Checked = true;
                }
                else if (objCourse.CourseDelivery == "Online")
                {
                    rdbOnline.Checked = true;
                }
                txtHoursPerWeek.Text = objCourse.HoursPerWeek.ToString();
                txtNumOfUnits.Text   = objCourse.NoOfUnits.ToString();
                txtCourseFee.Text    = objCourse.CourseFee.ToString();
            }
        }
Пример #2
0
        private void CourseForm_Load(object sender, EventArgs e)
        {
            clsCourse objCourse = new clsCourse();

            ComboBox[] cmb = new ComboBox[] { cmbSuburbID, cmbSuburbName, cmbSemesterID };
            objCourse.Load(cmb);
            objCourse.ViewAll(dgvCourse);
        }
Пример #3
0
        private void mnuDelete_Click(object sender, EventArgs e)
        {
            if (!clsValidation.ValidateTextBoxForNumeric(txtCourseID))
            {
                txtCourseID.Focus();
                return;
            }
            clsCourse objCourse = new clsCourse(Convert.ToInt32(txtCourseID.Text));

            objCourse.Delete();
            MessageBox.Show("Course record successfully deleted");
            objCourse.ViewAll(dgvCourse);
        }
Пример #4
0
        private void mnuViewAll_Click(object sender, EventArgs e)
        {
            clsCourse objCourse = new clsCourse();

            objCourse.ViewAll(dgvCourse);
        }
Пример #5
0
        private void mnuAdd_Click(object sender, EventArgs e)
        {
            #region ValidationArea
            if (!clsValidation.ValidateTextBox(txtCourseName))
            {
                txtCourseName.Focus();
                return;
            }
            if (!clsValidation.ValidateForAlphabet(txtCourseName))
            {
                txtCourseName.Focus();
                return;
            }
            if (!clsValidation.ValidateComboBox(cmbSuburbName))
            {
                return;
            }
            if (!clsValidation.ValidateTextBox(txtCourseDuration))
            {
                txtCourseDuration.Focus();
                return;
            }
            if (!clsValidation.ValidateTextBoxForNumeric(txtCourseDuration))
            {
                txtCourseDuration.Focus();
                return;
            }
            if (!clsValidation.ValidateTextBoxRange(txtCourseDuration, 100, 200))
            {
                txtCourseDuration.Focus();
                return;
            }
            if (!clsValidation.ValidateComboBox(cmbSemesterID))
            {
                return;
            }
            if (!clsValidation.ValidateDate(dtpStartDate))
            {
                return;
            }
            if (!clsValidation.ValidateDate(dtpEndDate))
            {
                return;
            }
            if (!clsValidation.ValidateDateStartVsEnd(dtpStartDate, dtpEndDate))
            {
                return;
            }
            if (!clsValidation.ValidateRadioButton(rdbFaceToFace, rdbOnline))
            {
                return;
            }
            if (!clsValidation.ValidateTextBox(txtHoursPerWeek))
            {
                txtHoursPerWeek.Focus();
                return;
            }
            if (!clsValidation.ValidateTextBoxForNumeric(txtHoursPerWeek))
            {
                txtHoursPerWeek.Focus();
                return;
            }
            if (!clsValidation.ValidateTextBoxRange(txtHoursPerWeek, 10, 30))
            {
                txtHoursPerWeek.Focus();
                return;
            }
            if (!clsValidation.ValidateTextBox(txtNumOfUnits))
            {
                txtNumOfUnits.Focus();
                return;
            }
            if (!clsValidation.ValidateTextBoxForNumeric(txtNumOfUnits))
            {
                txtNumOfUnits.Focus();
                return;
            }
            if (!clsValidation.ValidateTextBoxRange(txtNumOfUnits, 5, 30))
            {
                txtNumOfUnits.Focus();
                return;
            }
            if (!clsValidation.ValidateTextBox(txtCourseFee))
            {
                txtCourseFee.Focus();
                return;
            }
            if (!clsValidation.ValidateTextBoxForNumeric(txtCourseFee))
            {
                txtCourseFee.Focus();
                return;
            }
            if (!clsValidation.ValidateTextBoxRange(txtCourseFee, 1000, 6000))
            {
                txtCourseFee.Focus();
                return;
            }
            #endregion
            string courseDelText = String.Empty;
            if (rdbFaceToFace.Checked)
            {
                courseDelText = "FaceToFace";
            }
            else if (rdbOnline.Checked)
            {
                courseDelText = "Online";
            }

            clsCourse objCourse = new clsCourse(txtCourseName.Text, Convert.ToInt32(cmbSuburbID.Text), Convert.ToInt32(txtCourseDuration.Text),
                                                Convert.ToInt32(cmbSemesterID.Text), dtpStartDate.Value.ToString("yyyy-MM-dd"), dtpEndDate.Value.ToString("yyyy-MM-dd"), courseDelText,
                                                Convert.ToInt32(txtHoursPerWeek.Text), Convert.ToInt32(txtNumOfUnits.Text), Convert.ToInt32(txtCourseFee.Text));

            objCourse.Add();
            MessageBox.Show("Course record successfully added!");
            objCourse.ViewAll(dgvCourse);
        }