/// <summary> /// Logs user into the requested interface /// </summary> private void loginSuccess() { // Get staffID int staffID = Convert.ToInt32(staffTableAdapter.StaffIDQuery(txtUser.Text)); // Launch requested interface if (management == true) { // Verify user is a manager if (staffTableAdapter.PositionQuery(staffID) == "Manager") { // Launch management interface Management m = new Management(); m.Show(); } // Deny user access else MessageBox.Show("Sorry you are not authorised to access the management interface.","Access Denined"); } else { // Get time DateTime time = DateTime.Now; // Record login shiftsTableAdapter.Insert(time, null, staffID); // Set attending staff Monitor.curStaff = txtUser.Text; // Create new monitor Monitor m = new Monitor(); // Set monitor attending staff shift details m.startTime = time; m.staffID = staffID; m.shiftID = Convert.ToInt32(shiftsTableAdapter.LatestShiftID()); // Launch monitor m.Show(); } // Close login box this.Close(); }
private void btnManage_Click(object sender, EventArgs e) { Management m = new Management(); m.Show(); }