//define event listener method
 protected virtual void OnOverdraft(OverdraftEventArgs e)
 {
     EventHandler<OverdraftEventArgs> handler = Overdraft;
     if(handler != null)
     {
         handler(this, e);
     }
 }
Beispiel #2
0
        // The event handler with event args.
        private void SavingsOverdrawnHandler(object sender, OverdraftEventArgs args)
        {
            string message =
                "The savings account is overdrawn." + Environment.NewLine +
                "Current Balance: " + args.Balance.ToString("C") + Environment.NewLine +
                "Debit Amount: " + args.Debit.ToString("C");

            MessageBox.Show(message);
        }
Beispiel #3
0
        //define event listener method
        protected virtual void OnOverdraft(OverdraftEventArgs e)
        {
            EventHandler <OverdraftEventArgs> handler = Overdraft;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Beispiel #4
0
 // The event handler with event args.
 private void AccountOverdrawnHandler(object sender, OverdraftEventArgs args)
 {
     // Get the overdraft account.
     OverdraftAccount account = sender as OverdraftAccount;
     string message =
         "The account is overdrawn." + Environment.NewLine +
         "Current Balance: " + account.Balance.ToString("C") + Environment.NewLine +
         "Savings Balance: " + account.SavingsAccount.Balance.ToString("C") + Environment.NewLine +
         "Debit Amount: " + args.Debit.ToString("C");
     MessageBox.Show(message);
 }
Beispiel #5
0
        // The event handler with event args.
        private void AccountOverdrawnHandler(object sender, OverdraftEventArgs args)
        {
            // Get the overdraft account.
            OverdraftAccount account = sender as OverdraftAccount;
            string           message =
                "The account is overdrawn." + Environment.NewLine +
                "Current Balance: " + account.Balance.ToString("C") + Environment.NewLine +
                "Savings Balance: " + account.SavingsAccount.Balance.ToString("C") + Environment.NewLine +
                "Debit Amount: " + args.Debit.ToString("C");

            MessageBox.Show(message);
        }
Beispiel #6
0
 // The event handler with event args.
 private void SavingsOverdrawnHandler(object sender, OverdraftEventArgs args)
 {
     string message =
         "The savings account is overdrawn." + Environment.NewLine +
         "Current Balance: " + args.Balance.ToString("C") + Environment.NewLine +
         "Debit Amount: " + args.Debit.ToString("C");
     MessageBox.Show(message);
 }