public override void deleteBtn_Click(object sender, EventArgs e) { if (edit == 1) { obj.st_deleteStaff(staffID); MainClass.ShowMSG(nameTxt.Text + " deleted successfully from the system.", "Success", "Success"); MainClass.disable_reset(panel6); loadData(); } }
public override void deleteBtn_Click(object sender, EventArgs e) { if (edit == 1) { DialogResult dr = MessageBox.Show("Are you sure you want to delete" + levelNameTxt.Text + "?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { obj.st_deletelevel(levelID); MainClass.ShowMSG(levelNameTxt.Text + " deleted successfully.", "Success...", "Success"); MainClass.disable_reset(panel6); loadData(); } } }
public override void saveBtn_Click(object sender, EventArgs e) { if (subjectTxt.Text == "") { subjectErrorLabel.Visible = true; } else { subjectErrorLabel.Visible = false; if (classDD.SelectedIndex == -1) { belongsErrorLabel.Visible = true; } else { belongsErrorLabel.Visible = false; } if (subjectErrorLabel.Visible || belongsErrorLabel.Visible) { MainClass.ShowMSG("Fields with * are mandatory.", "Error...", "Error"); } else { if (edit == 0) // code for SAVE operation { try { subject s = new subject(); obj.st_insertSubject(subjectTxt.Text, Convert.ToInt32(classDD.SelectedValue.ToString())); obj.SubmitChanges(); MainClass.ShowMSG(subjectTxt.Text + " added successfully.", "Success...", "Success"); MainClass.disable_reset(panel6); loadData(); } catch (Exception ex) { MainClass.ShowMSG("Possible Errors\n\n1.Are you trying to add same subject in this class?\n2.Contact technical support assistance.", "Error", "Error"); } } else { obj.st_updateSubject(subjectTxt.Text, Convert.ToInt32(classDD.SelectedValue.ToString()), subjectID); MainClass.ShowMSG(subjectTxt.Text + " updated successfully.", "Success...", "Success"); MainClass.disable_reset(panel6); loadData(); } } } }
private void loginBtn_Click(object sender, EventArgs e) { if (usernameTxt.Text == "") { usernameErrorLabel.Visible = true; } else { usernameErrorLabel.Visible = false; } if (passwordtxt.Text == "") { passwordErrorLabel.Visible = true; } else { passwordErrorLabel.Visible = false; } if (usernameErrorLabel.Visible || passwordErrorLabel.Visible) { MainClass.ShowMSG("Fields with * are mandatory.", "Error", "Error"); } else { if (mai.getStaffLogin(usernameTxt.Text, passwordtxt.Text)) { if (MainClass.STAFFROLE == "Faculty") { FacultyDB hs = new FacultyDB(); MainClass.showWindow(hs, this, MDI.ActiveForm); MDI.mdiobj.logoutToolStripMenuItem.Enabled = true; this.Close(); } else if (MainClass.STAFFROLE == "Admin") { HomeScreen hs = new HomeScreen(); MainClass.showWindow(hs, this, MDI.ActiveForm); MDI.mdiobj.logoutToolStripMenuItem.Enabled = true; this.Close(); } } else { MainClass.ShowMSG("Invalid login details.", "Error", "Error"); } } }
public override void saveBtn_Click(object sender, EventArgs e) { if (levelNameTxt.Text == "") { levelErrorLabel.Visible = true; } else { levelErrorLabel.Visible = false; } if (levelErrorLabel.Visible) { MainClass.ShowMSG("Fields with * are mandatory.", "Error...", "Error"); } else { if (edit == 0) // code for SAVE operation { levels c = new levels(); obj.st_insertlevel(levelNameTxt.Text); obj.SubmitChanges(); MainClass.ShowMSG(levelNameTxt.Text + " added successfully.", "Success...", "Success"); MainClass.disable_reset(panel6); loadData(); } else if (edit == 1) // code for UPDATE { obj.st_updatelevel(levelID, levelNameTxt.Text); MainClass.ShowMSG(levelNameTxt.Text + " updated successfully.", "Success...", "Success"); MainClass.disable_reset(panel6); loadData(); } } }
public override void saveBtn_Click(object sender, EventArgs e) { if (sectionTxt.Text == "") { sectionErrorLabel.Visible = true; } else { sectionErrorLabel.Visible = false; } if (statusDD.SelectedIndex == -1) { statusErrorLabel.Visible = true; } else { statusErrorLabel.Visible = false; } if (sectionErrorLabel.Visible || statusErrorLabel.Visible) { MainClass.ShowMSG("Fields with * are mandatory.", "Error...", "Error"); } else { if (edit == 0) // code for SAVe { section s = new section(); if (statusDD.SelectedIndex == 0) { s.sec_status = 1; } else { s.sec_status = 0; } obj.st_insertSections(sectionTxt.Text, s.sec_status); obj.SubmitChanges(); MainClass.ShowMSG(sectionTxt.Text + " added successfully.", "Success...", "Success"); MainClass.disable_reset(panel6); loadData(); } else // code for update { byte stat; if (statusDD.SelectedIndex == 0) { stat = 1; } else { stat = 0; } obj.st_updateSections(sectionTxt.Text, stat, sectionID); MainClass.ShowMSG(sectionTxt.Text + " updated successfully.", "Success...", "Success"); MainClass.disable_reset(panel6); loadData(); } } }
public override void saveBtn_Click(object sender, EventArgs e) { if (nameTxt.Text == "") { nameErrorLabel.Visible = true; } else { nameErrorLabel.Visible = false; } if (usernameTxt.Text == "") { usernameErrorLabel.Visible = true; } else { usernameErrorLabel.Visible = false; } if (passwordTxt.Text == "") { passwordErrorLabel.Visible = true; } else { passwordErrorLabel.Visible = false; } if (confirmPassTxt.Text == "") { confirmPassErrorLabel.Visible = true; } else { confirmPassErrorLabel.Visible = false; } if (passwordTxt.Text != confirmPassTxt.Text) { mismatchedErrorLabel.Visible = true; } else { mismatchedErrorLabel.Visible = false; } if (phone1Txt.Text == "") { phone1ErrorLabel.Visible = true; } else { phone1ErrorLabel.Visible = false; } if (roleDD.SelectedIndex == -1) { roleErrorLabel.Visible = true; } else { roleErrorLabel.Visible = false; } if (statusDD.SelectedIndex == -1) { statusErrorLabel.Visible = true; } else { statusErrorLabel.Visible = false; } if (nameErrorLabel.Visible || usernameErrorLabel.Visible || passwordErrorLabel.Visible || confirmPassErrorLabel.Visible || mismatchedErrorLabel.Visible || phone1ErrorLabel.Visible || roleErrorLabel.Visible || statusErrorLabel.Visible) { MainClass.ShowMSG("Fields with * are mandatory.", "Stop...", "Error"); } else { if (edit == 0) // code for SAVE operation { if (imagePathTxt.Text == "") { byte stat = statusDD.SelectedIndex == 0? Convert.ToByte(1) : Convert.ToByte(0); obj.st_insertStaffWithoutImage(nameTxt.Text, usernameTxt.Text, passwordTxt.Text, phone1Txt.Text, phone2Txt.Text, Convert.ToInt32(roleDD.SelectedValue.ToString()), stat); MainClass.ShowMSG(nameTxt.Text + " added successfully into the system.", "Success", "Success"); MainClass.disable_reset(panel6); loadData(); } else { byte stat = statusDD.SelectedIndex == 0 ? Convert.ToByte(1) : Convert.ToByte(0); MemoryStream ms = new MemoryStream(); i.Save(ms, ImageFormat.Jpeg); byte[] arr = ms.ToArray(); obj.st_insertStaff(nameTxt.Text, usernameTxt.Text, passwordTxt.Text, phone1Txt.Text, phone2Txt.Text, Convert.ToInt32(roleDD.SelectedValue.ToString()), stat, arr); MainClass.ShowMSG(nameTxt.Text + " added successfully into the system.", "Success", "Success"); MainClass.disable_reset(panel6); loadData(); } } else if (edit == 1) // code for UPDATE operation { byte stat = statusDD.SelectedIndex == 0 ? Convert.ToByte(1) : Convert.ToByte(0); if (i == null) { obj.st_updateStaffWithoutImage(nameTxt.Text, usernameTxt.Text, passwordTxt.Text, phone1Txt.Text, phone2Txt.Text, Convert.ToInt32(roleDD.SelectedValue.ToString()), stat, staffID); MainClass.ShowMSG(nameTxt.Text + " data updated successfully into the system.", "Success", "Success"); MainClass.disable_reset(panel6); loadData(); } else { MemoryStream ms = new MemoryStream(); i.Save(ms, ImageFormat.Jpeg); byte[] arr = ms.ToArray(); obj.st_updateStaff(nameTxt.Text, usernameTxt.Text, passwordTxt.Text, phone1Txt.Text, phone2Txt.Text, Convert.ToInt32(roleDD.SelectedValue.ToString()), stat, arr, staffID); MainClass.ShowMSG(nameTxt.Text + " data updated successfully into the system.", "Success", "Success"); MainClass.disable_reset(panel6); loadData(); } } } }
public override void saveBtn_Click(object sender, EventArgs e) { if (shiftNameTxt.Text == "") { shiftErrorLabel.Visible = true; } else { shiftErrorLabel.Visible = false; } if (shiftDD.SelectedIndex == -1) { shiftDDerrorLabel.Visible = true; } else { shiftDDerrorLabel.Visible = false; } if (shiftDDerrorLabel.Visible || shiftDDerrorLabel.Visible) { MainClass.ShowMSG("Fields with * are mandatory.", "Error...", "Error"); } else { TimeSpan startTime = new TimeSpan(startPicker.Value.Hour, startPicker.Value.Minute, startPicker.Value.Second); TimeSpan endTime = new TimeSpan(endPicker.Value.Hour, endPicker.Value.Minute, endPicker.Value.Second); //startTime.ToString(); //endTime.ToString(); //TimeSpan st = Convert.ToInt16(startPicker.Value.Hour.ToString()); //TimeSpan et = endPicker.Value.TimeOfDay; //TimeSpan st = this.startPicker.Value.TimeOfDay; //TimeSpan et = this.endPicker.Value.TimeOfDay; //int st = Convert.ToInt16(startPicker.Value.ToString()); //int et = Convert.ToInt16(endPicker.Value.ToString()); //DateTime start = DateTime.Parse(startPicker.Text).Date; //DateTime end = DateTime.Parse(endPicker.Text).Date; //DateTime dt = startPicker.Value; //TimeSpan st = new TimeSpan(dt.Hour, dt.Minute, dt.Second); //DateTime en = endPicker.Value; //TimeSpan et = new TimeSpan(en.Hour, en.Minute, en.Second); //TimeSpan st = dt.TimeOfDay; //int t = Convert.ToInt16(startPicker.Value.Hour.ToString()); //int y = Convert.ToInt16(endPicker.Value.Hour.ToString()); //TimeSpan ts1 = TimeSpan.Parse(startPicker.Text); //TimeSpan ts2 = TimeSpan.Parse(endPicker.Text); //TimeSpan ts = startPicker.Value.TimeOfDay; //TimeSpan es = endPicker.Value.TimeOfDay; if (edit == 0) // code for SAVE operation { try { shift s = new shift(); obj.st_insertShifts(shiftNameTxt.Text, Convert.ToByte(shiftDD.SelectedItem.ToString()), startTime, endTime); obj.SubmitChanges(); MainClass.ShowMSG(shiftNameTxt.Text + " added successfully.", "Success...", "Success"); MainClass.disable_reset(panel6); loadData(); } catch (Exception ex) { MainClass.ShowMSG(ex.Message, "Error", "Error"); } } else { obj.st_updateShifts(shiftNameTxt.Text, Convert.ToByte(shiftDD.SelectedItem.ToString()), startTime, endTime, shiftID); MainClass.ShowMSG(shiftNameTxt.Text + " updated successfully.", "Success...", "Success"); MainClass.disable_reset(panel6); loadData(); } } }
public override void saveBtn_Click(object sender, EventArgs e) { if (classnameTxt.Text == "") { classNameErrorLabel.Visible = true; } else { classNameErrorLabel.Visible = false; } if (statusDD.SelectedIndex == -1) { levlErrorLabel.Visible = true; } else { levlErrorLabel.Visible = false; } if (levelDD.SelectedIndex == -1) { levlErrorLabel.Visible = true; } else { levlErrorLabel.Visible = false; } if (classNameErrorLabel.Visible || levlErrorLabel.Visible || levlErrorLabel.Visible) { MainClass.ShowMSG("Fields with * are mandatory.", "Error...", "Error"); } else { if (edit == 0) // code for SAVE operation { clase c = new clase(); // c.cls_name = classnameTxt.Text; if (statusDD.SelectedIndex == 0) { c.cls_status = 1; } else { c.cls_status = 0; } //obj.roles.InsertOnSubmit(r); obj.st_insertClass(classnameTxt.Text, c.cls_status); //obj.SubmitChanges(); MainClass.ShowMSG(classnameTxt.Text + " added successfully.", "Success...", "Success"); MainClass.disable_reset(panel6); loadData(); } else if (edit == 1) // code for UPDATE { byte stat; if (statusDD.SelectedIndex == 0) { stat = 1; } else { stat = 0; } obj.st_updateClass(classnameTxt.Text, stat, classID); MainClass.ShowMSG(classnameTxt.Text + " updated successfully.", "Success...", "Success"); MainClass.disable_reset(panel6); loadData(); } } }
public override void saveBtn_Click(object sender, EventArgs e) { if (timingNameTxt.Text == "") { timingNameErrorLabel.Visible = true; } else { timingNameErrorLabel.Visible = false; } if (timingShiftDD.SelectedIndex == -1) { timingshifterrorLabel.Visible = true; } else { timingshifterrorLabel.Visible = false; } if (timingDaysDD.SelectedIndex == -1) { timingDayErrorLabel.Visible = true; } else { timingDayErrorLabel.Visible = false; } if (levelDD1.SelectedIndex == -1) { levelerrorlabel.Visible = true; } else { levelerrorlabel.Visible = false; } if (timingNameErrorLabel.Visible || timingshifterrorLabel.Visible || timingDayErrorLabel.Visible || levelerrorlabel.Visible) { MainClass.ShowMSG("Fields with * are mandatory.", "Error...", "Error"); } else { TimeSpan startTime = new TimeSpan(fromTiming.Value.Hour, fromTiming.Value.Minute, fromTiming.Value.Second); TimeSpan endTime = new TimeSpan(toTiming.Value.Hour, toTiming.Value.Minute, toTiming.Value.Second); if (edit == 0) // code for SAVE operation { try { ClassTimings s = new ClassTimings(); obj.st_insertTimings(timingNameTxt.Text, Convert.ToInt32(timingShiftDD.SelectedValue.ToString()), startTime, endTime, timingDaysDD.SelectedItem.ToString(), Convert.ToInt32(levelDD1.SelectedValue.ToString())); obj.SubmitChanges(); MainClass.ShowMSG(timingNameTxt.Text + " added successfully.", "Success...", "Success"); MainClass.disable_reset(panel6); loadData(); } catch (Exception ex) { MainClass.ShowMSG(ex.Message, "Error", "Error"); } } else { obj.st_updateTimings(timingNameTxt.Text, Convert.ToInt32(timingShiftDD.SelectedValue.ToString()), startTime, endTime, timingDaysDD.SelectedItem.ToString(), timingID, Convert.ToInt32(levelDD1.SelectedValue.ToString())); MainClass.ShowMSG(timingNameTxt.Text + " updated successfully.", "Success...", "Success"); MainClass.disable_reset(panel6); loadData(); } } }
public override void saveBtn_Click(object sender, EventArgs e) { if (roleTxt.Text == "") { roleErrorLabel.Visible = true; } else { roleErrorLabel.Visible = false; } if (statusDD.SelectedIndex == -1) { statusErrorLabel.Visible = true; } else { statusErrorLabel.Visible = false; } if (roleErrorLabel.Visible || statusErrorLabel.Visible) { MainClass.ShowMSG("Fields with * are mandatory.", "Error...", "Error"); } else { if (edit == 0) // code for SAVE operation { role r = new role(); r.r_name = roleTxt.Text; if (statusDD.SelectedIndex == 0) { r.r_status = 1; } else { r.r_status = 0; } //obj.roles.InsertOnSubmit(r); obj.st_insertRoles(roleTxt.Text, r.r_status); obj.SubmitChanges(); MainClass.ShowMSG(roleTxt.Text + " added successfully.", "Success...", "Success"); MainClass.disable_reset(panel6); loadData(); } else if (edit == 1) // code for UPDATE { byte stat; if (statusDD.SelectedIndex == 0) { stat = 1; } else { stat = 0; } obj.st_updateRoles(roleTxt.Text, stat, roleID); //var data = obj.roles.Single(x => x.r_id == roleID); //data.r_name = roleTxt.Text; //if (statusDD.SelectedIndex == 0) //{ // data.r_status = 1; //} //else //{ // data.r_status = 0; //} //obj.SubmitChanges(); MainClass.ShowMSG(roleTxt.Text + " updated successfully.", "Success...", "Success"); MainClass.disable_reset(panel6); loadData(); } } }