public void DebitingMethode(int amountToWithdraw) { Balance = Balance - amountToWithdraw; EventDataClass eventDataClass = new EventDataClass("Withdrawn", amountToWithdraw); OnTransactionSuccessful(eventDataClass); }
public void CreditingMethod(int amountToDeposit) { Balance = Balance + amountToDeposit; EventDataClass eventDataClass = new EventDataClass("Deposited", amountToDeposit); OnTransactionSuccessful(eventDataClass); }
protected virtual void OnTransactionSuccessful(EventDataClass eventDataClass) { if (TransactionSuccessful != null) { TransactionSuccessful(this, eventDataClass); } }
private static void NotificationSender(Object sender, EventDataClass @event) { if (@event.transactiontype == "Withdrawn") { Console.WriteLine("You have successfully {0} {1} Pounds from your account", @event.transactiontype, @event.transactionamout); } else { Console.WriteLine("You have successfully {0} {1} Pounds to your account", @event.transactiontype, @event.transactionamout); } }