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