Esempio n. 1
0
        // Method to control what happens when a pin number has been entered
        public void EnterPin()
        {
            if (account.checkPin(Int32.Parse(userInput)))       // Convert userInput to an int and compare against the real pin
            {
                DisplayMenuOptions();

                MessageBank(account.getAccountNum() + " entered their pin number");
            }
            else                                                // If the pin wasn't valid
            {
                Screen.Items.Clear();                           // Clear the screen
                Screen.Items.Add(lastMessage);                  // Add back the last message
                Screen.Items.Add("Incorrect pin");              // Tell the user that the pin was incorrect
                userInput = "";

                MessageBank(account.getAccountNum() + " entered an incorrect pin");

                if (account.CheckFail())                        // Check if the account has been incorrectly accessed too many times
                {
                    Screen.Items.Clear();
                    Screen.Items.Add("Too many attempts");      // Tell the user that they have attempted too many times
                    lastMessage = "Enter your account number:";
                    Screen.Items.Add(lastMessage);
                    mode = 0;                                   // Tell the system that an account number is expected

                    MessageBank(account.getAccountNum() + "'s account has been locked");
                }
            }
        }