private static void Transferral() { int sendingAccountId = ConsoleQueries.QueryInt("Input ID of sending account: "); int receivingAccountId = ConsoleQueries.QueryInt("Input ID of receiving account: "); decimal amount = ConsoleQueries.QueryDecimal("Input amount: "); Account sendingAccount = MyBank.AccountManager.GetAccountByAccountId(sendingAccountId); Account receivingAccount = MyBank.AccountManager.GetAccountByAccountId(receivingAccountId); if (sendingAccount == null || receivingAccount == null) { Console.WriteLine($"One of the input accounts does not exist."); } else { Transfer newTransfer = MyBank.TransactionManager.Transfer(sendingAccount, receivingAccount, amount); if (newTransfer == null) { Console.WriteLine($"Transfer failed due to lack of funds."); } else { Console.WriteLine($"Successfully transferred {amount:C} from {sendingAccountId} to {receivingAccountId}"); } } }
private static void ChangeCreditRoof() { int accountId = ConsoleQueries.QueryInt("Input account ID: "); decimal creditRoof = ConsoleQueries.QueryDecimal("Input new creditroof: "); MyBank.AccountManager.GetAccountByAccountId(accountId).CreditRoof = creditRoof; }
private static void Deposit() { int accountId = ConsoleQueries.QueryInt("Input ID of receiving account: "); decimal amount = ConsoleQueries.QueryDecimal("Input amount: "); Account receivingAccount = MyBank.AccountManager.GetAccountByAccountId(accountId); if (receivingAccount == null) { Console.WriteLine($"Failure to deposit {amount:C} to account {accountId}"); } else { Deposit newDeposit = MyBank.TransactionManager.Deposit(receivingAccount, amount); Console.WriteLine($"Successfully deposited {amount:C} to {accountId}"); } }
private static void Withdrawal() { int accountId = ConsoleQueries.QueryInt("Input ID of withdrawing account: "); decimal amount = ConsoleQueries.QueryDecimal("Input amount: "); Account withdrawingAccount = MyBank.AccountManager.GetAccountByAccountId(accountId); if (withdrawingAccount == null) { Console.WriteLine($"Failure to Withdraw {amount:C} from account {accountId}"); } else { Withdrawal newWithdrawal = MyBank.TransactionManager.Withdraw(withdrawingAccount, amount); if (newWithdrawal == null) { Console.WriteLine($"Withdrawal failed due to lack of funds."); } else { Console.WriteLine($"Successfully Withdrew {amount:C} from {accountId}"); } } }