Exemple #1
0
        public static void Deposit()
        {
            Console.WriteLine("Please enter your unique user Pin:");
            string pin       = Console.ReadLine();
            int    pinNumber = UI.CheckPin(pin);

            Console.Clear();
            CheckForCustomer();
            AccountManager accountManager = new AccountManager();

            accountManager.ListOfAccountsByCustomerPin(pinNumber);
            Customer customer = accountManager.GetCustomer(pinNumber);

            accountManager.CheckForNoAccounts(customer);
            Console.WriteLine("Please type in the account ID for which you'd like to make a deposit");
            var     answer     = Console.ReadLine();
            int     accountNum = CheckAccountNumber(answer);
            Account acc        = customer.listOfAccounts.FirstOrDefault(a => a.AccountID == accountNum);

            CheckAccountNumber(acc);
            Console.Write("Please enter the amount you would like to deposit into Account: {0} \n$", acc.AccountID);
            var     stringOutput = Console.ReadLine();
            decimal output;

            while (!Decimal.TryParse(stringOutput, out output))
            {
                Console.WriteLine("Incorrect Format: Please enter the amount you would like to deposit: $");
                stringOutput = Console.ReadLine();
            }
            acc.MakeDeposit(output, DateTime.Now);
            Console.WriteLine("Deposit was recieved!");
            OnEnterPress();
            Program.ExecuteUserInput();
        }
 public void Transfer(Account account1, Account account2, decimal withdrawalAmount)
 {
     _amount = withdrawalAmount;
     if (account1.AccountType == "Certificate Deposit" && account1.WithdrawalAmount != account1.Balance)
     {
         account1.MakeWithdrawal(_amount, DateTime.Now);
     }
     else if (account1.AccountType == "Loan")
     {
         Console.WriteLine("Cannot make a transfer from accounts of type loan!");
         UI.OnEnterPress();
         Program.ExecuteUserInput();
     }
     else
     {
         account1.MakeWithdrawal(_amount, DateTime.Now);
         account2.MakeDeposit(withdrawalAmount, DateTime.Now);
         Console.WriteLine("Transfer succeeded!");
     }
 }
Exemple #3
0
 private static void DepositScenario(Account acc)
 {
     GetInputFromConsole("\nHow much would you like to deposit?", "", _ => true, out string amount);
     acc.MakeDeposit(CheckMoney(amount, "reg"));
 }