Exemple #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));
        }
Exemple #2
0
        /// <summary>
        /// Get the registration information from the user.
        /// </summary>
        private void GetRegistration()
        {
            _srw.ClearConsole();
            _srw.WriteString(Prompt.Register);

            _name            = GetNameFromUser();
            _password        = GetPasswordFromUser();
            _confirmPassword = GetPasswordConfirmationFromUser();
        }
        /// <summary>
        /// Display a welcome message, get the user's login data, and
        /// begin the main menu process.
        /// </summary>
        public void StartProgram()
        {
            var srw = new StrReadWrite();

            srw.WriteString(WelcomeMessage);

            if (_lc.UserIsLoggedIn())
            {
                var mmc = new MainMenuController(_lc.GetCurrentUser());
                mmc.StartMenu();
            }
            else
            {
                srw.WriteString(ExitMessage);
            }
        }
Exemple #4
0
 protected void Display(string str)
 {
     _srw.ClearConsole();
     _srw.WriteString(str);
 }