private void btnDelete_Click(object sender, EventArgs e) { if (ID == 0) { MessageBox.Show("Please select Consective Session first!", "Delete Message", MessageBoxButtons.OK, MessageBoxIcon.Error); initForm(); } else { ActionResult deleteResult = formCtrl._deleteFormData(new ConsectiveSessionsModel() { Id = ID }); if (deleteResult.State) { ConsectiveSessionsModel deleteObj = deleteResult.Data; MessageBox.Show("Consective Session 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 (comboSub.SelectedIndex == 0) { MessageBox.Show("Please Select Subject!If Year List Empty Please Add Subject", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error); comboSub.Focus(); } else if ((!checkBoxLecture.Checked && !checkBoxTutorial.Checked && !checkBoxLab.Checked) || (!checkBoxLecture.Checked && !checkBoxTutorial.Checked) || (!checkBoxLecture.Checked && !checkBoxLab.Checked) || (!checkBoxTutorial.Checked && !checkBoxLab.Checked)) { MessageBox.Show("Please Select Two or More Tags For Consective Session!", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error); comboSub.Focus(); } else { ActionResult updateResult = formCtrl._updateFormData(new ConsectiveSessionsModel() { Id = ID, Year = comboYear.SelectedItem.ToString(), Semester = comboSemester.SelectedItem.ToString(), Subject = comboSub.SelectedItem.ToString(), Lecture = getCheckedSate("Lecture"), Tutorial = getCheckedSate("Tutorial"), Lab = getCheckedSate("Lab"), }); if (updateResult.State) { ConsectiveSessionsModel updateObj = updateResult.Data; MessageBox.Show("Consective Session Sucessfully Updated!", "Update Message", MessageBoxButtons.OK, MessageBoxIcon.Information); initForm(); } else { MessageBox.Show(updateResult.Data, "Update Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }