예제 #1
0
 public void OnAuditingTransaction(BankTransaction bankTransaction)
 {
     if (AuditingTransaction != null)
     {
         var auditEventArgs = new AuditEventArgs(bankTransaction);
         AuditingTransaction(this, auditEventArgs);
     }
 }
예제 #2
0
        public decimal Deposit(decimal amount)
        {
            Balance += amount;

            BankTransaction bankTransaction = new BankTransaction(amount);

            Transaction.Enqueue(bankTransaction);
            OnAuditingTransaction(bankTransaction);
            return(Balance);
        }
예제 #3
0
        public bool Withdraw(decimal amount)
        {
            if (Balance - amount < 0)
            {
                return(false);
            }

            Balance -= amount;
            BankTransaction bankTransaction = new BankTransaction(-amount);

            Transaction.Enqueue(bankTransaction);
            OnAuditingTransaction(bankTransaction);
            return(true);
        }
예제 #4
0
 public AuditEventArgs(BankTransaction bankTransaction) => _transData = bankTransaction;
예제 #5
0
        public void RecordTransaction(object sender, AuditEventArgs eventData)
        {
            BankTransaction bankTransaction = eventData.GetTransaction();

            _auditFile.WriteLine(bankTransaction.Amount + "---" + bankTransaction.Date);
        }