using System; using System.Collections.Generic; using System.IO; using System.Linq; using AsbCloudApp.Data.ProcessMaps; using AsbCloudApp.Data.ProcessMaps.Operations; using AsbCloudApp.Repositories; using AsbCloudInfrastructure.Services.ExcelServices.Templates; using AsbCloudInfrastructure.Services.ExcelServices.Templates.ProcessMapPlanTemplates; namespace AsbCloudInfrastructure.Services.ProcessMapPlan.Parser; public class ProcessMapPlanOscillationAnglesParser : ProcessMapPlanParser { public ProcessMapPlanOscillationAnglesParser(IWellOperationRepository wellOperationRepository) : base(wellOperationRepository) { } protected override ITemplateParameters TemplateParameters => new ProcessMapPlanOscillationAnglesTemplate(); protected override ProcessMapPlanOscillationAnglesDto BuildDto(IDictionary row, int rowNumber) { 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; } }