Beispiel #1
0
 public override void Withdraw(IAccount account, decimal amount)
 {
     foreach (var acc in checkingAccounts)
     {
         if (acc.Accountno == account.Accountno && (acc.Balance - amount) >= 0 && acc.AccountStatus)
         {
             if (!IsTransfer)
             {
                 Transaction.CreateTransaction(account, account, amount, "Withdraw");
             }
             acc.Balance -= amount;
         }
         else if (acc.Accountno == account.Accountno && acc.AccountStatus)
         {
             Console.WriteLine("Insufficient fund, Please try again!");
         }
     }
 }
Beispiel #2
0
        }//end method CloseAccount()

        public override void Withdraw(IAccount account, decimal amount)
        {
            foreach (var acc in businessAccounts)
            {
                if (acc.Accountno == account.Accountno && acc.AccountStatus)
                {
                    acc.Balance -= amount;
                    if (!IsTransfer)
                    {
                        Transaction.CreateTransaction(account, account, amount, "Withdraw");
                    }
                }

                else
                {
                    Console.WriteLine("Record not found");
                }
            }
        }