forked from ddrilling/AsbCloudServer
Убран лишний код
This commit is contained in:
parent
96b96a0a22
commit
878dfb3daa
@ -1,39 +0,0 @@
|
||||
using AsbCloudApp.Data.WellOperation;
|
||||
using AsbCloudApp.Repositories;
|
||||
using AsbCloudApp.Requests;
|
||||
using AsbCloudApp.Requests.ExportOptions;
|
||||
using AsbCloudApp.Services;
|
||||
using AsbCloudInfrastructure.Repository;
|
||||
using AsbCloudInfrastructure.Services.ExcelServices.Templates;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudInfrastructure.Services.ExcelServices
|
||||
{
|
||||
public class ExcelTemplateService<TTemplate> : ExcelExportService<WellOperationCategoryDto, WellOperationExportRequest, TTemplate>
|
||||
where TTemplate : class, ITemplateParameters, new()
|
||||
{
|
||||
private readonly IWellOperationCategoryRepository wellOperationCategoryRepository;
|
||||
|
||||
public ExcelTemplateService(IWellOperationCategoryRepository wellOperationCategoryRepository,
|
||||
IWellService wellService)
|
||||
{
|
||||
this.wellOperationCategoryRepository = wellOperationCategoryRepository;
|
||||
}
|
||||
|
||||
protected override async Task<string> BuildFileNameAsync(WellOperationExportRequest options, CancellationToken token)
|
||||
{
|
||||
return "WellOperationFactTemplate";
|
||||
}
|
||||
|
||||
protected override async Task<IEnumerable<WellOperationCategoryDto>> GetDtosAsync(WellOperationExportRequest options, CancellationToken token)
|
||||
{
|
||||
var dtos = wellOperationCategoryRepository.Get(false);
|
||||
return dtos;
|
||||
}
|
||||
}
|
||||
}
|
@ -71,7 +71,7 @@ namespace AsbCloudInfrastructure.Services
|
||||
return DateTimeOffset.MinValue;
|
||||
|
||||
var datesRange = telemetryService.GetDatesRange(well.IdTelemetry.Value);
|
||||
return datesRange.To;
|
||||
return datesRange.To.DateTime;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
@ -51,7 +51,6 @@ public class WellOperationController : ControllerBase
|
||||
IUserRepository userRepository,
|
||||
WellOperationParserFactory wellOperationParserFactory,
|
||||
WellOperationExportServiceFactory wellOperationExportServiceFactory)
|
||||
//IExportService<WellRelatedExportRequest> templateService
|
||||
{
|
||||
this.wellOperationRepository = wellOperationRepository;
|
||||
this.wellOperationCategoryRepository = wellOperationCategoryRepository;
|
||||
@ -59,8 +58,6 @@ public class WellOperationController : ControllerBase
|
||||
this.userRepository = userRepository;
|
||||
this.wellOperationParserFactory = wellOperationParserFactory;
|
||||
this.wellOperationExportServiceFactory = wellOperationExportServiceFactory;
|
||||
//this.templateService = templateService;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -324,19 +321,12 @@ public class WellOperationController : ControllerBase
|
||||
[HttpGet("template")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType(typeof(PhysicalFileResult), StatusCodes.Status200OK, "application/octet-stream")]
|
||||
public async Task<IActionResult> GetTemplate(int idType)
|
||||
{
|
||||
public IActionResult GetTemplate(int idType)
|
||||
{
|
||||
var parser = wellOperationParserFactory.CreateParser<WellOperationParserRequest>(idType);
|
||||
var stream = parser.GetTemplateFile();
|
||||
|
||||
//using var workbook = new XLWorkbook(stream);
|
||||
//AddDtosToWorkbook(workbook, dtos);
|
||||
|
||||
return File(stream, "application/octet-stream", templateNames[idType]);
|
||||
|
||||
//var exportOptions = new WellRelatedExportRequest(5);
|
||||
//var (fileName, file) = await templateService.ExportAsync(exportOptions, CancellationToken.None);
|
||||
//return File(file, "application/octet-stream", fileName);
|
||||
}
|
||||
|
||||
private async Task<bool> CanUserAccessToWellAsync(int idWell, CancellationToken token)
|
||||
|
@ -7,10 +7,10 @@
|
||||
}
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"DefaultConnection": "Host=localhost;Database=postgres2;Username=postgres;Password=q;Persist Security Info=True",
|
||||
"DebugConnection": "Host=localhost;Database=postgres2;Username=postgres;Password=q;Persist Security Info=True;Include Error Detail=True",
|
||||
"DefaultConnection": "Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True",
|
||||
"DebugConnection": "Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True;Include Error Detail=True",
|
||||
"TestConnection": "Host=localhost;Database=test;Username=postgres;Password=q;Persist Security Info=True;Include Error Detail=True",
|
||||
"LocalConnection": "Host=localhost;Database=postgres2;Username=postgres;Password=q;Persist Security Info=True"
|
||||
"LocalConnection": "Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True"
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"ContentPath": "../data",
|
||||
|
Loading…
Reference in New Issue
Block a user