private void btnSaveCarHire_Click(object sender, RoutedEventArgs e) { try { if (datePickerStart.SelectedDate == null || datePickerEnd.SelectedDate == null || txtBoxDriverName.Text == String.Empty) { throw new ArgumentException("You must select Both dates and driver's name!", "Car Hire"); } if (datePickerStart.SelectedDate.Value >= datePickerEnd.SelectedDate.Value) { throw new ArgumentException("Nice try! But I caught you! You can't do that, but A+ for effort!"); } win.getCar().StartDate = datePickerStart.SelectedDate.Value; win.getCar().EndDate = datePickerEnd.SelectedDate.Value; win.getCar().DriverName = txtBoxDriverName.Text; MessageBox.Show("Car Hire succesfully added!", "Car Hire"); win.Show(); this.Close(); } catch (Exception ee) { MessageBox.Show(ee.Message, "Car Hire"); } }
private void btnGoBack_Click(object sender, RoutedEventArgs e) { if (win != null) { win.Show(); this.Close(); } else if (existingCustomer != null) { existingCustomer.Show(); this.Close(); } }
private void btnAddCustomer_Click(object sender, RoutedEventArgs e) { try { customer = new Customer(); customer.Address = txtCustomerAddress.Text; customer.Name = txtCustomerName.Text; BookingDetails win = new BookingDetails(booking, customer); win.Show(); this.Close(); } catch (Exception ee) { MessageBox.Show(ee.Message, "Customer"); } }
private void btnModifyBookingExtrasAndGuests_Click(object sender, RoutedEventArgs e) { BookingDetails win = new BookingDetails(b, facade.getGuestsForBooking(b), c, this, facade.getCarHireForBooking(b)); win.Show(); this.Hide(); /* * List<Guest> guests = data.getGuests(b.BookingReferenceNumber); * * bool carFlag = data.checkCarHireForBooking(b.BookingReferenceNumber); * * CarHire car = data.getCarHire(b.BookingReferenceNumber); * * * NewCustomer win = new NewCustomer(b, guests, c, this, carFlag ,car); * * win.Show(); * this.Hide(); */ }
private void btnNext_Click(object sender, RoutedEventArgs e) { this.booking = new Booking(); try { SelectedDatesCollection Dates = calendarBookingDate.SelectedDates; if (Dates.Count <= 1) { throw new ArgumentException("You need to select and drag a range of dates!"); } if (Dates.Count > 1) { booking.ArrivalDate = Dates[0]; booking.DepartureDate = Dates[Dates.Count - 1]; } if (Dates[0].Date > Dates[Dates.Count - 1].Date) { throw new ArgumentException("The Arrival Date Can't be after the Departure Date!"); } if (customer != null) { BookingDetails winB = new BookingDetails(booking, customer, true); winB.Show(); this.Close(); } else { CustomerWindow win = new CustomerWindow(booking); win.Show(); this.Close(); } } catch (Exception ee) { MessageBox.Show(ee.Message, "Booking"); } }