Пример #1
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                int hotel          = hotel = Convert.ToInt32(cbHotels.SelectedValue);
                int transportation = Convert.ToInt32(cbTransportation.SelectedValue);
                int entertainment  = Convert.ToInt32(cbEvents.SelectedValue);

                int duration = Convert.ToInt32(txtNights.Text);

                // Save Booking Information

                Booking booking = new Booking(dtStartDate.Text, int.Parse(txtNights.Text), txtDestination.Text, entertainment,
                                              hotel, transportation, CalculatePrice(hotel, entertainment, transportation, duration), duration);
                if (_editMode)
                {
                    bookingController.EditBooking(_id, booking);
                    lblMessage.Text = "Tour Updated";
                }
                else
                {
                    bookingController.NewBooking(_id, booking);
                    lblMessage.Text = "New Tour Added";
                }
            } catch (Exception ex)
            {
                lblMessage.Text = ex.Message;
            }
        }