private void ServiceOnGetAnalyticRuleSettingsByTypeCompleted(object sender, GetAnalyticRuleSettingsByTypeCompletedEventArgs e) { if (e.Error != null) { errorCallback.Invoke(e.Error, e.Error.Message); } else { List <AnalyticRuleSettings> result = new List <AnalyticRuleSettings>(); foreach (AnalyticRuleSettingsDto ruleSettingsDto in e.Result) { result.Add(AnalyticRuleSettingsAssembler.FromDtoToDomainObject(ruleSettingsDto)); } collectionFetchedCallback.Invoke(result); } }
private void ServiceOnGetAnalyticRuleSettingsByTypeEngineFamilyAndEngineTypeCompleted(object sender, GetAnalyticRuleSettingsByTypeEngineFamilyAndEngineTypeCompletedEventArgs e) { if (e.Error != null) { errorCallback.Invoke(e.Error, e.Error.Message); } else { if (e.Result.Count == 0) { singleFetchedCallback.Invoke(null); return; } singleFetchedCallback.Invoke(AnalyticRuleSettingsAssembler.FromDtoToDomainObject(e.Result.First())); } }
private void ServiceOnGetAnalyticRuleSettingsCompleted(object sender, GetAnalyticRuleSettingsCompletedEventArgs e) { if (e.Error != null) { ErrorCallback(e.Error, e.Error.Message); } else { result.Clear(); foreach (AnalyticRuleSettingsDto dto in e.Result) { result.Add(AnalyticRuleSettingsAssembler.FromDtoToDomainObject(dto)); } SuccessCallback(); } }
public static List <AnalyticRuleSettings> GetSettings(string vin) { string vinU = vin.ToUpper(); if (!RuleSettingsForVinCache.ContainsKey(vinU)) { try { VtsWebServiceClient service = new VtsWebServiceClient(); List <AnalyticRuleSettings> result = new List <AnalyticRuleSettings>(); foreach (AnalyticRuleSettingsDto dto in service.GetAllSettingsForVehicle(vinU)) { result.Add(AnalyticRuleSettingsAssembler.FromDtoToDomainObject(dto)); } RuleSettingsForVinCache[vinU] = result; } catch (Exception e) { Log.Error(e, "Can not get settings."); return(new List <AnalyticRuleSettings>()); // empty } } return(RuleSettingsForVinCache[vinU]); }