Пример #1
0
        private void RetrieveAndPersistAllLanguagesForThisVin(string vin)
        {
            List <string> requiredNativeLangCodes = new List <string>();

            foreach (SupportedLanguage value in
                     Enum.GetValues(typeof(SupportedLanguage)))
            {
                CharacteristicsLanguageMapper mapper =
                    new CharacteristicsLanguageMapper(
                        VinChecker.GetManufacturer(vin));
                string nativeLangValue = mapper.GetSpecificCode(value);
                if (!requiredNativeLangCodes.Contains(nativeLangValue))
                {
                    requiredNativeLangCodes.Add(nativeLangValue);
                }
            }
            foreach (string code in requiredNativeLangCodes)
            {
                IVendorCharacteristicsProvider provider =
                    VendorCharacteristicsProviderFactory.Create(
                        VinChecker.GetManufacturer(vin));
                VehicleCharacteristics chars = provider.GetByVin(vin, code);
                PersistVehicleCharacteristics(chars);
            }
        }
Пример #2
0
        private void RetrieveAndPersistAllLangsWeDoNotHaveYetForThisVin(string vin)
        {
            IList <SupportedLanguage> langsWeLackForThisVin =
                GetLangsWeDoNotHaveForVin(vin);

            foreach (SupportedLanguage language in langsWeLackForThisVin)
            {
                IVendorCharacteristicsProvider provider =
                    VendorCharacteristicsProviderFactory.Create(
                        VinChecker.GetManufacturer(vin));
                CharacteristicsLanguageMapper mapper =
                    new CharacteristicsLanguageMapper(VinChecker.GetManufacturer(vin));
                VehicleCharacteristics chars = provider.GetByVin(vin,
                                                                 mapper.GetSpecificCode(language));
                PersistVehicleCharacteristics(chars);
            }
        }