Esempio n. 1
0
        public void Execute(Account account, string message, bool transfer, Account transferAccount, bool deleting = false)
        {
            decimal amount;

            if (deleting == false)
            {
                amount = UserPrompts.GetDecimalFromUser(message);
            }
            else
            {
                amount = account.Balance;
            }

            var manager = new AccountManager();

            var response = manager.Withdrawl(amount, account);

            if (response.Success)
            {
                AccountScreens.WithdrawlDetails(response.Data);
                if (transfer == true)
                {
                    DepositWorkflow depositTransfer = new DepositWorkflow();
                    depositTransfer.Execute(transferAccount, amount);
                }
            }
            else
            {
                AccountScreens.WorkflowErrorScreen(response.Message);
            }
        }
Esempio n. 2
0
        private void CreateAndSaveAccount()
        {
            Account newAccount = new Account();

            newAccount.FirstName = UserPrompts.GetStringFromUser("Enter the First Name of the new account holder:");
            newAccount.LastName  = UserPrompts.GetStringFromUser("Enter the Last Name of the new account holder:");
            newAccount.Balance   = UserPrompts.GetDecimalFromUser("How much would you like to deposit to start the account?");

            AccountManager manager = new AccountManager();

            newAccount.AccountNumber = manager.GenerateNewAccountNumber();
            manager.SaveNewAccount(newAccount);
            _currentAccount = newAccount;
        }
        public void Execute(Account account)
        {
            decimal amount = UserPrompts.GetDecimalFromUser("Please provide a deposit amount:");

            var manager  = new AccountManager();
            var response = manager.Deposit(amount, account);

            if (response.Success)
            {
                AccountScreens.DepositDetails(response.Data);
            }
            else
            {
                AccountScreens.WorkflowErrorScreen(response.Message);
            }
        }
        private Account GetDataForNewAccount()
        {
            Account newAccount = new Account();

            int newAccountNumberInt = GenerateNewRandomAccountNumber();

            newAccount.AccountNumber = newAccountNumberInt;

            newAccount.Name = UserPrompts.GetStringFromUser("Please enter a name for the new account.");

            newAccount.Balance = UserPrompts.GetDecimalFromUser("Starting deposit: ");

            newAccount.Type =
                (AccountType)
                UserPrompts.GetIntFromUser("Please enter an acct type \n1 for Free, 2 for Basic, 3 for Premium");

            return(newAccount);
        }
Esempio n. 5
0
        public void Execute(Account account, decimal amount)
        {
            Console.ForegroundColor = ConsoleColor.White;
            if (amount <= 0)
            {
                amount = UserPrompts.GetDecimalFromUser("Please enter a deposit amount.");
            }

            var manager  = new AccountManager();
            var response = manager.Deposit(amount, account);

            if (response.Success)
            {
                AccountScreens.DepositDetails(response.Data);
            }
            else
            {
                AccountScreens.WorkflowErrorScreen(response.Message);
            }
        }
Esempio n. 6
0
        public void Execute()
        {
            Console.Clear();

            Account newAccount = new Account();

            newAccount.FirstName = UserPrompts.GetStringFromUser("Enter the First Name of the new account holder:");
            newAccount.LastName  = UserPrompts.GetStringFromUser("Enter the Last Name of the new account holder:");
            newAccount.Balance   = UserPrompts.GetDecimalFromUser("How much would you like to deposit to start the account?");

            AccountManager manager = new AccountManager();

            newAccount.AccountNumber = manager.GenerateNewAccountNumber();
            manager.SaveNewAccount(newAccount);

            Console.Clear();
            Console.WriteLine("Here are your new account details: \n");
            AccountScreens.PrintAccountDetails(newAccount);
            Console.ReadLine();
        }
Esempio n. 7
0
        public void Execute(Account account)
        {
            Console.Clear();

            decimal amount = UserPrompts.GetDecimalFromUser($"Make a deposit to Account #{account.AccountNumber}" +
                                                            $"\n===============================================================" +
                                                            $"\nCurrent Account Balance: {account.Balance:C}" +
                                                            $"\nHow much would you like to deposit? Please enter decimal amount.");

            var manager  = new AccountManager();
            var response = manager.Deposit(amount, account);

            if (response.Success)
            {
                AccountScreens.DepositDetails(response.Data);
            }
            else
            {
                AccountScreens.WorkflowErrorScreen(response.Message);
            }
        }
        public void Execute(Account currentAccount)
        {
            Console.Clear();

            decimal amount = UserPrompts.GetDecimalFromUser($"Make a withdrawal from Account #{currentAccount.AccountNumber}" +
                                                            $"\n===============================================================" +
                                                            $"\nCurrent Account Balance: {currentAccount.Balance:C}" +
                                                            $"\nHow much would you like to withdraw? Please enter decimal amount.");


            AccountManager manager  = new AccountManager();
            var            response = manager.Withdraw(amount, currentAccount);

            if (response.Success)
            {
                AccountScreens.WithdrawalDetails(response.Data);
            }
            else
            {
                AccountScreens.WorkflowErrorScreen(response.Message);
            }
        }