public static SearchTypeStubSearchVm GetSearchTypeSearchVm(SearchTypeStubSearchVm searchVm)
        {
            List <CityListingsInfo> result;

            if (searchVm.PageType == PageType.ServiceProvidersByType)
            {
                CountryStubSearchModel countryStubSearchModel = new CountryStubSearchModel();
                countryStubSearchModel.Criteria = searchVm.Criteria.ToSearchCriteria();
                countryStubSearchModel.MaxCount = ConfigurationManager.Instance.SearchTypeStubCitiesMaxCount;
                result = SearchBc.Instance.SearchServiceProvidersStubCities(countryStubSearchModel).Result;
            }
            else
            {
                CommunityCountryStubSearchModel communityCountryStubSearchModel = new CommunityCountryStubSearchModel();
                communityCountryStubSearchModel.Criteria    = searchVm.Criteria.ToSearchCriteria();
                communityCountryStubSearchModel.ListingType = searchVm.PageType.ToSearchType().ToListingType();
                communityCountryStubSearchModel.MaxCount    = ConfigurationManager.Instance.SearchTypeStubCitiesMaxCount;
                result = SearchBc.Instance.SearchCommunitiesStubCities(communityCountryStubSearchModel).Result;
            }
            searchVm.Result      = result.MapToCitiesTabs(searchVm.PageType.ToSearchType());
            searchVm.Seo         = SeoHelper.GetSeo(searchVm);
            searchVm.SearchBar   = GetSearchBarVm(searchVm);
            searchVm.Breadcrumbs = GetBreadcrumbs(searchVm);
            return(searchVm);
        }
        public static IndexVm GetIndexSearchVm()
        {
            IndexVm indexVm = new IndexVm();

            indexVm.PageType = PageType.Index;
            indexVm.Seo      = SeoHelper.GetSeo(indexVm);
            indexVm.Criteria = GetInitSearchCriteriaVm();
            CountryStubSearchModel countryStubSearchModel = new CountryStubSearchModel();

            countryStubSearchModel.Criteria         = indexVm.Criteria.ToSearchCriteria();
            countryStubSearchModel.MaxCount         = ConfigurationManager.Instance.IndexStubCitiesMaxCount;
            countryStubSearchModel.IsMarketAreaOnly = true;
            List <CityListingsInfo> result = SearchBc.Instance.SearchStubCities(countryStubSearchModel).Result;

            indexVm.Result.Add(SearchType.ActiveAdultCommunities, result.OrderByDescending((CityListingsInfo li) => li.AdultCommunitiesCount).Take(countryStubSearchModel.MaxCount).MapToCitiesLinks(SearchType.ActiveAdultCommunities, addCounting: false));
            indexVm.Result.Add(SearchType.ActiveAdultHomes, result.OrderByDescending((CityListingsInfo li) => li.AdultHomesCount).Take(countryStubSearchModel.MaxCount).MapToCitiesLinks(SearchType.ActiveAdultHomes, addCounting: false));
            indexVm.Result.Add(SearchType.SeniorHousingAndCare, result.OrderByDescending((CityListingsInfo li) => li.SeniorHousingCount).Take(countryStubSearchModel.MaxCount).MapToCitiesLinks(SearchType.SeniorHousingAndCare, addCounting: false));
            indexVm.Result.Add(SearchType.ProductsAndServices, result.OrderByDescending((CityListingsInfo li) => li.ServicesCount).Take(countryStubSearchModel.MaxCount).MapToCitiesLinks(SearchType.ProductsAndServices, addCounting: false));
            List <KeyValuePair <int, string> > shcCategoriesForCommunity = ItemTypeBc.Instance.GetShcCategoriesForCommunity();
            List <int> ShcCategories = new List <int>();

            indexVm.Refine = new CommunityRefineVm();
            indexVm.SearchBar.SHCategories = shcCategoriesForCommunity.MapToSelectListItemList(ShcCategories);
            //indexVm.Refine.ShcCategories =
            return(indexVm);
        }
        public CountryStubSearchModel SearchCountryStubCitiesWithServices(CountryStubSearchModel searchModel)
        {
            GetCountrySearchStubCommand getCountrySearchStubCommand = new GetCountrySearchStubCommand(searchModel, null);

            getCountrySearchStubCommand.Execute();
            searchModel.Result = getCountrySearchStubCommand.CommandResult;
            return(searchModel);
        }
 public GetCountrySearchStubCommand(CountryStubSearchModel searchModel, ListingType?listingType = null)
 {
     this._searchModel        = searchModel;
     this._listingType        = listingType;
     this._searchResult       = new List <CityListingsInfo>();
     base.StoredProcedureName = ClientStoredProcedures.SpGetCountryStubCities;
     base.CacheKey            = CachedBaseCommand <List <CityListingsInfo> > .GetCacheKey(new string[] { base.StoredProcedureName, this._searchModel.ToString(), this._listingType.ToString() });
 }
        public CountryStubSearchModel SearchServiceProvidersStubCities(CountryStubSearchModel searchModel)
        {
            SearchCriteria criteria = searchModel.Criteria;

            searchModel.Criteria = searchModel.Criteria.ToSearchableCriteria();
            searchModel          = this._searchDac.SearchCountryStubCitiesWithServices(searchModel);
            searchModel.Criteria = criteria;
            return(searchModel);
        }
        public CountryStubSearchModel SearchStubCities(CountryStubSearchModel searchModel)
        {
            SearchCriteria criteria = searchModel.Criteria;

            searchModel.Criteria = searchModel.Criteria.ToSearchableCriteria();
            searchModel          = this._searchDac.SearchCountryStubCitiesWithServices(searchModel);
            searchModel.Criteria = criteria;
            CommunityCountryStubSearchModel communityCountryStubSearchModel = new CommunityCountryStubSearchModel()
            {
                Criteria         = searchModel.Criteria,
                ListingType      = ListingType.ActiveAdultCommunities,
                MaxCount         = searchModel.MaxCount,
                IsMarketAreaOnly = searchModel.IsMarketAreaOnly
            };

            searchModel.Result.AddRange(this.SearchCommunitiesStubCities(communityCountryStubSearchModel).Result);
            communityCountryStubSearchModel.ListingType = ListingType.ActiveAdultHomes;
            searchModel.Result.AddRange(this.SearchCommunitiesStubCities(communityCountryStubSearchModel).Result);
            communityCountryStubSearchModel.ListingType = ListingType.SeniorHousingAndCare;
            searchModel.Result.AddRange(this.SearchCommunitiesStubCities(communityCountryStubSearchModel).Result);
            searchModel.Result = searchModel.Result.DistinctBy <CityListingsInfo, ISearchCriteria>((CityListingsInfo i) => i.SearchCriteria, new SearchCriteriaComparer()).ToList <CityListingsInfo>();
            return(searchModel);
        }