//Add Button public override void add_Btn_Click(object sender, EventArgs e) { try { if (classesname_textBox.Text == "") { classname_errorlabel.Visible = true; } else { classname_errorlabel.Visible = false; } if (classname_errorlabel.Visible) { MainClass.MSGBox("Fields * are Mandatory", "Fill all Fields", "ERROR"); } else { ClassDB classDB = new ClassDB(); classDB.add(classesname_textBox); MainClass.reset_disable(panel4); ShowData(); } Disable_errorlabel(); } catch { MainClass.MSGBox("Something Went Wrong", "ERROR", "ERROR"); } }
//Edit Button public override void edit_Btn_Click(object sender, EventArgs e) { try { if (classesname_textBox.Text == "") { classname_errorlabel.Visible = true; } else { classname_errorlabel.Visible = false; } if (classname_errorlabel.Visible) { MainClass.MSGBox("Fields * are Mandatory", "Fill all Fields", "ERROR"); } else { ClassDB classDB = new ClassDB(); classDB.edit(classesname_textBox); MainClass.reset_disable(panel4); ShowData(); } Disable_errorlabel(); } catch { MainClass.MSGBox("Oops... Class Not Updated", "Error", "Error"); } }
//Delete Button public override void delete_Btn_Click(object sender, EventArgs e) { try { if (classesname_textBox.Text == "") { MainClass.MSGBox("Enter Class Name", "Error", "Error"); } else { ClassDB classDB = new ClassDB(); classDB.delete(classesname_textBox); MainClass.Disable(panel4); ShowData(); } } catch { MainClass.MSGBox("Oopss... Class Not Deleted!!", "Error", "Error"); } Disable_errorlabel(); }