diff --git a/MP-SITE/BaseExportPage.cs b/MP-SITE/BaseExportPage.cs index 234b49df..8e29667a 100644 --- a/MP-SITE/BaseExportPage.cs +++ b/MP-SITE/BaseExportPage.cs @@ -1,5 +1,6 @@ using SteamWare; using System; +using System.Collections.Generic; using System.IO; using System.Web; using System.Web.UI; @@ -8,30 +9,8 @@ namespace MP_SITE { public class BaseExportPage : System.Web.UI.Page { - protected resoconti _resoconti; + #region Public Properties - /// - /// idx della macchina da mostrare - /// - public string idxMacchina - { - get - { - string idxMacchina = "0"; - try - { - idxMacchina = memLayer.ML.StringSessionObj("IdxMacchina"); - } - catch - { - } - return idxMacchina; - } - set - { - memLayer.ML.setSessionVal("IdxMacchina", value); - } - } /// /// inizio periodo da mostrare /// @@ -76,6 +55,45 @@ namespace MP_SITE } } + /// + /// idx della macchina da mostrare + /// + public string idxMacchina + { + get + { + string idxMacchina = "0"; + try + { + idxMacchina = memLayer.ML.StringSessionObj("IdxMacchina"); + } + catch + { + } + return idxMacchina; + } + set + { + memLayer.ML.setSessionVal("IdxMacchina", value); + } + } + + #endregion Public Properties + + #region Public Methods + + /// + /// Recupera commessa al momento indicato + /// + /// + /// + public string commessaCorr(object _dtRif) + { + DateTime dtRif = DateTime.Now; + DateTime.TryParse($"{_dtRif}", out dtRif); + return _resoconti.commessaAttiva(idxMacchina, dtFrom, dtTo, dtRif); + } + /// /// restituisce stringa formattata in HH:mm /// @@ -104,27 +122,24 @@ namespace MP_SITE public string operatoreDaMatr(object matricola) { int matr = 0; - if (matricola != null) + string answ = "N.A."; + try { - try - { - matr = Convert.ToInt32(matricola); - } - catch - { } + matr = Convert.ToInt32(matricola); } - return _resoconti.oprDaMatr(matr); - } - /// - /// Recupera commessa al momento indicato - /// - /// - /// - public string commessaCorr(object _dtRif) - { - DateTime dtRif = DateTime.Now; - DateTime.TryParse($"{_dtRif}", out dtRif); - return _resoconti.commessaAttiva(idxMacchina, dtFrom, dtTo, dtRif); + catch + { } + // cerco in LUT... + if (OprLUT.ContainsKey(matr)) + { + answ = OprLUT[matr]; + } + else + { + answ = _resoconti.oprDaMatr(matr); + OprLUT.Add(matr, answ); + } + return answ; } public string statoDaIdx(object idx) @@ -139,9 +154,14 @@ namespace MP_SITE public override void VerifyRenderingInServerForm(Control control) { - // Confirms that an HtmlForm control is rendered for the specified ASP.NET server control at run time. + // Confirms that an HtmlForm control is rendered for the specified ASP.NET server + // control at run time. } + #endregion Public Methods + + #region Internal Methods + internal virtual void aggiornamento() { } @@ -170,14 +190,25 @@ namespace MP_SITE Response.Clear(); Response.AddHeader("content-disposition", "attachment; filename=DatiConfermati.xls"); Response.Charset = ""; - // If you want the option to open the Excel file without saving than - // comment out the line below + // If you want the option to open the Excel file without saving than comment out the + // line below Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.ContentType = "application/vnd.xls"; stringWrite = new StringWriter(); htmlWrite = new HtmlTextWriter(stringWrite); } + #endregion Internal Methods + + #region Protected Fields + + protected resoconti _resoconti; + protected Dictionary OprLUT = new Dictionary(); + + #endregion Protected Fields + + #region Protected Methods + protected void Page_Load(object sender, EventArgs e) { _resoconti = new resoconti(); @@ -187,5 +218,7 @@ namespace MP_SITE doExport(); } } + + #endregion Protected Methods } } \ No newline at end of file diff --git a/MP-SITE/DettaglioMacchina.aspx.cs b/MP-SITE/DettaglioMacchina.aspx.cs index efb4910a..a7a67d3e 100644 --- a/MP-SITE/DettaglioMacchina.aspx.cs +++ b/MP-SITE/DettaglioMacchina.aspx.cs @@ -1,5 +1,7 @@ +using MapoDb; using SteamWare; using System; +using System.Collections.Generic; using System.Web.UI; namespace MP_SITE @@ -144,6 +146,17 @@ namespace MP_SITE { chkHideSpenta.DataBind(); graphDataRefresh = true; + // controllo se devo ricaricare i valori in cache redis... + string rKey = DataLayer.mHash($"VETO:ReloadTabInCache"); + var vetoRefresh = memLayer.ML.getRSV(rKey); + if(string.IsNullOrEmpty(vetoRefresh)) + { + // metto veto + int ttlReload = memLayer.ML.CRI("SITE_ForceReloadCache"); + memLayer.ML.setRSV(rKey, $"Veto Reload TabInCache until: {DateTime.Now.AddSeconds(ttlReload): HH:mm:ss}", ttlReload); + // chiamo refresh tab in cache... + refreshTabInCache(); + } } Mod_periodoAnalisi1.eh_doUpdate += new EventHandler(Mod_periodoAnalisi1_eh_doUpdate); Mod_listaStatiEventi1.eh_doUpdate += new EventHandler(Mod_listaStatiEventi1_eh_doUpdate); @@ -157,6 +170,40 @@ namespace MP_SITE impostaGrafici(); } + private void refreshTabInCache() + { +#if false + // salvo i dati attuali... + string cod_cdc = SteamWare.memLayer.ML.StringSessionObj("valRicercaCdC"); + string lingua = user_std.UtSn.lingua; + string USER_NAME = SteamWare.memLayer.ML.StringSessionObj("USER_NAME"); + string DOMINIO = SteamWare.memLayer.ML.StringSessionObj("DOMINIO"); + bool isForceUser = user_std.UtSn.isForcedUser; + // salvo i valori delle tab in session... + Dictionary sessionParam = SteamWare.memLayer.ML.valSess2SurvUpd; + + // svuoto session e cache per rileggere i dati da Db + Session.RemoveAll(); +#endif + + SteamWare.memLayer.ML.flushRegisteredCache(); + +#if false + // rimemorizzo + SteamWare.memLayer.ML.setSessionVal("valRicercaCdC", cod_cdc); + user_std.UtSn.startUpUtente(DOMINIO, USER_NAME); + user_std.UtSn.lingua = lingua; + user_std.UtSn.isForcedUser = isForceUser; + DataWrap.DW.resetVocabolario(); + + // risalvo in session i valori... + foreach (KeyValuePair kvp in sessionParam) + { + SteamWare.memLayer.ML.setSessionVal(kvp.Key, kvp.Value, true); + } +#endif + } + protected void setSequencer() { // procedo SOLO SE ho dei dati... diff --git a/MP-SITE/WebUserControls/baseUserControl.cs b/MP-SITE/WebUserControls/baseUserControl.cs index d8fdf859..dacc90af 100644 --- a/MP-SITE/WebUserControls/baseUserControl.cs +++ b/MP-SITE/WebUserControls/baseUserControl.cs @@ -9,15 +9,6 @@ namespace MP_SITE.WebUserControls { public class baseUserControl : System.Web.UI.UserControl { - #region Private Fields - - /// - /// Oggetto datalayer specifico - /// - private DataLayer DataLayerObj = new DataLayer(); - - #endregion Private Fields - #region Public Properties public string cognomeNome @@ -62,30 +53,31 @@ namespace MP_SITE.WebUserControls #endregion Public Properties - #region Protected Methods - - protected virtual void doTranslate() - { - } - - /// - /// Verifica se la macchina MAIN sia MULTI (da DatiMacchina / redis...) - /// - /// - /// - protected bool isMulti(string idxMacchina) - { - return DataLayerObj.isMulti(idxMacchina); - } - - protected virtual void Page_Load(object sender, EventArgs e) - { - } - - #endregion Protected Methods - #region Public Methods + public string operatoreDaMatr(object matricola) + { + int matr = 0; + string answ = "N.A."; + try + { + matr = Convert.ToInt32(matricola); + } + catch + { } + // cerco in LUT... + if (OprLUT.ContainsKey(matr)) + { + answ = OprLUT[matr]; + } + else + { + answ = _resoconti.oprDaMatr(matr); + OprLUT.Add(matr, answ); + } + return answ; + } + /// /// effettua traduzione del lemma /// @@ -108,6 +100,33 @@ namespace MP_SITE.WebUserControls #endregion Public Methods + #region Protected Fields + + protected resoconti _resoconti = new resoconti(); + + protected Dictionary OprLUT = new Dictionary(); + + #endregion Protected Fields + + #region Protected Methods + + protected virtual void doTranslate() + { + } + + /// + /// Verifica se la macchina MAIN sia MULTI (da DatiMacchina / redis...) + /// + /// + /// + protected bool isMulti(string idxMacchina) + { + return DataLayerObj.isMulti(idxMacchina); + } + + protected virtual void Page_Load(object sender, EventArgs e) + { + } /// /// Arrotondamento oggetto datetime all'intervallo timespan indicato @@ -119,5 +138,16 @@ namespace MP_SITE.WebUserControls { return new DateTime((dt.Ticks + d.Ticks - 1) / d.Ticks * d.Ticks, dt.Kind); } + + #endregion Protected Methods + + #region Private Fields + + /// + /// Oggetto datalayer specifico + /// + private DataLayer DataLayerObj = new DataLayer(); + + #endregion Private Fields } } \ No newline at end of file diff --git a/MP-Site/WebUserControls/baseProdControl.cs b/MP-Site/WebUserControls/baseProdControl.cs index 4bbbadb2..c6db7233 100644 --- a/MP-Site/WebUserControls/baseProdControl.cs +++ b/MP-Site/WebUserControls/baseProdControl.cs @@ -1,28 +1,12 @@ using MapoDb; using SteamWare; using System; +using System.Collections.Generic; namespace MP_SITE.WebUserControls { public class baseProdControl : System.Web.UI.UserControl { - #region Private Fields - - /// - /// Oggetto datalayer specifico - /// - internal DataLayer DataLayerObj = new DataLayer(); - - #endregion Private Fields - - #region Protected Fields - - protected int _numRighe = 17; - - protected resoconti _resoconti; - - #endregion Protected Fields - #region Public Events /// @@ -48,35 +32,56 @@ namespace MP_SITE.WebUserControls #endregion Public Properties - #region Protected Methods - - /// - /// Verifica se la macchina MAIN sia MULTI (da DatiMacchina / redis...) - /// - /// - /// - protected bool isMulti(string idxMacchina) - { - return DataLayerObj.isMulti(idxMacchina); - } - - protected virtual void Page_Load(object sender, EventArgs e) - { - _resoconti = new resoconti(); - if (!Page.IsPostBack) - { - doUpdate(); - } - } - - #endregion Protected Methods - #region Public Methods public virtual void doUpdate() { } + /// + /// Conversione a bool del valore + /// + /// + /// + public bool getBool(object value) + { + bool answ = false; + string rawVal = $"{value}".ToUpper(); + // se è 1/0 --> len 1 + if (rawVal.Length == 1) + { + answ = rawVal == "1" || rawVal == "S" || rawVal == "Y"; + } + else + { + bool.TryParse($"{value}", out answ); + } + return answ; + } + + public string operatoreDaMatr(object matricola) + { + int matr = 0; + string answ = "N.A."; + try + { + matr = Convert.ToInt32(matricola); + } + catch + { } + // cerco in LUT... + if (OprLUT.ContainsKey(matr)) + { + answ = OprLUT[matr]; + } + else + { + answ = _resoconti.oprDaMatr(matr); + OprLUT.Add(matr, answ); + } + return answ; + } + public void reportUpdate() { // alzo l'evento d update/inserimento e ricarico cache... @@ -106,27 +111,47 @@ namespace MP_SITE.WebUserControls return user_std.UtSn.TraduciEn(lemma); } + #endregion Public Methods + + #region Internal Fields + /// - /// Conversione a bool del valore + /// Oggetto datalayer specifico /// - /// + internal DataLayer DataLayerObj = new DataLayer(); + + #endregion Internal Fields + + #region Protected Fields + + protected int _numRighe = 17; + + protected resoconti _resoconti; + protected Dictionary OprLUT = new Dictionary(); + + #endregion Protected Fields + + #region Protected Methods + + /// + /// Verifica se la macchina MAIN sia MULTI (da DatiMacchina / redis...) + /// + /// /// - public bool getBool(object value) + protected bool isMulti(string idxMacchina) { - bool answ = false; - string rawVal = $"{value}".ToUpper(); - // se è 1/0 --> len 1 - if (rawVal.Length == 1) - { - answ = rawVal == "1" || rawVal == "S" || rawVal == "Y"; - } - else - { - bool.TryParse($"{value}", out answ); - } - return answ; + return DataLayerObj.isMulti(idxMacchina); } - #endregion Public Methods + protected virtual void Page_Load(object sender, EventArgs e) + { + _resoconti = new resoconti(); + if (!Page.IsPostBack) + { + doUpdate(); + } + } + + #endregion Protected Methods } } \ No newline at end of file diff --git a/MP-Site/WebUserControls/mod_listaStatiEventi.ascx.cs b/MP-Site/WebUserControls/mod_listaStatiEventi.ascx.cs index 86551206..c6c68542 100644 --- a/MP-Site/WebUserControls/mod_listaStatiEventi.ascx.cs +++ b/MP-Site/WebUserControls/mod_listaStatiEventi.ascx.cs @@ -90,6 +90,7 @@ namespace MP_SITE.WebUserControls return utility.durataEventoHMS((double)durataMinuti); } +#if false public string operatoreDaMatr(object matricola) { int matr = 0; @@ -113,7 +114,8 @@ namespace MP_SITE.WebUserControls return answ; } - protected Dictionary OprLUT = new Dictionary(); + protected Dictionary OprLUT = new Dictionary(); +#endif public void reportUpdt(object sender, EventArgs e) { diff --git a/MP-Site/WebUserControls/mod_logEventi.ascx b/MP-Site/WebUserControls/mod_logEventi.ascx index 05cf2a72..f23e97be 100644 --- a/MP-Site/WebUserControls/mod_logEventi.ascx +++ b/MP-Site/WebUserControls/mod_logEventi.ascx @@ -24,7 +24,7 @@ - + diff --git a/MP-Site/WebUserControls/mod_logEventi.ascx.designer.cs b/MP-Site/WebUserControls/mod_logEventi.ascx.designer.cs index 2f486d0c..cb7be45f 100644 --- a/MP-Site/WebUserControls/mod_logEventi.ascx.designer.cs +++ b/MP-Site/WebUserControls/mod_logEventi.ascx.designer.cs @@ -1,50 +1,52 @@ //------------------------------------------------------------------------------ -// -// Codice generato da uno strumento. +// +// This code was generated by a tool. // -// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se -// il codice viene rigenerato. -// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// //------------------------------------------------------------------------------ -namespace MP_SITE.WebUserControls { - - - public partial class mod_logEventi { - +namespace MP_SITE.WebUserControls +{ + + + public partial class mod_logEventi + { + /// - /// Controllo gvView. + /// gvView control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.GridView gvView; - + /// - /// Controllo ods. + /// ods control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.ObjectDataSource ods; - + /// - /// Controllo HyperLink2. + /// HyperLink2 control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.HyperLink HyperLink2; - + /// - /// Controllo HyperLink4. + /// HyperLink4 control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.HyperLink HyperLink4; }