Ejemplo n.º 1
0
        /// <summary>
        /// Loop the main menu for a valid selection, and execute the user's
        /// action choice.
        /// </summary>
        internal void StartMenu()
        {
            const string userSelection = "User Selection: ";
            string       mainAction;

            do
            {
                mainAction = GetMainMenuAction();
                _srw.DisplayMessageWithDelay(userSelection + mainAction, EchoDelay);

                switch (mainAction)
                {
                case Deposit:
                {
                    decimal d = GetDeposit();
                    if (d > Validation.DepositMin && d < Validation.DepositMax)
                    {
                        _am.Deposit(d);
                    }
                    break;
                }

                case Withdrawal:
                {
                    decimal d = GetWithdrawal();
                    if (d > Validation.WithdrawalMin && d < Validation.WithdrawalMax)
                    {
                        _am.Withdrawal(d);
                    }
                    break;
                }

                case Balance:
                {
                    DisplayBalance();
                    break;
                }

                case History:
                {
                    var history = GetHistory();
                    foreach (var s in history)
                    {
                        _srw.WriteString(s);
                    }

                    _srw.WriteString(Prompt.EnterKeyMainMenu);
                    _srw.PauseForKey();

                    break;
                }

                default:
                {
                    break;
                }
                }
            } while (!mainAction.Equals(Exit));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Return true if user is able to login. Display an error otherwise.
        /// </summary>
        /// <returns></returns>
        private bool LoginUser()
        {
            GetLoginCredentials();
            var success = VerifyCredentials(_name, _password);

            if (!success)
            {
                _srw.DisplayMessageWithDelay(ErrorString.LoginAttempt);
            }

            return(success);
        }
Ejemplo n.º 3
0
 protected void DisplaySelectionError()
 {
     _srw.DisplayMessageWithDelay(SelectionError);
 }