using AsbCloudApp.Data; using AsbCloudApp.Repositories; using AsbCloudApp.Services; using ClosedXML.Excel; namespace AsbCloudInfrastructure.Services.Trajectory { public class FactTrajectoryImportService : TrajectoryImportService<TrajectoryGeoFactDto> { public override string templateFileName { get; set; } = "FactTrajectoryTemplate.xlsx"; public override string usingTemplateFile { get; set; } = "AsbCloudInfrastructure.Services.Trajectory"; 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 FactTrajectoryImportService( IWellService wellService, ITrajectoryEditableRepository<TrajectoryGeoFactDto> factTrajectoryService) : base(factTrajectoryService, wellService) { } protected override void AddCoordinatesToRow(IXLRow row, TrajectoryGeoFactDto 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; } protected override TrajectoryGeoFactDto ParseRow(IXLRow row) { var trajectoryRow = new TrajectoryGeoFactDto { WellboreDepth = row.Cell(ColumnWellboreDepth).GetCellValue<double>(), ZenithAngle = row.Cell(ColumnZenithAngle).GetCellValue<double>(), AzimuthGeo = row.Cell(ColumnAzimuthGeo).GetCellValue<double>(), AzimuthMagnetic = row.Cell(ColumnAzimuthMagnetic).GetCellValue<double>(), VerticalDepth = row.Cell(ColumnVerticalDepth).GetCellValue<double>(), Radius = row.Cell(ColumnRadius).GetCellValue<double>(), Comment = row.Cell(ColumnComment).GetCellValue<string?>() }; return trajectoryRow; } } }