rewrite osago manager

This commit is contained in:
vchikalkin 2021-04-20 11:15:13 +03:00
parent 547b5cd59e
commit 437e6e86a2

View File

@ -1,5 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using ELT.Client.Models.Insurance; using ELT.Client.Models.Insurance;
using ELT.Client.Models.Insurance.Request; using ELT.Client.Models.Insurance.Request;
using ELTOsago; using ELTOsago;
@ -29,17 +31,12 @@ namespace ELT.Client.Managers.Insurance
Password = AuthInfo.Password Password = AuthInfo.Password
}; };
foreach (var companyId in calculateOsagoRequest.CompanyIds) var tasks = calculateOsagoRequest.CompanyIds.Distinct().Select(companyId => new Task(() =>
try {
{ var res = _eltOsagoSoap.OSAGOFullCalculation(osagoParams);
var res = _eltOsagoSoap.OSAGOFullCalculation(osagoParams); if (string.IsNullOrEmpty(res.Error))
if (string.IsNullOrEmpty(res.Error)) result.Add(companyId, res);
result.Add(companyId, res); }));
}
catch (Exception)
{
// ignored
}
return result; return result;
} }