private void LoadNights(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.Clear(); return; } IList <string> selectedValues = new List <string>(); if (isReinit && !ChblNightsFilter.IsAllOptionsSelected) { selectedValues = ChblNightsFilter.SelectedValues; } ChblNightsFilter.DataSource = mtsDc.GetTourNights(sftDc, SelectedCityFromKey, SelectedCountryToKey, SelectedCitiesToKeys, SelectedTourKeys, SelectedArrivalDates); ChblNightsFilter.DataBind(); if (isReinit && selectedValues.Any()) { ChblNightsFilter.SelectItems(selectedValues); } }
private bool SetNightsByQs() { if (_queryStringParametrs.IsEmpty || !_queryStringParametrs.IsParametrsValid) { return(false); } if (_queryStringParametrs.Nights == null) { return(true); } return(ChblNightsFilter.SelectItems(_queryStringParametrs.Nights.Select(p => p.ToString(CultureInfo.InvariantCulture)).ToList())); }