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

            BankTransaction bankTransaction = new BankTransaction(amount);

            Transaction.Enqueue(bankTransaction);
            OnAuditingTransaction(bankTransaction);
            return(Balance);
        }
Exemplo n.º 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);
        }
Exemplo n.º 4
0
 public AuditEventArgs(BankTransaction bankTransaction) => _transData = bankTransaction;
Exemplo n.º 5
0
        public void RecordTransaction(object sender, AuditEventArgs eventData)
        {
            BankTransaction bankTransaction = eventData.GetTransaction();

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