protected void Page_Init(object sender, EventArgs e) { if (SearchState.ValidateDetailsPageParameters(Request.Params)) { State = new SearchState("Details", Request.Params, new HotelBooking.HotelBookingDataContextExt()); } CheckInDateEdit.MinDate = DateTime.Now + TimeSpan.FromDays(1); if (State != null) { LocationComboBox.DataBindItems(); LocationComboBox.SelectedItem = LocationComboBox.Items.FindByValue(State.Metro_Area.ID); CheckOutDateEdit.Value = State.CheckOutDate; CheckInDateEdit.Value = State.CheckInDate; RoomsComboBox.Value = State.RoomsCount; AdultsSpinEdit.Value = State.AdultsCount; ChildrenSpinEdit.Value = State.ChildrenCount; } else { CheckOutDateEdit.Value = DateTime.Now + TimeSpan.FromDays(3); CheckInDateEdit.Value = DateTime.Now + TimeSpan.FromDays(1); } }
protected void Page_Load(object sender, EventArgs e) { if (!SearchState.ValidateResultsPageParameters(Request.Params)) { Response.Redirect("Default.aspx"); } State = new SearchState("Results", Request.Params, new HotelBookingDataContextExt()); if (!IsPostBack) { LocationComboBox.DataBindItems(); LocationComboBox.SelectedItem = LocationComboBox.Items.FindByValue(State.Metro_Area.ID); NightlyRateTrackBar.MaxValue = Math.Floor(State.Metro_Area.MaxRoomPrice); NightlyRateTrackBar.MinValue = Math.Floor(State.Metro_Area.MinRoomPrice); NightlyRateTrackBar.PositionStart = GetDecimalValue(State.FilterMinPrice, NightlyRateTrackBar.MinValue, NightlyRateTrackBar.MaxValue, NightlyRateTrackBar.MinValue); NightlyRateTrackBar.PositionEnd = GetDecimalValue(State.FilterMaxPrice, NightlyRateTrackBar.MinValue, NightlyRateTrackBar.MaxValue, NightlyRateTrackBar.MaxValue); CustomerRatingTrackBar.Position = GetDecimalValue(State.FilterCustomerRating, CustomerRatingTrackBar.MinValue, CustomerRatingTrackBar.MaxValue, CustomerRatingTrackBar.MinValue); LocationRatingComboBox.Value = State.FilterLocationRating ?? "BBB"; MapImage.ImageUrl = State.Metro_Area.Map_ImageUrl; for (int i = 0; i < 5; i++) { OurRatingCheckBoxList.Items[i].Selected = State.FilterOurRatingArray.Contains(i + 1); } EnsureTokensList(false); } var hotels = FindHotels().ToList(); HotelsDataView.DataSource = hotels; HotelsDataView.DataBind(); HotelsCountLabel.Text = String.Format("{0} CONSTRUCIONES", hotels.Count()); }