private void Login() { loginStorage = new LoginMySQL(); employeeStorage = new EmployeeMySQL(); functionStorage = new FunctionMySQL(); //Asks the loginStorage to check if the entered details match those we have stored. userId = loginStorage.Check(textBoxLoginUsername.Text, textBoxLoginPassword.Text); if (userId > 0) { this.loggedInUser = employeeStorage.Get(userId); this.loggedInUser.Permissions = functionStorage.GetPermissions(loggedInUser.Function); this.DialogResult = DialogResult.OK; } else if (userId < 0) { MessageBox.Show("Invalid Credentials"); } else { MessageBox.Show("Your account has been disabled"); } }
/// <summary> /// Loads the permissions of the selected function from the database. /// </summary> private void LoadPermissions(int function) { permissionsGranted = functionStorage.GetPermissions(function); }