Add converting strategies for beam shear actions
This commit is contained in:
57
DataAccess/DTOs/Converters/BeamShearActionConvertStrategy.cs
Normal file
57
DataAccess/DTOs/Converters/BeamShearActionConvertStrategy.cs
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperCommon.Models.Forces.BeamShearActions;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs
|
||||||
|
{
|
||||||
|
public class BeamShearActionConvertStrategy : ConvertStrategy<BeamShearActionDTO, IBeamShearAction>
|
||||||
|
{
|
||||||
|
private IUpdateStrategy<IBeamShearAction> updateStrategy;
|
||||||
|
private IConvertStrategy<FactoredForceTupleDTO, IFactoredForceTuple> factoredTupleConvertStrategy;
|
||||||
|
private IConvertStrategy<BeamShearAxisActionDTO, IBeamShearAxisAction> axisActionConvertStrategy;
|
||||||
|
|
||||||
|
public BeamShearActionConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public BeamShearActionConvertStrategy(Dictionary<(Guid id, Type type), ISaveable> referenceDictionary, IShiftTraceLogger traceLogger)
|
||||||
|
: base(referenceDictionary, traceLogger)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override BeamShearActionDTO GetNewItem(IBeamShearAction source)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
GetNewBeamAction(source);
|
||||||
|
return NewItem;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
TraceErrorByEntity(this, ex.Message);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GetNewBeamAction(IBeamShearAction source)
|
||||||
|
{
|
||||||
|
TraceLogger?.AddMessage($"Converting of beam shear action Id = {source.Id} has been started", TraceLogStatuses.Debug);
|
||||||
|
InitializeStrategies();
|
||||||
|
NewItem = new(source.Id);
|
||||||
|
updateStrategy.Update(NewItem, source);
|
||||||
|
NewItem.ExternalForce = factoredTupleConvertStrategy.Convert(source.ExternalForce);
|
||||||
|
NewItem.SupportAction = axisActionConvertStrategy.Convert(source.SupportAction);
|
||||||
|
TraceLogger?.AddMessage($"Converting of beam shear action Id = {NewItem.Id} has been finished", TraceLogStatuses.Debug);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitializeStrategies()
|
||||||
|
{
|
||||||
|
updateStrategy ??= new BeamShearActionUpdateStrategy();
|
||||||
|
factoredTupleConvertStrategy = new DictionaryConvertStrategy<FactoredForceTupleDTO, IFactoredForceTuple>
|
||||||
|
(this, new FactoredForceTupleToDTOConvertStrategy(this));
|
||||||
|
axisActionConvertStrategy = new DictionaryConvertStrategy<BeamShearAxisActionDTO, IBeamShearAxisAction>
|
||||||
|
(this, new BeamShearAxisActionToDTOConvertStrategy(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,12 +1,15 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using StructureHelperCommon.Models;
|
using StructureHelperCommon.Models;
|
||||||
|
using StructureHelperCommon.Models.Analyses;
|
||||||
using StructureHelperLogics.Models.Analyses;
|
using StructureHelperLogics.Models.Analyses;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces.LimitCurve;
|
||||||
|
|
||||||
namespace DataAccess.DTOs
|
namespace DataAccess.DTOs
|
||||||
{
|
{
|
||||||
public class BeamShearAnalysisToDTOConvertStrategy : ConvertStrategy<BeamShearAnalysisDTO, IBeamShearAnalysis>
|
public class BeamShearAnalysisToDTOConvertStrategy : ConvertStrategy<BeamShearAnalysisDTO, IBeamShearAnalysis>
|
||||||
{
|
{
|
||||||
private IUpdateStrategy<IBeamShearAnalysis> updateStrategy;
|
private IUpdateStrategy<IBeamShearAnalysis> updateStrategy;
|
||||||
|
private IConvertStrategy<VersionProcessorDTO, IVersionProcessor> convertStrategy;
|
||||||
|
|
||||||
public BeamShearAnalysisToDTOConvertStrategy(Dictionary<(Guid id, Type type), ISaveable> referenceDictionary, IShiftTraceLogger traceLogger) : base(referenceDictionary, traceLogger)
|
public BeamShearAnalysisToDTOConvertStrategy(Dictionary<(Guid id, Type type), ISaveable> referenceDictionary, IShiftTraceLogger traceLogger) : base(referenceDictionary, traceLogger)
|
||||||
{
|
{
|
||||||
@@ -17,8 +20,7 @@ namespace DataAccess.DTOs
|
|||||||
updateStrategy ??= new BeamShearAnalysisUpdateStrategy();
|
updateStrategy ??= new BeamShearAnalysisUpdateStrategy();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
NewItem = new(source.Id);
|
GetNewAnalysis(source);
|
||||||
updateStrategy.Update(NewItem, source);
|
|
||||||
return NewItem;
|
return NewItem;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -27,5 +29,26 @@ namespace DataAccess.DTOs
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void GetNewAnalysis(IBeamShearAnalysis source)
|
||||||
|
{
|
||||||
|
TraceLogger?.AddMessage($"Converting beam shear analysis id = {source.Id} has been started");
|
||||||
|
InitializeStrategies();
|
||||||
|
NewItem = new(source.Id);
|
||||||
|
updateStrategy.Update(NewItem, source);
|
||||||
|
NewItem.VersionProcessor = convertStrategy.Convert(source.VersionProcessor);
|
||||||
|
TraceLogger?.AddMessage($"Converting beam shear analysis id = {NewItem.Id} has done successfully");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitializeStrategies()
|
||||||
|
{
|
||||||
|
updateStrategy ??= new BeamShearAnalysisUpdateStrategy();
|
||||||
|
convertStrategy = new DictionaryConvertStrategy<VersionProcessorDTO, IVersionProcessor>()
|
||||||
|
{
|
||||||
|
ReferenceDictionary = ReferenceDictionary,
|
||||||
|
ConvertStrategy = new VersionProcessorToDTOConvertStrategy(ReferenceDictionary, TraceLogger),
|
||||||
|
TraceLogger = TraceLogger
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperCommon.Models.Forces.BeamShearActions;
|
||||||
|
|
||||||
|
//Copyright (c) 2025 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs
|
||||||
|
{
|
||||||
|
public class BeamShearAxisActionToDTOConvertStrategy : ConvertStrategy<BeamShearAxisActionDTO, IBeamShearAxisAction>
|
||||||
|
{
|
||||||
|
private IUpdateStrategy<IBeamShearAxisAction> updateStrategy;
|
||||||
|
private IConvertStrategy<FactoredForceTupleDTO, IFactoredForceTuple> factoredTupleConvertStrategy;
|
||||||
|
private IConvertStrategy<IBeamSpanLoad, IBeamSpanLoad> spanLoadConvertStrategy;
|
||||||
|
|
||||||
|
public BeamShearAxisActionToDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override BeamShearAxisActionDTO GetNewItem(IBeamShearAxisAction source)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
GetNewBeamAction(source);
|
||||||
|
return NewItem;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
TraceErrorByEntity(this, ex.Message);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GetNewBeamAction(IBeamShearAxisAction source)
|
||||||
|
{
|
||||||
|
TraceLogger?.AddMessage($"Converting of beam shear action Id = {source.Id} has been started", TraceLogStatuses.Debug);
|
||||||
|
InitializeStrategies();
|
||||||
|
NewItem = new(source.Id);
|
||||||
|
updateStrategy.Update(NewItem, source);
|
||||||
|
NewItem.SupportForce = factoredTupleConvertStrategy.Convert(source.SupportForce);
|
||||||
|
NewItem.ShearLoads.Clear();
|
||||||
|
foreach (var spanLoad in source.ShearLoads)
|
||||||
|
{
|
||||||
|
var newSpanLoad = spanLoadConvertStrategy.Convert(spanLoad);
|
||||||
|
NewItem.ShearLoads.Add(newSpanLoad);
|
||||||
|
}
|
||||||
|
TraceLogger?.AddMessage($"Converting of beam shear action Id = {source.Id} has been finished", TraceLogStatuses.Debug);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitializeStrategies()
|
||||||
|
{
|
||||||
|
updateStrategy ??= new BeamShearAxisActionUpdateStrategy();
|
||||||
|
factoredTupleConvertStrategy = new DictionaryConvertStrategy<FactoredForceTupleDTO, IFactoredForceTuple>
|
||||||
|
(this, new FactoredForceTupleToDTOConvertStrategy(this));
|
||||||
|
spanLoadConvertStrategy = new DictionaryConvertStrategy<IBeamSpanLoad, IBeamSpanLoad>
|
||||||
|
(this, new BeamSpanLoadToDTOConvertStrategy(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
using DataAccess.DTOs.Converters;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperCommon.Models.Forces.BeamShearActions;
|
||||||
|
using StructureHelperLogics.Models.BeamShears;
|
||||||
|
|
||||||
|
//Copyright (c) 2025 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs
|
||||||
|
{
|
||||||
|
public class BeamShearRepositoryToDTOConvertStrategy : ConvertStrategy<BeamShearRepositoryDTO, IBeamShearRepository>
|
||||||
|
{
|
||||||
|
private IUpdateStrategy<IHasBeamShearActions> actionUpdateStrategy;
|
||||||
|
private IUpdateStrategy<IHasBeamShearSections> sectionUpdateStrategy;
|
||||||
|
|
||||||
|
public BeamShearRepositoryToDTOConvertStrategy(Dictionary<(Guid id, Type type), ISaveable> referenceDictionary, IShiftTraceLogger traceLogger) : base(referenceDictionary, traceLogger)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override BeamShearRepositoryDTO GetNewItem(IBeamShearRepository source)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
GetNewBeamRepository(source);
|
||||||
|
return NewItem;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
TraceErrorByEntity(this, ex.Message);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GetNewBeamRepository(IBeamShearRepository source)
|
||||||
|
{
|
||||||
|
TraceLogger?.AddMessage($"Converting of beam shear repository Id = {source.Id} has been started", TraceLogStatuses.Debug);
|
||||||
|
InitializeStrategies();
|
||||||
|
NewItem = new(source.Id);
|
||||||
|
actionUpdateStrategy.Update(NewItem, source);
|
||||||
|
sectionUpdateStrategy.Update(NewItem, source);
|
||||||
|
TraceLogger?.AddMessage($"Converting of beam shear repository Id = {NewItem.Id} has been finished", TraceLogStatuses.Service);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitializeStrategies()
|
||||||
|
{
|
||||||
|
actionUpdateStrategy ??= new HasBeamShearActionToDTOConvertStrategy(ReferenceDictionary, TraceLogger);
|
||||||
|
sectionUpdateStrategy ??= new HasBeamShearSectionConvertStrategy(ReferenceDictionary, TraceLogger);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
53
DataAccess/DTOs/Converters/BeamShearToDTOConvertStrategy.cs
Normal file
53
DataAccess/DTOs/Converters/BeamShearToDTOConvertStrategy.cs
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using StructureHelperLogics.Models.BeamShears;
|
||||||
|
|
||||||
|
//Copyright (c) 2025 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs
|
||||||
|
{
|
||||||
|
public class BeamShearToDTOConvertStrategy : ConvertStrategy<BeamShearDTO, IBeamShear>
|
||||||
|
{
|
||||||
|
private IUpdateStrategy<IBeamShear> updateStrategy;
|
||||||
|
private IConvertStrategy<BeamShearRepositoryDTO, IBeamShearRepository> repositoryConvertStrategy;
|
||||||
|
public BeamShearToDTOConvertStrategy(Dictionary<(Guid id, Type type), ISaveable> referenceDictionary, IShiftTraceLogger traceLogger)
|
||||||
|
: base(referenceDictionary, traceLogger)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override BeamShearDTO GetNewItem(IBeamShear source)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
GetNewBeamShear(source);
|
||||||
|
return NewItem;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
TraceErrorByEntity(this, ex.Message);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GetNewBeamShear(IBeamShear source)
|
||||||
|
{
|
||||||
|
TraceLogger?.AddMessage($"Converting of beam shear Id = {source.Id} has been started");
|
||||||
|
InitializeStrategies();
|
||||||
|
NewItem = new(source.Id);
|
||||||
|
updateStrategy.Update(NewItem, source);
|
||||||
|
NewItem.Repository = repositoryConvertStrategy.Convert(source.Repository);
|
||||||
|
TraceLogger?.AddMessage($"Converting of beam shear Id = {NewItem.Id} has been finished successfully");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitializeStrategies()
|
||||||
|
{
|
||||||
|
updateStrategy ??= new BeamShearUpdateStrategy();
|
||||||
|
repositoryConvertStrategy = new DictionaryConvertStrategy<BeamShearRepositoryDTO, IBeamShearRepository>(
|
||||||
|
ReferenceDictionary,
|
||||||
|
TraceLogger,
|
||||||
|
new BeamShearRepositoryToDTOConvertStrategy(ReferenceDictionary, TraceLogger)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
using DataAccess.DTOs.DTOEntities;
|
||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs
|
||||||
|
{
|
||||||
|
public class BeamSpanLoadToDTOConvertStrategy : ConvertStrategy<IBeamSpanLoad, IBeamSpanLoad>
|
||||||
|
{
|
||||||
|
public BeamSpanLoadToDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override IBeamSpanLoad GetNewItem(IBeamSpanLoad source)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
GetNewBeamAction(source);
|
||||||
|
return NewItem;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
TraceErrorByEntity(this, ex.Message);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GetNewBeamAction(IBeamSpanLoad source)
|
||||||
|
{
|
||||||
|
TraceLogger?.AddMessage($"Converting of beam shear action Id = {source.Id} has been started", TraceLogStatuses.Debug);
|
||||||
|
if (source is IDistributedLoad distributedLoad)
|
||||||
|
{
|
||||||
|
ProcessDistributedLoad(distributedLoad);
|
||||||
|
}
|
||||||
|
else if (source is IConcentratedForce concentratedForce)
|
||||||
|
{
|
||||||
|
ProcessConcentratedForce(concentratedForce);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(source) + ": type of span load");
|
||||||
|
}
|
||||||
|
TraceLogger?.AddMessage($"Converting of beam shear action Id = {source.Id} has been finished", TraceLogStatuses.Debug);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProcessConcentratedForce(IConcentratedForce concentratedForce)
|
||||||
|
{
|
||||||
|
var convertStrategy = new DictionaryConvertStrategy<ConcentratedForceDTO, IConcentratedForce>
|
||||||
|
(this, new ConcentratedForceToDTOConvertStrategy(this));
|
||||||
|
ConcentratedForceDTO concentratedForceDTO = convertStrategy.Convert(concentratedForce);
|
||||||
|
NewItem = concentratedForceDTO;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProcessDistributedLoad(IDistributedLoad distributedLoad)
|
||||||
|
{
|
||||||
|
var convertStrategy = new DictionaryConvertStrategy<DistributedLoadDTO, IDistributedLoad>
|
||||||
|
(this, new DistributedLoadToDTOConvertStrategy(this));
|
||||||
|
DistributedLoadDTO distributedLoadDTO = convertStrategy.Convert(distributedLoad);
|
||||||
|
NewItem = distributedLoadDTO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperCommon.Models.Forces.BeamShearActions;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs
|
||||||
|
{
|
||||||
|
public class ConcentratedForceToDTOConvertStrategy : ConvertStrategy<ConcentratedForceDTO, IConcentratedForce>
|
||||||
|
{
|
||||||
|
private IUpdateStrategy<IConcentratedForce> updateStrategy;
|
||||||
|
private IConvertStrategy<ForceTupleDTO, IForceTuple> tupleConvertStrategy;
|
||||||
|
private IConvertStrategy<FactoredCombinationPropertyDTO, IFactoredCombinationProperty> combinationConvertStrategy;
|
||||||
|
|
||||||
|
public ConcentratedForceToDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override ConcentratedForceDTO GetNewItem(IConcentratedForce source)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
GetNewConcentratedForce(source);
|
||||||
|
return NewItem;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
TraceErrorByEntity(this, ex.Message);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GetNewConcentratedForce(IConcentratedForce source)
|
||||||
|
{
|
||||||
|
TraceLogger?.AddMessage($"Concentrated force converting Id = {source.Id} has been started", TraceLogStatuses.Debug);
|
||||||
|
InitializeStrategies();
|
||||||
|
NewItem = new(source.Id);
|
||||||
|
updateStrategy.Update(NewItem, source);
|
||||||
|
NewItem.ForceValue = tupleConvertStrategy.Convert(source.ForceValue);
|
||||||
|
NewItem.CombinationProperty = combinationConvertStrategy.Convert(source.CombinationProperty);
|
||||||
|
TraceLogger?.AddMessage($"Concentrated force converting Id = {NewItem.Id} has been finished successfully", TraceLogStatuses.Debug);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitializeStrategies()
|
||||||
|
{
|
||||||
|
updateStrategy ??= new ConcentratedForceUpdateStrategy();
|
||||||
|
tupleConvertStrategy = new DictionaryConvertStrategy<ForceTupleDTO, IForceTuple>
|
||||||
|
(this, new ForceTupleToDTOConvertStrategy(ReferenceDictionary, TraceLogger));
|
||||||
|
combinationConvertStrategy = new DictionaryConvertStrategy<FactoredCombinationPropertyDTO, IFactoredCombinationProperty>
|
||||||
|
(this, new FactoredCombinationPropertyToDTOConvertStrategy(ReferenceDictionary, TraceLogger));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,80 +7,48 @@ using StructureHelperLogics.Models.Analyses;
|
|||||||
|
|
||||||
namespace DataAccess.DTOs
|
namespace DataAccess.DTOs
|
||||||
{
|
{
|
||||||
internal class CrossSectionNdmAnalysisToDTOConvertStrategy : IConvertStrategy<CrossSectionNdmAnalysisDTO, ICrossSectionNdmAnalysis>
|
internal class CrossSectionNdmAnalysisToDTOConvertStrategy : ConvertStrategy<CrossSectionNdmAnalysisDTO, ICrossSectionNdmAnalysis>
|
||||||
{
|
{
|
||||||
private IUpdateStrategy<ICrossSectionNdmAnalysis> updateStrategy;
|
private IUpdateStrategy<ICrossSectionNdmAnalysis> updateStrategy;
|
||||||
private IConvertStrategy<VersionProcessorDTO, IVersionProcessor> convertStrategy;
|
private IConvertStrategy<VersionProcessorDTO, IVersionProcessor> convertStrategy;
|
||||||
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
|
||||||
public IShiftTraceLogger TraceLogger { get; set; }
|
|
||||||
|
|
||||||
public CrossSectionNdmAnalysisToDTOConvertStrategy(
|
public CrossSectionNdmAnalysisToDTOConvertStrategy(Dictionary<(Guid id, Type type), ISaveable> referenceDictionary, IShiftTraceLogger traceLogger) : base(referenceDictionary, traceLogger)
|
||||||
IUpdateStrategy<ICrossSectionNdmAnalysis> updateStrategy,
|
|
||||||
IConvertStrategy<VersionProcessorDTO, IVersionProcessor> convertStrategy,
|
|
||||||
IShiftTraceLogger traceLogger)
|
|
||||||
{
|
{
|
||||||
this.updateStrategy = updateStrategy;
|
|
||||||
this.convertStrategy = convertStrategy;
|
|
||||||
this.TraceLogger = traceLogger;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public CrossSectionNdmAnalysisToDTOConvertStrategy() : this(
|
public override CrossSectionNdmAnalysisDTO GetNewItem(ICrossSectionNdmAnalysis source)
|
||||||
new CrossSectionNdmAnalysisUpdateStrategy(),
|
|
||||||
new VersionProcessorToDTOConvertStrategy(),
|
|
||||||
null)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public CrossSectionNdmAnalysisToDTOConvertStrategy(Dictionary<(Guid id, Type type), ISaveable> referenceDictionary, IShiftTraceLogger? traceLogger)
|
|
||||||
: this(
|
|
||||||
new CrossSectionNdmAnalysisUpdateStrategy(),
|
|
||||||
new VersionProcessorToDTOConvertStrategy(),
|
|
||||||
null)
|
|
||||||
{
|
|
||||||
ReferenceDictionary = referenceDictionary;
|
|
||||||
TraceLogger = traceLogger;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CrossSectionNdmAnalysisDTO Convert(ICrossSectionNdmAnalysis source)
|
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Check();
|
GetNewAnalysis(source);
|
||||||
return GetNewAnalysis(source);
|
return NewItem;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Error);
|
TraceErrorByEntity(this, ex.Message);
|
||||||
TraceLogger?.AddMessage(ex.Message, TraceLogStatuses.Error);
|
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private void GetNewAnalysis(ICrossSectionNdmAnalysis source)
|
||||||
private CrossSectionNdmAnalysisDTO GetNewAnalysis(ICrossSectionNdmAnalysis source)
|
|
||||||
{
|
{
|
||||||
TraceLogger?.AddMessage("Cross-section ndm analysis converting is started", TraceLogStatuses.Debug);
|
TraceLogger?.AddMessage("Cross-section ndm analysis converting is started", TraceLogStatuses.Debug);
|
||||||
CrossSectionNdmAnalysisDTO newItem = new();
|
InitializeStrategies();
|
||||||
newItem.Id = source.Id;
|
NewItem = new(source.Id);
|
||||||
updateStrategy.Update(newItem, source);
|
updateStrategy.Update(NewItem, source);
|
||||||
convertStrategy.ReferenceDictionary = ReferenceDictionary;
|
|
||||||
convertStrategy.TraceLogger = TraceLogger;
|
|
||||||
var convertLogic = new DictionaryConvertStrategy<VersionProcessorDTO, IVersionProcessor>()
|
|
||||||
{
|
|
||||||
ReferenceDictionary = ReferenceDictionary,
|
|
||||||
ConvertStrategy = convertStrategy,
|
|
||||||
TraceLogger = TraceLogger
|
|
||||||
};
|
|
||||||
TraceLogger?.AddMessage("Convert version processor is started", TraceLogStatuses.Service);
|
TraceLogger?.AddMessage("Convert version processor is started", TraceLogStatuses.Service);
|
||||||
newItem.VersionProcessor = convertLogic.Convert(source.VersionProcessor);
|
NewItem.VersionProcessor = convertStrategy.Convert(source.VersionProcessor);
|
||||||
TraceLogger?.AddMessage("Cross-section ndm analysis has been converted successfully", TraceLogStatuses.Service);
|
TraceLogger?.AddMessage("Cross-section ndm analysis has been converted successfully", TraceLogStatuses.Service);
|
||||||
return newItem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Check()
|
private void InitializeStrategies()
|
||||||
{
|
{
|
||||||
var checkLogic = new CheckConvertLogic<CrossSectionNdmAnalysisDTO, ICrossSectionNdmAnalysis>(this);
|
updateStrategy ??= new CrossSectionNdmAnalysisUpdateStrategy();
|
||||||
checkLogic.Check();
|
convertStrategy = new DictionaryConvertStrategy<VersionProcessorDTO, IVersionProcessor>()
|
||||||
|
{
|
||||||
|
ReferenceDictionary = ReferenceDictionary,
|
||||||
|
ConvertStrategy = new VersionProcessorToDTOConvertStrategy(ReferenceDictionary, TraceLogger),
|
||||||
|
TraceLogger = TraceLogger
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,76 +1,58 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using StructureHelperCommon.Models;
|
using StructureHelperCommon.Models;
|
||||||
using StructureHelperCommon.Models.Analyses;
|
using StructureHelperCommon.Models.Analyses;
|
||||||
using StructureHelperCommon.Models.Loggers;
|
|
||||||
using StructureHelperLogic.Models.Analyses;
|
//Copyright (c) 2025 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||||
using StructureHelperLogics.Models.CrossSections;
|
//All rights reserved.
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace DataAccess.DTOs
|
namespace DataAccess.DTOs
|
||||||
{
|
{
|
||||||
public class DateVersionToDTOConvertStrategy : IConvertStrategy<DateVersionDTO, IDateVersion>
|
public class DateVersionToDTOConvertStrategy : ConvertStrategy<DateVersionDTO, IDateVersion>
|
||||||
{
|
{
|
||||||
private IUpdateStrategy<IDateVersion> updateStrategy;
|
private IUpdateStrategy<IDateVersion> updateStrategy;
|
||||||
private IConvertStrategy<ISaveable, ISaveable> convertStrategy;
|
private DictionaryConvertStrategy<ISaveable, ISaveable> convertStrategy;
|
||||||
private DictionaryConvertStrategy<ISaveable, ISaveable> convertLogic;
|
|
||||||
|
|
||||||
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
public DateVersionToDTOConvertStrategy(Dictionary<(Guid id, Type type), ISaveable> referenceDictionary, IShiftTraceLogger traceLogger)
|
||||||
public IShiftTraceLogger TraceLogger { get; set; }
|
: base(referenceDictionary, traceLogger)
|
||||||
|
|
||||||
public DateVersionToDTOConvertStrategy(
|
|
||||||
IUpdateStrategy<IDateVersion> updateStrategy,
|
|
||||||
IConvertStrategy<ISaveable, ISaveable> convertStrategy)
|
|
||||||
{
|
{
|
||||||
this.updateStrategy = updateStrategy;
|
|
||||||
this.convertStrategy = convertStrategy;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public DateVersionToDTOConvertStrategy() : this (
|
public override DateVersionDTO GetNewItem(IDateVersion source)
|
||||||
new DateVersionUpdateStrategy(),
|
|
||||||
new VersionItemToDTOConvertStrategy())
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public DateVersionDTO Convert(IDateVersion source)
|
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Check();
|
GetNewDateVersion(source);
|
||||||
return GetNewDateVersion(source);
|
return NewItem;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Error);
|
TraceErrorByEntity(this, ex.Message);
|
||||||
TraceLogger?.AddMessage(ex.Message, TraceLogStatuses.Error);
|
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private DateVersionDTO GetNewDateVersion(IDateVersion source)
|
private void GetNewDateVersion(IDateVersion source)
|
||||||
{
|
{
|
||||||
TraceLogger?.AddMessage("Date version converting is started", TraceLogStatuses.Debug);
|
TraceLogger?.AddMessage("Date version converting is started", TraceLogStatuses.Debug);
|
||||||
DateVersionDTO newItem = new()
|
InitializeStrategies();
|
||||||
|
NewItem = new()
|
||||||
{
|
{
|
||||||
Id = source.Id
|
Id = source.Id
|
||||||
};
|
};
|
||||||
updateStrategy.Update(newItem, source);
|
updateStrategy.Update(NewItem, source);
|
||||||
convertStrategy.ReferenceDictionary = ReferenceDictionary;
|
NewItem.AnalysisVersion = convertStrategy.Convert(source.AnalysisVersion);
|
||||||
convertStrategy.TraceLogger = TraceLogger;
|
|
||||||
convertLogic = new DictionaryConvertStrategy<ISaveable, ISaveable>(this, convertStrategy);
|
|
||||||
newItem.AnalysisVersion = convertLogic.Convert(source.AnalysisVersion);
|
|
||||||
TraceLogger?.AddMessage("Date version converting has been finished", TraceLogStatuses.Service);
|
TraceLogger?.AddMessage("Date version converting has been finished", TraceLogStatuses.Service);
|
||||||
return newItem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Check()
|
private void InitializeStrategies()
|
||||||
{
|
{
|
||||||
var checkLogic = new CheckConvertLogic<DateVersionDTO, IDateVersion>(this);
|
updateStrategy ??= new DateVersionUpdateStrategy();
|
||||||
checkLogic.Check();
|
convertStrategy = new DictionaryConvertStrategy<ISaveable, ISaveable>()
|
||||||
|
{
|
||||||
|
ReferenceDictionary = ReferenceDictionary,
|
||||||
|
TraceLogger = TraceLogger,
|
||||||
|
ConvertStrategy = new VersionItemToDTOConvertStrategy(ReferenceDictionary, TraceLogger)
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperCommon.Models.Forces.BeamShearActions;
|
||||||
|
|
||||||
|
//Copyright (c) 2025 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs
|
||||||
|
{
|
||||||
|
public class DistributedLoadToDTOConvertStrategy : ConvertStrategy<DistributedLoadDTO, IDistributedLoad>
|
||||||
|
{
|
||||||
|
private IUpdateStrategy<IDistributedLoad> updateStrategy;
|
||||||
|
private IConvertStrategy<ForceTupleDTO, IForceTuple> tupleConvertStrategy;
|
||||||
|
private IConvertStrategy<FactoredCombinationPropertyDTO, IFactoredCombinationProperty> combinationConvertStrategy;
|
||||||
|
|
||||||
|
public DistributedLoadToDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override DistributedLoadDTO GetNewItem(IDistributedLoad source)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
GetNewBeamAction(source);
|
||||||
|
return NewItem;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
TraceErrorByEntity(this, ex.Message);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GetNewBeamAction(IDistributedLoad source)
|
||||||
|
{
|
||||||
|
TraceLogger?.AddMessage($"Converting of beam shear action Id = {source.Id} has been started", TraceLogStatuses.Debug);
|
||||||
|
InitializeStrategies();
|
||||||
|
NewItem = new(source.Id);
|
||||||
|
updateStrategy.Update(NewItem, source);
|
||||||
|
NewItem.LoadValue = tupleConvertStrategy.Convert(source.LoadValue);
|
||||||
|
NewItem.CombinationProperty = combinationConvertStrategy.Convert(source.CombinationProperty);
|
||||||
|
TraceLogger?.AddMessage($"Converting of beam shear action Id = {source.Id} has been finished", TraceLogStatuses.Debug);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitializeStrategies()
|
||||||
|
{
|
||||||
|
updateStrategy ??= new DistributedLoadUpdateStrategy();
|
||||||
|
tupleConvertStrategy = new DictionaryConvertStrategy<ForceTupleDTO, IForceTuple>
|
||||||
|
(this, new ForceTupleToDTOConvertStrategy(ReferenceDictionary, TraceLogger));
|
||||||
|
combinationConvertStrategy = new DictionaryConvertStrategy<FactoredCombinationPropertyDTO, IFactoredCombinationProperty>
|
||||||
|
(this, new FactoredCombinationPropertyToDTOConvertStrategy(ReferenceDictionary, TraceLogger));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
using StructureHelperCommon.Models.Forces.Logics;
|
using StructureHelperCommon.Models.Forces.Logics;
|
||||||
using System;
|
using System;
|
||||||
@@ -22,10 +23,16 @@ namespace DataAccess.DTOs
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public FactoredCombinationPropertyToDTOConvertStrategy(Dictionary<(Guid id, Type type), ISaveable> referenceDictionary, IShiftTraceLogger traceLogger)
|
||||||
|
: base(referenceDictionary, traceLogger)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public override FactoredCombinationPropertyDTO GetNewItem(IFactoredCombinationProperty source)
|
public override FactoredCombinationPropertyDTO GetNewItem(IFactoredCombinationProperty source)
|
||||||
{
|
{
|
||||||
InitializeStrategies();
|
|
||||||
TraceLogger?.AddMessage($"Force factored combination property Id={source.Id} converting has been started");
|
TraceLogger?.AddMessage($"Force factored combination property Id={source.Id} converting has been started");
|
||||||
|
InitializeStrategies();
|
||||||
FactoredCombinationPropertyDTO newItem = new(source.Id);
|
FactoredCombinationPropertyDTO newItem = new(source.Id);
|
||||||
updateStrategy.Update(newItem, source);
|
updateStrategy.Update(newItem, source);
|
||||||
TraceLogger?.AddMessage($"Force factored combination property Id={newItem.Id} converting has been finished");
|
TraceLogger?.AddMessage($"Force factored combination property Id={newItem.Id} converting has been finished");
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs
|
||||||
|
{
|
||||||
|
public class FactoredForceTupleToDTOConvertStrategy : ConvertStrategy<FactoredForceTupleDTO, IFactoredForceTuple>
|
||||||
|
{
|
||||||
|
private IConvertStrategy<ForceTupleDTO, IForceTuple> tupleConvertStrategy;
|
||||||
|
private IConvertStrategy<FactoredCombinationPropertyDTO, IFactoredCombinationProperty> combinationConvertStrategy;
|
||||||
|
|
||||||
|
public FactoredForceTupleToDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override FactoredForceTupleDTO GetNewItem(IFactoredForceTuple source)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
GetNewFactoredForceTuple(source);
|
||||||
|
return NewItem;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
TraceErrorByEntity(this, ex.Message);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GetNewFactoredForceTuple(IFactoredForceTuple source)
|
||||||
|
{
|
||||||
|
TraceLogger?.AddMessage($"Converting of factored force tuple Id = {source.Id} has been started", TraceLogStatuses.Debug);
|
||||||
|
InitializeStrategies();
|
||||||
|
NewItem = new(source.Id);
|
||||||
|
NewItem.ForceTuple = tupleConvertStrategy.Convert(source.ForceTuple);
|
||||||
|
NewItem.CombinationProperty = combinationConvertStrategy.Convert(source.CombinationProperty);
|
||||||
|
TraceLogger?.AddMessage($"Converting of factored force tuple Id = {NewItem.Id} has been finished", TraceLogStatuses.Debug);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitializeStrategies()
|
||||||
|
{
|
||||||
|
tupleConvertStrategy = new DictionaryConvertStrategy<ForceTupleDTO, IForceTuple>
|
||||||
|
(this, new ForceTupleToDTOConvertStrategy(ReferenceDictionary, TraceLogger));
|
||||||
|
combinationConvertStrategy = new DictionaryConvertStrategy<FactoredCombinationPropertyDTO, IFactoredCombinationProperty>
|
||||||
|
(this, new FactoredCombinationPropertyToDTOConvertStrategy(ReferenceDictionary, TraceLogger));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,12 +1,6 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using StructureHelperCommon.Models;
|
using StructureHelperCommon.Models;
|
||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
using StructureHelperCommon.Models.Loggers;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace DataAccess.DTOs
|
namespace DataAccess.DTOs
|
||||||
{
|
{
|
||||||
@@ -24,11 +18,33 @@ namespace DataAccess.DTOs
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ForceTupleToDTOConvertStrategy(Dictionary<(Guid id, Type type), ISaveable> referenceDictionary, IShiftTraceLogger traceLogger)
|
||||||
|
: base(referenceDictionary, traceLogger)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public override ForceTupleDTO GetNewItem(IForceTuple source)
|
public override ForceTupleDTO GetNewItem(IForceTuple source)
|
||||||
{
|
{
|
||||||
ForceTupleDTO newItem = new(source.Id);
|
try
|
||||||
updateStrategy.Update(newItem, source);
|
{
|
||||||
return newItem;
|
GetNewBeamForceTuple(source);
|
||||||
|
return NewItem;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
TraceErrorByEntity(this, ex.Message);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GetNewBeamForceTuple(IForceTuple source)
|
||||||
|
{
|
||||||
|
TraceLogger?.AddMessage($"Converting of force tuple Id = {source.Id} has been started", TraceLogStatuses.Debug);
|
||||||
|
updateStrategy ??= new ForceTupleUpdateStrategy();
|
||||||
|
NewItem = new(source.Id);
|
||||||
|
updateStrategy.Update(NewItem, source);
|
||||||
|
TraceLogger?.AddMessage($"Converting of force tuple Id = {source.Id} has been finished", TraceLogStatuses.Debug);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperCommon.Services;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs
|
||||||
|
{
|
||||||
|
public class HasBeamShearActionToDTOConvertStrategy : IUpdateStrategy<IHasBeamShearActions>
|
||||||
|
{
|
||||||
|
|
||||||
|
private Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get;}
|
||||||
|
private IShiftTraceLogger TraceLogger { get;}
|
||||||
|
public HasBeamShearActionToDTOConvertStrategy(Dictionary<(Guid id, Type type), ISaveable> referenceDictionary, IShiftTraceLogger traceLogger)
|
||||||
|
{
|
||||||
|
ReferenceDictionary = referenceDictionary;
|
||||||
|
TraceLogger = traceLogger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(IHasBeamShearActions targetObject, IHasBeamShearActions sourceObject)
|
||||||
|
{
|
||||||
|
CheckObject.IsNull(targetObject);
|
||||||
|
CheckObject.IsNull(sourceObject);
|
||||||
|
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||||
|
CheckObject.IsNull(sourceObject.Actions);
|
||||||
|
CheckObject.IsNull(targetObject.Actions);
|
||||||
|
targetObject.Actions.Clear();
|
||||||
|
foreach (var action in sourceObject.Actions)
|
||||||
|
{
|
||||||
|
var convertStrategy = new DictionaryConvertStrategy<BeamShearActionDTO, IBeamShearAction>(
|
||||||
|
ReferenceDictionary,
|
||||||
|
TraceLogger,
|
||||||
|
new BeamShearActionConvertStrategy(ReferenceDictionary, TraceLogger));
|
||||||
|
var newAction = convertStrategy.Convert(action);
|
||||||
|
targetObject.Actions.Add(newAction);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using StructureHelperCommon.Services;
|
||||||
|
using StructureHelperLogics.Models.BeamShears;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs
|
||||||
|
{
|
||||||
|
public class HasBeamShearSectionConvertStrategy : IUpdateStrategy<IHasBeamShearSections>
|
||||||
|
{
|
||||||
|
private Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; }
|
||||||
|
private IShiftTraceLogger TraceLogger { get; }
|
||||||
|
public HasBeamShearSectionConvertStrategy(Dictionary<(Guid id, Type type), ISaveable> referenceDictionary, IShiftTraceLogger traceLogger)
|
||||||
|
{
|
||||||
|
ReferenceDictionary = referenceDictionary;
|
||||||
|
TraceLogger = traceLogger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(IHasBeamShearSections targetObject, IHasBeamShearSections sourceObject)
|
||||||
|
{
|
||||||
|
CheckObject.IsNull(targetObject);
|
||||||
|
CheckObject.IsNull(sourceObject);
|
||||||
|
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||||
|
CheckObject.IsNull(sourceObject.Sections);
|
||||||
|
CheckObject.IsNull(targetObject.Sections);
|
||||||
|
targetObject.Sections.Clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,37 +2,18 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using StructureHelperCommon.Models;
|
using StructureHelperCommon.Models;
|
||||||
using StructureHelperCommon.Models.Loggers;
|
using StructureHelperCommon.Models.Loggers;
|
||||||
|
using StructureHelperLogics.Models.BeamShears;
|
||||||
using StructureHelperLogics.Models.CrossSections;
|
using StructureHelperLogics.Models.CrossSections;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace DataAccess.DTOs
|
namespace DataAccess.DTOs
|
||||||
{
|
{
|
||||||
public class VersionItemToDTOConvertStrategy : IConvertStrategy<ISaveable, ISaveable>
|
public class VersionItemToDTOConvertStrategy : ConvertStrategy<ISaveable, ISaveable>
|
||||||
{
|
{
|
||||||
private const string AnalysisIs = "Analysis type is";
|
private const string AnalysisIs = "Analysis type is";
|
||||||
private IConvertStrategy<CrossSectionDTO, ICrossSection> crossSectionConvertStrategy = new CrossSectionToDTOConvertStrategy();
|
|
||||||
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
|
||||||
public IShiftTraceLogger TraceLogger { get; set; }
|
|
||||||
|
|
||||||
|
public VersionItemToDTOConvertStrategy(Dictionary<(Guid id, Type type), ISaveable> referenceDictionary, IShiftTraceLogger traceLogger)
|
||||||
public ISaveable Convert(ISaveable source)
|
: base(referenceDictionary, traceLogger)
|
||||||
{
|
{
|
||||||
try
|
|
||||||
{
|
|
||||||
Check();
|
|
||||||
return GetNewAnalysis(source);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Error);
|
|
||||||
TraceLogger?.AddMessage(ex.Message, TraceLogStatuses.Error);
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ISaveable GetNewAnalysis(ISaveable source)
|
private ISaveable GetNewAnalysis(ISaveable source)
|
||||||
@@ -42,6 +23,10 @@ namespace DataAccess.DTOs
|
|||||||
{
|
{
|
||||||
newItem = ProcessCrossSection(crossSection);
|
newItem = ProcessCrossSection(crossSection);
|
||||||
}
|
}
|
||||||
|
else if (source is IBeamShear beamShear)
|
||||||
|
{
|
||||||
|
newItem = ProcessBeamShear(beamShear);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string errorString = ErrorStrings.ObjectTypeIsUnknownObj(source);
|
string errorString = ErrorStrings.ObjectTypeIsUnknownObj(source);
|
||||||
@@ -51,12 +36,27 @@ namespace DataAccess.DTOs
|
|||||||
return newItem;
|
return newItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private BeamShearDTO ProcessBeamShear(IBeamShear beamShear)
|
||||||
|
{
|
||||||
|
TraceLogger?.AddMessage(AnalysisIs + " Beam Shear Analysis", TraceLogStatuses.Debug);
|
||||||
|
var convertLogic = new DictionaryConvertStrategy<BeamShearDTO, IBeamShear>()
|
||||||
|
{
|
||||||
|
ReferenceDictionary = ReferenceDictionary,
|
||||||
|
TraceLogger = TraceLogger,
|
||||||
|
ConvertStrategy = new BeamShearToDTOConvertStrategy(ReferenceDictionary, TraceLogger)
|
||||||
|
};
|
||||||
|
return convertLogic.Convert(beamShear);
|
||||||
|
}
|
||||||
|
|
||||||
private ISaveable ProcessCrossSection(ICrossSection crossSection)
|
private ISaveable ProcessCrossSection(ICrossSection crossSection)
|
||||||
{
|
{
|
||||||
TraceLogger?.AddMessage(AnalysisIs + " Cross-Section Ndm Analysis", TraceLogStatuses.Debug);
|
TraceLogger?.AddMessage(AnalysisIs + " Cross-Section Ndm Analysis", TraceLogStatuses.Debug);
|
||||||
ISaveable saveable;
|
ISaveable saveable;
|
||||||
crossSectionConvertStrategy.ReferenceDictionary = ReferenceDictionary;
|
IConvertStrategy<CrossSectionDTO, ICrossSection> crossSectionConvertStrategy = new CrossSectionToDTOConvertStrategy
|
||||||
crossSectionConvertStrategy.TraceLogger = TraceLogger;
|
{
|
||||||
|
ReferenceDictionary = ReferenceDictionary,
|
||||||
|
TraceLogger = TraceLogger
|
||||||
|
};
|
||||||
var convertLogic = new DictionaryConvertStrategy<CrossSectionDTO, ICrossSection>()
|
var convertLogic = new DictionaryConvertStrategy<CrossSectionDTO, ICrossSection>()
|
||||||
{
|
{
|
||||||
ReferenceDictionary = ReferenceDictionary,
|
ReferenceDictionary = ReferenceDictionary,
|
||||||
@@ -67,10 +67,18 @@ namespace DataAccess.DTOs
|
|||||||
return saveable;
|
return saveable;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Check()
|
public override ISaveable GetNewItem(ISaveable source)
|
||||||
{
|
{
|
||||||
var checkLogic = new CheckConvertLogic<ISaveable, ISaveable>(this);
|
try
|
||||||
checkLogic.Check();
|
{
|
||||||
|
return GetNewAnalysis(source);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Error);
|
||||||
|
TraceLogger?.AddMessage(ex.Message, TraceLogStatuses.Error);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,69 +2,48 @@
|
|||||||
using StructureHelperCommon.Models;
|
using StructureHelperCommon.Models;
|
||||||
using StructureHelperCommon.Models.Analyses;
|
using StructureHelperCommon.Models.Analyses;
|
||||||
using StructureHelperCommon.Models.Loggers;
|
using StructureHelperCommon.Models.Loggers;
|
||||||
using StructureHelperLogics.Models.CrossSections;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace DataAccess.DTOs
|
namespace DataAccess.DTOs
|
||||||
{
|
{
|
||||||
public class VersionProcessorToDTOConvertStrategy : IConvertStrategy<VersionProcessorDTO, IVersionProcessor>
|
public class VersionProcessorToDTOConvertStrategy : ConvertStrategy<VersionProcessorDTO, IVersionProcessor>
|
||||||
{
|
{
|
||||||
private IConvertStrategy<DateVersionDTO, IDateVersion> dataVersionConvertStrategy;
|
private IConvertStrategy<DateVersionDTO, IDateVersion> dataVersionConvertStrategy;
|
||||||
private ICheckConvertLogic<VersionProcessorDTO, IVersionProcessor> checkLogic;
|
|
||||||
|
|
||||||
public VersionProcessorToDTOConvertStrategy(IConvertStrategy<DateVersionDTO, IDateVersion> dataVersionConvertStrategy)
|
public VersionProcessorToDTOConvertStrategy(Dictionary<(Guid id, Type type), ISaveable> referenceDictionary, IShiftTraceLogger traceLogger)
|
||||||
|
: base(referenceDictionary, traceLogger)
|
||||||
{
|
{
|
||||||
this.dataVersionConvertStrategy = dataVersionConvertStrategy;
|
|
||||||
}
|
|
||||||
public VersionProcessorToDTOConvertStrategy() : this( new DateVersionToDTOConvertStrategy())
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
public override VersionProcessorDTO GetNewItem(IVersionProcessor source)
|
||||||
public IShiftTraceLogger TraceLogger { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
public VersionProcessorDTO Convert(IVersionProcessor source)
|
|
||||||
{
|
{
|
||||||
Check();
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
VersionProcessorDTO versionProcessorDTO = GetNewVersionProcessor(source);
|
GetNewVersionProcessor(source);
|
||||||
return versionProcessorDTO;
|
return NewItem;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Debug);
|
TraceErrorByEntity(this, ex.Message);
|
||||||
TraceLogger?.AddMessage(ex.Message, TraceLogStatuses.Error);
|
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private VersionProcessorDTO GetNewVersionProcessor(IVersionProcessor source)
|
private void GetNewVersionProcessor(IVersionProcessor source)
|
||||||
{
|
{
|
||||||
VersionProcessorDTO newItem = new()
|
TraceLogger?.AddMessage($"Converting version processor Id={source.Id} has been started", TraceLogStatuses.Debug);
|
||||||
{
|
InitializeStrategies();
|
||||||
Id = source.Id
|
NewItem = new(source.Id);
|
||||||
};
|
|
||||||
dataVersionConvertStrategy.ReferenceDictionary = ReferenceDictionary;
|
|
||||||
dataVersionConvertStrategy.TraceLogger = TraceLogger;
|
|
||||||
foreach (var item in source.Versions)
|
foreach (var item in source.Versions)
|
||||||
{
|
{
|
||||||
var convertLogic = new DictionaryConvertStrategy<DateVersionDTO, IDateVersion>(this, dataVersionConvertStrategy);
|
var convertLogic = new DictionaryConvertStrategy<DateVersionDTO, IDateVersion>(this, dataVersionConvertStrategy);
|
||||||
newItem.Versions.Add(convertLogic.Convert(item));
|
NewItem.Versions.Add(convertLogic.Convert(item));
|
||||||
}
|
}
|
||||||
return newItem;
|
TraceLogger?.AddMessage($"Converting version processor Id={NewItem.Id} has been done successfully", TraceLogStatuses.Service);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Check()
|
private void InitializeStrategies()
|
||||||
{
|
{
|
||||||
checkLogic = new CheckConvertLogic<VersionProcessorDTO, IVersionProcessor>(this);
|
dataVersionConvertStrategy ??= new DateVersionToDTOConvertStrategy(ReferenceDictionary, TraceLogger);
|
||||||
checkLogic.Check();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
30
DataAccess/DTOs/DTOEntities/BeamShearActionDTO.cs
Normal file
30
DataAccess/DTOs/DTOEntities/BeamShearActionDTO.cs
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
|
||||||
|
//Copyright (c) 2025 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs
|
||||||
|
{
|
||||||
|
public class BeamShearActionDTO : IBeamShearAction
|
||||||
|
{
|
||||||
|
[JsonProperty("Id")]
|
||||||
|
public Guid Id { get; }
|
||||||
|
[JsonProperty("Name")]
|
||||||
|
public string Name { get; set; }
|
||||||
|
[JsonProperty("ExternalForce")]
|
||||||
|
public IFactoredForceTuple ExternalForce { get; set; } = new FactoredForceTupleDTO(Guid.Empty);
|
||||||
|
[JsonProperty("SupportAction")]
|
||||||
|
public IBeamShearAxisAction SupportAction { get; set; } = new BeamShearAxisActionDTO(Guid.Empty);
|
||||||
|
|
||||||
|
public BeamShearActionDTO(Guid id)
|
||||||
|
{
|
||||||
|
Id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object Clone()
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,7 +17,7 @@ namespace DataAccess.DTOs
|
|||||||
public string Comment { get; set; } = string.Empty;
|
public string Comment { get; set; } = string.Empty;
|
||||||
[JsonProperty("Color")]
|
[JsonProperty("Color")]
|
||||||
public Color Color { get; set; }
|
public Color Color { get; set; }
|
||||||
public IVersionProcessor VersionProcessor { get; set; } = new VersionProcessorDTO();
|
public IVersionProcessor VersionProcessor { get; set; } = new VersionProcessorDTO(Guid.NewGuid());
|
||||||
public BeamShearAnalysisDTO(Guid id)
|
public BeamShearAnalysisDTO(Guid id)
|
||||||
{
|
{
|
||||||
Id = id;
|
Id = id;
|
||||||
|
|||||||
31
DataAccess/DTOs/DTOEntities/BeamShearAxisActionDTO.cs
Normal file
31
DataAccess/DTOs/DTOEntities/BeamShearAxisActionDTO.cs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
|
||||||
|
//Copyright (c) 2025 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs
|
||||||
|
{
|
||||||
|
public class BeamShearAxisActionDTO : IBeamShearAxisAction
|
||||||
|
{
|
||||||
|
[JsonProperty("Id")]
|
||||||
|
public Guid Id { get; }
|
||||||
|
[JsonProperty("Name")]
|
||||||
|
public string Name { get; set; }
|
||||||
|
[JsonProperty("SupportForce")]
|
||||||
|
public IFactoredForceTuple SupportForce { get; set; }
|
||||||
|
[JsonProperty("SpanLoads")]
|
||||||
|
public List<IBeamSpanLoad> ShearLoads { get; } = new();
|
||||||
|
|
||||||
|
public BeamShearAxisActionDTO(Guid id)
|
||||||
|
{
|
||||||
|
Id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public object Clone()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,19 +1,23 @@
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using StructureHelperLogics.Models.BeamShears;
|
using StructureHelperLogics.Models.BeamShears;
|
||||||
|
|
||||||
namespace DataAccess.DTOs.DTOEntities
|
namespace DataAccess.DTOs
|
||||||
{
|
{
|
||||||
public class BeamShearDTO : IBeamShear
|
public class BeamShearDTO : IBeamShear
|
||||||
{
|
{
|
||||||
[JsonProperty("Id")]
|
[JsonProperty("Id")]
|
||||||
public Guid Id { get; }
|
public Guid Id { get; }
|
||||||
[JsonProperty("Repository")]
|
[JsonProperty("Repository")]
|
||||||
public IBeamShearRepository Repository { get; set; }
|
public IBeamShearRepository Repository { get; set; } = new BeamShearRepositoryDTO(Guid.NewGuid());
|
||||||
|
|
||||||
|
public BeamShearDTO(Guid id)
|
||||||
|
{
|
||||||
|
Id = id;
|
||||||
|
}
|
||||||
|
|
||||||
public object Clone()
|
public object Clone()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ using StructureHelperCommon.Models.Calculators;
|
|||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
using StructureHelperLogics.Models.BeamShears;
|
using StructureHelperLogics.Models.BeamShears;
|
||||||
|
|
||||||
namespace DataAccess.DTOs.DTOEntities
|
namespace DataAccess.DTOs
|
||||||
{
|
{
|
||||||
public class BeamShearRepositoryDTO : IBeamShearRepository
|
public class BeamShearRepositoryDTO : IBeamShearRepository
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
|
||||||
namespace DataAccess.DTOs.DTOEntities
|
namespace DataAccess.DTOs
|
||||||
{
|
{
|
||||||
public class ConcentratedForceDTO : IConcentratedForce
|
public class ConcentratedForceDTO : IConcentratedForce
|
||||||
{
|
{
|
||||||
@@ -10,7 +10,7 @@ namespace DataAccess.DTOs.DTOEntities
|
|||||||
[JsonProperty("Name")]
|
[JsonProperty("Name")]
|
||||||
public string Name { get; set; } = string.Empty;
|
public string Name { get; set; } = string.Empty;
|
||||||
[JsonProperty("ForceValue")]
|
[JsonProperty("ForceValue")]
|
||||||
public IForceTuple ForceValue { get; set; }
|
public IForceTuple ForceValue { get; set; } = new ForceTupleDTO(Guid.Empty);
|
||||||
[JsonProperty("ForceCoordinate")]
|
[JsonProperty("ForceCoordinate")]
|
||||||
public double ForceCoordinate { get; set; }
|
public double ForceCoordinate { get; set; }
|
||||||
[JsonProperty("RelativeLoadLevel")]
|
[JsonProperty("RelativeLoadLevel")]
|
||||||
@@ -18,12 +18,16 @@ namespace DataAccess.DTOs.DTOEntities
|
|||||||
[JsonProperty("LoadRatio")]
|
[JsonProperty("LoadRatio")]
|
||||||
public double LoadRatio { get; set; }
|
public double LoadRatio { get; set; }
|
||||||
[JsonProperty("CombinationProperty")]
|
[JsonProperty("CombinationProperty")]
|
||||||
public IFactoredCombinationProperty CombinationProperty { get; set; }
|
public IFactoredCombinationProperty CombinationProperty { get; set; } = new FactoredCombinationPropertyDTO(Guid.Empty);
|
||||||
|
|
||||||
|
public ConcentratedForceDTO(Guid id)
|
||||||
|
{
|
||||||
|
Id = id;
|
||||||
|
}
|
||||||
|
|
||||||
public object Clone()
|
public object Clone()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,18 +8,23 @@ namespace DataAccess.DTOs
|
|||||||
public class CrossSectionNdmAnalysisDTO : ICrossSectionNdmAnalysis
|
public class CrossSectionNdmAnalysisDTO : ICrossSectionNdmAnalysis
|
||||||
{
|
{
|
||||||
[JsonProperty("Id")]
|
[JsonProperty("Id")]
|
||||||
public Guid Id { get; set;}
|
public Guid Id { get;}
|
||||||
[JsonProperty("Name")]
|
[JsonProperty("Name")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
[JsonProperty("Tags")]
|
[JsonProperty("Tags")]
|
||||||
public string Tags { get; set; }
|
public string Tags { get; set; }
|
||||||
[JsonProperty("VersionProcessor")]
|
[JsonProperty("VersionProcessor")]
|
||||||
public IVersionProcessor VersionProcessor { get; set; } = new VersionProcessorDTO();
|
public IVersionProcessor VersionProcessor { get; set; } = new VersionProcessorDTO(Guid.NewGuid());
|
||||||
[JsonProperty("Comment")]
|
[JsonProperty("Comment")]
|
||||||
public string Comment { get; set; } = string.Empty;
|
public string Comment { get; set; } = string.Empty;
|
||||||
[JsonProperty("Color")]
|
[JsonProperty("Color")]
|
||||||
public Color Color { get; set; } = new();
|
public Color Color { get; set; } = new();
|
||||||
|
|
||||||
|
public CrossSectionNdmAnalysisDTO(Guid id)
|
||||||
|
{
|
||||||
|
Id = id;
|
||||||
|
}
|
||||||
|
|
||||||
public object Clone()
|
public object Clone()
|
||||||
{
|
{
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
|
||||||
namespace DataAccess.DTOs.DTOEntities
|
namespace DataAccess.DTOs
|
||||||
{
|
{
|
||||||
public class DistributedLoadDTO : IDistributedLoad
|
public class DistributedLoadDTO : IDistributedLoad
|
||||||
{
|
{
|
||||||
@@ -20,12 +20,15 @@ namespace DataAccess.DTOs.DTOEntities
|
|||||||
[JsonProperty("LoadRatio")]
|
[JsonProperty("LoadRatio")]
|
||||||
public double LoadRatio { get; set; }
|
public double LoadRatio { get; set; }
|
||||||
[JsonProperty("CombinationProperty")]
|
[JsonProperty("CombinationProperty")]
|
||||||
public IFactoredCombinationProperty CombinationProperty { get; set; }
|
public IFactoredCombinationProperty CombinationProperty { get; set; } = new FactoredCombinationPropertyDTO(Guid.Empty);
|
||||||
|
public DistributedLoadDTO(Guid id)
|
||||||
|
{
|
||||||
|
Id = id;
|
||||||
|
}
|
||||||
|
|
||||||
public object Clone()
|
public object Clone()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
25
DataAccess/DTOs/DTOEntities/FactoredForceTupleDTO.cs
Normal file
25
DataAccess/DTOs/DTOEntities/FactoredForceTupleDTO.cs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs
|
||||||
|
{
|
||||||
|
public class FactoredForceTupleDTO : IFactoredForceTuple
|
||||||
|
{
|
||||||
|
[JsonProperty("Id")]
|
||||||
|
public Guid Id { get; }
|
||||||
|
[JsonProperty("ForceTuple")]
|
||||||
|
public IForceTuple ForceTuple { get; set; }
|
||||||
|
[JsonProperty("CombinationProperty")]
|
||||||
|
public IFactoredCombinationProperty CombinationProperty { get; set; }
|
||||||
|
|
||||||
|
public FactoredForceTupleDTO(Guid id)
|
||||||
|
{
|
||||||
|
Id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object Clone()
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ using StructureHelperCommon.Models.Analyses;
|
|||||||
using StructureHelperCommon.Models.Calculators;
|
using StructureHelperCommon.Models.Calculators;
|
||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
using StructureHelperCommon.Models.Materials.Libraries;
|
using StructureHelperCommon.Models.Materials.Libraries;
|
||||||
|
using StructureHelperLogics.Models.BeamShears;
|
||||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
|
||||||
namespace DataAccess.DTOs
|
namespace DataAccess.DTOs
|
||||||
@@ -50,12 +51,6 @@ namespace DataAccess.DTOs
|
|||||||
{ (typeof(FileVersionDTO), "FileVersion") },
|
{ (typeof(FileVersionDTO), "FileVersion") },
|
||||||
{ (typeof(ForceCalculatorDTO), "ForceCalculator") },
|
{ (typeof(ForceCalculatorDTO), "ForceCalculator") },
|
||||||
{ (typeof(ForceCalculatorInputDataDTO), "ForceCalculatorInputData") },
|
{ (typeof(ForceCalculatorInputDataDTO), "ForceCalculatorInputData") },
|
||||||
{ (typeof(ForceCombinationByFactorV1_0DTO), "ForceCombinationByFactor") },
|
|
||||||
{ (typeof(ForceFactoredListDTO), "ForceCombinationByFactor_v1_1") },
|
|
||||||
{ (typeof(ForceCombinationFromFileDTO), "ForceCombinationFromFile") },
|
|
||||||
{ (typeof(ForceCombinationListDTO), "ForceCombinationList") },
|
|
||||||
{ (typeof(FactoredCombinationPropertyDTO), "ForceFactoredCombinationProperty") },
|
|
||||||
{ (typeof(ForceTupleDTO), "ForceTuple") },
|
|
||||||
{ (typeof(FRMaterialDTO), "FRMaterial") },
|
{ (typeof(FRMaterialDTO), "FRMaterial") },
|
||||||
{ (typeof(HeadMaterialDTO), "HeadMaterial") },
|
{ (typeof(HeadMaterialDTO), "HeadMaterial") },
|
||||||
{ (typeof(MaterialSafetyFactorDTO), "MaterialSafetyFactor") },
|
{ (typeof(MaterialSafetyFactorDTO), "MaterialSafetyFactor") },
|
||||||
@@ -91,6 +86,42 @@ namespace DataAccess.DTOs
|
|||||||
{ (typeof(UserCrackInputDataDTO), "UserCrackInputData") },
|
{ (typeof(UserCrackInputDataDTO), "UserCrackInputData") },
|
||||||
{ (typeof(WorkPlanePropertyDTO), "WorkPlanePropertyDTO") },
|
{ (typeof(WorkPlanePropertyDTO), "WorkPlanePropertyDTO") },
|
||||||
};
|
};
|
||||||
|
newList.AddRange(GetForceList());
|
||||||
|
newList.AddRange(GetListForBeamShear());
|
||||||
|
return newList;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<(Type type, string name)> GetForceList()
|
||||||
|
{
|
||||||
|
List<(Type type, string name)> newList = new()
|
||||||
|
{
|
||||||
|
{ (typeof(ConcentratedForceDTO), "ConcentratedForce") },
|
||||||
|
{ (typeof(DistributedLoadDTO), "DistributedLoad") },
|
||||||
|
{ (typeof(FactoredForceTupleDTO), "FactoredForceTuple") },
|
||||||
|
{ (typeof(ForceCombinationByFactorV1_0DTO), "ForceCombinationByFactor") },
|
||||||
|
{ (typeof(ForceFactoredListDTO), "ForceCombinationByFactor_v1_1") },
|
||||||
|
{ (typeof(ForceCombinationFromFileDTO), "ForceCombinationFromFile") },
|
||||||
|
{ (typeof(ForceCombinationListDTO), "ForceCombinationList") },
|
||||||
|
{ (typeof(FactoredCombinationPropertyDTO), "ForceFactoredCombinationProperty") },
|
||||||
|
{ (typeof(ForceTupleDTO), "ForceTuple") },
|
||||||
|
};
|
||||||
|
return newList;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<(Type type, string name)> GetListForBeamShear()
|
||||||
|
{
|
||||||
|
List<(Type type, string name)> newList = new()
|
||||||
|
{
|
||||||
|
{ (typeof(BeamShearDTO), "BeamShear") },
|
||||||
|
{ (typeof(BeamShearActionDTO), "BeamShearAction") },
|
||||||
|
{ (typeof(BeamShearAxisActionDTO), "BeamShearAxisAction") },
|
||||||
|
{ (typeof(BeamShearAnalysisDTO), "BeamShearAnalysis") },
|
||||||
|
{ (typeof(BeamShearRepositoryDTO), "BeamShearRepository") },
|
||||||
|
{ (typeof(List<IBeamShearAction>), "ListOfBeamShearActions") },
|
||||||
|
{ (typeof(List<IBeamShearSection>), "ListOfBeamShearSections") },
|
||||||
|
{ (typeof(List<IBeamSpanLoad>), "ListOfSpanLoads") },
|
||||||
|
{ (typeof(List<IStirrup>), "ListOfStirrups") },
|
||||||
|
};
|
||||||
return newList;
|
return newList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +1,21 @@
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using StructureHelperCommon.Models.Analyses;
|
using StructureHelperCommon.Models.Analyses;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Text.Json.Serialization;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace DataAccess.DTOs
|
namespace DataAccess.DTOs
|
||||||
{
|
{
|
||||||
public class VersionProcessorDTO : IVersionProcessor
|
public class VersionProcessorDTO : IVersionProcessor
|
||||||
{
|
{
|
||||||
[JsonProperty("Id")]
|
[JsonProperty("Id")]
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get;}
|
||||||
[JsonProperty("Versions")]
|
[JsonProperty("Versions")]
|
||||||
public List<IDateVersion> Versions { get; } = new();
|
public List<IDateVersion> Versions { get; } = new();
|
||||||
|
|
||||||
|
public VersionProcessorDTO(Guid id)
|
||||||
|
{
|
||||||
|
Id = id;
|
||||||
|
}
|
||||||
|
|
||||||
public void AddVersion(ISaveable newItem)
|
public void AddVersion(ISaveable newItem)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
|
|||||||
@@ -19,6 +19,12 @@ namespace StructureHelperCommon.Infrastructures.Interfaces
|
|||||||
TraceLogger = traceLogger;
|
TraceLogger = traceLogger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected ConvertStrategy(IBaseConvertStrategy baseConvertStrategy)
|
||||||
|
{
|
||||||
|
ReferenceDictionary = baseConvertStrategy.ReferenceDictionary;
|
||||||
|
TraceLogger = baseConvertStrategy.TraceLogger;
|
||||||
|
}
|
||||||
|
|
||||||
protected ConvertStrategy(IConvertStrategy<ISaveable, ISaveable> convertStrategy)
|
protected ConvertStrategy(IConvertStrategy<ISaveable, ISaveable> convertStrategy)
|
||||||
{
|
{
|
||||||
ReferenceDictionary = convertStrategy.ReferenceDictionary;
|
ReferenceDictionary = convertStrategy.ReferenceDictionary;
|
||||||
|
|||||||
@@ -28,6 +28,12 @@ namespace StructureHelperCommon.Infrastructures.Interfaces
|
|||||||
TraceLogger = baseConvertStrategy.TraceLogger;
|
TraceLogger = baseConvertStrategy.TraceLogger;
|
||||||
ConvertStrategy = convertStrategy;
|
ConvertStrategy = convertStrategy;
|
||||||
}
|
}
|
||||||
|
public DictionaryConvertStrategy(Dictionary<(Guid id, Type type), ISaveable> referenceDictionary, IShiftTraceLogger? traceLogger, IConvertStrategy<T, V> convertStrategy)
|
||||||
|
{
|
||||||
|
ReferenceDictionary = referenceDictionary;
|
||||||
|
TraceLogger = traceLogger;
|
||||||
|
ConvertStrategy = convertStrategy;
|
||||||
|
}
|
||||||
public DictionaryConvertStrategy()
|
public DictionaryConvertStrategy()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Infrastructures.Interfaces
|
||||||
|
{
|
||||||
|
public interface IProcessStrategy<T>
|
||||||
|
{
|
||||||
|
void Process(T entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Infrastructures.Interfaces
|
||||||
|
{
|
||||||
|
public interface IRepository
|
||||||
|
{
|
||||||
|
void ClearRepository();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -91,7 +91,7 @@ namespace StructureHelperCommon.Infrastructures.Settings
|
|||||||
return new FileVersion()
|
return new FileVersion()
|
||||||
{
|
{
|
||||||
VersionNumber = 1,
|
VersionNumber = 1,
|
||||||
SubVersionNumber = 1
|
SubVersionNumber = 2 //Add Beam shear analysis
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,14 +15,9 @@ namespace StructureHelperCommon.Models.Analyses
|
|||||||
|
|
||||||
public VersionProcessor(Guid id)
|
public VersionProcessor(Guid id)
|
||||||
{
|
{
|
||||||
|
|
||||||
Id = id;
|
Id = id;
|
||||||
Versions = new();
|
Versions = new();
|
||||||
}
|
}
|
||||||
public VersionProcessor() : this (Guid.NewGuid())
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void AddVersion(IDateVersion version)
|
private void AddVersion(IDateVersion version)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,15 +1,12 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models.Forces.Logics;
|
||||||
using StructureHelperCommon.Services;
|
using StructureHelperCommon.Services;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace StructureHelperCommon.Models.Forces.BeamShearActions
|
namespace StructureHelperCommon.Models.Forces.BeamShearActions
|
||||||
{
|
{
|
||||||
public class BeamShearLoadBaseUpdateStrategy : IUpdateStrategy<IBeamSpanLoad>
|
public class BeamShearLoadBaseUpdateStrategy : IUpdateStrategy<IBeamSpanLoad>
|
||||||
{
|
{
|
||||||
|
private IUpdateStrategy<IFactoredCombinationProperty> combinationUpdateStrategy;
|
||||||
public void Update(IBeamSpanLoad targetObject, IBeamSpanLoad sourceObject)
|
public void Update(IBeamSpanLoad targetObject, IBeamSpanLoad sourceObject)
|
||||||
{
|
{
|
||||||
CheckObject.IsNull(targetObject);
|
CheckObject.IsNull(targetObject);
|
||||||
@@ -18,6 +15,10 @@ namespace StructureHelperCommon.Models.Forces.BeamShearActions
|
|||||||
targetObject.Name = sourceObject.Name;
|
targetObject.Name = sourceObject.Name;
|
||||||
targetObject.LoadRatio = sourceObject.LoadRatio;
|
targetObject.LoadRatio = sourceObject.LoadRatio;
|
||||||
targetObject.RelativeLoadLevel = sourceObject.RelativeLoadLevel;
|
targetObject.RelativeLoadLevel = sourceObject.RelativeLoadLevel;
|
||||||
|
CheckObject.IsNull(sourceObject.CombinationProperty);
|
||||||
|
CheckObject.IsNull(targetObject.CombinationProperty);
|
||||||
|
combinationUpdateStrategy ??= new FactoredCombinationPropertyUpdateStrategy();
|
||||||
|
combinationUpdateStrategy.Update(targetObject.CombinationProperty, sourceObject.CombinationProperty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace StructureHelperCommon.Models.Forces
|
|||||||
|
|
||||||
public object Clone()
|
public object Clone()
|
||||||
{
|
{
|
||||||
var newTuple = new DesignForceTuple();
|
var newTuple = new DesignForceTuple(Guid.NewGuid());
|
||||||
updateStrategy.Update(newTuple, this);
|
updateStrategy.Update(newTuple, this);
|
||||||
return newTuple;
|
return newTuple;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,12 @@ namespace StructureHelperCommon.Models.Forces
|
|||||||
public ForceCombinationList(Guid id)
|
public ForceCombinationList(Guid id)
|
||||||
{
|
{
|
||||||
Id = id;
|
Id = id;
|
||||||
DesignForces = new List<IDesignForceTuple>
|
DesignForces = AddDefaultForces();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<IDesignForceTuple> AddDefaultForces()
|
||||||
|
{
|
||||||
|
return new List<IDesignForceTuple>
|
||||||
{
|
{
|
||||||
new DesignForceTuple()
|
new DesignForceTuple()
|
||||||
{
|
{
|
||||||
@@ -51,6 +56,7 @@ namespace StructureHelperCommon.Models.Forces
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public ForceCombinationList() : this (Guid.NewGuid()) { }
|
public ForceCombinationList() : this (Guid.NewGuid()) { }
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public object Clone()
|
public object Clone()
|
||||||
|
|||||||
@@ -1,11 +1,6 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using StructureHelperCommon.Services;
|
using StructureHelperCommon.Services;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace StructureHelperCommon.Models.Forces
|
namespace StructureHelperCommon.Models.Forces
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,10 +1,5 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using StructureHelperCommon.Services;
|
using StructureHelperCommon.Services;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace StructureHelperCommon.Models.Forces.Logics
|
namespace StructureHelperCommon.Models.Forces.Logics
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,10 +1,6 @@
|
|||||||
using StructureHelperCommon.Models.Analyses;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models.Analyses;
|
||||||
using StructureHelperLogics.Models.BeamShears;
|
using StructureHelperLogics.Models.BeamShears;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
|
|
||||||
namespace StructureHelperLogics.Models.Analyses
|
namespace StructureHelperLogics.Models.Analyses
|
||||||
@@ -12,6 +8,7 @@ namespace StructureHelperLogics.Models.Analyses
|
|||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public class BeamShearAnalysis : IBeamShearAnalysis
|
public class BeamShearAnalysis : IBeamShearAnalysis
|
||||||
{
|
{
|
||||||
|
private IUpdateStrategy<IBeamShearAnalysis> updateStrategy;
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public Guid Id { get; }
|
public Guid Id { get; }
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
@@ -23,7 +20,7 @@ namespace StructureHelperLogics.Models.Analyses
|
|||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public Color Color { get; set; } = Color.FromRgb(128, 0, 0);
|
public Color Color { get; set; } = Color.FromRgb(128, 0, 0);
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public IVersionProcessor VersionProcessor { get; set; } = new VersionProcessor();
|
public IVersionProcessor VersionProcessor { get; set; } = new VersionProcessor(Guid.NewGuid());
|
||||||
public BeamShearAnalysis(Guid id)
|
public BeamShearAnalysis(Guid id)
|
||||||
{
|
{
|
||||||
Id = id;
|
Id = id;
|
||||||
@@ -31,10 +28,28 @@ namespace StructureHelperLogics.Models.Analyses
|
|||||||
VersionProcessor.AddVersion(beamShear);
|
VersionProcessor.AddVersion(beamShear);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
public object Clone()
|
public object Clone()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
InitializeStrategies();
|
||||||
|
BeamShearAnalysis newAnalysis = new(Guid.NewGuid());
|
||||||
|
updateStrategy.Update(newAnalysis, this);
|
||||||
|
newAnalysis.VersionProcessor.Versions.Clear();
|
||||||
|
IBeamShear newVersion = GetCloneOfCurrentVersion();
|
||||||
|
newAnalysis.VersionProcessor.AddVersion(newVersion);
|
||||||
|
return newAnalysis;
|
||||||
|
}
|
||||||
|
|
||||||
|
private IBeamShear GetCloneOfCurrentVersion()
|
||||||
|
{
|
||||||
|
IBeamShear currentVersionOfSource = VersionProcessor.GetCurrentVersion().AnalysisVersion as IBeamShear;
|
||||||
|
IBeamShear newVersion = currentVersionOfSource.Clone() as IBeamShear;
|
||||||
|
return newVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitializeStrategies()
|
||||||
|
{
|
||||||
|
updateStrategy ??= new BeamShearAnalysisUpdateStrategy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace StructureHelperLogics.Models.Analyses
|
|||||||
targetObject.VersionProcessor.Versions.Clear();
|
targetObject.VersionProcessor.Versions.Clear();
|
||||||
foreach (var version in sourceObject.VersionProcessor.Versions)
|
foreach (var version in sourceObject.VersionProcessor.Versions)
|
||||||
{
|
{
|
||||||
if (version is IBeamShear beamShear)
|
if (version.AnalysisVersion is IBeamShear beamShear)
|
||||||
{
|
{
|
||||||
updateVersion(targetObject, version, beamShear);
|
updateVersion(targetObject, version, beamShear);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace StructureHelperLogic.Models.Analyses
|
|||||||
{
|
{
|
||||||
public class CrossSectionNdmAnalysis : ICrossSectionNdmAnalysis
|
public class CrossSectionNdmAnalysis : ICrossSectionNdmAnalysis
|
||||||
{
|
{
|
||||||
private CrossSectionNdmAnalysisUpdateStrategy updateStrategy = new();
|
private IUpdateStrategy<ICrossSectionNdmAnalysis> updateStrategy;
|
||||||
public Guid Id { get; private set; }
|
public Guid Id { get; private set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public string Tags { get; set; }
|
public string Tags { get; set; }
|
||||||
@@ -23,12 +23,12 @@ namespace StructureHelperLogic.Models.Analyses
|
|||||||
VersionProcessor = versionProcessor;
|
VersionProcessor = versionProcessor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CrossSectionNdmAnalysis(Guid id) : this (id, new VersionProcessor())
|
public CrossSectionNdmAnalysis(Guid id) : this (id, new VersionProcessor(Guid.NewGuid()))
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public CrossSectionNdmAnalysis() : this(Guid.NewGuid(), new VersionProcessor())
|
public CrossSectionNdmAnalysis() : this(Guid.NewGuid(), new VersionProcessor(Guid.NewGuid()))
|
||||||
{
|
{
|
||||||
CrossSection crossSection = new();
|
CrossSection crossSection = new();
|
||||||
VersionProcessor.AddVersion(crossSection);
|
VersionProcessor.AddVersion(crossSection);
|
||||||
@@ -36,11 +36,12 @@ namespace StructureHelperLogic.Models.Analyses
|
|||||||
|
|
||||||
public object Clone()
|
public object Clone()
|
||||||
{
|
{
|
||||||
|
updateStrategy ??= new CrossSectionNdmAnalysisUpdateStrategy();
|
||||||
CrossSectionNdmAnalysis newAnalysis = new();
|
CrossSectionNdmAnalysis newAnalysis = new();
|
||||||
updateStrategy.Update(newAnalysis, this);
|
updateStrategy.Update(newAnalysis, this);
|
||||||
|
newAnalysis.VersionProcessor.Versions.Clear();
|
||||||
var currentVersion = VersionProcessor.GetCurrentVersion().AnalysisVersion as ICloneable;
|
var currentVersion = VersionProcessor.GetCurrentVersion().AnalysisVersion as ICloneable;
|
||||||
ISaveable newCrossSection = currentVersion.Clone() as ISaveable;
|
ISaveable newCrossSection = currentVersion.Clone() as ISaveable;
|
||||||
newAnalysis.VersionProcessor.Versions.Clear();
|
|
||||||
newAnalysis.VersionProcessor.AddVersion(newCrossSection);
|
newAnalysis.VersionProcessor.AddVersion(newCrossSection);
|
||||||
return newAnalysis;
|
return newAnalysis;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,11 +4,6 @@ using StructureHelperCommon.Models.Analyses;
|
|||||||
using StructureHelperCommon.Services;
|
using StructureHelperCommon.Services;
|
||||||
using StructureHelperLogic.Models.Analyses;
|
using StructureHelperLogic.Models.Analyses;
|
||||||
using StructureHelperLogics.Models.CrossSections;
|
using StructureHelperLogics.Models.CrossSections;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.Models.Analyses
|
namespace StructureHelperLogics.Models.Analyses
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,17 +1,33 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
using System;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using System.Collections.Generic;
|
using StructureHelperCommon.Services;
|
||||||
using System.Linq;
|
using StructureHelperLogics.Models.BeamShears.Logics;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
//Copyright (c) 2025 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
namespace StructureHelperLogics.Models.BeamShears
|
namespace StructureHelperLogics.Models.BeamShears
|
||||||
{
|
{
|
||||||
public class BeamShearUpdateStrategy : IUpdateStrategy<IBeamShear>
|
public class BeamShearUpdateStrategy : IUpdateStrategy<IBeamShear>
|
||||||
{
|
{
|
||||||
|
IProcessStrategy<IBeamShearRepository> clearStrategy;
|
||||||
|
IUpdateStrategy<IBeamShearRepository> repositoryUpdateStrategy;
|
||||||
public void Update(IBeamShear targetObject, IBeamShear sourceObject)
|
public void Update(IBeamShear targetObject, IBeamShear sourceObject)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
CheckObject.IsNull(sourceObject, ErrorStrings.SourceObject);
|
||||||
|
CheckObject.IsNull(targetObject, ErrorStrings.TargetObject);
|
||||||
|
if (ReferenceEquals(targetObject, sourceObject)) { return; };
|
||||||
|
CheckObject.IsNull(sourceObject.Repository);
|
||||||
|
CheckObject.IsNull(targetObject.Repository);
|
||||||
|
InitializeStrategies();
|
||||||
|
clearStrategy.Process(targetObject.Repository);
|
||||||
|
repositoryUpdateStrategy.Update(targetObject.Repository, sourceObject.Repository);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitializeStrategies()
|
||||||
|
{
|
||||||
|
repositoryUpdateStrategy ??= new BeamShearRepositoryAddUpdateStrategy();
|
||||||
|
clearStrategy ??= new BeamShearReporitoryClearStrategy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Services;
|
||||||
|
|
||||||
|
//Copyright (c) 2025 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.Models.BeamShears
|
||||||
|
{
|
||||||
|
public class BeamShearReporitoryClearStrategy : IProcessStrategy<IBeamShearRepository>
|
||||||
|
{
|
||||||
|
public void Process(IBeamShearRepository entity)
|
||||||
|
{
|
||||||
|
CheckObject.IsNull(entity.Calculators);
|
||||||
|
entity.Calculators.Clear();
|
||||||
|
CheckObject.IsNull(entity.Actions);
|
||||||
|
entity.Actions.Clear();
|
||||||
|
CheckObject.IsNull(entity.Sections);
|
||||||
|
entity.Sections.Clear();
|
||||||
|
CheckObject.IsNull(entity.Stirrups);
|
||||||
|
entity.Stirrups.Clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user