Exemplo n.º 1
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);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
        private void mnuViewAll_Click(object sender, EventArgs e)
        {
            clsCourse objCourse = new clsCourse();

            objCourse.ViewAll(dgvCourse);
        }
Exemplo n.º 4
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);
        }