Ancora update plan

This commit is contained in:
Samuele Locatelli
2021-10-19 12:33:39 +02:00
parent 35d00767c1
commit 89b9cfd6b0
2 changed files with 35 additions and 20 deletions
@@ -6,6 +6,7 @@ using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ETS_Data;
using Newtonsoft.Json;
using NLog;
namespace PROJ_ETS.WebUserControls
@@ -55,6 +56,8 @@ namespace PROJ_ETS.WebUserControls
protected ETS_Data.Type.BazaarRes[,] TabellaRisorse;
protected string userLockTable = utils.obj.redHash("LOCK:UserLockTable");
/// <summary>
/// String x veto udpate tabella (ridisegno)
/// </summary>
@@ -353,6 +356,7 @@ namespace PROJ_ETS.WebUserControls
}
// metto prima riga con indicazione valori NUMERICI delle colonne
setupRigaDip(false);
// ciclo nel mio array e creo di conseguenza le celle di tabella
for (int pos_y = numComm - 1; pos_y >= 0; pos_y--)
{
@@ -431,6 +435,7 @@ namespace PROJ_ETS.WebUserControls
cell = setupCellaComm(pos_y, riga, true);
tblBlocco.Rows.Add(riga);
}
// metto ultima riga con indicazione valori NUMERICI del totale ore x dipendente
setupRigaDip(true);
}
@@ -470,6 +475,9 @@ namespace PROJ_ETS.WebUserControls
IdxFaseSel = Convert.ToInt32(valori[1]);
// blocco dip!
DataProxy_ProjEts.DP.taTLB.lockDip(IdxDipSel, user_std.UtSn.NomeCognome);
// resetto in redis tabella
utils.obj.setRSV(userLockTable, "", 1);
// continuo
rigaBaz = (Ds_ProjEts.BazaarRisorseRow)tabBaz.Select(string.Format("idxDipendente={0} AND idxFase={1}", IdxDipSel, IdxFaseSel))[0];
rigaDip = (Ds_ProjEts.DipendentiRow)tabDip.Select(string.Format("idxDipendente={0}", IdxDipSel))[0];
@@ -976,7 +984,31 @@ namespace PROJ_ETS.WebUserControls
/// <returns></returns>
protected bool userIsLocked(int IdxDipendente)
{
return DataProxy_ProjEts.DP.taTLB.getByDip(IdxDipendente).Rows.Count > 0;
bool answ = false;
Ds_ProjEts.TLockBazRADataTable tabDati = null;
// cerco in cache
var rawData = utils.obj.getRSV(userLockTable);
if (!string.IsNullOrEmpty(rawData))
{
tabDati = JsonConvert.DeserializeObject<Ds_ProjEts.TLockBazRADataTable>(rawData);
}
// sennò leggo da DB
else
{
tabDati = DataProxy_ProjEts.DP.taTLB.GetData();
rawData = JsonConvert.SerializeObject(tabDati);
utils.obj.setRSV(userLockTable, rawData, 10);
}
if (tabDati != null && tabDati.Count > 0)
{
answ = tabDati
.Where(x => x.idxDipendente == IdxDipendente)
.Count() > 0;
}
return answ;
//cerco il lock nella tab...
//return DataProxy_ProjEts.DP.taTLB.getByDip(IdxDipendente).Rows.Count > 0;
}
#endregion Protected Methods
@@ -991,31 +1023,14 @@ namespace PROJ_ETS.WebUserControls
string rawData = utils.obj.getRSV(vetoUpdate);
if (string.IsNullOrEmpty(rawData))
{
TimeSpan ts;
stopWatch.Restart();
setBtnStatus();
stopWatch.Stop();
ts = stopWatch.Elapsed;
lg.Info($"doUpdate: 01-setBtnStatus in {ts.TotalMilliseconds} ms");
stopWatch.Restart();
caricaDatiBlocco();
stopWatch.Stop();
ts = stopWatch.Elapsed;
lg.Info($"doUpdate: 02-caricaDatiBlocco in {ts.TotalMilliseconds} ms");
stopWatch.Restart();
disegnaTabella();
stopWatch.Stop();
ts = stopWatch.Elapsed;
lg.Info($"doUpdate: 03-disegnaTabella in {ts.TotalMilliseconds} ms");
// salvo veto ridisegno x 3 sec...
utils.obj.setRSV(vetoUpdate, $"LAST disegnaTabella in {ts.TotalMilliseconds} ms", 35);
// salvo veto ridisegno x 10 sec...
utils.obj.setRSV(vetoUpdate, $"VETO doUpdate", 5);
}
}
Binary file not shown.