Beispiel #1
0
        private static void SubtractBalance(double amount,Account account)
        {
            // Check the balance of the account, throw exception if balance cant cover credit
            if (amount > account.AccountBalance)
                throw new InsufficientFunds();

            account.AccountBalance -= amount;
        }
Beispiel #2
0
 private static void Transfer(double amount, Account account)
 {
     AddBalance(amount,account);
     AddTransaction(amount, TransactionType.TransferIn,account);
 }
Beispiel #3
0
 private static void AddTransaction(double amount, TransactionType type,Account account)
 {
     account.Transactions.Add(new Transaction(type, amount, account.AccountBalance));
 }
Beispiel #4
0
 private static void AddBalance(double amount, Account account)
 {
     account.AccountBalance += amount;
 }
Beispiel #5
0
 public static void Transfer(double amount, ref Account accountTo,Account account)
 {
     SubtractBalance(amount,account);
     AddTransaction(amount, TransactionType.TransferOut,account);
     Transfer(amount,account);
 }
Beispiel #6
0
 public static void Debit(Double amount, Account account)
 {
     SubtractBalance(amount,account);
     AddTransaction(amount, TransactionType.Debit,account);
 }
Beispiel #7
0
 public static void Credit(Double amount, Account account)
 {
     // Check the balance of the account, throw exception if balance cant cover credit
     AddBalance(amount,account);
     AddTransaction(amount, TransactionType.Credit,account);
 }