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");
            }
        }
示例#2
0
 public LoginController(ILoginStorage storage)
 {
     this.storage = storage;
 }
示例#3
0
 public LoginController()
 {
     storage = new LoginStorage();
 }