DD.WellWorkover.Cloud/AsbCloudInfrastructure/Services/SAUB/TelemetryDataEditorService.cs

85 lines
3.1 KiB
C#
Raw Permalink Normal View History

using AsbCloudApp.Data;
using AsbCloudApp.Data.SAUB;
using AsbCloudApp.Data.WITS;
using AsbCloudApp.Repositories;
using AsbCloudApp.Requests;
using AsbCloudApp.Services;
using System.Threading;
using System.Threading.Tasks;
2024-08-19 10:01:07 +05:00
namespace AsbCloudInfrastructure.Services.SAUB;
/// <summary>
/// Сервис по работе с данными телеметрии
/// </summary>
public class TelemetryDataEditorService : ITelemetryDataEditorService
{
2024-08-19 10:01:07 +05:00
private readonly ITelemetryDataEditorService[] repositories;
/// <summary>
2024-08-19 10:01:07 +05:00
///
/// </summary>
2024-08-19 10:01:07 +05:00
/// <param name="dataSaubService"></param>
/// <param name="dataSpinService"></param>
/// <param name="dataSaubStatRepository"></param>
/// <param name="messageRepository"></param>
2024-08-19 10:01:07 +05:00
/// <param name="drillTestRepository"></param>
/// <param name="limitingParameterRepository"></param>
/// <param name="detectedOperationRepository"></param>
/// <param name="witsRecord1Repository"></param>
/// <param name="witsRecord7Repository"></param>
/// <param name="witsRecord8Repository"></param>
/// <param name="witsRecord50Repository"></param>
/// <param name="witsRecord60Repository"></param>
/// <param name="witsRecord61Repository"></param>
/// <param name="gtrRepository"></param>
public TelemetryDataEditorService(
ITelemetryDataSaubService dataSaubService,
ITelemetryDataService<TelemetryDataSpinDto> dataSpinService,
IDataSaubStatRepository<DataSaubStatDto> dataSaubStatRepository,
IDataSaubStatRepository<DataSaubStatDrillingQualityDto> dataSaubStatDrillingQualityRepository,
IMessageRepository messageRepository,
2024-08-19 10:01:07 +05:00
IDrillTestRepository drillTestRepository,
ILimitingParameterRepository limitingParameterRepository,
IDetectedOperationRepository detectedOperationRepository,
IWitsRecordRepository<Record1Dto> witsRecord1Repository,
IWitsRecordRepository<Record7Dto> witsRecord7Repository,
IWitsRecordRepository<Record8Dto> witsRecord8Repository,
IWitsRecordRepository<Record50Dto> witsRecord50Repository,
IWitsRecordRepository<Record60Dto> witsRecord60Repository,
IWitsRecordRepository<Record61Dto> witsRecord61Repository,
IGtrRepository gtrRepository
)
{
2024-08-19 10:01:07 +05:00
repositories =
[
dataSaubService,
dataSpinService,
dataSaubStatRepository,
dataSaubStatDrillingQualityRepository,
messageRepository,
2024-08-19 10:01:07 +05:00
drillTestRepository,
limitingParameterRepository,
detectedOperationRepository,
witsRecord1Repository,
witsRecord7Repository,
witsRecord8Repository,
witsRecord50Repository,
witsRecord60Repository,
witsRecord61Repository,
gtrRepository,
];
}
2024-08-19 10:01:07 +05:00
public async Task<int> DeleteAsync(TelemetryPartDeleteRequest request, CancellationToken token)
{
var result = 0;
foreach (var repository in repositories)
{
2024-08-19 10:01:07 +05:00
result += await repository.DeleteAsync(request, token);
}
2024-08-19 10:01:07 +05:00
return result;
}
}