private void CustomerBox_SelectedIndexChanged(object sender, EventArgs e) { var Data = new GetData(); var Search = new SearchCustomer(); BookingBox.DisplayMember = "BookingID"; BookingBox.ValueMember = "BookingID"; if (CustomerBox.SelectedValue == null) { CustomerBox.ClearSelected(); } else { Customer C = Search.FindACustomer(int.Parse(CustomerBox.SelectedValue.ToString())); BookingBox.DataSource = Data.GetBookings(C); } }
private void DeleteCustomerButton_Click(object sender, EventArgs e) { if (CustomerBox.SelectedValue == null) { return; } var Delete = new AdjustData(); var Get = new GetData(); var Search = new SearchCustomer(); Customer C = Search.FindACustomer(int.Parse(CustomerBox.SelectedValue.ToString())); var List = Get.GetBookings(C); if (List.Count > 0) { MessageBox.Show("Cannot Delete: Active Booking"); } else { CustomerBox.ClearSelected(); CustomerBox.DataSource = null; Delete.DeleteCustomer(C); } }