private void AccountBalanceOption(Customer customer) { _console.LineBreak(); _console.HorizontalString(); _console.WriteLineBold(String.Format("{0}{1}", "Account".PadRight(20), "Balance")); _console.HorizontalString(); foreach (var account in customer.AccountBalances()) _console.WriteLineBold(account); _console.LineBreak(); }
private void BankerConsoleInterface(Customer customer, OptionsList accountOptions, OptionsList transferOptions, OptionsList transactionOptions) { int selection; do { int accountSelection; double amount; selection = _console.ReadFromOptions( "Account Options", "Select an option", "Invalid option", transactionOptions ); switch (selection) { case 1: DepositOption(accountOptions, customer, out accountSelection, out amount); break; case 2: WithdrawOption(accountOptions, customer, out accountSelection, out amount); break; case 3: TransferOption(transferOptions, customer, out accountSelection, out amount); break; case 4: TransactionSummaryOption(customer); break; case 5: AccountBalanceOption(customer); break; } } while (selection != transactionOptions.ContinueOption); _console.Pause(String.Format("Thank you for using the Algonquin Banking System {0}\n",Helpers.UppercaseFirst(customer.Name))); }
private void WithdrawOption(OptionsList accountOptions, Customer customer, out int accountSelection, out double amount) { do accountSelection = _console.ReadFromOptions( "Withdraw from Which account?", "Select an account", "Invalid account", accountOptions, false ); while (!accountOptions.IsValid(accountSelection)); amount = _console.ReadValidDouble("Amount", "Invalid Amount"); try { switch (accountSelection) { case 1: customer.WidthdrawFrom(AccountType.Checking, amount); break; case 2: customer.WidthdrawFrom(AccountType.Saving, amount); break; } _console.WriteASuccessLine("Transaction complete"); } catch (Exceptions.InsufficientFunds) { _console.WriteAErrorLine("Insufficient Funds"); } }
private void TransferOption(OptionsList transferOptions, Customer customer, out int accountSelection, out double amount) { do accountSelection = _console.ReadFromOptions( "Transfer Options", "Select an Option", "Invalid Option", transferOptions, false ); while (!transferOptions.IsValid(accountSelection)); amount = _console.ReadValidDouble("Enter the amount", "Invalid amount"); try { switch (accountSelection) { case 1: customer.TransferFunds(AccountType.Saving, AccountType.Checking, amount); break; case 2: customer.TransferFunds(AccountType.Checking, AccountType.Saving, amount); break; } _console.WriteASuccessLine("Transfer complete"); } catch (Exceptions.InsufficientFunds) { _console.WriteAErrorLine("Insufficient Funds"); } }
private void TransactionSummaryOption(Customer customer) { _console.LineBreak(); TransactionHeader("Checkings"); ExtractTransactions(customer, AccountType.Checking); TransactionHeader("Savings"); ExtractTransactions(customer, AccountType.Saving); }
private void ExtractTransactions(Customer customer,AccountType type) { foreach (var transaction in customer.AccountTransactions(type)) _console.WriteLine(transaction); _console.LineBreak(); }
private void DepositOption(OptionsList accountOptions, Customer customer, out int accountSelection, out double amount) { do accountSelection = _console.ReadFromOptions( "Deposit into Which account?", "Select an account", "Invalid account", accountOptions, false ); while (!accountOptions.IsValid(accountSelection)); amount = _console.ReadValidDouble("Amount", "Invalid Amount"); switch (accountSelection) { case 1: customer.DepositTo(AccountType.Checking, amount); _console.WriteASuccessLine("Deposit to Checkings successful"); break; case 2: customer.DepositTo(AccountType.Saving, amount); _console.WriteASuccessLine("Deposit to Savings successful"); break; } }