Fix reload matricola --> operatore

This commit is contained in:
Samuele Locatelli
2024-08-19 19:17:50 +02:00
parent 78b316a645
commit 5c22d0d977
2 changed files with 21 additions and 5 deletions
@@ -1,5 +1,6 @@
using SteamWare;
using System;
using System.Collections.Generic;
using System.Web.UI;
namespace MP_SITE.WebUserControls
@@ -92,15 +93,28 @@ namespace MP_SITE.WebUserControls
public string operatoreDaMatr(object matricola)
{
int matr = 0;
string answ = "N.A.";
try
{
matr = Convert.ToInt32(matricola);
}
catch
{ }
return _resoconti.oprDaMatr(matr);
// cerco in LUT...
if (OprLUT.ContainsKey(matr))
{
answ = OprLUT[matr];
}
else
{
answ = _resoconti.oprDaMatr(matr);
OprLUT.Add(matr, answ);
}
return answ;
}
protected Dictionary<int, string> OprLUT = new Dictionary<int, string>();
public void reportUpdt(object sender, EventArgs e)
{
reportUpdate();
@@ -132,6 +146,7 @@ namespace MP_SITE.WebUserControls
_resoconti = new resoconti();
if (!Page.IsPostBack)
{
OprLUT = new Dictionary<int, string>();
aggiornamento();
}
mod_logStati.eh_doUpdate += Mod_logStati_eh_doUpdate;
+5 -4
View File
@@ -268,7 +268,7 @@ public class resoconti
try
{
DS_applicazione.AnagraficaOperatoriRow riga = AnagOpr.FindByMatrOpr(matr);
answ = string.Format("{0} {1}", riga.Cognome, riga.Nome);
answ = $"{riga.Cognome} {riga.Nome}";
}
catch
{ }
@@ -615,15 +615,16 @@ public class resoconti
{
get
{
if (!memLayer.ML.isInCacheObject("AnagOpr"))
string keyName = "AnagOpr";
if (!memLayer.ML.isInCacheObject(keyName))
{
_AnagOpr = taAnagOpr.GetData();
string serVal = JsonConvert.SerializeObject(_AnagOpr);
memLayer.ML.setCacheVal("AnagOpr", serVal, true);
memLayer.ML.setCacheVal(keyName, serVal, true);
}
else
{
string redKey = memLayer.ML.redHash("AnagOpr");
string redKey = memLayer.ML.redHash(keyName);
string serVal = memLayer.ML.getRSV(redKey);
_AnagOpr = JsonConvert.DeserializeObject<DS_applicazione.AnagraficaOperatoriDataTable>(serVal);
}