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);
            }
        }
예제 #3
0
        static void Main(string[] args)
        {
            InputOutputHandler IO_Handler = new InputOutputHandler();

            IO_Handler.printInterfaceOnTheBasisOfUser();
        }
 // Constructor
 public AccountManager()
 {
     accountsData = new AccountsFilesHandler();
     IO_Handler = new InputOutputHandler();
 }