diff --git a/AsbCloudInfrastructure/Services/WellOperationImport/WellOperationExportService.cs b/AsbCloudInfrastructure/Services/WellOperationImport/WellOperationExportService.cs index e9f1a01f..e4ffd14e 100644 --- a/AsbCloudInfrastructure/Services/WellOperationImport/WellOperationExportService.cs +++ b/AsbCloudInfrastructure/Services/WellOperationImport/WellOperationExportService.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -36,17 +35,15 @@ public class WellOperationExportService : IWellOperationExportService IdWell = idWell }, cancellationToken); - var timezone = wellService.GetTimezone(idWell); - - return MakeExcelFileStream(operations, timezone.Hours); + return MakeExcelFileStream(operations); } - private Stream MakeExcelFileStream(IEnumerable operations, double timezoneOffset) + private Stream MakeExcelFileStream(IEnumerable operations) { using Stream ecxelTemplateStream = wellOperationImportTemplateService.GetExcelTemplateStream(); using var workbook = new XLWorkbook(ecxelTemplateStream, XLEventTracking.Disabled); - AddOperationsToWorkbook(workbook, operations, timezoneOffset); + AddOperationsToWorkbook(workbook, operations); var memoryStream = new MemoryStream(); workbook.SaveAs(memoryStream, new SaveOptions { }); @@ -54,14 +51,14 @@ public class WellOperationExportService : IWellOperationExportService return memoryStream; } - private void AddOperationsToWorkbook(XLWorkbook workbook, IEnumerable operations, double timezoneOffset) + private void AddOperationsToWorkbook(XLWorkbook workbook, IEnumerable operations) { var planOperations = operations.Where(o => o.IdType == 0); if (planOperations.Any()) { var sheetPlan = workbook.Worksheets.FirstOrDefault(ws => ws.Name == DefaultTemplateInfo.SheetNamePlan); if (sheetPlan is not null) - AddOperationsToSheet(sheetPlan, planOperations, timezoneOffset); + AddOperationsToSheet(sheetPlan, planOperations); } var factOperations = operations.Where(o => o.IdType == 1); @@ -69,11 +66,11 @@ public class WellOperationExportService : IWellOperationExportService { var sheetFact = workbook.Worksheets.FirstOrDefault(ws => ws.Name == DefaultTemplateInfo.SheetNameFact); if (sheetFact is not null) - AddOperationsToSheet(sheetFact, factOperations, timezoneOffset); + AddOperationsToSheet(sheetFact, factOperations); } } - private void AddOperationsToSheet(IXLWorksheet sheet, IEnumerable operations, double timezoneOffset) + private void AddOperationsToSheet(IXLWorksheet sheet, IEnumerable operations) { var operationsToArray = operations.ToArray(); @@ -83,19 +80,19 @@ public class WellOperationExportService : IWellOperationExportService for (int i = 0; i < operationsToArray.Length; i++) { var row = sheet.Row(1 + i + DefaultTemplateInfo.HeaderRowsCount); - AddOperationToRow(row, operationsToArray[i], sections, categories, timezoneOffset); + AddOperationToRow(row, operationsToArray[i], sections, categories); } } private static void AddOperationToRow(IXLRow row, WellOperationDto operation, IEnumerable sections, - IEnumerable categories, double timezoneOffset) + IEnumerable categories) { row.Cell(DefaultTemplateInfo.ColumnSection).Value = sections.First(s => s.Id == operation.IdWellSectionType).Caption; row.Cell(DefaultTemplateInfo.ColumnCategory).Value = categories.First(o => o.Id == operation.IdCategory).Name; row.Cell(DefaultTemplateInfo.ColumnCategoryInfo).Value = operation.CategoryInfo; row.Cell(DefaultTemplateInfo.ColumnDepthStart).Value = operation.DepthStart; row.Cell(DefaultTemplateInfo.ColumnDepthEnd).Value = operation.DepthEnd; - row.Cell(DefaultTemplateInfo.ColumnDate).Value = new DateTimeOffset(operation.DateStart).ToRemoteDateTime(timezoneOffset); + row.Cell(DefaultTemplateInfo.ColumnDate).Value = operation.DateStart; row.Cell(DefaultTemplateInfo.ColumnDuration).Value = operation.DurationHours; row.Cell(DefaultTemplateInfo.ColumnComment).Value = operation.Comment; }