private void CallEvent(AccountEvent e, StateAccHand handler) { if (e != null) { handler?.Invoke(this, e); } }
private static void WithdrawSumHandler(object sender, AccountEvent e) { Console.WriteLine(e.Message); if (e.Sum > 0) { Console.WriteLine("ttttt"); } }
private static void CloseAccountHandler(object sender, AccountEvent e) { Console.WriteLine(e.Message); }
protected virtual void OnCalculated(AccountEvent e) { CallEvent(e, Calculated); }
protected virtual void OnClosed(AccountEvent e) { CallEvent(e, Closed); }
protected virtual void OnAdded(AccountEvent e) { CallEvent(e, Added); }
protected virtual void OnWithdrawed(AccountEvent e) { CallEvent(e, Withdrawed); }
protected virtual void OnOpened(AccountEvent e) { CallEvent(e, Opened); }