Exemple #1
0
 private static Contractor CreateContractorOrBuilder(RawBMContractor rawResult, LocatorBusinessTypes businessType)
 {
     if (CheckContractorResultType(rawResult, BUILDER_ALL_TYPE_IDS))
     {
         return(new Builder(LocatorBusinessTypes.Roofing | LocatorBusinessTypes.ResidentialInsulation));
     }
     else if (CheckContractorResultType(rawResult, ROOFING_INSTALLER_TYPE_IDS))
     {
         return(new Contractor(LocatorBusinessTypes.Roofing));
     }
     else if (CheckContractorResultType(rawResult, INSULATION_ALL_TYPE_IDS))
     {
         return(new Contractor(LocatorBusinessTypes.ResidentialInsulation));
     }
     return(new Contractor(businessType));
 }
Exemple #2
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);
        }
Exemple #3
0
        private static bool CheckContractorResultType(RawBMContractor rawResult, int[] typesToCheck)
        {
            bool typeFound = false;

            int[] contractorTypes =
                (from RawBMContractorType contractorType
                 in rawResult.RawBMContractorTypes
                 select contractorType.type_id).ToArray();

            foreach (int contractorType in contractorTypes)
            {
                if (typesToCheck.Contains(contractorType))
                {
                    typeFound = true;
                    break;
                }
            }
            return(typeFound);
        }