public override void save_btn_Click(object sender, EventArgs e) { if (timingNameTxt.Text == "") { timingnameerror_Label.Visible = true; } else { timingnameerror_Label.Visible = false; } if (dayDD.SelectedIndex == -1) { dayerror_label.Visible = true; } else { dayerror_label.Visible = false; } //Now We made a condition if any of error label is visible it will show a message dialog if (timingnameerror_Label.Visible || dayerror_label.Visible) { MainClass.MSGBox("Fields with * are mandatory", "ERROR!!", "Error"); } else { TimeSpan startTime = new TimeSpan(classstart_TimePicker.Value.Hour, classstart_TimePicker.Value.Minute, classstart_TimePicker.Value.Second); TimeSpan endTime = new TimeSpan(endclass_TimePicker.Value.Hour, endclass_TimePicker.Value.Minute, endclass_TimePicker.Value.Second); if (edit == 0) //Code For SAVE { try { //here the table is come up as a class because we use LINQ method timing t = new timing(); eduvationdb.st_insertTimings(timingNameTxt.Text, startTime, endTime, dayDD.SelectedItem.ToString(), Convert.ToInt32(classDD.SelectedValue.ToString())); //Without this class you could not submit the changes to dbs so it is necessary eduvationdb.SubmitChanges(); MainClass.MSGBox(timingNameTxt.Text + " Added Successfully.", "Success", "Success"); MainClass.reset_disable(panel6); loadData(); } catch (Exception ex) { MainClass.MSGBox(ex.Message, "Error", "Error"); } } else if (edit == 1) //Code For UPDATE { eduvationdb.st_updateTimings(timingNameTxt.Text, startTime, endTime, dayDD.SelectedItem.ToString(), timingID, Convert.ToInt32(classDD.SelectedValue.ToString())); //Without this class you could not submit the changes to dbs so it is necessary eduvationdb.SubmitChanges(); MainClass.MSGBox(timingNameTxt.Text + " Updated Successfully.", "Success", "Success"); MainClass.reset_disable(panel6); loadData(); } } }
public override void delete_btn_Click(object sender, EventArgs e) { if (edit == 1) { eduvationdb.staff_deleteStaff(staffID); MainClass.MSGBox(nameTxt.Text + " deleted successfully from the system.", "Success", "Success"); MainClass.reset_disable(panel7); loadData(); } }
public override void delete_btn_Click(object sender, EventArgs e) { if (edit == 1) { DialogResult dr = MessageBox.Show("Are You sure you want to delete " + timingNameTxt.Text + " ?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dr == DialogResult.Yes) { eduvationdb.st_deleteTimings(timingID); MainClass.MSGBox(timingNameTxt.Text + " Deleted Successfully.", "Success", "Success"); MainClass.reset_disable(panel6); loadData(); } } }
public override void save_btn_Click(object sender, EventArgs e) { if (subjectNameTxt.Text == "") { subjectnameerror_Label.Visible = true; } else { subjectnameerror_Label.Visible = false; } //Now We made a condition if any of error label is visible it will show a message dialog if (subjectnameerror_Label.Visible) { MainClass.MSGBox("Fields with * are mandatory", "ERROR!!", "Error"); } else { if (edit == 0) //Code For SAVE { try { //here the table is come up as a class because we use LINQ method subject s = new subject(); eduvationdb.st_insertSubject(subjectNameTxt.Text, Convert.ToInt32(classDD.SelectedValue.ToString())); //Without this class you could not submit the changes to dbs so it is necessary eduvationdb.SubmitChanges(); MainClass.MSGBox(subjectNameTxt.Text + " Added Successfully.", "Success", "Success"); MainClass.reset_disable(panel6); loadData(); } catch (Exception ex) { MainClass.MSGBox("Possible Errors\n\n1.Are you trying to add same subject in this class?\n2.Contact Technical Support for Assisitance.\[email protected]", "Error", "Error"); } } else if (edit == 1) //Code For UPDATE { eduvationdb.st_updateSubject(subjectNameTxt.Text, Convert.ToInt32(classDD.SelectedValue.ToString()), subjectID); //Without this class you could not submit the changes to dbs so it is necessary eduvationdb.SubmitChanges(); MainClass.MSGBox(subjectNameTxt.Text + " Updated Successfully.", "Success", "Success"); MainClass.reset_disable(panel6); loadData(); } } }
private void login_btn_Click(object sender, EventArgs e) { if (usernameTxt.Text == "") { loginusernameerrorlabel.Visible = true; } else { loginusernameerrorlabel.Visible = false; } if (passwordTxt.Text == "") { passworderrorlabel.Visible = true; } else { passworderrorlabel.Visible = false; } if (loginusernameerrorlabel.Visible || passworderrorlabel.Visible) { MainClass.MSGBox("Field with * are mandatory.", "Error", "Error"); } else { if (main.GetStaffLogin(usernameTxt.Text, passwordTxt.Text)) { if (MainClass.STAFFROLE == "Faculty") { FacultyDB facDB = new FacultyDB(); MainClass.ShowWindow(facDB, this, MDI.ActiveForm); } else if (MainClass.STAFFROLE == "Admin") { Home home = new Home(); MainClass.ShowWindow(home, this, MDI.ActiveForm); } } else { MainClass.MSGBox("Invalid Username OR Password", "Error", "Error"); } } }
public override void save_btn_Click(object sender, EventArgs e) { if (role_textBox.Text == "") { roleerrorlabel.Visible = true; } else { roleerrorlabel.Visible = false; } if (statusDD.SelectedIndex == -1) { rolestatuserrorlabel.Visible = true; } else { rolestatuserrorlabel.Visible = false; } //Now We made a condition if any of error label is visible it will show a message dialog if (roleerrorlabel.Visible || rolestatuserrorlabel.Visible) { MainClass.MSGBox("Fields with * are mandatory", "ERROR!!", "Error"); } else { if (edit == 0) //Code For SAVE { //here the table is come up as a class because we use LINQ method role r = new role(); r.rl_name = role_textBox.Text; if (statusDD.SelectedIndex == 0) { r.rl_status = 1; //For Active } else { r.rl_status = 0; //For Inactive } eduvationdb.staff_insertRoles(role_textBox.Text, r.rl_status); //Without this class you could not submit the changes to dbs so it is necessary eduvationdb.SubmitChanges(); MainClass.MSGBox(role_textBox.Text + " Added Successfully.", "Success", "Success"); MainClass.reset_disable(panel6); loadData(); } else if (edit == 1) //Code For UPDATE { //here the table is come up as a class because we use LINQ method byte status; if (statusDD.SelectedIndex == 0) { status = 1; //For Active } else { status = 0; //For Inactive } eduvationdb.staff_updateRoles(role_textBox.Text, status, roleID); //Without this class you could not submit the changes to dbs so it is necessary eduvationdb.SubmitChanges(); MainClass.MSGBox(role_textBox.Text + " Updated Successfully.", "Success", "Success"); MainClass.reset_disable(panel6); loadData(); } } }
public override void save_btn_Click(object sender, EventArgs e) { if (nameTxt.Text == "") { nameerror_Label.Visible = true; } else { nameerror_Label.Visible = false; } if (usernameTxt.Text == "") { unameerror_Label.Visible = true; } else { unameerror_Label.Visible = false; } if (passwordTxt.Text == "") { pswderror_Label.Visible = true; } else { pswderror_Label.Visible = false; } if (confirmpasswordTxt.Text == "") { cpswderror_Label.Visible = true; } else { cpswderror_Label.Visible = false; } if (passwordTxt.Text != confirmpasswordTxt.Text) { mismatchedError_Label.Visible = true; } else { mismatchedError_Label.Visible = false; } if (phoneTxt.Text == "") { phoneerror_Label.Visible = true; } else { phoneerror_Label.Visible = false; } if (roleDD.SelectedIndex == -1) { roleerror_Label.Visible = true; } else { roleerror_Label.Visible = false; } if (statusDD.SelectedIndex == -1) { statuserror_Label.Visible = true; } else { statuserror_Label.Visible = false; } //Now We made a condition if any of error label is visible it will show a message dialog if (nameerror_Label.Visible || unameerror_Label.Visible || pswderror_Label.Visible || cpswderror_Label.Visible || mismatchedError_Label.Visible || phoneerror_Label.Visible || roleerror_Label.Visible || statuserror_Label.Visible) { MainClass.MSGBox("Fields with * are mandatory", "ERROR!!", "Error"); } else { if (edit == 0) //Code For SAVE { if (imgTxt.Text == "") { byte stat = statusDD.SelectedIndex == 0 ? Convert.ToByte(1) : Convert.ToByte(0); eduvationdb.staff_insertStaffWithoutImage(nameTxt.Text, usernameTxt.Text, passwordTxt.Text, phoneTxt.Text, Convert.ToInt32(roleDD.SelectedValue.ToString()), stat); MainClass.MSGBox(nameTxt.Text + " Added Successfully into the System.", "Success", "Success"); MainClass.reset_disable(panel7); loadData(); } else { byte stat = statusDD.SelectedIndex == 0 ? Convert.ToByte(1) : Convert.ToByte(0); MemoryStream ms = new MemoryStream(); image.Save(ms, ImageFormat.Jpeg); byte[] arr = ms.ToArray(); eduvationdb.staff_insertStaff(nameTxt.Text, usernameTxt.Text, passwordTxt.Text, phoneTxt.Text, Convert.ToInt32(roleDD.SelectedValue.ToString()), stat, arr); MainClass.MSGBox(nameTxt.Text + " Added Successfully into the System.", "Success", "Success"); MainClass.reset_disable(panel7); loadData(); } } else if (edit == 1) //Code For UPDATE { byte stat = statusDD.SelectedIndex == 0 ? Convert.ToByte(1) : Convert.ToByte(0); if (image == null) { eduvationdb.staff_updatetStaffWithoutImage(nameTxt.Text, usernameTxt.Text, passwordTxt.Text, phoneTxt.Text, Convert.ToInt32(roleDD.SelectedValue.ToString()), stat, staffID); MainClass.MSGBox(nameTxt.Text + " data updated successfully in the system.", "Success", "Success"); MainClass.reset_disable(panel7); loadData(); } else { MemoryStream ms = new MemoryStream(); image.Save(ms, ImageFormat.Jpeg); byte[] arr = ms.ToArray(); eduvationdb.staff_updatetStaff(nameTxt.Text, usernameTxt.Text, passwordTxt.Text, phoneTxt.Text, Convert.ToInt32(roleDD.SelectedValue.ToString()), stat, arr, staffID); MainClass.MSGBox(nameTxt.Text + " data updated successfully in the system.", "Success", "Success"); MainClass.reset_disable(panel7); loadData(); } } } }