Add beam shear analysis converting from DTO
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class FRMaterialFromDTOConvertStrategy : ConvertStrategy<FRMaterial, FRMaterialDTO>
|
||||
{
|
||||
private IUpdateStrategy<IFRMaterial> updateStrategy;
|
||||
|
||||
public FRMaterialFromDTOConvertStrategy(IUpdateStrategy<IFRMaterial> updateStrategy)
|
||||
{
|
||||
this.updateStrategy = updateStrategy;
|
||||
}
|
||||
|
||||
public FRMaterialFromDTOConvertStrategy() : this(new FRUpdateStrategy())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override FRMaterial GetNewItem(FRMaterialDTO source)
|
||||
{
|
||||
TraceLogger?.AddMessage("Fiber reinforcement material converting is started", TraceLogStatuses.Service);
|
||||
FRMaterial newItem = new(source.MaterialType, source.Id);
|
||||
updateStrategy.Update(newItem, source);
|
||||
TraceLogger?.AddMessage("FiberReinforcement material converting has been finished successfully", TraceLogStatuses.Service);
|
||||
return newItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Loggers;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class FRMaterialToDTOConvertStrategy : IConvertStrategy<FRMaterialDTO, IFRMaterial>
|
||||
{
|
||||
private IUpdateStrategy<IFRMaterial> updateStrategy;
|
||||
|
||||
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||
public IShiftTraceLogger TraceLogger { get; set; }
|
||||
|
||||
public FRMaterialToDTOConvertStrategy(IUpdateStrategy<IFRMaterial> updateStrategy)
|
||||
{
|
||||
this.updateStrategy = updateStrategy;
|
||||
}
|
||||
|
||||
public FRMaterialToDTOConvertStrategy() : this (new FRUpdateStrategy())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public FRMaterialDTO Convert(IFRMaterial source)
|
||||
{
|
||||
Check();
|
||||
try
|
||||
{
|
||||
FRMaterialDTO newItem = new() { Id = source.Id };
|
||||
updateStrategy.Update(newItem, source);
|
||||
return newItem;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Debug);
|
||||
TraceLogger?.AddMessage(ex.Message, TraceLogStatuses.Error);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private void Check()
|
||||
{
|
||||
var checkLogic = new CheckConvertLogic<FRMaterialDTO, IFRMaterial>(this);
|
||||
checkLogic.Check();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public interface IMaterialSafetyFactorDTOLogic
|
||||
{
|
||||
IMaterialPartialFactor GetNewPartialFactorByOld(IMaterialPartialFactor partialFactor);
|
||||
IMaterialSafetyFactor GetNewSafetyFactorByOld(IMaterialSafetyFactor safetyFactor);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Materials;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using StructureHelperCommon.Services;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class LibMaterialDTOUpdateStrategy : IUpdateStrategy<ILibMaterial>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public void Update(ILibMaterial targetObject, ILibMaterial sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(sourceObject);
|
||||
CheckObject.IsNull(targetObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Loggers;
|
||||
using StructureHelperCommon.Models.Materials;
|
||||
|
||||
//Copyright (c) 2025 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||
//All rights reserved.
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public abstract class LibMaterialToDTOConvertStrategy<T,V> : IConvertStrategy<T, V>
|
||||
where T : V
|
||||
where V : ILibMaterial
|
||||
{
|
||||
public abstract IUpdateStrategy<V> UpdateStrategy { get; }
|
||||
public abstract T GetMaterialDTO(V source);
|
||||
//private IUpdateStrategy<ILibMaterial> libMaterialUpdateStrategy = new LibMaterialDTOUpdateStrategy();
|
||||
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||
public IShiftTraceLogger TraceLogger { get; set; }
|
||||
|
||||
public T Convert(V source)
|
||||
{
|
||||
Check();
|
||||
T newItem = GetMaterialDTO(source);
|
||||
try
|
||||
{
|
||||
UpdateStrategy.Update(newItem, source);
|
||||
//libMaterialUpdateStrategy.Update(newItem, source);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Error);
|
||||
TraceLogger?.AddMessage(ex.Message, TraceLogStatuses.Error);
|
||||
throw;
|
||||
}
|
||||
return newItem;
|
||||
}
|
||||
|
||||
|
||||
private void Check()
|
||||
{
|
||||
var checkLogic = new CheckConvertLogic<T, V>(this);
|
||||
checkLogic.Check();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class MaterialSafetyFactorsFromDTOLogic : IMaterialSafetyFactorDTOLogic
|
||||
{
|
||||
public IMaterialSafetyFactor GetNewSafetyFactorByOld(IMaterialSafetyFactor safetyFactor)
|
||||
{
|
||||
MaterialSafetyFactor newItem = new(safetyFactor.Id);
|
||||
return newItem;
|
||||
}
|
||||
public IMaterialPartialFactor GetNewPartialFactorByOld(IMaterialPartialFactor partialFactor)
|
||||
{
|
||||
MaterialPartialFactor newItem = new(partialFactor.Id);
|
||||
return newItem;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user