private void btnCustomersUpdate_Click(object sender, EventArgs e) { string customerName = txtCustomersFName.Text + txtCustomersLName; if (string.IsNullOrWhiteSpace(txtCustomersFName.Text) || customerName.Any(Char.IsDigit)) { MessageBox.Show("Please enter valid Customer name.", "Error Message"); txtCustomersFName.Clear(); txtCustomersLName.Clear(); txtCustomersFName.Focus(); } else { try { var booking = new Booking(database); var result = booking.UpdateCustomer(((Customer) cboCustomersName.SelectedItem).Id, txtCustomersFName.Text, txtCustomersLName.Text); if (result) { cboCustomersName.DataSource = booking.GetCustomer().ToList(); cboCustomersName.DisplayMember = "Name"; txtCustomersFName.Clear(); txtCustomersLName.Clear(); cboRentCustomerName.DataSource = booking.GetCustomer().ToList(); cboRentCustomerName.DisplayMember = "Name"; FillBookingList(); } else { MessageBox.Show("Update not successfull: Customer already exists.", "Error Message"); } } catch (VideoRentalException ex) { MessageBox.Show(String.Format("Error occured: Customar {0} is not updated succesfully", ex.Item.Name)); } catch (Exception ex) { MessageBox.Show(string.Format("Error Occoured: {0}", ex.Message)); } } }