Update comportamenti perdita selezioni varie

This commit is contained in:
Samuele Locatelli
2025-02-03 19:20:21 +01:00
parent 45aefc8a48
commit 42d07b113c
16 changed files with 61 additions and 99 deletions
+1
View File
@@ -69,6 +69,7 @@ namespace Core
public static Dictionary<string, string> AppType = new Dictionary<string, string>{
{ "", "---Selezionare---" },
{ "Cli", "Cli (Console)" },
{ "EgwACC", "EgwAppCtrCenter" },
{ "LicenceApp", "LicenceApp" },
{ "Machine", "Machine" },
{ "WebApp", "WebApp" },
+1 -1
View File
@@ -248,7 +248,7 @@ namespace LiMan.APi.Controllers
{
bool extractDone = false;
// recupero applicativi connessi
var listLic = await dataService.ApplicativiSearch(CodInst, CodApp, false);
var listLic = await dataService.AppDtoSearch(CodInst, CodApp, false);
var currLic = listLic.Where(x => x.IsActive).FirstOrDefault();
// procedo SOLO SE ho una licenza attiva x questo cliente
if (currLic != null)
@@ -60,7 +60,7 @@ namespace LiMan.APi.Controllers
[HttpGet("{id}")]
public async Task<List<DB.DTO.ApplicativoDTO>> Get(string id, string CodApp)
{
var result = await dataService.ApplicativiSearch(id, CodApp, true);
var result = await dataService.AppDtoSearch(id, CodApp, true);
await dataService.recordCall(id, CodApp, $"GET:api/applicazione");
return result;
}
+1 -1
View File
@@ -314,7 +314,7 @@ namespace LiMan.APi.Controllers
{
bool extractDone = false;
// recupero applicativi connessi
var listLic = await dataService.ApplicativiSearch(CodInst, CodApp, false);
var listLic = await dataService.AppDtoSearch(CodInst, CodApp, false);
var currLic = listLic.Where(x => x.IsActive).FirstOrDefault();
// procedo SOLO SE ho una licenza attiva x questo cliente
if (currLic != null)
+2 -2
View File
@@ -215,7 +215,7 @@ namespace LiMan.APi.Controllers
if (licUploader != null && licUploader.Count > 0)
{
// in primis cerco app...
var appList = await dataService.ApplicativiGetAll();
var appList = await dataService.ApplicNextGetAll(true);
ApplicativoModel recApp = new ApplicativoModel();
if (appList != null)
{
@@ -231,7 +231,7 @@ namespace LiMan.APi.Controllers
TplConnString = "",
Tipo = CurrReq.Tipo
};
await dataService.ApplicativoUpsert(recApp);
await dataService.ApplicNextUpdate(recApp);
}
//converto in una release...
ReleaseModel newRec = new ReleaseModel()
-53
View File
@@ -81,59 +81,6 @@ namespace LiMan.APi.Data
#region Public Methods
/// <summary> Elenco Applicativi (all) <returns></returns>
public async Task<List<ApplicativoModel>> ApplicativiGetAll()
{
List<ApplicativoModel> dbResult = new List<ApplicativoModel>();
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
dbResult = dbController.GetApplicazioni();
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB per ApplicativiGetAll: {ts.TotalMilliseconds} ms");
return await Task.FromResult(dbResult);
}
/// <summary>
/// Elenco licenze dato cliente
/// </summary>
/// <param name="CodInst">Codice Installaizone /Cliente</param>
/// <param name="CodApp">Codice Applicazione</param>
/// <param name="HideData">Indica se nascondere i dati sensibili</param>
/// <returns></returns>
public async Task<List<ApplicativoDTO>> ApplicativiSearch(string CodInst, string CodApp, bool HideData)
{
List<ApplicativoDTO> dbResult = new List<ApplicativoDTO>();
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
dbResult = dbController.GetApplicativiFilt(true, CodApp, CodInst, HideData);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB per ApplicativiByCliente: {ts.TotalMilliseconds} ms");
return await Task.FromResult(dbResult);
}
/// <summary>
/// Aggiornameto/Inserimento record applicativo
/// </summary>
/// <param name="newRec">record Release</param>
/// <returns></returns>
public async Task<bool> ApplicativoUpsert(ApplicativoModel newRec)
{
await Task.Delay(1);
bool fatto = false;
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
// inserisco
fatto = dbController.ApplicativoUpsert(newRec);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuato upsert su DB per ApplicativoUpsert | {newRec.CodApp} | {ts.TotalMilliseconds} ms");
return fatto;
}
/// <summary>
/// Elenco licenze dato cliente
/// </summary>
+6 -4
View File
@@ -34,6 +34,7 @@ namespace LiMan.DB.Controllers
#region Public Methods
#if false
/// <summary>
/// Upsert record applicativo
/// </summary>
@@ -73,7 +74,8 @@ namespace LiMan.DB.Controllers
}
}
return fatto;
}
}
#endif
/// <summary>
/// Verifica se una applcazione abbia record correlati...
@@ -114,7 +116,7 @@ namespace LiMan.DB.Controllers
}
catch (Exception exc)
{
Log.Error($"Eccezione in ApplicazioniHasChild:{Environment.NewLine}{exc}");
Log.Error($"Eccezione in ApplicHasChild:{Environment.NewLine}{exc}");
}
}
return answ;
@@ -147,7 +149,7 @@ namespace LiMan.DB.Controllers
}
catch (Exception exc)
{
Log.Error($"Eccezione in ApplicazioniNextDelete:{Environment.NewLine}{exc}");
Log.Error($"Eccezione in ApplicNextDelete:{Environment.NewLine}{exc}");
}
}
return done;
@@ -183,7 +185,7 @@ namespace LiMan.DB.Controllers
}
catch (Exception exc)
{
Log.Error($"Eccezione in ApplicazioniNextUpdate:{Environment.NewLine}{exc}");
Log.Error($"Eccezione in ApplicNextUpdate:{Environment.NewLine}{exc}");
}
}
return done;
+34 -14
View File
@@ -92,7 +92,27 @@ namespace LiMan.DB.Services
#region Public Methods
public async Task<bool> ApplicazioniHasChild(string CodApp)
/// <summary>
/// Elenco licenze dato cliente
/// </summary>
/// <param name="CodInst">Codice Installaizone /Cliente</param>
/// <param name="CodApp">Codice Applicazione</param>
/// <param name="HideData">Indica se nascondere i dati sensibili</param>
/// <returns></returns>
public async Task<List<ApplicativoDTO>> AppDtoSearch(string CodInst, string CodApp, bool HideData)
{
List<ApplicativoDTO> dbResult = new List<ApplicativoDTO>();
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
dbResult = dbController.GetApplicativiFilt(true, CodApp, CodInst, HideData);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB per ApplicativiByCliente: {ts.TotalMilliseconds} ms");
return await Task.FromResult(dbResult);
}
public async Task<bool> ApplicHasChild(string CodApp)
{
string source = "DB";
bool dbResult = false;
@@ -114,11 +134,11 @@ namespace LiMan.DB.Services
redisHashKeySet(currKey, CodApp, rawData, UltraLongCache.Minutes);
}
sw.Stop();
Log.Debug($"ApplicazioniHasChild | {source} in: {sw.Elapsed.TotalMilliseconds:N2} ms");
Log.Debug($"ApplicHasChild | {source} in: {sw.Elapsed.TotalMilliseconds:N2} ms");
}
catch (Exception exc)
{
Log.Error($"Error during ApplicazioniHasChild:{Environment.NewLine}{exc}");
Log.Error($"Error during ApplicHasChild:{Environment.NewLine}{exc}");
}
await Task.Delay(0);
return dbResult;
@@ -129,7 +149,7 @@ namespace LiMan.DB.Services
/// </summary>
/// <param name="currItem"></param>
/// <returns></returns>
public async Task<bool> ApplicazioniNextDelete(ApplicativoModel currItem)
public async Task<bool> ApplicNextDelete(ApplicativoModel currItem)
{
bool done = false;
try
@@ -144,12 +164,12 @@ namespace LiMan.DB.Services
}
catch (Exception exc)
{
Log.Error($"Eccezione in ApplicazioniNextDelete:{Environment.NewLine}{exc}");
Log.Error($"Eccezione in ApplicNextDelete:{Environment.NewLine}{exc}");
}
return done;
}
public async Task<List<ApplicativoModel>> ApplicazioniNextGetAll()
public async Task<List<ApplicativoModel>> ApplicNextGetAll(bool forceDb)
{
string source = "DB";
List<ApplicativoModel> dbResult = new List<ApplicativoModel>();
@@ -159,7 +179,7 @@ namespace LiMan.DB.Services
Stopwatch sw = new Stopwatch();
sw.Start();
string? rawData = await redisDb.StringGetAsync(currKey);
if (!string.IsNullOrEmpty(rawData))
if (!string.IsNullOrEmpty(rawData) && !forceDb)
{
source = "REDIS";
var tempResult = JsonConvert.DeserializeObject<List<ApplicativoModel>>(rawData);
@@ -183,16 +203,16 @@ namespace LiMan.DB.Services
dbResult = new List<ApplicativoModel>();
}
sw.Stop();
Log.Debug($"ApplicazioniNextGetAll | {source} in: {sw.Elapsed.TotalMilliseconds:N2} ms");
Log.Debug($"ApplicNextGetAll | {source} in: {sw.Elapsed.TotalMilliseconds:N2} ms");
}
catch (Exception exc)
{
Log.Error($"Error during ApplicazioniNextGetAll:{Environment.NewLine}{exc}");
Log.Error($"Error during ApplicNextGetAll:{Environment.NewLine}{exc}");
}
return dbResult;
}
public async Task<bool> ApplicazioniNextUpdate(ApplicativoModel currItem)
public async Task<bool> ApplicNextUpdate(ApplicativoModel currItem)
{
bool done = false;
try
@@ -202,7 +222,7 @@ namespace LiMan.DB.Services
}
catch (Exception exc)
{
Log.Error($"Eccezione in ApplicazioniNextUpdate:{Environment.NewLine}{exc}");
Log.Error($"Eccezione in ApplicNextUpdate:{Environment.NewLine}{exc}");
}
return done;
}
@@ -1457,12 +1477,12 @@ namespace LiMan.DB.Services
/// <returns></returns>
public bool TaskReqReset(string CodImp)
{
RedisKey currKey = (RedisKey)$"{rKeyTaskReq}:{CodImp}";
bool answ = redisHashDictDelete(currKey);
bool okReq = redisHashDictDelete((RedisKey)$"{rKeyTaskReq}:{CodImp}");
bool okRun = redisHashDictDelete((RedisKey)$"{rKeyTaskRun}:{CodImp}");
redisHashKeyDelete((RedisKey)$"{rKeyTaskReq}List", CodImp);
redisHashKeyDelete((RedisKey)$"{rKeyTaskRun}List", CodImp);
redisHashKeyDelete((RedisKey)$"{rKeyTaskDone}List", CodImp);
return answ;
return okReq && okRun;
}
/// <summary>
@@ -109,7 +109,7 @@ namespace LiMan.UI.Components
{
if (_currItem != null)
{
await DataService.ApplicazioniNextUpdate(_currItem);
await DataService.ApplicNextUpdate(_currItem);
await DataUpdated.InvokeAsync(0);
}
else
+1 -1
View File
@@ -72,7 +72,7 @@ namespace LiMan.UI.Components
_currItem = value;
var pUpd = Task.Run(async () =>
{
ListApp = await DataService.ApplicazioniNextGetAll();
ListApp = await DataService.ApplicNextGetAll(false);
ListInstall = await DataService.InstallazioniNextGetAll();
});
pUpd.Wait();
@@ -49,6 +49,7 @@ namespace LiMan.UI.Components
protected override void OnParametersSet()
{
currPage = 1;
ReloadData();
}
@@ -117,7 +117,7 @@ namespace LiMan.UI.Components
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler eliminare il record? Se ci sono record correlati questo non sarà comunque possibile"))
return;
await DataService.ApplicazioniNextDelete(rec2del);
await DataService.ApplicNextDelete(rec2del);
await ReloadAllData();
}
@@ -140,7 +140,7 @@ namespace LiMan.UI.Components
{
var pUpd = Task.Run(async () =>
{
answ = await DataService.ApplicazioniHasChild(currRec.CodApp);
answ = await DataService.ApplicHasChild(currRec.CodApp);
});
pUpd.Wait();
}
@@ -290,7 +290,7 @@ namespace LiMan.UI.Components
isLoading = true;
//SearchRecords = null;
SearchRecords = await DataService.ApplicazioniNextGetAll();
SearchRecords = await DataService.ApplicNextGetAll(false);
if (!string.IsNullOrEmpty(appTipoSel))
{
SearchRecords = SearchRecords.Where(x => x.Tipo == appTipoSel).ToList();
@@ -46,6 +46,7 @@ namespace LiMan.UI.Components
protected override void OnParametersSet()
{
currPage = 1;
ReloadData();
}
+1 -1
View File
@@ -388,7 +388,7 @@ namespace LiMan.UI.Components
isLoading = true;
ListRecords = null;
// se ho un tipoApp filtrato --> filtro applicazioni
ListApp = await DataService.ApplicazioniNextGetAll();
ListApp = await DataService.ApplicNextGetAll(false);
if (!string.IsNullOrEmpty(AppTipoSel))
{
ListApp = ListApp.Where(x => x.Tipo == AppTipoSel || string.IsNullOrEmpty(x.Tipo)).ToList();
+6 -2
View File
@@ -57,7 +57,8 @@
<tr class="bg-dark bg-gradient text-light">
<th class="text-center" style="width: 6rem;"></th>
<th>App Type</th>
<th>Path</th>
<th style="min-width: 16rem;">Path</th>
<th style="min-width: 8rem;">Search Pattern</th>
<th class="text-end" style="width: 3rem;">Enabled</th>
<th class="text-end" style="width: 3rem;">Update</th>
<th class="text-end" style="width: 3rem;"></th>
@@ -101,6 +102,9 @@
<td>
<input type="text" class="form-control form-control-sm" @bind="@item.BasePath" />
</td>
<td>
<input type="text" class="form-control form-control-sm" @bind="@item.SearchPattern" />
</td>
<td class="text-end">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" @bind="@item.IsEnabled">
@@ -108,7 +112,7 @@
</td>
<td class="text-end">
<div class="form-check form-switch">
@if (item.ApplicationType == "WinApp")
@if (item.ApplicationType == "WinApp" || item.ApplicationType == "EgwACC")
{
<input class="form-check-input" type="checkbox" @bind="@item.UpdateEnabled">
}
+1 -15
View File
@@ -302,20 +302,6 @@ namespace LiMan.UI.Components
#region Private Methods
//[Parameter]
//public LicenzaModel MasterLicence
//{
// get
// {
// return _masterLic;
// }
// set
// {
// _masterLic = value;
// var pUpd = Task.Run(async () => await ReloadAllData());
// pUpd.Wait();
// }
//}
private async Task FullReload()
{
await DataService.FlushRedisCache();
@@ -328,7 +314,7 @@ namespace LiMan.UI.Components
idxTicketSel = 0;
await Task.Delay(1);
showTickets = false;
ListApp = await DataService.ApplicazioniNextGetAll();
ListApp = await DataService.ApplicNextGetAll(false);
ListInstall = await DataService.InstallazioniNextGetAll();
//bool StatoRichiesta = true;
//SearchRecords = await LMDService.LicenzeNextGetFilt(AppMServ.DetailDBFilter);