private void AddStaffbtn_Click_1(object sender, EventArgs e)
        {
            DialogResult AddStaff = MessageBox.Show("Are You Sure You Wish To ADD This Staff Member?", "Add Staff", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (AddStaff == DialogResult.Yes)
            {
                MySqlConnection con = new MySqlConnection();
                con.ConnectionString = LoginForm.constring;
                con.Open();

                MySqlCommand command = con.CreateCommand();
                command.CommandText = "INSERT INTO staff (job_id, staff_forename, staff_surname, staff_username, staff_phone, staff_password) VALUES " + "(" + Rolecb.SelectedIndex + ",'" + Forenametxt.Text + "','" + Surnametxt.Text + "','" + Usernametxt.Text + "'," + Phonetxt.Text + ",'" + "password" + "');";
                command.ExecuteNonQuery();
                MessageBox.Show("The Staff Member Has Been Added Successfully.");
                con.Close();

                ManageStaffAccounts ManageStaffAccounts = new ManageStaffAccounts();
                ManageStaffAccounts.Show();
                this.Close();
            }
        }
        private void Removebtn_Click(object sender, EventArgs e)
        {
            DialogResult RemoveStaff = MessageBox.Show("Are You Sure You Wish To DELETE This Staff Member?", "Delete Staff Member", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (RemoveStaff == DialogResult.Yes)
            {
                MySqlConnection con = new MySqlConnection();
                con.ConnectionString = LoginForm.constring;
                con.Open();

                MySqlCommand command = con.CreateCommand();
                command.CommandText = "DELETE FROM staff WHERE staff_username='******';";

                command.ExecuteNonQuery();
                MessageBox.Show("The Staff Member Has Been Removed Successfully.");
                con.Close();

                ManageStaffAccounts ManageStaffAccounts = new ManageStaffAccounts();
                ManageStaffAccounts.Show();
                this.Close();

            }
        }
Beispiel #3
0
 private void StaffAccountsbtn_Click(object sender, EventArgs e)
 {
     ManageStaffAccounts ManageStaffAccounts = new ManageStaffAccounts();
     ManageStaffAccounts.Show();
     this.Dispose(false);
 }