예제 #1
0
        public IEnumerable <ILocatorResult> GetDealerLocatorResultsV4(LocatorSearchOptions searchOptions)
        {
            // early exits for currently unsupported conditions
            if (searchOptions.SearchType != OwensCorning.Locator.Data.SearchType.Advanced)
            {
                throw new NotImplementedException();
            }
            if (string.IsNullOrEmpty(searchOptions.Company))
            {
                throw new NotImplementedException();
            }

            using (DealerLocatorDataContext dataContext = new DealerLocatorDataContext())
            {
                var searchResults =
                    from contractor in dataContext.RawBMDealers
                    select contractor;

                if (!String.IsNullOrEmpty(searchOptions.Company))
                {
                    searchResults = searchResults.Where(result => result.ChainName.Contains(searchOptions.Company));
                    searchResults = searchResults.OrderBy(result => result.RecordID);
                }
                return(searchResults.ToList().Where(r => TryParseInt(r.RecordID) != null).Select(a => BuildDealerLocatorResultV4(a) as ILocatorResult).ToList());
            }
        }
예제 #2
0
        private List <ILocatorResult> GetInternalLocatorResults(LocatorSearchOptions searchOptions)
        {
            SetSearchOptionsGeolocation(searchOptions);
            List <ILocatorResult> results = LocatorDAO.Instance.GetLocatorResults(searchOptions);

            return(results);
        }
예제 #3
0
 public Contractor[] GetContractors(LocatorSearchOptions searchOptions)
 {
     searchOptions.LocatorResultType = LocatorResultTypes.Installer;
     SetSearchOptionsGeolocation(searchOptions);
     return(GetInternalLocatorResults(searchOptions)
            .ConvertAll(result => result as Contractor).ToArray());
 }
예제 #4
0
 private static void SetSearchOptionsGeolocation(LocatorSearchOptions searchOptions)
 {
     if (!String.IsNullOrEmpty(searchOptions.Location))
     {
         Location location = LocationDAO.Instance.GetLocationWithPostalCode(searchOptions.Location);
         searchOptions.Latitude  = (double)location.Latitude;
         searchOptions.Longitude = (double)location.Longitude;
     }
 }
예제 #5
0
        public List <ILocatorResult> GetLocatorResults(LocatorSearchOptions searchOptions)
        {
            List <ILocatorResult> results = new List <ILocatorResult>();

            if ((searchOptions.LocatorBusinessType & LocatorBusinessTypes.Masonry) == LocatorBusinessTypes.Masonry)
            {
                results.AddRange(GetMasonryLocatorResults(searchOptions));
            }
            if ((searchOptions.LocatorBusinessType & LocatorBusinessTypes.Roofing) == LocatorBusinessTypes.Roofing)
            {
                results.AddRange(GetBMLocatorResults(searchOptions));
            }
            return(results);
        }
예제 #6
0
        public Dealer[] GetMasonryDealers(string zipCode, int radius)
        {
            LocatorSearchOptions searchOptions =
                new LocatorSearchOptions
            {
                LocatorBusinessType = LocatorBusinessTypes.Masonry,
                LocatorResultType   = LocatorResultTypes.Dealer,
                Location            = zipCode,
                Radius = radius
            };

            SetSearchOptionsGeolocation(searchOptions);
            return(GetInternalLocatorResults(searchOptions)
                   .ConvertAll(result => result as Dealer).ToArray());
        }
예제 #7
0
        public Builder[] GetBuilders(string zipCode, int radius)
        {
            LocatorSearchOptions searchOptions =
                new LocatorSearchOptions
            {
                LocatorBusinessType = (LocatorBusinessTypes.ResidentialInsulation | LocatorBusinessTypes.Roofing),
                LocatorResultType   = LocatorResultTypes.Builder,
                Location            = zipCode,
                Radius = radius
            };

            SetSearchOptionsGeolocation(searchOptions);
            return(GetInternalLocatorResults(searchOptions)
                   .ConvertAll(result => result as Builder).ToArray());
        }
예제 #8
0
        private List <ILocatorResult> GetBMLocatorResults(LocatorSearchOptions searchOptions)
        {
            List <ILocatorResult> locatorResults = new List <ILocatorResult>();

            if ((searchOptions.LocatorResultType & LocatorResultTypes.Dealer) == LocatorResultTypes.Dealer)
            {
                locatorResults.AddRange(GetDealerLocatorResults(searchOptions));
            }
            if ((searchOptions.LocatorResultType & LocatorResultTypes.Installer) == LocatorResultTypes.Installer ||
                (searchOptions.LocatorResultType & LocatorResultTypes.Builder) == LocatorResultTypes.Builder)
            {
                locatorResults.AddRange(GetContractorLocatorResults(searchOptions));
            }
            return(locatorResults);
        }
예제 #9
0
        public Contractor[] GetRoofingInstallers(string zipCode, int radius)
        {
            LocatorSearchOptions searchOptions =
                new LocatorSearchOptions
            {
                LocatorBusinessType = LocatorBusinessTypes.Roofing,
                LocatorResultType   = LocatorResultTypes.Installer,
                Location            = zipCode,
                Radius = radius
            };

            SetSearchOptionsGeolocation(searchOptions);
            return(GetInternalLocatorResults(searchOptions)
                   .ConvertAll(result => result as Contractor).ToArray());
        }
예제 #10
0
        private Contractor GetBMContractorForFunction(Func <RawBMContractor, bool> func)
        {
            Contractor           result        = null;
            LocatorSearchOptions searchOptions =
                new LocatorSearchOptions()
            {
                LocatorBusinessType = LocatorBusinessTypes.All
            };

            using (ContractorLocatorDataContext dataContext = new ContractorLocatorDataContext())
            {
                var rawResults =
                    dataContext.RawBMContractors.Where(func).ToList();
                if (rawResults.Count > 0)
                {
                    result = BuildContractorLocatorResult(rawResults.First(), 0.0, searchOptions);
                }
            }
            return(result);
        }
예제 #11
0
        public com.ocwebservice.locator.model.WCFPagedList <ILocatorResult> GetPagedLocatorResults(LocatorSearchOptions searchOptions, OwensCorning.Paging.PageInfo pagingInfo)
        {
            IEnumerable <ILocatorResult> results = LocatorService.Instance.GetDealerLocatorResults(searchOptions);

            return(new com.ocwebservice.locator.model.WCFPagedList <ILocatorResult>(results, pagingInfo));
        }
예제 #12
0
 private IEnumerable <ILocatorResult> LoadDealerLocatorResultsV4(LocatorSearchOptions searchOptions)
 {
     return(LocatorDAO.Instance.GetDealerLocatorResultsV4(searchOptions));
 }
예제 #13
0
 public IEnumerable <ILocatorResult> GetDealerLocatorResultsV4(LocatorSearchOptions searchOptions)
 {
     return(ObtainCacheableData <IEnumerable <ILocatorResult>, LocatorSearchOptions>("V4." + searchOptions.ToString(), "cache.locator.duration", System.Web.Caching.CacheItemPriority.Normal, LoadDealerLocatorResultsV4, searchOptions));
 }
예제 #14
0
        private static Contractor BuildContractorLocatorResult(RawBMContractor rawResult, double distance, LocatorSearchOptions searchOptions)
        {
            Contractor result =
                CreateContractorOrBuilder(rawResult, searchOptions.LocatorBusinessType);

            result.Id           = rawResult.id;
            result.ContactName  = rawResult.contact;
            result.Company      = rawResult.store;
            result.Address      = rawResult.address1;
            result.Address2     = rawResult.address2;
            result.City         = rawResult.city;
            result.State        = rawResult.state;
            result.Zip          = rawResult.zip;
            result.Phone        = rawResult.phone;
            result.Fax          = rawResult.phone2;
            result.AsmEmail     = rawResult.SalesRepEmailID;
            result.AsmLastName  = rawResult.salesrep;
            result.AsmFirstName = rawResult.SalesRepFirstName;
            result.Email        = rawResult.MemberEmailID;
            result.Website      = rawResult.url;
            result.Distance     = distance;

            result.ContractorPrograms |= rawResult.ProConnectFlag ? ContractorPrograms.HasProConnectProfile : 0;
            result.ContractorPrograms |= rawResult.Top_Of_The_House_Certified == 'Y' ? ContractorPrograms.IsTopOfTheHouse : 0;
            result.ContractorPrograms |= rawResult.IsExFxCertified == 'Y' ? ContractorPrograms.IsExteriorFx : 0;
            bool isContractor = CheckContractorResultType(rawResult, ROOFING_INSTALLER_TYPE_IDS);

            result.ContractorPrograms |= isContractor ? ContractorPrograms.IsPreferred : 0;
            result.ContractorPrograms |= rawResult.IsPreferredPride == 'Y' ? ContractorPrograms.IsPreferredPride : 0;
            result.ContractorPrograms |= rawResult.IsPreferredPlat == 'Y' ? ContractorPrograms.IsPlatinumPreferred : 0;
            result.ContractorPrograms |= rawResult.Platinum_Pride_Award == 'Y' ? ContractorPrograms.IsPlatinumAwardWinner : 0;
            result.ContractorPrograms |= rawResult.Total_Protection_Rfg_System == 'Y' ? ContractorPrograms.IsTotalProtectionRoofingSystem : 0;

            result.ContractorPrograms |= GetRewardsFlags(rawResult.RewardsLevel);

            if (result is Builder)
            {
                Builder builder = result as Builder;
                builder.BuilderPrograms |= rawResult.IsQuietZoneBuilder == 'Y' ? BuilderPrograms.IsQuietZoneBuilder : 0;
                bool isSystemThinkingBuilder = CheckContractorResultType(rawResult, BUILDER_SYSTEM_THINKING_IDS);
                builder.BuilderPrograms |= isSystemThinkingBuilder ? BuilderPrograms.IsSystemThinkingBuilder : 0;
            }

            return(result);
        }
예제 #15
0
        private List <ILocatorResult> GetMasonryLocatorResults(LocatorSearchOptions searchOptions)
        {
            if (MasonryLocatorResultTypeToKeyDictionary.Count +
                MasonryDealerLevelToKeyDictionary.Count == 0)
            {
                InitializeMasonryDAO();
            }

            //Disable builder search
            var locatorResultType = searchOptions.LocatorResultType & ~LocatorResultTypes.Builder;

            using (MasonryLocatorDataContext dataContext = new MasonryLocatorDataContext())
            {
                IQueryable <MasonryLocatorResultWrapper> results;

                if (searchOptions.SearchType != SearchType.Advanced)
                {
                    results =
                        (from dealer in dataContext.RawMasonryLocatorResults
                         join zipCode in dataContext.RawMasonryLocations on dealer.ShipZip equals zipCode.PostalCode
                         let distance =
                             //TODO find some way to abstract this out into an expression JGK
                             DistanceCalculationUtil.EARTH_RADIUS * (
                                 Math.Atan(
                                     Math.Sqrt(1 -
                                               Math.Pow(
                                                   Math.Sin(searchOptions.Latitude / DistanceCalculationUtil.DEGREES_PER_RADIAN) * Math.Sin(zipCode.Latitude.Value / DistanceCalculationUtil.DEGREES_PER_RADIAN) +
                                                   Math.Cos(searchOptions.Latitude / DistanceCalculationUtil.DEGREES_PER_RADIAN) * Math.Cos(zipCode.Latitude.Value / DistanceCalculationUtil.DEGREES_PER_RADIAN) *
                                                   Math.Cos(zipCode.Longitude.Value / DistanceCalculationUtil.DEGREES_PER_RADIAN - searchOptions.Longitude / DistanceCalculationUtil.DEGREES_PER_RADIAN)
                                                   , 2))
                                     /
                                     (Math.Sin(searchOptions.Latitude / DistanceCalculationUtil.DEGREES_PER_RADIAN) * Math.Sin(zipCode.Latitude.Value / DistanceCalculationUtil.DEGREES_PER_RADIAN) +
                                      Math.Cos(searchOptions.Latitude / DistanceCalculationUtil.DEGREES_PER_RADIAN) * Math.Cos(zipCode.Latitude.Value / DistanceCalculationUtil.DEGREES_PER_RADIAN) *
                                      Math.Cos(zipCode.Longitude.Value / DistanceCalculationUtil.DEGREES_PER_RADIAN - searchOptions.Longitude / DistanceCalculationUtil.DEGREES_PER_RADIAN))
                                     )
                                 )
                             where distance <= searchOptions.Radius
                             orderby distance, zipCode.PostalCode
                         select new MasonryLocatorResultWrapper {
                        Result = dealer, Distance = distance
                    });
                }
                else
                {
                    if (searchOptions.Latitude > 0.0)
                    {
                        results =
                            from dealer in dataContext.RawMasonryLocatorResults
                            join zipCode in dataContext.RawMasonryLocations on dealer.ShipZip equals zipCode.PostalCode
                            let distance =
                                //TODO find some way to abstract this out into an expression JGK
                                DistanceCalculationUtil.EARTH_RADIUS * (
                                    Math.Atan(
                                        Math.Sqrt(1 -
                                                  Math.Pow(
                                                      Math.Sin(searchOptions.Latitude / DistanceCalculationUtil.DEGREES_PER_RADIAN) * Math.Sin(zipCode.Latitude.Value / DistanceCalculationUtil.DEGREES_PER_RADIAN) +
                                                      Math.Cos(searchOptions.Latitude / DistanceCalculationUtil.DEGREES_PER_RADIAN) * Math.Cos(zipCode.Latitude.Value / DistanceCalculationUtil.DEGREES_PER_RADIAN) *
                                                      Math.Cos(zipCode.Longitude.Value / DistanceCalculationUtil.DEGREES_PER_RADIAN - searchOptions.Longitude / DistanceCalculationUtil.DEGREES_PER_RADIAN)
                                                      , 2))
                                        /
                                        (Math.Sin(searchOptions.Latitude / DistanceCalculationUtil.DEGREES_PER_RADIAN) * Math.Sin(zipCode.Latitude.Value / DistanceCalculationUtil.DEGREES_PER_RADIAN) +
                                         Math.Cos(searchOptions.Latitude / DistanceCalculationUtil.DEGREES_PER_RADIAN) * Math.Cos(zipCode.Latitude.Value / DistanceCalculationUtil.DEGREES_PER_RADIAN) *
                                         Math.Cos(zipCode.Longitude.Value / DistanceCalculationUtil.DEGREES_PER_RADIAN - searchOptions.Longitude / DistanceCalculationUtil.DEGREES_PER_RADIAN))
                                        )
                                    )
                                orderby dealer.Product_Lead_Type_Code descending, dealer.Company ascending
                        select new MasonryLocatorResultWrapper {
                            Result = dealer, Distance = distance
                        };
                    }
                    else
                    {
                        results =
                            from dealer in dataContext.RawMasonryLocatorResults
                            orderby(dealer.Product_Lead_Type_Code == MasonrySelectInstaller) descending, dealer.Company ascending
                        select new MasonryLocatorResultWrapper
                        {
                            Result = dealer, Distance = 0
                        };
                    }

                    if (!String.IsNullOrEmpty(searchOptions.Company))
                    {
                        results = results.Where(lr => lr.Result.Company.Contains(searchOptions.Company));
                    }

                    if (!String.IsNullOrEmpty(searchOptions.City))
                    {
                        results = results.Where(lr => lr.Result.ShipCity.Contains(searchOptions.City));
                    }

                    if (!String.IsNullOrEmpty(searchOptions.State))
                    {
                        results = results.Where(lr => lr.Result.ShipState == searchOptions.State);
                    }
                }

                if (searchOptions.RequireEmailAddress)
                {
                    results = results.Where(lr => lr.Result.Email != null && lr.Result.Email.Length > 5);
                }

                // add where for dealer type
                if (!(LocatorResultTypes.None == locatorResultType ||     //If none is selected, return everything
                      AllMasonryLocatorResultTypes == locatorResultType)) //If everything is selected, do not apply filter.
                {
                    //if builders are ever added, this needs to have another case to support two out of three locator result types
                    results =
                        results
                        .Where(lr =>
                               lr.Result.Member_Type_Code.StartsWith(MasonryLocatorResultTypeToKeyDictionary[locatorResultType]
                                                                     ));
                }

                List <ILocatorResult> locatorResults =
                    results.ToList().ConvertAll(r => BuildMasonryLocatorResult(r.Result, r.Distance));

                // if these are dealers and not installers sort by dealer level
                if ((LocatorResultTypes.Dealer & locatorResultType) == locatorResultType)
                {
                    List <Contractor> contractors =
                        locatorResults
                        .Take(searchOptions.MaxResultsPerType)
                        .Where(lr => lr is Contractor)
                        .ToList().ConvertAll(lr => lr as Contractor);
                    List <Dealer> dealers =
                        locatorResults
                        .Take(searchOptions.MaxResultsPerType)
                        .Where(lr => lr is Dealer)
                        .ToList().ConvertAll(lr => lr as Dealer)
                        .OrderByDescending(d => d.DealerLevel).ToList();

                    locatorResults = new List <ILocatorResult>();
                    locatorResults.AddRange(contractors.ConvertAll(c => c as ILocatorResult));
                    locatorResults.AddRange(dealers.ConvertAll(d => d as ILocatorResult));
                }
                else
                {
                    locatorResults = locatorResults.Take(searchOptions.MaxResultsPerType).ToList();
                }

                return(locatorResults);
            }
        }
예제 #16
0
 public ILocatorResult[] GetLocatorResults(LocatorSearchOptions searchOptions)
 {
     SetSearchOptionsGeolocation(searchOptions);
     return(GetInternalLocatorResults(searchOptions).ToArray());
 }
예제 #17
0
 public com.ocwebservice.locator.model.WCFPagedList <ILocatorResult> GetPagedLocatorResults(LocatorSearchOptions searchOptions, OwensCorning.Paging.PageInfo pagingInfo)
 {
     throw new NotImplementedException();
 }
예제 #18
0
        private IEnumerable <ILocatorResult> GetContractorLocatorResults(LocatorSearchOptions searchOptions)
        {
            int[] typesToSearchFor = new int[0];
            if ((searchOptions.LocatorResultType & LocatorResultTypes.Installer) == LocatorResultTypes.Installer)
            {
                if ((searchOptions.LocatorBusinessType & LocatorBusinessTypes.Roofing) == LocatorBusinessTypes.Roofing)
                {
                    typesToSearchFor = CombineIdArrays(typesToSearchFor, ROOFING_INSTALLER_TYPE_IDS);
                }
                if ((searchOptions.LocatorBusinessType & LocatorBusinessTypes.ResidentialInsulation) == LocatorBusinessTypes.ResidentialInsulation)
                {
                    typesToSearchFor = CombineIdArrays(typesToSearchFor, INSULATION_ALL_TYPE_IDS);
                }
            }
            if ((searchOptions.LocatorResultType & LocatorResultTypes.Builder) == LocatorResultTypes.Builder)
            {
                typesToSearchFor = CombineIdArrays(typesToSearchFor, BUILDER_ALL_TYPE_IDS);
            }

            double searchLatitude  = searchOptions.Latitude;
            double searchLongitude = searchOptions.Longitude * -1;

            using (ContractorLocatorDataContext dataContext = new ContractorLocatorDataContext())
            {
                List <Contractor> contractors;
                if (searchOptions.SearchType != SearchType.Advanced)
                {
                    var searchResults =
                        (from contractor in dataContext.RawBMContractors
                         join location in dataContext.RawBMLocations
                         on contractor.zip equals location.PostalCode
                         let distance =
                             //TODO find some way to abstract this out into an expression JGK
                             DistanceCalculationUtil.EARTH_RADIUS * (
                                 Math.Atan(
                                     Math.Sqrt(1 -
                                               Math.Pow(
                                                   Math.Sin(searchLatitude / DistanceCalculationUtil.DEGREES_PER_RADIAN) * Math.Sin(location.Latitude.Value / DistanceCalculationUtil.DEGREES_PER_RADIAN) +
                                                   Math.Cos(searchLatitude / DistanceCalculationUtil.DEGREES_PER_RADIAN) * Math.Cos(location.Latitude.Value / DistanceCalculationUtil.DEGREES_PER_RADIAN) *
                                                   Math.Cos(location.Longitude.Value / DistanceCalculationUtil.DEGREES_PER_RADIAN - searchLongitude / DistanceCalculationUtil.DEGREES_PER_RADIAN)
                                                   , 2))
                                     /
                                     (Math.Sin(searchLatitude / DistanceCalculationUtil.DEGREES_PER_RADIAN) * Math.Sin(location.Latitude.Value / DistanceCalculationUtil.DEGREES_PER_RADIAN) +
                                      Math.Cos(searchLatitude / DistanceCalculationUtil.DEGREES_PER_RADIAN) * Math.Cos(location.Latitude.Value / DistanceCalculationUtil.DEGREES_PER_RADIAN) *
                                      Math.Cos(location.Longitude.Value / DistanceCalculationUtil.DEGREES_PER_RADIAN - searchLongitude / DistanceCalculationUtil.DEGREES_PER_RADIAN))
                                     )
                                 )
                             where distance <= searchOptions.Radius &&
                             (searchOptions.RequireEmailAddress ? (contractor.MemberEmailID != null && contractor.MemberEmailID.Length > 5) : true) &&
                             contractor.RawBMContractorTypes.Any(type => typesToSearchFor.Contains(type.type_id))
                             select new { Contractor = contractor, Distance = distance }).ToList();
                    contractors = searchResults.ConvertAll <Contractor>(a => BuildContractorLocatorResult(a.Contractor, a.Distance, searchOptions));
                }
                else
                {
                    var searchResults =
                        from contractor in dataContext.RawBMContractors
                        join location in dataContext.RawBMLocations
                        on contractor.zip equals location.PostalCode
                        let distance =
                            //TODO find some way to abstract this out into an expression JGK
                            DistanceCalculationUtil.EARTH_RADIUS * (
                                Math.Atan(
                                    Math.Sqrt(1 -
                                              Math.Pow(
                                                  Math.Sin(searchLatitude / DistanceCalculationUtil.DEGREES_PER_RADIAN) * Math.Sin(location.Latitude.Value / DistanceCalculationUtil.DEGREES_PER_RADIAN) +
                                                  Math.Cos(searchLatitude / DistanceCalculationUtil.DEGREES_PER_RADIAN) * Math.Cos(location.Latitude.Value / DistanceCalculationUtil.DEGREES_PER_RADIAN) *
                                                  Math.Cos(location.Longitude.Value / DistanceCalculationUtil.DEGREES_PER_RADIAN - searchLongitude / DistanceCalculationUtil.DEGREES_PER_RADIAN)
                                                  , 2))
                                    /
                                    (Math.Sin(searchLatitude / DistanceCalculationUtil.DEGREES_PER_RADIAN) * Math.Sin(location.Latitude.Value / DistanceCalculationUtil.DEGREES_PER_RADIAN) +
                                     Math.Cos(searchLatitude / DistanceCalculationUtil.DEGREES_PER_RADIAN) * Math.Cos(location.Latitude.Value / DistanceCalculationUtil.DEGREES_PER_RADIAN) *
                                     Math.Cos(location.Longitude.Value / DistanceCalculationUtil.DEGREES_PER_RADIAN - searchLongitude / DistanceCalculationUtil.DEGREES_PER_RADIAN))
                                    )
                                )
                            where contractor.RawBMContractorTypes.Any(type => typesToSearchFor.Contains(type.type_id))
                            select new { Contractor = contractor, Distance = distance };

                    if (!String.IsNullOrEmpty(searchOptions.Company))
                    {
                        searchResults = searchResults.Where(result => result.Contractor.store.Contains(searchOptions.Company));
                    }
                    if (!String.IsNullOrEmpty(searchOptions.City))
                    {
                        searchResults = searchResults.Where(result => result.Contractor.city.Contains(searchOptions.City));
                    }
                    if (!String.IsNullOrEmpty(searchOptions.State))
                    {
                        searchResults = searchResults.Where(result => result.Contractor.state == searchOptions.State);
                    }
                    if (searchOptions.RequireEmailAddress)
                    {
                        searchResults = searchResults.Where(result => result.Contractor.MemberEmailID != null && result.Contractor.MemberEmailID.Length > 5);
                    }
                    contractors = searchResults.Take(250).ToList()
                                  .ConvertAll <Contractor>(a =>
                                                           BuildContractorLocatorResult(a.Contractor, a.Distance, searchOptions));
                }

                contractors = contractors.Where(c => !c.ContractorPrograms.Includes(ContractorPrograms.IsSilverRewards)).ToList();

                var sortedResults = (from contractor in contractors
                                     //where (contractor.LocatorResultType & searchOptions.LocatorResultType) == contractor.LocatorResultType
                                     orderby contractor.BusinessType descending,
                                     contractor.LocatorResultType descending,
                                     GetContractorSortOrder(contractor) descending,
                                     contractor.Distance,
                                     contractor.Company
                                     select contractor);

                var finalResults =
                    sortedResults
                    .Where(c => c.LocatorResultType == LocatorResultTypes.Installer)
                    .Take(searchOptions.MaxResultsPerType).ToList();
                finalResults.AddRange(
                    sortedResults
                    .Where(c => c.LocatorResultType == LocatorResultTypes.Builder)
                    .Take(searchOptions.MaxResultsPerType));
                return(finalResults.ConvertAll(c => c as ILocatorResult));
            }
        }