Exemplo n.º 1
0
 private void depositButton_Click(object sender, EventArgs e)
 {
     AmountEntryForm form = new AmountEntryForm(AmountDialogType.Deposit);
     DialogResult result = form.ShowDialog(this);
     if (result == DialogResult.OK)
     {
         exceptionTextBox.Text = String.Empty;
         try
         {
             bankAccount.Deposit(form.Amount);
         }
         catch (Exception ex)
         {
             exceptionTextBox.Text = ex.Message;
         }
     }
 }
Exemplo n.º 2
0
        private void withdrawButton_Click(object sender, EventArgs e)
        {
            AmountEntryForm form   = new AmountEntryForm(AmountDialogType.Withdraw);
            DialogResult    result = form.ShowDialog(this);

            if (result == DialogResult.OK)
            {
                exceptionTextBox.Text = String.Empty;
                try
                {
                    bankAccount.Withdraw(form.Amount);
                }
                catch (Exception ex)
                {
                    exceptionTextBox.Text = ex.Message;
                }
            }
        }