Add beam shear analysis converting from DTO

This commit is contained in:
Evgeny Redikultsev
2025-06-08 20:02:56 +05:00
parent 0d7f47653b
commit 4845a35ba5
28 changed files with 166 additions and 280 deletions

View File

@@ -1,64 +1,34 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models;
using StructureHelperCommon.Models.Analyses;
using StructureHelperCommon.Models.Loggers;
using StructureHelperLogic.Models.Analyses;
using StructureHelperLogics.Models.Analyses;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DataAccess.DTOs.Converters
{
public class CrossSectionNdmAnalysisFromDTOConvertStrategy : IConvertStrategy<ICrossSectionNdmAnalysis, ICrossSectionNdmAnalysis>
public class CrossSectionNdmAnalysisFromDTOConvertStrategy : ConvertStrategy<ICrossSectionNdmAnalysis, ICrossSectionNdmAnalysis>
{
private IUpdateStrategy<ICrossSectionNdmAnalysis> updateStrategy;
public CrossSectionNdmAnalysisFromDTOConvertStrategy(IUpdateStrategy<ICrossSectionNdmAnalysis> updateStrategy)
public CrossSectionNdmAnalysisFromDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
{
this.updateStrategy = updateStrategy;
}
public CrossSectionNdmAnalysisFromDTOConvertStrategy() : this(new CrossSectionNdmAnalysisUpdateStrategy())
public override ICrossSectionNdmAnalysis GetNewItem(ICrossSectionNdmAnalysis source)
{
ChildClass = this;
GetAnalysis(source);
return NewItem;
}
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
public IShiftTraceLogger TraceLogger { get; set; }
public ICrossSectionNdmAnalysis Convert(ICrossSectionNdmAnalysis source)
private void GetAnalysis(ICrossSectionNdmAnalysis source)
{
try
{
Check();
ICrossSectionNdmAnalysis newItem = GetCrossSectionNDMAnalysis(source);
return newItem;
}
catch (Exception ex)
{
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Error);
TraceLogger?.AddMessage(ex.Message, TraceLogStatuses.Error);
throw;
}
TraceLogger?.AddMessage("Cross-section analysis converting has been started");
updateStrategy ??= new CrossSectionNdmAnalysisUpdateStrategy();
NewItem = new CrossSectionNdmAnalysis(source.Id);
updateStrategy.Update(NewItem, source);
TraceLogger?.AddMessage("Cross-section analysis has been finished successfully");
}
private ICrossSectionNdmAnalysis GetCrossSectionNDMAnalysis(ICrossSectionNdmAnalysis source)
{
TraceLogger?.AddMessage("Cross-section sonverting is started");
CrossSectionNdmAnalysis newItem = new(source.Id);
updateStrategy.Update(newItem, source);
TraceLogger?.AddMessage("Cross-section analysis was obtained successfully");
return newItem;
}
private void Check()
{
var checkLogic = new CheckConvertLogic<ICrossSectionNdmAnalysis, ICrossSectionNdmAnalysis>(this);
checkLogic.Check();
}
}
}