示例#1
0
        private void mnuAdd_Click(object sender, EventArgs e)
        {
            if (!clsValidation.ValidateTextBoxForNumeric(txtNoOfHours))
            {
                return;
            }
            if (!clsValidation.ValidateTextBoxForNumeric(txtNoOfAssessments))
            {
                return;
            }
            if (!clsValidation.ValidateRadioButton(rdbCoreUnit, rdbElectiveUnit))
            {
                return;
            }
            string unitTypeText = String.Empty;

            if (rdbCoreUnit.Checked)
            {
                unitTypeText = "Core Unit";
            }
            else if (rdbElectiveUnit.Checked)
            {
                unitTypeText = "Elective";
            }

            clsUnit objUnit = new clsUnit(txtUnitName.Text, Convert.ToInt32(txtNoOfHours.Text), unitTypeText);

            objUnit.Add();
            MessageBox.Show("Unit record successfully added!");
            objUnit.ViewAll(dgvUnit);
        }
示例#2
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            if (!clsValidation.ValidateTextBoxForNumeric(txtUnitID))
            {
                txtUnitID.Focus();
                return;
            }
            clsUnit objUnit = new clsUnit(Convert.ToInt32(txtUnitID.Text));
            bool    valid   = objUnit.Search();

            if (valid)
            {
                txtUnitName.Text        = objUnit.UnitName;
                txtNoOfHours.Text       = objUnit.NoOfHours.ToString();
                txtNoOfAssessments.Text = objUnit.NoOfAssessments.ToString();
                if (objUnit.UnitType == "Core Unit")
                {
                    rdbCoreUnit.Checked = true;
                }
                else if (objUnit.UnitType == "Elective")
                {
                    rdbElectiveUnit.Checked = true;
                }
            }
        }
示例#3
0
        private void mnuUpdate_Click(object sender, EventArgs e)
        {
            if (!clsValidation.ValidateTextBoxForNumeric(txtUnitID))
            {
                txtUnitID.Focus();
                return;
            }
            if (!clsValidation.ValidateTextBox(txtUnitName))
            {
                txtUnitName.Focus();
                return;
            }
            //if (!clsValidation.ValidateTextBox(txtCourseID))
            //{
            //    return;
            //}
            //if (!clsValidation.ValidateTextBoxForNumeric(txtCourseID))
            //{
            //    return;
            //}
            //if (!clsValidation.ValidateComboBox(cmbNoOfHours))
            //{
            //    return;
            //}
            //if (!clsValidation.ValidateComboBox(cmbNoOfAssessments))
            //{
            //    return;
            //}
            if (!clsValidation.ValidateTextBoxForNumeric(txtNoOfHours))
            {
                return;
            }
            if (!clsValidation.ValidateTextBoxForNumeric(txtNoOfAssessments))
            {
                return;
            }
            if (!clsValidation.ValidateRadioButton(rdbCoreUnit, rdbElectiveUnit))
            {
                return;
            }
            string unitTypeText = String.Empty;

            if (rdbCoreUnit.Checked)
            {
                unitTypeText = "Core Unit";
            }
            else if (rdbElectiveUnit.Checked)
            {
                unitTypeText = "Elective";
            }

            clsUnit objUnit = new clsUnit(Convert.ToInt32(txtUnitID.Text), txtUnitName.Text,
                                          Convert.ToInt32(txtNoOfHours.Text), unitTypeText);

            objUnit.Update();
            MessageBox.Show("Unit record successfully updated!");
            objUnit.ViewAll(dgvUnit);
        }
示例#4
0
        private void mnuDelete_Click(object sender, EventArgs e)
        {
            if (!clsValidation.ValidateTextBoxForNumeric(txtUnitID))
            {
                txtUnitID.Focus();
                return;
            }
            clsUnit objUnit = new clsUnit(Convert.ToInt32(txtUnitID.Text));

            objUnit.Delete();
            MessageBox.Show("Unit record successfully deleted");
            objUnit.ViewAll(dgvUnit);
        }
示例#5
0
        private void UnitForm_Load(object sender, EventArgs e)
        {
            clsUnit objUnit = new clsUnit();

            objUnit.ViewAll(dgvUnit);
        }
示例#6
0
        private void mnuViewAll_Click(object sender, EventArgs e)
        {
            clsUnit objUnit = new clsUnit();

            objUnit.ViewAll(dgvUnit);
        }