예제 #1
0
        public void Verify(string userName, string password) //TODO: Store if a successful login occured
        {
            //username will not be case-sensitive
            userName = userName.ToLower();
            //get the account from the database with the username (UN-COMMENT WHEN DBCONNECTOR IS IMPLEMENTED
            Account account = DBConnector.getAccount(userName);

            //if the database did not return an account
            if (account == null)
            {
                loginForm.loginError("Invalid username");
                return;
            }

            if (Verify(password, account))       //if this password is valid for the account
            {
                DBConnector.StoreLogin(account); //store successful login
                //decide which homepage to open
                if (account.Role == "Technician")
                {
                    HomepageTech form = new HomepageTech(account);
                    form.Show();
                }
                else
                {
                    HomepageAgent form = new HomepageAgent(account);
                    form.Show();
                }
                loginForm.Close();
            }
            else //invalid password
            {
                loginForm.loginError("Invalid password");
            }
        }
예제 #2
0
        public void ApproveRental(string Damage, double Cost)
        {
            DBConnector.ReturnRental(rental, Damage, Cost);
            HomepageTech f = new HomepageTech(account);

            f.Show();
        }
예제 #3
0
        public void ApproveRental()
        {
            DBConnector.ReturnRental(rental);
            HomepageTech f = new HomepageTech(account);

            f.Show();
        }
예제 #4
0
        public void Cancel()
        {
            HomepageTech f = new HomepageTech(account);

            f.Show();
        }