From 9ba06b5734b6757e0859889af138d3e63b84b061 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Thu, 13 Jan 2022 14:29:36 +0100 Subject: [PATCH 1/5] Fix letture dip attivi in pag admin --- GPW_Admin/WebUserControls/mod_adminDipendenti.ascx.cs | 6 +++--- GPW_Data/licenzeGPW.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/GPW_Admin/WebUserControls/mod_adminDipendenti.ascx.cs b/GPW_Admin/WebUserControls/mod_adminDipendenti.ascx.cs index 3eb80ba..d45679f 100644 --- a/GPW_Admin/WebUserControls/mod_adminDipendenti.ascx.cs +++ b/GPW_Admin/WebUserControls/mod_adminDipendenti.ascx.cs @@ -105,7 +105,7 @@ namespace GPW_Admin.WebUserControls int.TryParse($"{idxDip}", out IdxDip); if (IdxDip > 0) { - var localUserList = DataProxy.DP.taDipendenti.getAttivi(false); + var localUserList = licenzeGPW.getDipAttivi(); // cerco! var currUser = localUserList.Where(x => x.idxDipendente == IdxDip).FirstOrDefault(); @@ -136,7 +136,7 @@ namespace GPW_Admin.WebUserControls int.TryParse($"{idxDip}", out IdxDip); if (IdxDip > 0) { - var localUserList = DataProxy.DP.taDipendenti.getAttivi(false); + var localUserList = licenzeGPW.getDipAttivi(); // cerco! var currUser = localUserList.Where(x => x.idxDipendente == IdxDip).FirstOrDefault(); @@ -313,7 +313,7 @@ namespace GPW_Admin.WebUserControls if (numLicenzeOnline == numLicenze && attivazioniOnline != utentiAttivi) { // ciclo tutti gli utenti attivi - var localUserList = DataProxy.DP.taDipendenti.getAttivi(false); + var localUserList = licenzeGPW.getDipAttivi(); // verifico SE sia disponibile licenza... var activationsList = licenzeGPW.ListaAttivazioni; Dictionary CodList = new Dictionary(); diff --git a/GPW_Data/licenzeGPW.cs b/GPW_Data/licenzeGPW.cs index 3d34896..90dd847 100644 --- a/GPW_Data/licenzeGPW.cs +++ b/GPW_Data/licenzeGPW.cs @@ -884,7 +884,7 @@ namespace GPW_data return getDipAttivi().Count; } - private static DS_Applicazione.DipendentiDataTable getDipAttivi() + public static DS_Applicazione.DipendentiDataTable getDipAttivi() { DS_Applicazione.DipendentiDataTable answ = new DS_Applicazione.DipendentiDataTable(); // cerco da cache From 702a09decabc96f30aaa03da3c0be0bdf8110ddb Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Thu, 13 Jan 2022 14:47:09 +0100 Subject: [PATCH 2/5] Fix errore lettura idxFase vuoto --- .../WebUserControls/mod_adminClienti.ascx.cs | 35 ++++++++++++++----- .../WebUserControls/mod_adminFasi.ascx.cs | 23 +++++++----- 2 files changed, 42 insertions(+), 16 deletions(-) diff --git a/GPW_Admin/WebUserControls/mod_adminClienti.ascx.cs b/GPW_Admin/WebUserControls/mod_adminClienti.ascx.cs index a06da8d..c6052cd 100644 --- a/GPW_Admin/WebUserControls/mod_adminClienti.ascx.cs +++ b/GPW_Admin/WebUserControls/mod_adminClienti.ascx.cs @@ -230,15 +230,34 @@ namespace GPW_Admin.WebUserControls // solo se ha diritti scrittura controllo if (idxObj != null) { - int trovati = 0; int idxCli = 0; - _ = int.TryParse(idxObj.ToString(), out idxCli); - trovati = DataProxy.DP.taAP.getByIdxCli(idxCli, true, true).Rows.Count; - // controllo se ci sono record correlati... - if (trovati > 0) - { - answ = false; - } + _ = int.TryParse($"{idxObj}", out idxCli); + answ = !hasChildObj(idxCli); + } + return answ; + } + + + /// + /// Determina se abbia child obj --> NON eliminabile + /// + /// + /// + public bool hasChildObj(int idxCli) + { + bool answ = false; + string redKey = memLayer.ML.redHash($"clienteHasChildObj:{idxCli}"); + // cerco inc ache redis... + string rawData = memLayer.ML.getRSV(redKey); + if (rawData == null) + { + int trovati = DataProxy.DP.taAP.getByIdxCli(idxCli, true, false).Rows.Count; + answ = (trovati > 0); + memLayer.ML.setRSV(redKey, $"{answ}", 60 * 5); + } + else + { + bool.TryParse(rawData, out answ); } return answ; } diff --git a/GPW_Admin/WebUserControls/mod_adminFasi.ascx.cs b/GPW_Admin/WebUserControls/mod_adminFasi.ascx.cs index 2f3610c..f242622 100644 --- a/GPW_Admin/WebUserControls/mod_adminFasi.ascx.cs +++ b/GPW_Admin/WebUserControls/mod_adminFasi.ascx.cs @@ -557,18 +557,25 @@ namespace GPW_Admin.WebUserControls public bool hasChildObj(int idxFase) { bool answ = false; - string redKey = memLayer.ML.redHash($"faseHasChildObj:{idxFase}"); - // cerco inc ache redis... - string rawData = memLayer.ML.getRSV(redKey); - if (rawData == null) + if (idxFase > 0) { - int trovati = DataProxy.DP.taRA.getByFase(this.idxFase).Count; - answ = (trovati > 0); - memLayer.ML.setRSV(redKey, $"{answ}", 60 * 5); + string redKey = memLayer.ML.redHash($"faseHasChildObj:{idxFase}"); + // cerco inc ache redis... + string rawData = memLayer.ML.getRSV(redKey); + if (rawData == null) + { + int trovati = DataProxy.DP.taRA.getByFase(this.idxFase).Count; + answ = (trovati > 0); + memLayer.ML.setRSV(redKey, $"{answ}", 60 * 5); + } + else + { + bool.TryParse(rawData, out answ); + } } else { - bool.TryParse(rawData, out answ); + answ = true; } return answ; } From 61239955b0ec7f5f7f2f6ceda91e9dab168d05ee Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Thu, 13 Jan 2022 16:53:39 +0100 Subject: [PATCH 3/5] Fix calcolo true/false ore lav OK --- GPW_Admin/BaseUserControl.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/GPW_Admin/BaseUserControl.cs b/GPW_Admin/BaseUserControl.cs index 76e2732..9a01361 100644 --- a/GPW_Admin/BaseUserControl.cs +++ b/GPW_Admin/BaseUserControl.cs @@ -208,7 +208,17 @@ namespace GPW_Admin public bool toBool(object valore) { bool answ = false; - bool.TryParse($"{valore}", out answ); + string strVal = $"{valore}"; + // se è lungh 1 (0/1) converto 0=false, 1 = true... + if (strVal.Length == 1) + { + answ = strVal == "1" ? true : false; + } + else + { + // se è un valore testuale --> converisone boolean + bool.TryParse($"{valore}", out answ); + } return answ; } From 6d87631f7f52b13e147e4c93a20e5da314d26059 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Thu, 13 Jan 2022 16:53:51 +0100 Subject: [PATCH 4/5] refresh generale --- GPW.CORE.UI/GPW.CORE.UI.csproj | 2 +- Resources/ChangeLog.html | 2 +- Resources/VersNum.txt | 2 +- Resources/manifest.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/GPW.CORE.UI/GPW.CORE.UI.csproj b/GPW.CORE.UI/GPW.CORE.UI.csproj index 4dd64a3..a3fc802 100644 --- a/GPW.CORE.UI/GPW.CORE.UI.csproj +++ b/GPW.CORE.UI/GPW.CORE.UI.csproj @@ -2,7 +2,7 @@ net6.0 - 3.0.2201.1309 + 3.0.2201.1315 enable enable diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html index a7902a5..cbd9c3b 100644 --- a/Resources/ChangeLog.html +++ b/Resources/ChangeLog.html @@ -1,6 +1,6 @@ GPW - Gestione Presenze Web -

Versione: 3.0.2201.1309

+

Versione: 3.0.2201.1315


Note di rilascio:
  • diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt index 2156188..0353443 100644 --- a/Resources/VersNum.txt +++ b/Resources/VersNum.txt @@ -1 +1 @@ -3.0.2201.1309 +3.0.2201.1315 diff --git a/Resources/manifest.xml b/Resources/manifest.xml index 6e614df..aaa0cdc 100644 --- a/Resources/manifest.xml +++ b/Resources/manifest.xml @@ -1,6 +1,6 @@ - 3.0.2201.1309 + 3.0.2201.1315 http://nexus.steamware.net/repository/SWS/GWMS/stable/0/GWMS.UI.zip http://nexus.steamware.net/repository/SWS/GWMS/stable/0/ChangeLog.html false From 351cdf0f759b0f0a0ee685ae82dbb0094e9b6057 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Thu, 13 Jan 2022 18:55:21 +0100 Subject: [PATCH 5/5] Update gestione licenze: cache + spinta --- .../WebUserControls/mod_adminDipendenti.ascx.cs | 4 ++-- GPW_Data/licenzeGPW.cs | 15 +++++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/GPW_Admin/WebUserControls/mod_adminDipendenti.ascx.cs b/GPW_Admin/WebUserControls/mod_adminDipendenti.ascx.cs index d45679f..8a3ec60 100644 --- a/GPW_Admin/WebUserControls/mod_adminDipendenti.ascx.cs +++ b/GPW_Admin/WebUserControls/mod_adminDipendenti.ascx.cs @@ -411,14 +411,14 @@ namespace GPW_Admin.WebUserControls { isTicketReq = false; showTickets=false; - fullRefresh(); + //fullRefresh(); } fixVisibility(); } /// /// recupera i dati di un nuovo record contenuti nel footer di un gridView; - /// questi devono esses opportunamente nominati (es: txt{0}, dl{0}, ...) + /// questi devono essere opportunamente nominati (es: txt{0}, dl{0}, ...) /// /// /// diff --git a/GPW_Data/licenzeGPW.cs b/GPW_Data/licenzeGPW.cs index 90dd847..a068e11 100644 --- a/GPW_Data/licenzeGPW.cs +++ b/GPW_Data/licenzeGPW.cs @@ -643,10 +643,17 @@ namespace GPW_data private static bool _checkLicenze() { bool answ = false; + bool fatto = false; try { - // effettua refresh attivazioni... - var fatto = RefreshActInfo().Result; + // cerco da cache + string rawData = memLayer.ML.getRSV(rkeyActInfo); + // se non ci fosse --> refresh online! + if (string.IsNullOrEmpty(rawData)) + { + // effettua refresh attivazioni... + fatto = RefreshActInfo().Result; + } answ = utentiAttivi <= licenzeAttive; if (!answ && memLayer.ML.confReadInt("_logLevel") > 5) { @@ -786,7 +793,7 @@ namespace GPW_data List answ = new List(); // cerco da cache string rawData = memLayer.ML.getRSV(rkeyActInfo); - // se no ci fosse --> refresh online! + // se non ci fosse --> refresh online! if (string.IsNullOrEmpty(rawData)) { var fatto = RefreshActInfo().Result; @@ -996,7 +1003,7 @@ namespace GPW_data // deserializzo answ = JsonConvert.DeserializeObject>(rawData); // salvo in redis per TTL std - memLayer.ML.setRSV(rkeyTickets, rawData, 10); + memLayer.ML.setRSV(rkeyTickets, rawData, 20); } } return await Task.FromResult(answ);