Exemple #1
0
        private bool SetHotelsByQs()
        {
            if (_queryStringParametrs.IsEmpty || !_queryStringParametrs.IsParametrsValid)
            {
                return(false);
            }
            if (_queryStringParametrs.HotelKeys == null)
            {
                return(true);
            }

            return(UcHotelsFilter.SelectItems(_queryStringParametrs.HotelKeys.Select(p => p.ToString(CultureInfo.InvariantCulture)).ToList()));
        }
Exemple #2
0
        private void LoadHotels(MtSearchDbDataContext mtsDc, SftWebDbDataContext sftDc, bool isReinit = false)
        {
            if (RblCitiesFromFilter.Items.Count == 0 || DdlContriesToFilter.Items.Count == 0 ||
                ChblTourTypes.Items.Count == 0 || ChblCitiesToFilter.Items.Count == 0 ||
                DdlToursFilter.Items.Count == 0 || ArrivalDatesFilter.ArrivalDates == null ||
                !ArrivalDatesFilter.ArrivalDates.Any() ||
                ChblNightsFilter.Items.Count == 0 || ChblHotelCategoriesFilter.Items.Count == 0 ||
                ChblPansionsFilter.Items.Count == 0)
            {
                UcHotelsFilter.Items.Clear();
                return;
            }

            IList <string> selectedValues = new List <string>();

            if (isReinit && !UcHotelsFilter.IsAllOptionsSelected)
            {
                selectedValues = UcHotelsFilter.SelectedValues;
            }

            var hotels =
                mtsDc.GetTourHotels(sftDc, SelectedCityFromKey, SelectedCountryToKey, SelectedCitiesToKeys, SelectedTourKeys,
                                    SelectedArrivalDates,
                                    SelectedNights, SelectedHotelCategoriesKeys, SelectedPansionKeys,
                                    !UcHotelsFilter.IsFilterByArrNights).ToList();

            UcHotelsFilter.DataSource
                = hotels.ToDictionary(h => h.Key, h => GetHotelNameHtml(h.Name, h.Stars, h.ResortName, h.Url));
            UcHotelsFilter.DataBind();

            if (!UcHotelsFilter.IsFilterByArrNights)
            {
                foreach (var hotel in hotels.Where(h => !h.IsValidPrice))
                {
                    UcHotelsFilter.Items.FindByValue(hotel.Key.ToString(CultureInfo.InvariantCulture)).Enabled = false;
                }
            }

            if (isReinit && selectedValues.Any())
            {
                UcHotelsFilter.SelectItems(selectedValues);
            }
        }