Merge branch 'release/AddDeleteEnroll_02'

This commit is contained in:
Samuele Locatelli
2025-02-06 15:23:16 +01:00
15 changed files with 118 additions and 45 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>License Manager</i>
<h4>Versione: 2.1.2502.0318</h4>
<h4>Versione: 2.1.2502.0615</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
2.1.2502.0318
2.1.2502.0615
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>2.1.2502.0318</version>
<version>2.1.2502.0615</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>
+13 -12
View File
@@ -266,11 +266,12 @@ namespace LiMan.DB.Controllers
using (LMDbContext localDbCtx = new LMDbContext(_configuration))
{
DateTime oggi = DateTime.Today;
dbResult = localDbCtx
.DbSetSubLicenze
.Where(x => x.IdxLic == idxLic)
.OrderBy(o => o.VetoUnlock)
.ToList();
var rawRes = localDbCtx
.DbSetSubLicenze
.Where(x => x.IdxLic == idxLic)
.OrderBy(o => o.VetoUnlock)
.ToList();
dbResult = rawRes != null ? rawRes : dbResult;
}
return dbResult;
}
@@ -1413,13 +1414,13 @@ namespace LiMan.DB.Controllers
{
DateTime oggi = DateTime.Today;
dbResult = localDbCtx
.DbSetLicenze
.Where(x => (x.CodApp == CodApp || string.IsNullOrEmpty(CodApp)) && (x.CodInst == CodInst || string.IsNullOrEmpty(CodInst)) && (!OnlyActive || x.Scadenza > oggi))
.Include(a => a.ApplicativoNav)
.Include(a => a.Attivazioni)
.Include(t => t.Tickets.Where(c => c.Status < StatoRichiesta.Approvata))
.OrderByDescending(o => o.Scadenza)
.ToList();
.DbSetLicenze
.Where(x => (x.CodApp == CodApp || string.IsNullOrEmpty(CodApp)) && (x.CodInst == CodInst || string.IsNullOrEmpty(CodInst)) && (!OnlyActive || x.Scadenza > oggi))
.Include(a => a.ApplicativoNav)
.Include(a => a.Attivazioni)
.Include(t => t.Tickets.Where(c => c.Status < StatoRichiesta.Approvata))
.OrderByDescending(o => o.Scadenza)
.ToList();
}
return dbResult;
}
+39 -7
View File
@@ -228,7 +228,7 @@ namespace LiMan.DB.Services
}
/// <summary>
/// Effettua sblocco di una licenza impostando data veto a oggi
/// Elimina record attivazione
/// </summary>
/// <param name="idxSubLic"></param>
/// <returns></returns>
@@ -1113,13 +1113,45 @@ namespace LiMan.DB.Services
/// <returns></returns>
public async Task<List<LicenzaModel>> LicenzeNextGetFilt(SelectNext CurrFilter)
{
Stopwatch sw = new Stopwatch();
string source = "DB";
List<LicenzaModel> dbResult = new List<LicenzaModel>();
sw.Start();
dbResult = dbController.GetLicenzeFilt(CurrFilter.OnlyActive, CurrFilter.ApplicazioneSel, CurrFilter.InstallazioneSel);
sw.Stop();
Log.Trace($"Effettuata lettura da DB per LicenzeNextGetFilt: {sw.Elapsed.TotalMilliseconds} ms");
return await Task.FromResult(dbResult);
try
{
string currKey = $"{Const.rKeyConfig}:Next:LicenzeFilt:APP_{CurrFilter.ApplicazioneSel}:INS_{CurrFilter.InstallazioneSel}:OA_{CurrFilter.OnlyActive}";
Stopwatch sw = new Stopwatch();
sw.Start();
string? rawData = await redisDb.StringGetAsync(currKey);
if (!string.IsNullOrEmpty(rawData))
{
source = "REDIS";
var tempResult = JsonConvert.DeserializeObject<List<LicenzaModel>>(rawData);
if (tempResult == null)
{
dbResult = new List<LicenzaModel>();
}
else
{
dbResult = tempResult;
}
}
else
{
dbResult = dbController.GetLicenzeFilt(CurrFilter.OnlyActive, CurrFilter.ApplicazioneSel, CurrFilter.InstallazioneSel);
rawData = JsonConvert.SerializeObject(dbResult, JSSettings);
await redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
}
if (dbResult == null)
{
dbResult = new List<LicenzaModel>();
}
sw.Stop();
Log.Debug($"LicenzeNextGetFilt | {source} in: {sw.Elapsed.TotalMilliseconds:N2} ms");
}
catch (Exception exc)
{
Log.Error($"Error during LicenzeNextGetAll:{Environment.NewLine}{exc}");
}
return dbResult;
}
public async Task<bool> LicenzeNextUpdate(LicenzaModel currItem)
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>License Manager</i>
<h4>Versione: 2.1.2502.0318</h4>
<h4>Versione: 2.1.2502.0615</h4>
<br />
Note di rilascio:
<ul>
+1 -1
View File
@@ -1 +1 @@
2.1.2502.0318
2.1.2502.0615
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>2.1.2502.0318</version>
<version>2.1.2502.0615</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>
+17 -8
View File
@@ -120,13 +120,19 @@ else if (SelRecord != null)
<div class="px-2">
<h3>Assegnazione licenza</h3>
</div>
<div class="px-2">
</div>
<div class="row py-2">
<div class="col">
@if (SelRecord.IdxLic == 0)
{
<button class="btn btn-sm my-2 btn-success" @onclick="ToggleAddNew" title="Aggiunta nuova licenza CLiente/Installazione">Add New Inst <i class="fa-solid fa-plus"></i></button>
<button class="btn btn-sm my-2 btn-success w-100" @onclick="ToggleAddNew" title="Aggiunta nuova licenza Cliente (Installazione)">Add New Inst <i class="fa-solid fa-plus"></i></button>
}
<button class="btn btn-sm m-2 btn-primary" @onclick="ToggleEditLic" title="Modifica Licenza Esistente">Edit Inst <i class="fa-solid fa-edit"></i></button>
<button class="btn btn-sm my-2 btn-dark" @onclick="ResetSel" title="Torna ad elenco">Chiudi <i class="fa-solid fa-xmark"></i></button>
</div>
<div class="col">
<button class="btn btn-sm m-2 btn-primary w-100" @onclick="ToggleEditLic" title="Modifica Licenza Cliente (Installazione) Esistente">Modifica Lic Inst <i class="fa-solid fa-edit"></i></button>
</div>
<div class="col">
<button class="btn btn-sm my-2 btn-dark w-100" @onclick="ResetSel" title="Torna ad elenco">Chiudi <i class="fa-solid fa-xmark"></i></button>
</div>
</div>
@@ -168,11 +174,14 @@ else if (SelRecord != null)
}
</div>
</div>
<div class="row">
<div class="col-12">
<button class="btn btn-sm my-2 btn-danger w-50" @onclick="DoDelete" title="Elimina Licenza">Elimina <i class="fa-solid fa-trash"></i></button>
@if (!string.IsNullOrEmpty(SelRecord.UserAppr))
{
<div class="d-flex justify-content-around border-top mt-3">
<div class="px-2 w-50">
<button class="btn btn-sm my-2 btn-danger w-100" @onclick="DoDelete" title="Elimina Licenza">Elimina <i class="fa-solid fa-trash"></i></button>
</div>
</div>
</div>
}
</div>
</div>
}
+34 -7
View File
@@ -154,14 +154,41 @@ namespace LiMan.UI.Components
protected async Task DoDelete()
{
// chiedo conferma...
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler eliminare il record?"))
return;
if (SelRecord != null)
{
// chiedo conferma...
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler eliminare il record?"))
return;
await LMDService.EnrollReqDelete(SelRecord.IdReq);
await Task.Delay(50);
SelRecord = null;
await ReloadData();
// cerca l'attivazione collegata x DeviceID (contenuto nel payload) e se lo trova la elimina
List<SubLicenzaModel> listAtt = await LMDService.AttivazioniGetByLic(SelRecord.IdxLic);
// se ne ho trovate cerco...
if (listAtt.Count > 0)
{
var dictPayload = JsonConvert.DeserializeObject<Dictionary<string, string>>(SelRecord.ReqPayload);
if (dictPayload != null && dictPayload.Count > 0)
{
string DeviceID = "";
if (dictPayload.ContainsKey("DeviceID"))
{
DeviceID = dictPayload["DeviceID"];
}
// cerco attivazioni correlate (tutte)
var rec2del = listAtt.Where(x => x.CodImpiego == DeviceID).ToList();
if (rec2del != null)
{
foreach (var rec in rec2del)
{
await LMDService.AttivazioneDelete(rec.IdxSubLic);
}
}
}
}
await LMDService.EnrollReqDelete(SelRecord.IdReq);
await Task.Delay(10);
SelRecord = null;
await ReloadData();
}
}
protected async Task DoSelect(EnrollRequestModel curRec)
+5 -1
View File
@@ -70,7 +70,11 @@ namespace LiMan.UI.Components
{
ApplicazioneSel = "UpdateManager"
};
ListLicenze = await LMDService.LicenzeNextGetFilt(currFilt);
var rawList= await LMDService.LicenzeNextGetFilt(currFilt);
ListLicenze = rawList
.OrderBy(x => x.CodApp)
.ThenBy(x => x.CodInst)
.ToList();
}
#endregion Protected Methods
+1 -1
View File
@@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Version>2.1.2502.0612</Version>
<Version>2.1.2502.0615</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.2502.0612</h4>
<h4>Versione: 2.1.2502.0615</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
2.1.2502.0612
2.1.2502.0615
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>2.1.2502.0612</version>
<version>2.1.2502.0615</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>