public void makeTransactionFromSavingAccount(string accountNo = "") { if (accountNo == "") { InputOutputHandler IO_Handler = new InputOutputHandler(); accountNo = IO_Handler.getAccountNoFromUser(); } int indexOfSavingAccountInADT = this.getSavingAccountIndex(accountNo); if (indexOfSavingAccountInADT != -1) { SavingAccount savingAccountToMakeTransactionOn = accountsData.AllSavingAccountsList[indexOfSavingAccountInADT] as SavingAccount; double withdrawAmount = IO_Handler.getAmountToWithdrawFromUser(savingAccountToMakeTransactionOn.Balance, savingAccountToMakeTransactionOn.Balance); if (!isTransactionsThresholdMetForAnAccount(savingAccountToMakeTransactionOn.AccountNo, withdrawAmount)) { (accountsData.AllSavingAccountsList[indexOfSavingAccountInADT] as SavingAccount).withdrawal(withdrawAmount); Transaction transaction = new Transaction(savingAccountToMakeTransactionOn.AccountNo, withdrawAmount, 'S', DateTime.Now); accountsData.AllTransations.Add(transaction); accountsData.generateTransactionReport(transaction, (accountsData.AllSavingAccountsList[indexOfSavingAccountInADT] as SavingAccount).Balance); } else { IO_Handler.cantWithdrawToday(withdrawAmount); } } else { IO_Handler.printNotFoundSavingAccount(accountNo); } }
public void makeDepositToSavingAccount(string accountNo ="") { if (accountNo == "") { InputOutputHandler IO_Handler = new InputOutputHandler(); accountNo = IO_Handler.getAccountNoFromUser(); } int indexOfSavingAccountInADT = this.getSavingAccountIndex(accountNo); if (indexOfSavingAccountInADT != -1) { double depositAmount = IO_Handler.getAmountToDepositFromUser(); (accountsData.AllSavingAccountsList[indexOfSavingAccountInADT] as SavingAccount).deposit(depositAmount); } else { IO_Handler.printNotFoundSavingAccount(accountNo); } }
// Reading a sigle account public void readACurrentAccountsDetails() { string accountNo = IO_Handler.getAccountNoFromUser(); int indexOfCurrentAccountInADT = this.getCurrentAccountIndex(accountNo); if (indexOfCurrentAccountInADT != -1) { IO_Handler.printOneCurrentAccount(accountsData.AllCurrentAccountsArrayList[indexOfCurrentAccountInADT] as CurrentAccount); } else { IO_Handler.printNotFoundCurrentAccount(accountNo); } }