private void ListViewLastminute_DoubleClick(object sender, EventArgs e) { if (listViewLastminute.SelectedItems.Count > 0) { int offerID = Convert.ToInt32(listViewLastminute.SelectedItems[0].Text); PageController.DisplayOffer(offerID); this.Hide(); this.Dispose(); } }
private void PictureBoxSave_Click(object sender, EventArgs e) { SqlCommand cmd = conn.Command("UPDATE Offers SET country=@Country, city=@City, days=@Days, date_departure=@DateDeparture, date_return=@DateReturn" + ", visa_required=@VisaRequired, description=@Description, room=@Room, meals=@Meals, price=@Price, transport_price=@TransportPrice, " + "capacity_available=@CapacityAvailable, offer_type=@OfferType, hotel_id=@HotelID, tourist_guide_id=@TouristGuideID WHERE ID = @ID"); cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@Country", textBoxCountry.Text.Trim()); cmd.Parameters.AddWithValue("@City", textBoxCity.Text.Trim()); cmd.Parameters.AddWithValue("@Days", textBoxDays.Text.Trim()); cmd.Parameters.AddWithValue("@DateDeparture", dateTimePickerDeparture.Value); cmd.Parameters.AddWithValue("@DateReturn", dateTimePickerReturn.Value); cmd.Parameters.AddWithValue("@VisaRequired", textBoxVisaRequired.Text.Trim()); cmd.Parameters.AddWithValue("@Description", textBoxDescription.Text.Trim()); cmd.Parameters.AddWithValue("@Room", textBoxRoom.Text.Trim()); cmd.Parameters.AddWithValue("@Meals", textBoxMeals.Text.Trim()); cmd.Parameters.AddWithValue("@Price", textBoxPrice.Text.Trim()); cmd.Parameters.AddWithValue("@TransportPrice", textBoxTransportPrice.Text.Trim()); cmd.Parameters.AddWithValue("@CapacityAvailable", textBoxCapacityAvailable.Text.Trim()); cmd.Parameters.AddWithValue("@OfferType", textBoxOfferType.Text.Trim()); cmd.Parameters.AddWithValue("@HotelID", textBoxHotel.Text.Trim()); cmd.Parameters.AddWithValue("@TouristGuideID", textBoxTouristGuide.Text.Trim()); cmd.Parameters.AddWithValue("@ID", labelID.Text); try { conn.OpenConnection(); int result = cmd.ExecuteNonQuery(); if (result > 0) { MessageBox.Show("Offer is successfully updated."); PageController.DisplayOffer(id); this.Hide(); this.Dispose(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { conn.CloseConnection(); } }
private void PictureBoxBack_Click(object sender, EventArgs e) { PageController.DisplayOffer(OfferId); this.Hide(); this.Dispose(); }