Ejemplo n.º 1
0
        public void Submit(string name, string cc, string address, string exp, string cvv, string city, string state, string zip, string phone, string insurance)
        {
            CreditCard card = new CreditCard();

            card.CardNumber = cc;
            card.CVV        = int.Parse(cvv);
            card.ExpMonth   = int.Parse(exp.Substring(0, 2)); //1st and 2nd character
            card.ExpYear    = int.Parse(exp.Substring(3, 2)); //3rd and 4th character

            CustomerTransaction trans = new CustomerTransaction();

            trans.Address         = address;
            trans.Card            = card;
            trans.InsuranceNumber = insurance;
            trans.Name            = name;
            trans.PhoneNumber     = phone;

            Rental r = new Rental();

            r.CustInfo    = trans;
            r.Vehicle     = mVehicle;
            r.RentalStart = DateTime.Today;

            DBConnector.StoreRental(r);

            Form f = new HomepageAgent(account);

            f.Show();
        }
Ejemplo n.º 2
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");
            }
        }
Ejemplo n.º 3
0
        public void Cancel()
        {
            Form f = new HomepageAgent(account);

            f.Show();
        }