Exemplo n.º 1
0
 //define event listener method
 protected virtual void OnOverdraft(OverdraftEventArgs e)
 {
     EventHandler<OverdraftEventArgs> handler = Overdraft;
     if(handler != null)
     {
         handler(this, e);
     }
 }
Exemplo n.º 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);
        }
Exemplo n.º 3
0
        //define event listener method
        protected virtual void OnOverdraft(OverdraftEventArgs e)
        {
            EventHandler <OverdraftEventArgs> handler = Overdraft;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Exemplo n.º 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);
 }
Exemplo n.º 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);
        }
Exemplo n.º 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);
 }