2023-12-25 15:47:03 +05:00
|
|
|
|
using AsbCloudApp.Requests;
|
2023-12-25 10:53:45 +05:00
|
|
|
|
using AsbCloudApp.Services;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace AsbCloudInfrastructure.Background
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Класс для создания отчета
|
|
|
|
|
/// </summary>
|
|
|
|
|
internal class WorkToCreateReport : Work
|
|
|
|
|
{
|
|
|
|
|
private int idWell;
|
|
|
|
|
private int idUser;
|
2023-12-25 15:47:03 +05:00
|
|
|
|
private ReportParametersRequest request;
|
2023-12-25 10:53:45 +05:00
|
|
|
|
private Action<object, string> progressHandler;
|
|
|
|
|
|
|
|
|
|
public WorkToCreateReport(int idWell, int idUser, ReportParametersRequest request, Action<object, string> progressHandler) : base("")
|
|
|
|
|
{
|
|
|
|
|
this.idWell = idWell;
|
|
|
|
|
this.idUser = idUser;
|
2023-12-25 15:47:03 +05:00
|
|
|
|
this.request = request;
|
2023-12-25 10:53:45 +05:00
|
|
|
|
this.progressHandler = progressHandler;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected override async Task Action(string id, IServiceProvider services, Action<string, double?> onProgress, CancellationToken token)
|
|
|
|
|
{
|
2023-12-25 15:47:03 +05:00
|
|
|
|
var reportService = services.GetRequiredService<IReportService>();
|
|
|
|
|
await reportService.CreateReportAsync(idWell, idUser, request, progressHandler, token);
|
2023-12-25 10:53:45 +05:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|