public MenuInterface(StaffAccounts staff, LoginForm login) { InitializeComponent(); Icon = Resources.StartupIcon; Staff = staff; Login = login; }
//temp function for fast login when testing components during development public void TempStaffSetupFastLogin() { try { var staff = new StaffAccounts("Jesse", "Harasym", "admin", "admin123", "*****@*****.**", "Administrator", 1, 10); var cs = new MenuInterface(staff, this); cs.ShowDialog(); } catch (Exception ex) { Console.WriteLine("Something went wrong with fast login " + ex); } }
public StaffAccounts GetStaffInformation(int staffId, string username, string password) { string firstName = ""; string lastName = ""; string email = ""; string position = ""; string accessLevel = ""; using (SqlConnection connection = new SqlConnection(connectionString)) { using (SqlCommand cmd = new SqlCommand($"SELECT * FROM StaffInformation WHERE StaffId = @staffId", connection)) { connection.Open(); cmd.Parameters.AddWithValue("@staffId", staffId); using (SqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { try { firstName = reader["FirstName"].ToString(); lastName = reader["LastName"].ToString(); email = reader["Email"].ToString(); position = reader["Position"].ToString(); accessLevel = reader["AccessLevel"].ToString(); } catch (Exception ex) { Console.WriteLine("There was an issue retrieving the users staff information." + ex); } } } connection.Close(); } } var staff = new StaffAccounts(firstName, lastName, username, password, email, position, staffId, Convert.ToInt32(accessLevel)); return(staff); }
public IEnumerable <string> AssignedStaffAccounts() { return(StaffAccounts?.Split(new string[] { " ", "\r", "\n", "\t", "," }, StringSplitOptions.RemoveEmptyEntries) ?? new string[0]); }