private void btnDelete_Click(object sender, EventArgs e) { if (ID == 0) { MessageBox.Show("Please select Sub Group Id first!", "Delete Message", MessageBoxButtons.OK, MessageBoxIcon.Error); initForm(); } else { ActionResult deleteResult = formCtrl._deleteFormData(new SubGroupIDModel() { Id = ID }); if (deleteResult.State) { SubGroupIDModel deleteObj = deleteResult.Data; MessageBox.Show("Sub Group ID " + deleteObj.SubGroupID + " Sucessfully Deleted!", "Delete Message", MessageBoxButtons.OK, MessageBoxIcon.Information); initForm(); } else { MessageBox.Show(deleteResult.Data, "Delete Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void btnUpdate_Click(object sender, EventArgs e) { if (comboYear.SelectedIndex == 0) { MessageBox.Show("Please Select Year!If Year List Empty Please Add Academic Year And Semster", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error); comboYear.Focus(); } else if (comboSemester.SelectedIndex == 0) { MessageBox.Show("Please Select Year!If Year List Empty Please Add Academic Year And Semster", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error); comboSemester.Focus(); } else if (comboProgramme.SelectedIndex == 0) { MessageBox.Show("Please Select Programme!If Year List Empty Please Add Programmes", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error); comboProgramme.Focus(); } else if (comboGroup.SelectedIndex == 0) { MessageBox.Show("Please Select Group!If Year List Empty Please Add Groups", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error); comboGroup.Focus(); } else if (string.IsNullOrEmpty(txtSubGroup.Text)) { MessageBox.Show("Please Select Enter Sub Group!", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error); comboGroup.Focus(); } else { ActionResult updateResult = formCtrl._updateFormData(new SubGroupIDModel() { Id = ID, Year = comboYear.SelectedItem.ToString(), Semester = comboSemester.SelectedItem.ToString(), Programme = comboProgramme.SelectedItem.ToString(), Group = comboGroup.SelectedItem.ToString(), SubGroup = Int32.Parse(txtSubGroup.Text.Trim()), SubGroupID = comboGroup.SelectedItem.ToString() + "." + txtSubGroup.Text.Trim() }); if (updateResult.State) { SubGroupIDModel updateObj = updateResult.Data; MessageBox.Show("Sub Group ID " + updateObj.SubGroupID + " Sucessfully Updated!", "Update Message", MessageBoxButtons.OK, MessageBoxIcon.Information); initForm(); } else { MessageBox.Show(updateResult.Data, "Update Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void btnInsert_Click(object sender, EventArgs e) { if (comboYear.SelectedIndex == 0) { MessageBox.Show("Please Select Year!If Year List Empty Please Add Academic Year And Semster", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error); comboYear.Focus(); } else if (comboSemester.SelectedIndex == 0) { MessageBox.Show("Please Select Year!If Year List Empty Please Add Academic Year And Semster", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error); comboSemester.Focus(); } else if (comboSesssion.SelectedIndex == 0) { MessageBox.Show("Please Select Programme!If Year List Empty Please Add Programmes", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error); comboSesssion.Focus(); } else { ActionResult saveResult = formCtrl._saveFormData(new SubGroupIDModel() { Year = comboYear.SelectedItem.ToString(), Semester = comboSemester.SelectedItem.ToString(), Programme = comboSesssion.SelectedItem.ToString(), }); if (saveResult.State) { SubGroupIDModel saveObj = saveResult.Data; MessageBox.Show("Sub Group ID " + saveObj.SubGroupID + " Sucessfully Saved!", "Save Message", MessageBoxButtons.OK, MessageBoxIcon.Information); initForm(); } else { MessageBox.Show(saveResult.Data, "Save Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }