private void LoadToursTypes(MtSearchDbDataContext mtsDc, SftWebDbDataContext sftDc, bool isReinit = true) { if (mtsDc == null) { throw new ArgumentNullException("mtsDc"); } if (RblCitiesFromFilter.Items.Count == 0 || DdlContriesToFilter.Items.Count == 0) { ChblTourTypes.Items.Clear(); return; } IList <string> selectedValues = new List <string>(); if (isReinit && !ChblTourTypes.IsAllOptionsSelected) { selectedValues = ChblTourTypes.SelectedValues; } ChblTourTypes.DataSource = mtsDc.GetTourTypes(sftDc, SelectedCityFromKey, SelectedCountryToKey) .ToDictionary(k => k.Key, v => HttpUtility.HtmlEncode(v.Value)); ChblTourTypes.DataBind(); if (isReinit && selectedValues.Any()) { ChblTourTypes.SelectItems(selectedValues); } }
private bool SetToursTypesByQs() { if (_queryStringParametrs.IsEmpty || !_queryStringParametrs.IsParametrsValid) { return(false); } if (_queryStringParametrs.TourTypeKeys == null) { return(true); } return(ChblTourTypes.SelectItems(_queryStringParametrs.TourTypeKeys.Select(p => p.ToString(CultureInfo.InvariantCulture)).ToList())); }