Add converting beam shear analysis from DTOs

This commit is contained in:
Evgeny Redikultsev
2025-06-15 21:11:02 +05:00
parent 4845a35ba5
commit 87996cf37b
48 changed files with 992 additions and 105 deletions

View File

@@ -0,0 +1,38 @@
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Services;
using StructureHelperLogics.Models.BeamShears;
namespace DataAccess.DTOs
{
public class BeamShearFromDTOConvertStrategy : ConvertStrategy<BeamShear, BeamShearDTO>
{
private IUpdateStrategy<IBeamShear> updateStrategy;
public BeamShearFromDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
{
}
public override BeamShear GetNewItem(BeamShearDTO source)
{
ChildClass = this;
CheckObject.IsNull(source);
CheckObject.IsNull(source.Repository);
GetNewBeamShear(source);
return NewItem;
}
private void GetNewBeamShear(IBeamShear source)
{
if (source.Repository is not BeamShearRepositoryDTO repositoryDTO)
{
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(source.Repository));
}
updateStrategy ??= new BeamShearUpdateStrategy();
NewItem = new(source.Id);
updateStrategy.Update(NewItem, source);
BeamShearRepositoryFromDTOConvertStrategy convertStrategy = new(this);
NewItem.Repository = convertStrategy.Convert(repositoryDTO);
}
}
}