public void OnAuditingTransaction(BankTransaction bankTransaction) { if (AuditingTransaction != null) { var auditEventArgs = new AuditEventArgs(bankTransaction); AuditingTransaction(this, auditEventArgs); } }
public decimal Deposit(decimal amount) { Balance += amount; BankTransaction bankTransaction = new BankTransaction(amount); Transaction.Enqueue(bankTransaction); OnAuditingTransaction(bankTransaction); return(Balance); }
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); }
public AuditEventArgs(BankTransaction bankTransaction) => _transData = bankTransaction;
public void RecordTransaction(object sender, AuditEventArgs eventData) { BankTransaction bankTransaction = eventData.GetTransaction(); _auditFile.WriteLine(bankTransaction.Amount + "---" + bankTransaction.Date); }