diff --git a/GPW.CORE.ADM/Components/Compo/DipendentiMan.razor b/GPW.CORE.ADM/Components/Compo/DipendentiMan.razor
index 5ced628..ed480a8 100644
--- a/GPW.CORE.ADM/Components/Compo/DipendentiMan.razor
+++ b/GPW.CORE.ADM/Components/Compo/DipendentiMan.razor
@@ -20,7 +20,7 @@
-
+
diff --git a/GPW.CORE.ADM/Components/Compo/DipendentiMan.razor.cs b/GPW.CORE.ADM/Components/Compo/DipendentiMan.razor.cs
index 7f91438..b4f2db3 100644
--- a/GPW.CORE.ADM/Components/Compo/DipendentiMan.razor.cs
+++ b/GPW.CORE.ADM/Components/Compo/DipendentiMan.razor.cs
@@ -129,16 +129,20 @@ namespace GPW.CORE.ADM.Components.Compo
await LicServ.TryActivationMult(CodList);
// cmq faccio refresh
await FullRefresh();
+ // ricalcolo licenze
+ await RefreshLicData(true);
}
-
await ReloadData();
}
protected async Task DoRefresh()
{
isLoading = true;
+ await LicServ.resetActivList();
await FullRefresh();
await ReloadData();
+ // ricalcolo licenze
+ await RefreshLicData(false);
isLoading = false;
}
@@ -154,13 +158,15 @@ namespace GPW.CORE.ADM.Components.Compo
CtrlMode = DipendentiEdit.EditMode.None;
RecordEdit = null;
await ReloadData();
+ // ricalcolo licenze
+ await RefreshLicData(false);
}
protected override async Task OnInitializedAsync()
{
await ReloadConfData();
await ReloadData();
- RefreshLicData();
+ await RefreshLicData(true);
AppMServ.EA_SearchUpdated += AppMServ_EA_SearchUpdated;
}
@@ -270,6 +276,33 @@ namespace GPW.CORE.ADM.Components.Compo
}
return answ;
}
+ ///
+ /// Rilascia licenza e rilegge conf
+ ///
+ ///
+ ///
+ private async Task ReleaseLicense(DipendentiModel CurrRecord)
+ {
+ // verifica SE ci sono licenze disponibili
+ if (NumLicDispOnline > NumLicActOnline)
+ {
+ // chiamo rimozione licenza
+ var CodImpiego = LicServ.HashDip(CurrRecord);
+ bool fatto = await LicServ.TryRemoveActivation(CodImpiego, CurrRecord.AuthKey);
+ if (fatto)
+ {
+ // disattiva utente
+ GDataServ.DipUpdateActive(CurrRecord.IdxDipendente, false);
+ }
+ LicServ.ResetLicenseData();
+ }
+ // disattivo record mostrato...
+ RecordEdit = null;
+ // ricarico
+ await ReloadData();
+ // ricalcolo licenze
+ await RefreshLicData(true);
+ }
private async Task DoActivate(DipendentiModel CurrRecord)
{
@@ -284,8 +317,9 @@ namespace GPW.CORE.ADM.Components.Compo
// effettua riassegnazione
bool fatto = LicServ.TryActivation(CodImpiego, CurrRecord.AuthKey);
}
-
await ReloadData();
+ // ricalcolo licenze
+ await RefreshLicData(true);
}
private async Task FullRefresh()
@@ -296,22 +330,27 @@ namespace GPW.CORE.ADM.Components.Compo
bool refreshAct = await LicServ.RefreshLicense();
bool refreshPay = LicServ.RefreshPayload();
// chiama update di TUTTE le authKey verso il server online
+ int numLoc = 0;
foreach (var item in ListDipendentiAttiviOrd)
{
var CodImpiego = LicServ.HashDip(item);
bool fatto = await LicServ.TryRefreshActivation(CodImpiego, item.AuthKey);
+ if (fatto)
+ numLoc++;
}
+ Log.Trace($"NumLoc: {numLoc}");
}
- private void RefreshLicData()
+ private async Task RefreshLicData(bool forceReload)
{
- if (LicServ.HasAppData)
+ if (!LicServ.HasAppData || forceReload)
{
- NumLicDispLocal = LicServ.NumLicDb;
- NumLicActLocal = LicServ.ActivList.Count();
- NumLicDispOnline = LicServ.AppLicense.NumLicenze;
- NumLicActOnline = LicServ.AppLicense.NumLicenzeAttive;
+ await FullRefresh();
}
+ NumLicDispLocal = LicServ.NumLicDb;
+ NumLicActLocal = LicServ.ActivList.Count();
+ NumLicDispOnline = LicServ.AppLicense.NumLicenze;
+ NumLicActOnline = LicServ.AppLicense.NumLicenzeAttive;
}
private async Task ReloadConfData()
diff --git a/GPW.CORE.ADM/Components/Pages/ForceReset.razor.cs b/GPW.CORE.ADM/Components/Pages/ForceReset.razor.cs
index 5da37b7..da5b92c 100644
--- a/GPW.CORE.ADM/Components/Pages/ForceReset.razor.cs
+++ b/GPW.CORE.ADM/Components/Pages/ForceReset.razor.cs
@@ -16,13 +16,17 @@ namespace GPW.CORE.ADM.Components.Pages
[Inject]
protected MessageService AppMServ { get; set; } = null!;
+ [Inject]
+ protected AppAuthService AuthService { get; set; } = null!;
+
[Inject]
protected GpwDataService GDataServ { get; set; } = null!;
[Inject]
- protected NavigationManager NavManager { get; set; } = null!;
+ protected LicenseService LicServ { get; set; } = null!;
+
[Inject]
- protected AppAuthService AuthService { get; set; } = null!;
+ protected NavigationManager NavManager { get; set; } = null!;
#endregion Protected Properties
@@ -35,6 +39,8 @@ namespace GPW.CORE.ADM.Components.Pages
await Task.Delay(10);
await AuthService.FlushRedisCache();
await Task.Delay(10);
+ LicServ.ResetLicenseData();
+ await Task.Delay(10);
AppMServ.clonedRA = null;
AppMServ.recordRA = null;
diff --git a/GPW.CORE.ADM/GPW.CORE.ADM.csproj b/GPW.CORE.ADM/GPW.CORE.ADM.csproj
index a381aed..04414f1 100644
--- a/GPW.CORE.ADM/GPW.CORE.ADM.csproj
+++ b/GPW.CORE.ADM/GPW.CORE.ADM.csproj
@@ -4,7 +4,7 @@
net8.0
enable
enable
- 4.1.2507.2212
+ 4.1.2509.0110
diff --git a/GPW.CORE.Data/Services/LicenseService.cs b/GPW.CORE.Data/Services/LicenseService.cs
index 1b85993..acfaeb1 100644
--- a/GPW.CORE.Data/Services/LicenseService.cs
+++ b/GPW.CORE.Data/Services/LicenseService.cs
@@ -522,6 +522,46 @@ namespace GPW.CORE.Data.Services
return answ;
}
+ ///
+ /// Tenta rimozione licenza dato codice impiego
+ ///
+ ///
+ ///
+ public async Task TryRemoveActivation(string CodImpiego, string Chiave)
+ {
+ bool answ = false;
+ // cerco online
+ RestClient client = new RestClient(apiUrl);
+ //client.Authenticator = new HttpBasicAuthenticator("username", "password");
+ string MKeyEnc = HttpUtility.UrlEncode(MasterKey);
+ var request = new RestRequest($"/api/attivazioni/removeKey");
+ Dictionary parDict = new Dictionary();
+ parDict.Add(CodImpiego, Chiave);
+ UserLicenseRequest newBody = new UserLicenseRequest()
+ {
+ MasterKey = MasterKey,
+ ParamDict = parDict
+ };
+ request.AddJsonBody(newBody);
+ var response = client.Post(request);
+ // controllo risposta
+ if (response.StatusCode == System.Net.HttpStatusCode.OK)
+ {
+ // verifico risposta
+ string rawData = $"{response.Content}";
+ try
+ {
+ bool.TryParse(rawData, out answ);
+ ResetLicenseData();
+ await RefreshLicense();
+ }
+ catch
+ { }
+ }
+ Log.Info($"Richiesta TryRemoveActivation | CodImpiego: {CodImpiego} | answ: {answ}");
+ return answ;
+ }
+
///
/// Tenta refresh licenza dato codice impiego (aggiorna la authKey...)
///
diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html
index 5bb689f..97f292a 100644
--- a/Resources/ChangeLog.html
+++ b/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
GPW - Gestione Presenze Web
- Versione: 4.1.2507.2212
+ Versione: 4.1.2509.0110
Note di rilascio:
-
diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt
index 0acb20c..4d4ab64 100644
--- a/Resources/VersNum.txt
+++ b/Resources/VersNum.txt
@@ -1 +1 @@
-4.1.2507.2212
+4.1.2509.0110
diff --git a/Resources/manifest.xml b/Resources/manifest.xml
index 1b8c2f7..d1b2253 100644
--- a/Resources/manifest.xml
+++ b/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 4.1.2507.2212
+ 4.1.2509.0110
http://nexus.steamware.net/repository/SWS/GPW/stable/GPW.UI.zip
http://nexus.steamware.net/repository/SWS/GPW/stable/ChangeLog.html
false