public void Credit(int creditAmount) { BALAmount = BALAmount + creditAmount; BankTransEventArgs e = new BankTransEventArgs(creditAmount, "Credited"); OnProcessTransaction(e); // Credit transaction made }
public void SetInitialDeposit(int amount) { this.BALAmount = amount; BankTransEventArgs e = new BankTransEventArgs(amount, "InitialBalance"); OnProcessTransaction(e); // InitialBalance transaction made }
public void Debit(int debitAmount) { if (debitAmount < BALAmount) { BALAmount = BALAmount - debitAmount; BankTransEventArgs e = new BankTransEventArgs(debitAmount, "Debited"); OnProcessTransaction(e); // Debit transaction made } }
protected virtual void OnProcessTransaction(BankTransEventArgs e) { ProcessTransaction?.Invoke(this, e); }
public void ShowBalance() { BankTransEventArgs e = new BankTransEventArgs(BALAmount, "Total Balance"); OnProcessTransaction(e); // Credit transaction made }
private void AlertCustomer(object sender, BankTransEventArgs e) { Console.WriteLine("Your Account is {0} for Rs.{1} ", e.TranactionType, e.TranactionAmount); }