Esempio n. 1
0
 /// <summary>
 /// Method that will let teller to withdraw money customer's account.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void withDrawBtn_Click(object sender, EventArgs e)
 {
     lock (this)
     {
         List <Customer> tempList; Customer temp;
         try
         {
             int i = Convert.ToInt32(textBoxLookup.Text);
             tempList = dbase.getList();
             temp     = tempList[i];
             if (temp.balance > Convert.ToDouble(money.Text) || Convert.ToDouble(money.Text) <= 0)
             {
                 temp.balance   = Convert.ToDouble(temp.balance) - Convert.ToDouble(money.Text);
                 labelInfo.Text = "Updated Balance: $" + temp.balance.ToString(); //Update the list.?????
                 dbase.update(temp, i);
             }
             else
             {
                 MessageBox.Show("Please enter a valid amount!!!");
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show("Please Enter a Valid Customer number\n" + ex.ToString());
         }
         money.Text = ""; textBoxLookup.Text = "";
     }
 }
Esempio n. 2
0
 /// <summary>
 /// This method will withdraw the amount of money customer wants to withdraw to their account.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void withDrawBtn_Click(object sender, EventArgs e)
 {
     lock (this)
     {
         List <Customer> tempList; Customer temp;
         try
         {
             int i = Convert.ToInt32(testBox.Text);
             tempList = dbase.getList();
             temp     = tempList[i];
             if (temp.balance > Convert.ToDouble(amount.Text) || Convert.ToDouble(amount.Text) <= 0)
             {
                 temp.balance = Convert.ToDouble(temp.balance) - Convert.ToDouble(amount.Text);
                 dbase.update(temp, i);
                 MessageBox.Show("Receipt:\nYou succecsfully wihtdrew $" + amount.Text + "\nUpdated Balance: $" + temp.balance);
                 labelDetails.Text = "Updated balance: $" + temp.balance; amount.Text = "";
             }
             else
             {
                 MessageBox.Show("Please enter a valid amount!!!");
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show("Please Enter a Valid Customer number\n" + ex.ToString());
         }
     }
 }