// When the reject button is clicked.
 private void RejectBtn_Click(object sender, EventArgs e)
 {
     // Display confirmation display box.
     if (MessageBox.Show("Are you sure you want to reject this stationery request?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         // User clicked yes.
         // Convert cells into values.
         int selectedRequestID = Convert.ToInt32(requestDataGrid.CurrentRow.Cells[0].Value);
         // Update database row for the request.
         stationeryrequestTableAdapter.UpdateStatus("Denied", selectedRequestID);
         // Load form.
         ApproveRequestForm approve = new ApproveRequestForm();
         approve.Show();
         this.Close();
         // Display loading circle.
         LoadingCircle1.Visible = true;
     }
     else
     {
         // User clicked no.
         // Nothing happens, return to "My Requests" page.
         // Display loading circle.
         LoadingCircle1.Visible = true;
     }
 }
Beispiel #2
0
        // When approve/deny button is clicked.
        private void ApproveReqBtn_Click(object sender, EventArgs e)
        {
            // Using MVC.
            User selectedUser = Program.GetCurrentUser();

            // System admin does not have access to approve/deny requests.
            if (selectedUser.UserId == 4)
            {
                MessageBox.Show("You do not have access to this button.");
            }
            else
            {
                // Load form.
                ApproveRequestForm approve = new ApproveRequestForm();
                approve.Show();
                this.Close();
            }
        }