private void CreateDiscipline_Save_Btn_Click(object sender, EventArgs e) { String name = CreateDiscipline_DisciplineName_txt.Text; String session = CreateDiscipline_AcademicSession_txt.Text; String code = CreateDiscipline_DisciplineCode_txt.Text; if (name.Equals("") || session.Equals("") || code.Equals("")) { return; } try { bool flag = controller.DExists(); if (flag == false) { controller.saveDiscipline(name, session, code); MessageBox.Show("Discipline Saved !"); CreateDiscipline_DisciplineName_txt.Text = ""; CreateDiscipline_AcademicSession_txt.Text = ""; CreateDiscipline_DisciplineCode_txt.Text = ""; } else { MessageBox.Show("One Discipline has already been created"); CreateDiscipline_DisciplineName_txt.Text = ""; CreateDiscipline_AcademicSession_txt.Text = ""; CreateDiscipline_DisciplineCode_txt.Text = ""; } }catch (Exception) {} }
private void btnSave_Click(object sender, EventArgs e) { if (txtDisciplineName.Text == "") { MessageBox.Show("Discipline TextBox is Empty!"); txtDisciplineName.Focus(); } else if (txtAcademicSesssion.Text == "") { MessageBox.Show("Academic Sesssion TextBox is Empty!"); txtAcademicSesssion.Focus(); } else { DisciplineController dscontrol = new DisciplineController(); if (dscontrol.saveDiscipline(txtDisciplineName.Text, txtAcademicSesssion.Text)) { MessageBox.Show("Discipline saved successfully"); } } }