DD.WellWorkover.Cloud/AsbCloudInfrastructure/Services/ProcessMapPlan/Parser/ProcessMapPlanParser.cs
2024-03-14 08:03:57 +03:00

38 lines
1.0 KiB
C#

using System.Collections.Generic;
using System.IO;
using AsbCloudApp.Data;
using AsbCloudApp.Data.ProcessMaps;
using AsbCloudApp.Repositories;
using AsbCloudApp.Requests.ParserOptions;
using AsbCloudInfrastructure.Services.ExcelServices;
namespace AsbCloudInfrastructure.Services.ProcessMapPlan.Parser;
public abstract class ProcessMapPlanParser<TDto> : ParserExcelService<TDto, WellRelatedParserRequest>
where TDto : ProcessMapPlanBaseDto
{
protected readonly IEnumerable<WellSectionTypeDto> sections;
protected ProcessMapPlanParser(IWellOperationRepository wellOperationRepository)
{
sections = wellOperationRepository.GetSectionTypes();
}
public override ParserResultDto<TDto> Parse(Stream file, WellRelatedParserRequest options)
{
var result = base.Parse(file, options);
foreach (var item in result.Item)
item.Item.IdWell = options.IdWell;
return result;
}
protected static int? GetIdMode(string? modeName) =>
modeName?.Trim().ToLower() switch
{
"ротор" => 1,
"слайд" => 2,
_ => null
};
}