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); }
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; } } }
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); }
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); }
private void UnitForm_Load(object sender, EventArgs e) { clsUnit objUnit = new clsUnit(); objUnit.ViewAll(dgvUnit); }
private void mnuViewAll_Click(object sender, EventArgs e) { clsUnit objUnit = new clsUnit(); objUnit.ViewAll(dgvUnit); }