Example #1
0
 // deletes a customer provided that he/she has no outstanding bookings
 private void btnDeleteCust_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         int bookings = DataLayer.DataLayerFacade.OutstandingBookings(Convert.ToInt32(lblCustNumb.Content));
         if (bookings == 0)
         {
             DataLayerFacade.DeleteCustomer(Convert.ToInt32(lblCustNumb.Content));
             CustomerL CustomerList = new CustomerL();
             CustomerList.Show();
             this.Close();
             MessageBox.Show("Customer has been deleted");
         }
         else
         {
             MessageBox.Show("The customer has outstanding bookings. Please cancel those bookings if you want to remove the customer");
         }
     }
     catch (Exception)
     {
         MessageBox.Show("Unable to delete the customer at the moment. Please try again later.");
     }
 }