private void btnSave_Click(object sender, EventArgs e) { string msg = ""; if (Isvalid(txt_Name.Text.Trim()) && txt_Name.Text.Trim() != "") { if (current_event == "add") { msg = GradeLevel.Add(txt_Name.Text.Trim()); } else if (current_event == "edit") { msg = GradeLevel.Edit(lst_GradeLevel.SelectedItem.ToString(), txt_Name.Text.Trim()); } MessageBox.Show(msg, "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); if (msg.Contains("success")) { current_event = ""; txt_Name.Clear(); txtSearch.Clear(); lst_GradeLevel.SelectedIndex = -1; grade_level_list(""); txt_list_settings(true, false, true); btn_setup(true, false, false, false, false); } } else { MessageBox.Show("Invalid grade level name.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void btnDelete_Click(object sender, EventArgs e) { DialogResult dialogResult = MessageBox.Show("Are you sure you want to delete this Grade level?", "Deleting Grade Level", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { string msg = GradeLevel.Delete(txt_Name.Text.Trim()); if (msg.Contains("success")) { MessageBox.Show(msg, "Deleted"); } } }