public VehicleCharacteristics GetByVin(string vin, string preferredLanguage) { PublicServiceboxPeugeotComWebConnector connector = new PublicServiceboxPeugeotComWebConnector( preferredLanguage); string result; try { connector.Connect(); result = connector.Retrieve(vin); connector.Disconnect(); } catch (WebException) { result = null; //throw; } VehicleCharacteristicsPageParser parser = new VehicleCharacteristicsPageParser(result, preferredLanguage); VehicleCharacteristicsDto dto = parser.Parse(); dto.Vin = vin; return(VehicleCharacteristicsAssembler.FromDtoToDomainObject(dto)); }
public ViewResult Characteristics(string vin, SupportedLanguage language) { VehicleCharacteristicsDto dto = service.GetVehicleCharacteristics(vin, (int)language); var data = VehicleCharacteristicsAssembler.FromDtoToDomainObject(dto); return(View(data)); }
public static VehicleCharacteristics Get(string vin) { SupportedLanguage currentLang = TranslationManager.Instance.CurrentLanguageEnum; string vinU = vin.ToUpper(); if (cache.ContainsKey(vinU) && cache[vinU].ContainsKey(currentLang)) { return cache[vinU][currentLang]; } else { VtsWebServiceClient client = new VtsWebServiceClient(); try { VehicleCharacteristicsDto resultDto = client.GetVehicleCharacteristics(vinU, (int)TranslationManager.Instance.CurrentLanguageEnum); VehicleCharacteristics result = VehicleCharacteristicsAssembler.FromDtoToDomainObject(resultDto); if (result == null) { return null; } if (!cache.ContainsKey(vinU)) { cache[vinU] = new Dictionary<SupportedLanguage, VehicleCharacteristics>(); } cache[vinU][currentLang] = result; return cache[vinU][currentLang]; } catch (Exception e) { Log.Error(e, CodeBehindStringResolver.Resolve("CouldNotGetVehicleCharacteristicsMessage")); return null; } } }