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

38 lines
1.0 KiB
C#
Raw Normal View History

using System.Collections.Generic;
using System.IO;
using AsbCloudApp.Data;
2024-02-21 15:08:51 +05:00
using AsbCloudApp.Data.ProcessMaps;
using AsbCloudApp.Repositories;
using AsbCloudApp.Requests.ParserOptions;
using AsbCloudInfrastructure.Services.ExcelServices;
2024-02-09 11:32:31 +05:00
namespace AsbCloudInfrastructure.Services.ProcessMapPlan.Parser;
public abstract class ProcessMapPlanParser<TDto> : ParserExcelService<TDto, WellRelatedParserRequest>
2024-02-09 11:32:31 +05:00
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;
}
2024-02-09 11:32:31 +05:00
protected static int? GetIdMode(string? modeName) =>
modeName?.Trim().ToLower() switch
{
"ротор" => 1,
"слайд" => 2,
_ => null
};
}