Add converting primitives and calculators
This commit is contained in:
41
DataAccess/DTOs/Converters/HasForceActionsProcessLogic.cs
Normal file
41
DataAccess/DTOs/Converters/HasForceActionsProcessLogic.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class HasForceActionsProcessLogic : IHasForceActionsProcessLogic
|
||||
{
|
||||
private const string convertStarted = " converting is started";
|
||||
private const string convertFinished = " converting has been finished succesfully";
|
||||
|
||||
public IShiftTraceLogger TraceLogger { get; set; }
|
||||
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||
|
||||
public IHasForceActions Source { get; set; }
|
||||
public IHasForceActions Target { get; set; }
|
||||
public void Process()
|
||||
{
|
||||
TraceLogger?.AddMessage("Actions" + convertStarted);
|
||||
ForceActionsFromDTOConvertStrategy convertStrategy = new()
|
||||
{
|
||||
ReferenceDictionary = ReferenceDictionary,
|
||||
TraceLogger = TraceLogger
|
||||
};
|
||||
DictionaryConvertStrategy<IForceAction, IForceAction> convertLogic = new()
|
||||
{
|
||||
ReferenceDictionary = ReferenceDictionary,
|
||||
TraceLogger = TraceLogger,
|
||||
ConvertStrategy = convertStrategy
|
||||
};
|
||||
HasForceActionsFromDTOUpdateStrategy updateStrategy = new(convertLogic);
|
||||
updateStrategy.Update(Target, Source);
|
||||
TraceLogger?.AddMessage("Actions" + convertFinished);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user