public static CommunityDetailsVm GetCommunityDetailsVm(long communityId, PageType pageType)
        {
            CommunityDetailsVm result    = null;
            Community          community = SearchBc.Instance.GetCommunity(communityId);

            if (community != null)
            {
                result             = community.MapToCommunityDetailsVm(pageType);
                result.Breadcrumbs = GetBreadcrumbs(result);
                result.Seo         = SeoHelper.GetSeo(result);
                PopulateFeaturedServices(result, communityId);
                foreach (FloorPlanVm floorPlan in result.FloorPlans)
                {
                    floorPlan.LeadForm = GetLeadFormVm(floorPlan, communityId, pageType.ToSearchType());
                }
                foreach (SpecHomeVm specHome in result.SpecHomes)
                {
                    specHome.LeadForm = GetLeadFormVm(specHome, communityId, pageType.ToSearchType());
                }
                {
                    foreach (HomeVm home in result.Homes)
                    {
                        home.LeadForm = GetLeadFormVm(home, communityId, pageType.ToSearchType());
                    }
                    return(result);
                }
            }
            return(result);
        }
        public static ServiceProvidersSearchVm GetServiceProvidersSearchVm(ServiceProvidersSearchVm searchVm)
        {
            if (!ValidatePageNumber(searchVm.PageNumber))
            {
                return(null);
            }
            searchVm.ValidationResult = GetLookupLocationValidationVm(searchVm.SearchBar);
            if (!searchVm.ValidationResult.IsValid)
            {
                return(searchVm);
            }
            searchVm.Criteria  = searchVm.ValidationResult.Criteria;
            searchVm.SearchBar = GetSearchBarVm(searchVm);
            ServiceProviderSearchModel searchModel = searchVm.ToServiceProviderSearchModel();

            searchModel         = SearchBc.Instance.SearchServiceProviders(searchModel);
            searchVm.PageSize   = searchModel.PageSize;
            searchVm.TotalCount = searchModel.Result.TotalCount;
            searchVm.Paging     = searchVm.MapToPagingVm();
            searchVm.Refine     = searchVm.MapToServiceProviderRefineVm();
            searchVm.Result     = searchModel.Result.Results.MapToServiceProviderBlockVmList();
            PopulateFeaturedServices(searchVm);
            searchVm.Breadcrumbs       = GetBreadcrumbs(searchVm);
            searchVm.LeadForm          = GetLeadFormVm(searchVm);
            searchVm.DisplayProperties = new SearchDisplayProperties();
            searchVm.Seo = SeoHelper.GetSeo(searchVm);
            return(searchVm);
        }
        public static CommunitiesSearchVm GetCommunitiesSearchVm(CommunitiesSearchVm searchVm)
        {
            if (!ValidatePageNumber(searchVm.PageNumber))
            {
                return(null);
            }
            searchVm.ValidationResult = GetLookupLocationValidationVm(searchVm.SearchBar);
            if (!searchVm.ValidationResult.IsValid)
            {
                return(searchVm);
            }
            searchVm.Criteria  = searchVm.ValidationResult.Criteria;
            searchVm.SearchBar = GetSearchBarVm(searchVm);
            CommunitySearchModel         searchModel  = searchVm.ToCommunitySearchModel();
            FeaturedCommunitySearchModel searchModel2 = searchVm.ToFeaturedCommunitySearchModel();

            searchModel                  = SearchBc.Instance.SearchCommunities(searchModel);
            searchModel2                 = SearchBc.Instance.SearchFeaturedCommunities(searchModel2);
            searchVm.PageSize            = searchModel.PageSize;
            searchVm.TotalCount          = searchModel.Result.TotalCount;
            searchVm.Paging              = searchVm.MapToPagingVm();
            searchVm.Refine              = searchVm.MapToCommunityRefineVm();
            searchVm.Result              = searchModel.Result.Results.MapToCommunityBlockVmList(searchVm.Criteria.SearchType());
            searchVm.FeaturedCommunities = searchModel2.Result.MapToCommunityShortVmList(searchVm.Criteria.SearchType());
            PopulateFeaturedServices(searchVm);
            searchVm.Breadcrumbs = GetBreadcrumbs(searchVm);
            searchVm.LeadForm    = GetLeadFormVm(searchVm);
            searchVm.Seo         = SeoHelper.GetSeo(searchVm);
            return(searchVm);
        }
        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 static SearchVm GetStaticContent(PageType type)
        {
            SearchVm obj = new SearchVm
            {
                PageType = type,
                Seo      = SeoHelper.GetSeo(type),
                Criteria = GetInitSearchCriteriaVm()
            };

            obj.Breadcrumbs = GetBreadcrumbs(obj);
            return(obj);
        }
        public static ServiceProviderPrintDirectionVm GetServiceProviderPrintDirectionVm(long serviceProviderId, double latitude, double longitude)
        {
            ServiceProviderPrintDirectionVm serviceProviderPrintDirectionVm = null;
            ServiceProvider serviceProvider = SearchBc.Instance.GetServiceProvider(serviceProviderId);

            if (serviceProvider != null)
            {
                serviceProviderPrintDirectionVm     = serviceProvider.MapToServiceProviderPrintDirectionVm(latitude, longitude);
                serviceProviderPrintDirectionVm.Seo = SeoHelper.GetSeo(serviceProviderPrintDirectionVm);
            }
            return(serviceProviderPrintDirectionVm);
        }
        public static ServiceProviderDetailsVm GetServiceProviderDetailsVmForPrint(long serviceProviderId)
        {
            ServiceProviderDetailsVm serviceProviderDetailsVm = null;
            ServiceProvider          serviceProvider          = SearchBc.Instance.GetServiceProvider(serviceProviderId);

            if (serviceProvider != null)
            {
                serviceProviderDetailsVm     = serviceProvider.MapToServiceProviderDetailsVm();
                serviceProviderDetailsVm.Seo = SeoHelper.GetSeo(serviceProviderDetailsVm);
            }
            return(serviceProviderDetailsVm);
        }
        public static CommunityPrintDirectionVm GetCommunityPrintDirectionVm(long communityId, PageType pageType, double latitude, double longitude)
        {
            CommunityPrintDirectionVm communityPrintDirectionVm = null;
            Community community = SearchBc.Instance.GetCommunity(communityId);

            if (community != null)
            {
                communityPrintDirectionVm     = community.MapToCommunityPrintDirectionVm(pageType, latitude, longitude);
                communityPrintDirectionVm.Seo = SeoHelper.GetSeo(communityPrintDirectionVm);
            }
            return(communityPrintDirectionVm);
        }
        public static CommunityDetailsVm GetCommunityDetailsVmForPrint(long communityId, PageType pageType)
        {
            CommunityDetailsVm communityDetailsVm = null;
            Community          community          = SearchBc.Instance.GetCommunity(communityId);

            if (community != null)
            {
                communityDetailsVm     = community.MapToCommunityDetailsVm(pageType);
                communityDetailsVm.Seo = SeoHelper.GetSeo(communityDetailsVm);
            }
            return(communityDetailsVm);
        }
        public static ServiceProviderDetailsVm GetServiceProviderDetailsVm(long serviceProviderId)
        {
            ServiceProviderDetailsVm serviceProviderDetailsVm = null;
            ServiceProvider          serviceProvider          = SearchBc.Instance.GetServiceProvider(serviceProviderId);

            if (serviceProvider != null)
            {
                serviceProviderDetailsVm             = serviceProvider.MapToServiceProviderDetailsVm();
                serviceProviderDetailsVm.Breadcrumbs = GetBreadcrumbs(serviceProviderDetailsVm);
                serviceProviderDetailsVm.Seo         = SeoHelper.GetSeo(serviceProviderDetailsVm);
                PopulateFeaturedServices(serviceProviderDetailsVm, null, serviceProviderId);
            }
            return(serviceProviderDetailsVm);
        }