Add import of forces from excel

This commit is contained in:
Evgeny Redikultsev
2025-01-11 21:58:58 +05:00
parent 932f87f566
commit 690af15e2a
43 changed files with 843 additions and 166 deletions

View File

@@ -0,0 +1,45 @@
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Forces.Logics
{
public class CheckForceActionsLogic : ICheckEntityLogic<IEnumerable<IForceAction>>
{
private bool result;
private string checkResult;
public string CheckResult => checkResult;
public IShiftTraceLogger? TraceLogger { get; set; }
public IEnumerable<IForceAction> Entity { get; set; }
public bool Check()
{
result = true;
foreach (var item in Entity)
{
try
{
item.GetCombinations();
}
catch (Exception ex)
{
result = false;
string errorString = $"Error of getting of combination of forces from action {item.Name}: {ex.Message}";
TraceMessage(errorString);
}
}
return result;
}
private void TraceMessage(string errorString)
{
checkResult += errorString + "\n";
TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
}
}
}