Exemplo n.º 1
0
        //updates the accounts in on the form
        private void updateAccountsDisplay()
        {
            String updated = "Account Number\tBalance" + Environment.NewLine;

            BankAccount[] accounts = bankSystem.getAccounts();

            for (int i = 0; i < accounts.Length; i++)
            {
                updated += accounts[i].ToString();
            }
            accountsDisplay.Text = updated;
        }
Exemplo n.º 2
0
        // decides what to do when confirm is selected
        void handleConfirm(string userInput)
        {
            //checks if user is logged in
            if (!loggedIn)
            {
                // checks for account
                int tempAccountNumber = bankSystem.findAccount(Convert.ToInt32(userInput));

                if (tempAccountNumber != -999)
                {
                    //displaays next menu

                    loggedIn     = true;
                    accountIndex = tempAccountNumber;
                    Debug.WriteLine("AccountNumber = " + userInput);
                    this.userInput = "";
                    displayPrompt();
                }
                else
                {
                    errorLabel.Text = "Invalid account number please try again";
                    Debug.WriteLine("Invalid account number");
                    //add error state to methods
                }
                //check existing account if yes store number, display next step
            }
            // checks if pin has been entered and verified
            else if (!enteredPin)
            {
                // checks the pin
                if (bankSystem.getAccounts()[accountIndex].checkPin(Convert.ToInt32(userInput)))
                {
                    this.userInput = "";
                    enteredPin     = true;
                    Debug.WriteLine("succesfully logged in.");
                    displayPrompt();
                }
                else
                {
                    errorLabel.Text = "Invalid pin please try again";
                    Debug.WriteLine("Invalid pin");
                }
            }
            else
            {
            }
        }
Exemplo n.º 3
0
 public void withdrawCash()
 {
     bankSystem.getAccounts()[accountIndex].decrementBalence(num);
 }