public override void delete_Btn_Click(object sender, EventArgs e) { try { if (SID_textBox.Text == "") { MainClass.MSGBox("Enter Student Id", "Error", "Error"); } else { StudentDB studentDB = new StudentDB(); studentDB.Delete(SID_textBox, name_textBox, GenderDD, DOB_Picker, Phone_textBox, ClassDD); MainClass.Disable(panel4); ShowData(); } } catch { MainClass.MSGBox("Oopss... Student Not Deleted!!", "Error", "Error"); } Disable_errorlabel(); }
public override void add_Btn_Click(object sender, EventArgs e) { try { if (SID_textBox.Text == "") { SID_errorlabel.Visible = true; } else { SID_errorlabel.Visible = false; } if (name_textBox.Text == "") { SName_errorlabel.Visible = true; } else { SName_errorlabel.Visible = false; } if (GenderDD.SelectedIndex == -1) { GenderDD_errorlabel.Visible = true; } else { GenderDD_errorlabel.Visible = false; } if (DOB_Picker.Text == "") { DOB_errorlabel.Visible = true; } else { DOB_errorlabel.Visible = false; } if (Phone_textBox.Text == "") { phone_errorlabel.Visible = true; } else { phone_errorlabel.Visible = false; } if (ClassDD.SelectedIndex == -1) { class_errorlabel.Visible = true; } else { class_errorlabel.Visible = false; } if (SID_errorlabel.Visible || SName_errorlabel.Visible || GenderDD_errorlabel.Visible || DOB_errorlabel.Visible || phone_errorlabel.Visible || class_errorlabel.Visible) { MainClass.MSGBox("Fields * are Mandatory", "Fill all Fields", "ERROR"); } else { StudentDB studentDB = new StudentDB(); studentDB.Add(SID_textBox, name_textBox, GenderDD, DOB_Picker, Phone_textBox, ClassDD); MainClass.reset_disable(panel4); ShowData(); } Disable_errorlabel(); } catch (Exception ex) { MainClass.MSGBox(ex.Message, "ERROR", "ERROR"); } }