private void ButtonAddStaff_Click(object sender, EventArgs e)
        {
            if (ValidateForm())
            {
                StaffModel model = new StaffModel(
                    TextBoxFirstNameValue.Text.Trim(),
                    TextBoxLastNameValue.Text.Trim(),
                    TextBoxStaffEmailValue.Text);

                try
                {
                    GlobalConfig.Connection.CreateStaff(model);
                }
                catch
                {
                    MyMessageBox.ShowMessage("Failed to access the database.");
                    return;
                }

                MyMessageBox.ShowMessage("Successfully added new staff member to the database.");
                TextBoxFirstNameValue.Clear();
                TextBoxLastNameValue.Clear();
                TextBoxStaffEmailValue.Clear();
                SendEmail_AddStaff(model);
            }
            else
            {
                MyMessageBox.ShowMessage("Not all components validated successfully. Please check the flagged entries and try again.");
            }
        }
        private void ButtonAddStudent_Click(object sender, EventArgs e)
        {
            const string REPEATSTUDENTIDERROR = "Student ID is already present in the database";

            if (ValidateForm())
            {
                StudentModel model = new StudentModel(
                    TextBoxStudentIDValue.Text,
                    TextBoxFirstNameValue.Text,
                    TextBoxLastNameValue.Text,
                    TextBoxStudentIDValue.Text);

                try
                {
                    GlobalConfig.Connection.CreateStudent(model);
                }
                catch (SqlException)
                {
                    MyMessageBox.ShowMessage("Failed to add student to the database: the specified student ID is already present in the database.");
                    ErrorProvider.SetError(TextBoxStudentIDValue, REPEATSTUDENTIDERROR);
                    return;
                }
                catch
                {
                    MyMessageBox.ShowMessage("Failed to access the database. ");
                    return;
                }

                MyMessageBox.ShowMessage("Successfully added new student to the database.");
                TextBoxStudentIDValue.Clear();
                TextBoxFirstNameValue.Clear();
                TextBoxLastNameValue.Clear();
                SendEmail_AddStudent(model);
            }
            else
            {
                MyMessageBox.ShowMessage("Not all components validated successfully. Please check the flagged entries and try again.");
            }
        }