Пример #1
0
        private void LoadCitiesTo(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.Count == 0)
            {
                ChblCitiesToFilter.Items.Clear();
                return;
            }
            IList <string> selectedValues = new List <string>();

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

            ChblCitiesToFilter.DataSource = mtsDc.GetCitiesTo(sftDc, SelectedCityFromKey, SelectedCountryToKey,
                                                              SelectedTourTypeKeys).ToDictionary(k => k.Key, v => HttpUtility.HtmlEncode(v.Value));
            ChblCitiesToFilter.DataBind();

            if (isReinit && selectedValues.Any())
            {
                ChblCitiesToFilter.SelectItems(selectedValues);
            }
        }
Пример #2
0
        private bool SetCitiesByQs()
        {
            if (_queryStringParametrs.IsEmpty || !_queryStringParametrs.IsParametrsValid)
            {
                return(false);
            }
            if (_queryStringParametrs.CitiesToKeys == null)
            {
                return(true);
            }

            return(ChblCitiesToFilter.SelectItems(_queryStringParametrs.CitiesToKeys.Select(p => p.ToString(CultureInfo.InvariantCulture)).ToList()));
        }