using AsbCloudApp.Data; using AsbCloudApp.Repositories; using AsbCloudApp.Services; using ClosedXML.Excel; namespace AsbCloudInfrastructure.Services.Trajectory { public class PlannedTrajectoryImportService : TrajectoryImportService { /* * password for PlannedTrajectoryTemplate.xlsx is Drill2022 */ public override string templateFileName { get; set; } = "PlannedTrajectoryTemplate.xlsx"; public override string usingTemplateFile { get; set; } = "AsbCloudInfrastructure.Services.Trajectory.Templates"; public override string sheetNamePlannedTrajectory { get; set; } = "Плановая траектория"; public override int headerRowsCount { get; set; } = 2; public override int ColumnWellboreDepth { get; set; } = 1; public override int ColumnZenithAngle { get; set; } = 2; public override int ColumnAzimuthGeo { get; set; } = 3; public override int ColumnAzimuthMagnetic { get; set; } = 4; public override int ColumnVerticalDepth { get; set; } = 5; public override int ColumnRadius { get; set; } = 6; public override int ColumnComment { get; set; } = 7; public PlannedTrajectoryImportService( IWellService wellService, ITrajectoryEditableRepository plannedTrajectoryService) : base(plannedTrajectoryService, wellService) { } protected override TrajectoryGeoPlanDto ParseRow(IXLRow row) { var trajectoryRow = new TrajectoryGeoPlanDto { WellboreDepth = row.Cell(ColumnWellboreDepth).GetCellValue(), ZenithAngle = row.Cell(ColumnZenithAngle).GetCellValue(), AzimuthGeo = row.Cell(ColumnAzimuthGeo).GetCellValue(), AzimuthMagnetic = row.Cell(ColumnAzimuthMagnetic).GetCellValue(), VerticalDepth = row.Cell(ColumnVerticalDepth).GetCellValue(), Radius = row.Cell(ColumnRadius).GetCellValue(), Comment = row.Cell(ColumnComment).GetCellValue() }; return trajectoryRow; } protected override void AddCoordinatesToRow(IXLRow row, TrajectoryGeoPlanDto trajectory) { row.Cell(ColumnWellboreDepth).Value = trajectory.WellboreDepth; row.Cell(ColumnZenithAngle).Value = trajectory.ZenithAngle; row.Cell(ColumnAzimuthGeo).Value = trajectory.AzimuthGeo; row.Cell(ColumnAzimuthMagnetic).Value = trajectory.AzimuthMagnetic; row.Cell(ColumnVerticalDepth).Value = trajectory.VerticalDepth; row.Cell(ColumnRadius).Value = trajectory.Radius; row.Cell(ColumnComment).Value = trajectory.Comment; } } }