/// <summary> /// Method that will help teller to look up the information about the customer by checking their customer number. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonLookUp_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]; labelInfo.Text = "Customer's details:\n" + "\nCustomer number: 00" + i + "\nAccount number: 0" + temp.accountNum + "\nName: " + temp.name.ToString(); labelInfo.Text += "\nAddress: " + temp.address.ToString() + "\nBalance: $" + temp.balance.ToString(); } catch (Exception ex) { MessageBox.Show("Please Enter a Valid Customer number\n" + ex.ToString()); } amount.Text = ""; textBoxLookup.Text = ""; } }
/// <summary> /// This eventhandler will check the balance for entered customer number's account. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void checkBtn_Click(object sender, EventArgs e) { lock (this) { List <Customer> tList; Customer temp; try { int i = Convert.ToInt32(testBox.Text); //i = i + 1; tList = dbase.getList(); temp = tList[i]; labelDetails.Text = ("Customer's details:\n" + "\nCustomer number: 00" + i + "\nAccount number: 0" + temp.accountNum + "\nName: " + temp.name.ToString() + "\nAddress: " + temp.address + "\nBalance: $" + temp.balance.ToString()); //testBox.Text = ""; amount.Text = ""; } catch (Exception ex) { MessageBox.Show("ERROR\n" + ex.ToString()); } } }