public override void SaveButton_Click(object sender, EventArgs e) { if (GenderComboBox.SelectedIndex == -1 || TeacherTextBox.Text == "" || ActiveComboBox.SelectedIndex == -1) { MainClass.ShowMSG("الرجاء ملأ جميع الحفول", "...توقف", "Error"); } else { string Gender = GenderComboBox.Text; string Teacher = TeacherTextBox.Text; string Phone = PhoneTextBox.Text; string Active = ActiveComboBox.Text; if (Phone == "") { Phone = "-"; } if (edit == 0)//Code for Add operation { Insertion.Insert_Teacher(Teacher, Gender, Phone, Active); MainClass.ShowMSG($" لقد تم حفظ ({Teacher}) بنجاح", "نجحة العملية", "Success"); MainClass.disable_reset(panel5); Fill_TeachersGridView(); } else if (edit == 1)//Code for Edit operation { Updation.Update_Teacher(TeacherID.ToString(), Teacher, Gender, Phone, Active); MainClass.ShowMSG($" لقد تم تعديل ({Teacher}) بنجاح", "نجحة العملية", "Success"); MainClass.disable_reset(panel5); Fill_TeachersGridView(); } } }
public override void SaveButton_Click(object sender, EventArgs e) { if (SubjectTextBox.Text == "") { MainClass.ShowMSG("الرجاء ملأ جميع الحفول", "...توقف", "Error"); } else { string Subject = SubjectTextBox.Text; if (edit == 0)//Code for Add operation { try { Insertion.Insert_Subject(Subject); MainClass.ShowMSG($" لقد تم حفظ المادة ({Subject}) بنجاح ", "نجحة العملية", "Success"); MainClass.disable_reset(panel5); Fill_SubjectsGridView(); } catch (Exception) { MainClass.ShowMSG($"لقد تم إضافت المادة ({Subject}) مسبقا", "...توقف", "Error"); } } else if (edit == 1)//Code for Edit operation { Updation.Update_Subject(Subject, SubjectID.ToString()); MainClass.ShowMSG($" لقد تم تعديل المادة ({Subject}) بنجاح", "نجحة العملية", "Success"); MainClass.disable_reset(panel5); Fill_SubjectsGridView(); } } }
public override void SaveButton_Click(object sender, EventArgs e) { if (UsernameTextBox.Text == "" || PasswordTextBox.Text == "" || RePasswordTextBox.Text == "" || PositionComboBox.SelectedIndex == -1 || ActiveComboBox.SelectedIndex == -1) { MainClass.ShowMSG("الرجاء ملأ جميع الحفول", "...توقف", "Error"); } else { if (RePasswordTextBox.Text != PasswordTextBox.Text) { MainClass.ShowMSG("الرجاء التأكد من تطابق كلمة المرور", "...توقف", "Error"); } else { string User = UsernameTextBox.Text; string Password = RePasswordTextBox.Text; string Position = PositionComboBox.Text; string Active = ActiveComboBox.Text; if (edit == 0)//Code for Add operation { if (MainClass.User_Exists(User) == true) { MainClass.ShowMSG($"لقد تم إضافة مستخدم أخر بنفس الأسم مسبقا ", "...توقف", "Error"); } else { Insertion.Insert_User(User, Password, Position, Active); MainClass.ShowMSG($" لقد تم حفظ المستخدم ({User}) بنجاح", "نجحة العملية", "Success"); MainClass.disable_reset(panel5); Fill_UsersGridView(); } } else if (edit == 1)//Code for Edit operation { Updation.Update_User(UserID.ToString(), User, Position, Active); MainClass.ShowMSG($" لقد تم تعديل المستخدم ({User}) بنجاح", "نجحة العملية", "Success"); MainClass.disable_reset(panel5); Fill_UsersGridView(); } } } }
public override void SaveButton_Click(object sender, EventArgs e) { if (ClassComboBox.SelectedIndex == 0 || ClassComboBox.SelectedIndex == -1 || PeriodComboBox.SelectedIndex == -1 || TeacherComboBox.SelectedIndex == 0 || TeacherComboBox.SelectedIndex == -1 || SubjectComboBox.SelectedIndex == 0 || SubjectComboBox.SelectedIndex == -1) { MainClass.ShowMSG("الرجاء ملأ جميع الحقول", "...توقف", "Error"); } else { if (edit == 0)//Code for Add operation { try { //string teacher = (TeacherComboBox.SelectedValue.ToString() == "3") ? "" : TeacherComboBox.SelectedValue.ToString(); //Period represents the TimingID //Insertion.Insert_AssignmentNew(ClassComboBox.SelectedValue.ToString(), SubjectComboBox.SelectedValue.ToString(), TeacherComboBox.SelectedValue.ToString(), SectionID, PeriodComboBox.SelectedValue.ToString()); Insertion.Insert_AssignmentNew(ClassComboBox.SelectedValue.ToString(), SubjectComboBox.SelectedValue.ToString(), TeacherComboBox.SelectedValue.ToString(), SectionID, PeriodComboBox.SelectedValue.ToString()); MainClass.ShowMSG($" لقد تم حفظ التعين بنجاح ", "نجحة العملية", "Success"); MainClass.disable_reset(panel5); Fill_AssignmentsGridView(); DataGridViewAssignments.ClearSelection(); } catch (Exception ex) { MainClass.sqlite_conn.Close(); if (ex.ToString().Contains("Assignments3.Teacher_ID, Assignments3.Timing_ID")) { DataTable PreviousAssignmentTable = Selection.Get_Teacher_and_Timing_for_UniqueIndexError(teacherid: "0", timingid: PeriodComboBox.SelectedValue.ToString()); string periodtxt = PreviousAssignmentTable.Rows[0][1].ToString(); string classtxt = PreviousAssignmentTable.Rows[0][2].ToString(); string teachertxt = PreviousAssignmentTable.Rows[0][3].ToString(); string sectiontxt = PreviousAssignmentTable.Rows[0][4].ToString(); string CurrentAssignment = "معلم/معلمة " + TeacherComboBox.Text + " - " + PeriodComboBox.Text.Replace('(', '-').Replace(')', ' ') + " - " + ClassComboBox.Text + " - " + Section; string PreviousAssignment = "معلم/معلمة " + teachertxt + " - " + periodtxt.Replace('(', '-').Replace(')', ' ') + " - " + classtxt + " - " + sectiontxt; MainClass.ShowMSG($"لقد تم تعين المعلم/المعلمة {TeacherComboBox.Text} لفصل أخر في نفس اليوم و الحصه" + "\n\n" + "التعين السابق" + " : " + PreviousAssignment + "\n" + "التعين الحالي" + " : " + CurrentAssignment, "...توقف", "Error"); } else if (ex.ToString().Contains("Assignments3.Class_ID, Assignments3.Timing_ID")) { MainClass.ShowMSG($"لقد تم تعين حصه في ( {PeriodComboBox.Text} - {ClassComboBox.Text} ) مسبقا", "...توقف", "Error"); } else { MainClass.ShowMSG($"لقد حصل خطأ {ex.ToString()}", "...توقف", "Error"); } } } else if (edit == 1)//Code for Edit operation { try { Updation.Update_AssignmentNew(AssignmentID.ToString(), ClassComboBox.SelectedValue.ToString(), SubjectComboBox.SelectedValue.ToString(), TeacherComboBox.SelectedValue.ToString(), PeriodComboBox.SelectedValue.ToString()); MainClass.ShowMSG($" لقد تم تعديل التعين بنجاح", "نجحة العملية", "Success"); MainClass.disable_reset(panel5); Fill_AssignmentsGridView(); DataGridViewAssignments.ClearSelection(); } catch (Exception ex) { MainClass.sqlite_conn.Close(); if (ex.ToString().Contains("Assignments3.Teacher_ID, Assignments3.Timing_ID")) { DataTable PreviousAssignmentTable = Selection.Get_Teacher_and_Timing_for_UniqueIndexError(teacherid: "0", timingid: PeriodComboBox.SelectedValue.ToString()); string periodtxt = PreviousAssignmentTable.Rows[0][1].ToString(); string classtxt = PreviousAssignmentTable.Rows[0][2].ToString(); string teachertxt = PreviousAssignmentTable.Rows[0][3].ToString(); string sectiontxt = PreviousAssignmentTable.Rows[0][4].ToString(); string CurrentAssignment = "معلم/معلمة " + TeacherComboBox.Text + " - " + PeriodComboBox.Text.Replace('(', '-').Replace(')', ' ') + " - " + ClassComboBox.Text + " - " + Section; string PreviousAssignment = "معلم/معلمة " + teachertxt + " - " + periodtxt.Replace('(', '-').Replace(')', ' ') + " - " + classtxt + " - " + sectiontxt; MainClass.ShowMSG($"لقد تم تعين المعلم/المعلمة {TeacherComboBox.Text} لفصل أخر في نفس اليوم و الحصه" + "\n\n" + "التعين السابق" + " : " + PreviousAssignment + "\n" + "التعين الحالي" + " : " + CurrentAssignment, "...توقف", "Error"); } else if (ex.ToString().Contains("Assignments3.Class_ID, Assignments3.Timing_ID")) { MainClass.ShowMSG($"لقد تم تعين حصه في ( {PeriodComboBox.Text} - {ClassComboBox.Text} ) مسبقا", "...توقف", "Error"); } else { MainClass.ShowMSG($"لقد حصل خطأ {ex.ToString()}", "...توقف", "Error"); } } } } }