Пример #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;
        }
Пример #2
0
 private static void Transfer(double amount, Account account)
 {
     AddBalance(amount,account);
     AddTransaction(amount, TransactionType.TransferIn,account);
 }
Пример #3
0
 private static void AddTransaction(double amount, TransactionType type,Account account)
 {
     account.Transactions.Add(new Transaction(type, amount, account.AccountBalance));
 }
Пример #4
0
 private static void AddBalance(double amount, Account account)
 {
     account.AccountBalance += amount;
 }
Пример #5
0
 public static void Transfer(double amount, ref Account accountTo,Account account)
 {
     SubtractBalance(amount,account);
     AddTransaction(amount, TransactionType.TransferOut,account);
     Transfer(amount,account);
 }
Пример #6
0
 public static void Debit(Double amount, Account account)
 {
     SubtractBalance(amount,account);
     AddTransaction(amount, TransactionType.Debit,account);
 }
Пример #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);
 }