Merge branch 'release/AddMassiveCmd_02'

This commit is contained in:
Samuele Locatelli
2025-01-24 18:22:20 +01:00
14 changed files with 143 additions and 79 deletions
+3 -2
View File
@@ -44,6 +44,7 @@ namespace LiMan.APi.Data
/// <param name="logger"></param>
/// <param name="emailSender"></param>
/// <param name="redisCacheClient"></param>
/// <param name="redisConnMult"></param>
public ApiDataService(IConfiguration configuration, ILogger<ApiDataService> logger, IEmailSender emailSender, IRedisCacheClient redisCacheClient, IConnectionMultiplexer redisConnMult)
//public ApiDataService(IConfiguration configuration, ILogger<ApiDataService> logger, IDistributedCache distributedCache, IEmailSender emailSender, IRedisCacheClient redisCacheClient)
{
@@ -1239,7 +1240,7 @@ namespace LiMan.APi.Data
bool answ = redisHashKeySet(doneKey, res.Key, res.Value, scadenza);
redisHashKeyDelete(runKey, res.Key);
// sistemo hashset...
redisHashKeySet((RedisKey)$"{rKeyTaskDone}List", res.Key, res.Value);
redisHashKeySet((RedisKey)$"{rKeyTaskRun}List", CodImp, $"{DateTime.Now:yyyy-MM-dd HH:mm:ss}");
redisHashKeyDelete((RedisKey)$"{rKeyTaskRun}List", CodImp);
// segnalo fatto
done += answ ? 1 : 0;
@@ -1270,7 +1271,7 @@ namespace LiMan.APi.Data
bool answ = redisHashKeySet(runKey, res.Key, res.Value, scadenza);
redisHashKeyDelete(reqKey, res.Key);
// sistemo hashset...
redisHashKeySet((RedisKey)$"{rKeyTaskRun}List", res.Key, res.Value);
redisHashKeySet((RedisKey)$"{rKeyTaskRun}List", CodImp, $"{DateTime.Now:yyyy-MM-dd HH:mm:ss}");
redisHashKeyDelete((RedisKey)$"{rKeyTaskReq}List", CodImp);
// segnalo fatto
done += answ ? 1 : 0;
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>License Manager</i>
<h4>Versione: 2.1.2501.2319</h4>
<h4>Versione: 2.1.2501.2418</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
2.1.2501.2319
2.1.2501.2418
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>2.1.2501.2319</version>
<version>2.1.2501.2418</version>
<url>https://nexus.steamware.net/repository/SWS/LiMan/stable/LAST/LiMan.UI.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/LiMan/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+118
View File
@@ -0,0 +1,118 @@
using Core;
using Microsoft.AspNetCore.Identity.UI.Services;
using Microsoft.Extensions.Caching.Distributed;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using NLog;
using StackExchange.Redis;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime;
using System.Text;
using System.Threading.Tasks;
namespace LiMan.DB.Services
{
/// <summary>
/// Classe common x gestione servizi sui dati (DB + REDIS) x UI ed API
/// </summary>
public class CommonDataServices : IDisposable
{
#region Public Constructors
/// <summary>
/// Costruttore principale
/// </summary>
/// <param name="configuration"></param>
/// <param name="memoryCache"></param>
/// <param name="distributedCache"></param>
/// <param name="redisConnMult"></param>
/// <param name="emailSender"></param>
public CommonDataServices(IConfiguration configuration, IConnectionMultiplexer redisConnMult, IEmailSender emailSender)
{
_configuration = configuration;
// Conf cache
redisConn = redisConnMult;
redisDb = this.redisConn.GetDatabase();
// json serializer... FIX errore loop circolare https://www.ryadel.com/en/jsonserializationexception-self-referencing-loop-detected-error-fix-entity-framework-asp-net-core/
JSSettings = new JsonSerializerSettings()
{
ReferenceLoopHandling = ReferenceLoopHandling.Ignore
};
// conf messagepipe: setup canali pub/sub
EnrollMessPipe = new MessagePipe(redisConn, Const.ENRL_MSG_PIPE);
TaskMessPipe = new MessagePipe(redisConn, Const.TASK_MSG_PIPE);
_emailSender = emailSender;
// conf DB
string connStrDB = _configuration.GetConnectionString("LiMan.DB");
if (string.IsNullOrEmpty(connStrDB))
{
Log.Error("Empty ConnString for LiMan.DB!");
}
else
{
dbControllerNext = new LiMan.DB.Controllers.DbController(configuration);
Log.Info("DbController for LiMan.DB OK");
}
}
#endregion Public Constructors
#region Public Properties
/// <summary>
/// Wrapper x invio/ricezione messaggi sul canale dedicato agli eventi enroll
/// </summary>
public MessagePipe EnrollMessPipe { get; set; } = null!;
/// <summary>
/// Wrapper x invio/ricezione messaggi sul canale dedicato agli eventi Task
/// </summary>
public MessagePipe TaskMessPipe { get; set; } = null!;
#endregion Public Properties
#region Public Methods
public virtual void Dispose()
{
// Clear database controller
dbControllerNext.Dispose();
}
#endregion Public Methods
#region Protected Fields
protected static IConfiguration _configuration;
protected static Controllers.DbController dbControllerNext;
protected static JsonSerializerSettings? JSSettings;
protected static Logger Log = LogManager.GetCurrentClassLogger();
/// <summary>
/// Oggetto per invio email
/// </summary>
protected readonly IEmailSender _emailSender;
/// <summary>
/// Oggetto per connessione a REDIS
/// </summary>
protected IConnectionMultiplexer redisConn = null!;
/// <summary>
/// Oggetto DB redis da impiegare x chiamate R/W
/// </summary>
protected IDatabase redisDb = null!;
protected Random rnd = new Random();
#endregion Protected Fields
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>License Manager</i>
<h4>Versione: 2.1.2501.2315</h4>
<h4>Versione: 2.1.2501.2418</h4>
<br />
Note di rilascio:
<ul>
+1 -1
View File
@@ -1 +1 @@
2.1.2501.2315
2.1.2501.2418
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>2.1.2501.2315</version>
<version>2.1.2501.2418</version>
<url>https://nexus.steamware.net/repository/SWS/LiMan/stable/LAST/LiMan.Transfer.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/LiMan/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+4 -9
View File
@@ -223,6 +223,7 @@ namespace LiMan.UI.Components
isLoading = true;
InfoStats = await LMDService.InstallStatusGetInfo(DtInizio, DtFine, CodInstSel, CodTipoApp);
ReloadDevices();
ReloadTaskStatus();
isLoading = false;
}
@@ -260,15 +261,9 @@ namespace LiMan.UI.Components
/// </summary>
private void ReloadTaskStatus()
{
TaskReq = new Dictionary<string, string>();
TaskRun = new Dictionary<string, string>();
TaskDone = new Dictionary<string, string>();
if (!string.IsNullOrEmpty(CodImpSel))
{
TaskReq = LMDService.TaskListReqGet(CodImpSel);
TaskRun = LMDService.TaskListRunGet(CodImpSel);
TaskDone = LMDService.TaskListDoneGet(CodImpSel);
}
TaskReq = LMDService.TaskListReqGet(CodImpSel);
TaskRun = LMDService.TaskListRunGet(CodImpSel);
TaskDone = LMDService.TaskListDoneGet(CodImpSel);
}
/// <summary>
+8 -58
View File
@@ -6,6 +6,7 @@ using LiMan.DB;
using LiMan.DB.Controllers;
using LiMan.DB.DBModels;
using LiMan.DB.DTO;
using LiMan.DB.Services;
using Microsoft.AspNetCore.Identity.UI.Services;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Caching.Distributed;
@@ -28,70 +29,36 @@ using static Core.Enum;
namespace LiMan.UI.Data
{
public class LiManDataService : IDisposable
public class LiManDataService : CommonDataServices
{
#region Public Fields
public static GLS.Controllers.LicManController dbControllerGLS;
public static DB.Controllers.DbController dbControllerNext;
#endregion Public Fields
#region Public Constructors
public LiManDataService(IConfiguration configuration, ILogger<LiManDataService> logger, IMemoryCache memoryCache, IDistributedCache distributedCache, IConnectionMultiplexer redisConnMult, IEmailSender emailSender)
public LiManDataService(IConfiguration configuration, IMemoryCache memoryCache, IDistributedCache distributedCache, IConnectionMultiplexer redisConnMult, IEmailSender emailSender) : base(configuration, redisConnMult, emailSender)
{
_logger = logger;
_configuration = configuration;
// Conf cache
redisConn = redisConnMult;
redisDb = this.redisConn.GetDatabase();
// json serializer... FIX errore loop circolare https://www.ryadel.com/en/jsonserializationexception-self-referencing-loop-detected-error-fix-entity-framework-asp-net-core/
JSSettings = new JsonSerializerSettings()
{
ReferenceLoopHandling = ReferenceLoopHandling.Ignore
};
// conf messagepipe: setup canali pub/sub
EnrollMessPipe = new MessagePipe(redisConn, Const.ENRL_MSG_PIPE);
TaskMessPipe = new MessagePipe(redisConn, Const.TASK_MSG_PIPE);
_emailSender = emailSender;
// conf cache
this.memoryCache = memoryCache;
this.distributedCache = distributedCache;
// conf DB
string connStrGLS = _configuration.GetConnectionString("LiMan.GLS");
string connStrDB = _configuration.GetConnectionString("LiMan.DB");
if (string.IsNullOrEmpty(connStrDB) || string.IsNullOrEmpty(connStrGLS))
if (string.IsNullOrEmpty(connStrGLS))
{
_logger.LogError("Almost one ConnString empty!");
Log.Error("Empty ConnString for LiMan.GLS!");
}
else
{
dbControllerGLS = new LiMan.GLS.Controllers.LicManController(configuration);
dbControllerNext = new LiMan.DB.Controllers.DbController(configuration);
_logger.LogInformation("DbControllers OK");
Log.Info("DbController for LiMan.GLS OK");
}
}
#endregion Public Constructors
#region Public Properties
/// <summary>
/// Wrapper x invio/ricezione messaggi sul canale dedicato agli eventi enroll
/// </summary>
public MessagePipe EnrollMessPipe { get; set; } = null!;
/// <summary>
/// Wrapper x invio/ricezione messaggi sul canale dedicato agli eventi Task
/// </summary>
public MessagePipe TaskMessPipe { get; set; } = null!;
#endregion Public Properties
#region Public Methods
public async Task<List<GLS.DatabaseModels.AnagApplicazioni>> ApplicazioniGLSGetAll()
@@ -597,8 +564,9 @@ namespace LiMan.UI.Data
return await Task.FromResult(dbControllerGLS.DbForceMigrate());
}
public void Dispose()
public override void Dispose()
{
base.Dispose();
// Clear database controller
dbControllerGLS.Dispose();
}
@@ -1662,8 +1630,6 @@ namespace LiMan.UI.Data
/// </summary>
protected const string rKeyTaskRun = $"{rKeyBaseComm}:TaskRun";
protected static JsonSerializerSettings? JSSettings;
/// <summary>
/// Durata cache lunga IN SECONDI
/// </summary>
@@ -1674,18 +1640,6 @@ namespace LiMan.UI.Data
/// </summary>
protected int cacheTtlShort = 60 * 1;
/// <summary>
/// Oggetto per connessione a REDIS
/// </summary>
protected IConnectionMultiplexer redisConn = null!;
/// <summary>
/// Oggetto DB redis da impiegare x chiamate R/W
/// </summary>
protected IDatabase redisDb = null!;
protected Random rnd = new Random();
#endregion Protected Fields
#region Protected Properties
@@ -1763,10 +1717,6 @@ namespace LiMan.UI.Data
#region Private Fields
private static IConfiguration _configuration;
private static ILogger<LiManDataService> _logger;
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
private readonly IEmailSender _emailSender;
private readonly IDistributedCache distributedCache;
private readonly IMemoryCache memoryCache;
+1 -1
View File
@@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Version>2.1.2501.2408</Version>
<Version>2.1.2501.2418</Version>
<RootNamespace>LiMan.UI</RootNamespace>
<AssemblyName>LiMan.UI</AssemblyName>
</PropertyGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>License Manager</i>
<h4>Versione: 2.1.2501.2408</h4>
<h4>Versione: 2.1.2501.2418</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
2.1.2501.2408
2.1.2501.2418
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>2.1.2501.2408</version>
<version>2.1.2501.2418</version>
<url>https://nexus.steamware.net/repository/SWS/LiMan/stable/LAST/LiMan.UI.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/LiMan/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>