forked from ddrilling/AsbCloudServer
38 lines
1.3 KiB
C#
38 lines
1.3 KiB
C#
using System.IO;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using AsbCloudApp.Data;
|
|
using AsbCloudApp.Repositories;
|
|
using AsbCloudApp.Requests;
|
|
using AsbCloudApp.Services;
|
|
using AsbCloudInfrastructure.Services.ExcelServices;
|
|
|
|
namespace AsbCloudInfrastructure.Services.ProcessMapPlan.Export;
|
|
|
|
public abstract class ProcessMapPlanExportService<TDto> : ExportExcelService<TDto>,
|
|
IProcessMapPlanExportService
|
|
where TDto : ChangeLogAbstract
|
|
{
|
|
protected readonly IWellService wellService;
|
|
|
|
private readonly IChangeLogRepository<TDto, ProcessMapPlanBaseRequestWithWell> processMapPlanRepository;
|
|
|
|
protected ProcessMapPlanExportService(IChangeLogRepository<TDto, ProcessMapPlanBaseRequestWithWell> processMapPlanRepository,
|
|
IWellService wellService)
|
|
{
|
|
this.processMapPlanRepository = processMapPlanRepository;
|
|
this.wellService = wellService;
|
|
}
|
|
|
|
public async Task<(string FileName, Stream File)> ExportAsync(int idWell, CancellationToken token)
|
|
{
|
|
var request = new ProcessMapPlanBaseRequestWithWell(idWell);
|
|
var dtos = await processMapPlanRepository.Get(request, token);
|
|
|
|
var fileName = await BuildFileNameAsync(idWell, token);
|
|
var file = Export(dtos);
|
|
return (fileName, file);
|
|
}
|
|
|
|
protected abstract Task<string> BuildFileNameAsync(int idWell, CancellationToken token);
|
|
} |