DD.WellWorkover.Cloud/AsbCloudInfrastructure/Services/ProcessMapPlan/Parser/ProcessMapPlanShockTestParser.cs

42 lines
1.3 KiB
C#
Raw Normal View History

2024-06-26 11:42:10 +05:00
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using AsbCloudApp.Data.ProcessMaps;
using AsbCloudApp.Repositories;
using AsbCloudInfrastructure.Services.ExcelServices.Templates;
using AsbCloudInfrastructure.Services.ExcelServices.Templates.ProcessMapPlanTemplates;
namespace AsbCloudInfrastructure.Services.ProcessMapPlan.Parser;
2024-06-29 23:24:53 +05:00
public class ProcessMapPlanShockTestParser : ProcessMapPlanParser<ProcessMapPlanShockTestDto>
2024-06-26 11:42:10 +05:00
{
2024-06-29 23:24:53 +05:00
public ProcessMapPlanShockTestParser(IWellOperationRepository wellOperationRepository)
2024-06-26 11:42:10 +05:00
: base(wellOperationRepository)
{
}
2024-06-29 23:24:53 +05:00
protected override ITemplateParameters TemplateParameters => new ProcessMapPlanShockTestTemplate();
2024-06-26 11:42:10 +05:00
2024-06-29 23:24:53 +05:00
protected override ProcessMapPlanShockTestDto BuildDto(IDictionary<string, object?> row, int rowNumber)
2024-06-26 11:42:10 +05:00
{
var dto = base.BuildDto(row, rowNumber);
var section = sections.FirstOrDefault(s =>
string.Equals(s.Caption.Trim(), dto.Section?.Trim(), StringComparison.CurrentCultureIgnoreCase));
if (section is null)
{
var message = string.Format(XLExtentions.ProblemDetailsTemplate,
TemplateParameters.SheetName,
rowNumber,
TemplateParameters.Cells[nameof(ProcessMapPlanBaseDto.Section)],
"Указана некорректная секция");
throw new FileFormatException(message);
}
dto.IdWellSectionType = section.Id;
return dto;
}
}