Merge branch 'release/OttimizzazioneCacheCOntrolloLicGPW'

This commit is contained in:
Samuele Locatelli
2022-01-13 18:56:13 +01:00
9 changed files with 74 additions and 31 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Version>3.0.2201.1309</Version>
<Version>3.0.2201.1315</Version>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
+11 -1
View File
@@ -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;
}
@@ -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;
}
/// <summary>
/// Determina se abbia child obj --> NON eliminabile
/// </summary>
/// <param name="idxCli"></param>
/// <returns></returns>
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;
}
@@ -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<string, string> CodList = new Dictionary<string, string>();
@@ -411,14 +411,14 @@ namespace GPW_Admin.WebUserControls
{
isTicketReq = false;
showTickets=false;
fullRefresh();
//fullRefresh();
}
fixVisibility();
}
/// <summary>
/// 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}, ...)
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
@@ -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;
}
+12 -5
View File
@@ -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<LiManObj.AttivazioneDTO> answ = new List<LiManObj.AttivazioneDTO>();
// 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;
@@ -884,7 +891,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
@@ -996,7 +1003,7 @@ namespace GPW_data
// deserializzo
answ = JsonConvert.DeserializeObject<List<TicketDTO>>(rawData);
// salvo in redis per TTL std
memLayer.ML.setRSV(rkeyTickets, rawData, 10);
memLayer.ML.setRSV(rkeyTickets, rawData, 20);
}
}
return await Task.FromResult(answ);
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>GPW - Gestione Presenze Web</i>
<h4>Versione: 3.0.2201.1309</h4>
<h4>Versione: 3.0.2201.1315</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
3.0.2201.1309
3.0.2201.1315
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>3.0.2201.1309</version>
<version>3.0.2201.1315</version>
<url>http://nexus.steamware.net/repository/SWS/GWMS/stable/0/GWMS.UI.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/GWMS/stable/0/ChangeLog.html</changelog>
<mandatory>false</mandatory>