From 6b8c123bdf41e5c7cabc9b6d9bc277579591cca6 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Wed, 3 May 2023 15:49:04 +0200 Subject: [PATCH] Typo: code reorg --- MP-SITE/BasePage.cs | 1 + MP-SITE/MappaStato.aspx | 4 +- MP-SITE/MappaStato.aspx.cs | 15 + .../WebUserControls/mod_statoMacchina.ascx.cs | 300 +++++++++--------- 4 files changed, 168 insertions(+), 152 deletions(-) diff --git a/MP-SITE/BasePage.cs b/MP-SITE/BasePage.cs index 3c5902ea..b3c27de1 100644 --- a/MP-SITE/BasePage.cs +++ b/MP-SITE/BasePage.cs @@ -1,5 +1,6 @@ using MapoDb; using SteamWare; +using System; namespace MP_SITE { diff --git a/MP-SITE/MappaStato.aspx b/MP-SITE/MappaStato.aspx index fb71051a..4eba3f77 100644 --- a/MP-SITE/MappaStato.aspx +++ b/MP-SITE/MappaStato.aspx @@ -12,7 +12,7 @@
- +
@@ -27,4 +27,4 @@ - \ No newline at end of file + diff --git a/MP-SITE/MappaStato.aspx.cs b/MP-SITE/MappaStato.aspx.cs index 29334181..2ea9f094 100644 --- a/MP-SITE/MappaStato.aspx.cs +++ b/MP-SITE/MappaStato.aspx.cs @@ -5,6 +5,19 @@ namespace MP_SITE { public partial class MappaStato : BasePage { + #region Public Methods + + public override void Dispose() + { + repRows.Dispose(); + odsRows.Dispose(); + base.Dispose(); + } + + #endregion Public Methods + + #region Protected Methods + protected void lnkCambiaModo_Click(object sender, EventArgs e) { // passa alla pagina richiesta... @@ -15,5 +28,7 @@ namespace MP_SITE protected void Page_Load(object sender, EventArgs e) { } + + #endregion Protected Methods } } \ No newline at end of file diff --git a/MP-Site/WebUserControls/mod_statoMacchina.ascx.cs b/MP-Site/WebUserControls/mod_statoMacchina.ascx.cs index 2b384060..31a3fa1f 100644 --- a/MP-Site/WebUserControls/mod_statoMacchina.ascx.cs +++ b/MP-Site/WebUserControls/mod_statoMacchina.ascx.cs @@ -8,49 +8,6 @@ namespace MP_SITE.WebUserControls { public partial class mod_statoMacchina : System.Web.UI.UserControl { - #region Private Fields - - /// - /// Oggetto datalayer specifico - /// - private DataLayer DataLayerObj = new DataLayer(); - - #endregion Private Fields - - #region Protected Fields - - protected bool _linkActive = true; - - /// - /// posizione macchina nella tabella - /// - protected string _locazione; - - protected DS_applicazione.AnagraficaStatiDataTable tabAnagStati; - - protected DS_ProdTempi.MappaStatoExplDataTable tabMSE; - - #endregion Protected Fields - - #region Protected Properties - - /// - /// seriale associato alla macchina da controllare - /// - protected string _IdxMacchina - { - get - { - return hfIdxMacchina.Value; - } - set - { - hfIdxMacchina.Value = value.Trim(); - } - } - - #endregion Protected Properties - #region Public Properties /// @@ -119,6 +76,154 @@ namespace MP_SITE.WebUserControls #endregion Public Properties + #region Public Methods + + public override void Dispose() + { + base.Dispose(); + } + + /// + /// aggiorna controllo + /// + public void updateMe() + { + // SE E SOLO SE ho una macchina e/o locazione... + if (!string.IsNullOrEmpty(IdxMacchina) && !IdxMacchina.Contains("#") && (locazione != "00" && !string.IsNullOrEmpty(locazione))) + { + // effettua update visualizzazione + try + { + retrieveData(); + updateLayout(); + updateText(); + updateImg(); + updateHL(); + // controllo se link attivo... + if (!_linkActive) + { + valMacchina.Enabled = false; + } + divSegnaposto.Visible = false; + } + catch (Exception exc) + { + logger.lg.scriviLog($"Eccezione in fase popolamento statoMacchina per IdxMacchina {IdxMacchina} - locazione {locazione}{Environment.NewLine}{exc}", tipoLog.EXCEPTION); + } + } + else + { + pnlMacchina.Visible = false; + } + } + + #endregion Public Methods + + #region Protected Fields + + protected bool _linkActive = true; + + /// + /// posizione macchina nella tabella + /// + protected string _locazione; + + protected DS_applicazione.AnagraficaStatiDataTable tabAnagStati; + + protected DS_ProdTempi.MappaStatoExplDataTable tabMSE; + + #endregion Protected Fields + + #region Protected Properties + + /// + /// seriale associato alla macchina da controllare + /// + protected string _IdxMacchina + { + get + { + return hfIdxMacchina.Value; + } + set + { + hfIdxMacchina.Value = value.Trim(); + } + } + + #endregion Protected Properties + + #region Protected Methods + + /// + /// rimanda alla pagina di dettaglio della macchina scelta + /// + /// + /// + protected void lnkMacchina_Click(object sender, EventArgs e) + { + if (linkActive) + { + memLayer.ML.setSessionVal("IdxMacchina", IdxMacchina); + Response.Redirect(string.Format("~/DettaglioMacchina?IdxMacchina={0}", IdxMacchina)); + } + } + + /// + /// caricamento pagina + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + //updateMe(); + } + + /// + /// metto a posto l'immagine + /// + protected void updateImg() + { + string urlMacchina; + if (_IdxMacchina != "nd") + { + urlMacchina = $"~/images/macchine/{resoconti.mngr.urlMacchina(IdxMacchina)}"; + if (urlMacchina == "thumb_") + { + urlMacchina = "~/images/empty.png"; + } + else + { + imgThumb.ToolTip = resoconti.mngr.nomeMacchina(IdxMacchina); + } + + string fullPath = Server.MapPath(urlMacchina); + if (!File.Exists(fullPath)) + { + // metto default Steamware + urlMacchina = "~/images/macchine/Steamware.png"; + } + + imgThumb.ImageUrl = urlMacchina; + } + else + { + urlMacchina = "~/images/empty.png"; + imgThumb.ImageUrl = urlMacchina; + } + } + + #endregion Protected Methods + + #region Private Fields + + /// + /// Oggetto datalayer specifico + /// + private DataLayer DataLayerObj = new DataLayer(); + + #endregion Private Fields + #region Private Methods /// @@ -131,16 +236,13 @@ namespace MP_SITE.WebUserControls string hashKeyAS = memLayer.ML.redHash("Tab:AnagStati"); string serVal = ""; if (memLayer.ML.redKeyPresent(hashKeyMSE)) - //if (memLayer.ML.redHashPresent(hashKeyMSE)) { serVal = memLayer.ML.getRSV(hashKeyMSE); tabMSE = JsonConvert.DeserializeObject(serVal); - //tabMSE = (DS_ProdTempi.MappaStatoExplDataTable)memLayer.ML.deserializeVal(serVal); serVal = memLayer.ML.getRSV(hashKeyAS); tabAnagStati = JsonConvert.DeserializeObject(serVal); - //tabAnagStati = (DS_applicazione.AnagraficaStatiDataTable)memLayer.ML.deserializeVal(serVal); } else { @@ -228,9 +330,8 @@ namespace MP_SITE.WebUserControls lblStato.Text = "Stato"; lblProd.Text = "T.Ciclo"; // era OEE lblDurata.Text = "Durata"; - // 2018.02.05 cambio x fix nuovi impianti - // valMacchina.Text = tabMacchine.FindByIdxMacchina(IdxMacchina).Nome; - // valCodArticolo.Text = tabStatoMacchine.FindByIdxMacchina(IdxMacchina).CodArticolo; + // 2018.02.05 cambio x fix nuovi impianti valMacchina.Text = + // tabMacchine.FindByIdxMacchina(IdxMacchina).Nome; valCodArticolo.Text = tabStatoMacchine.FindByIdxMacchina(IdxMacchina).CodArticolo; // leggo valori da MSE... valMacchina.Text = tabMSE[0].Nome; @@ -362,106 +463,5 @@ namespace MP_SITE.WebUserControls } #endregion Private Methods - - #region Protected Methods - - /// - /// rimanda alla pagina di dettaglio della macchina scelta - /// - /// - /// - protected void lnkMacchina_Click(object sender, EventArgs e) - { - if (linkActive) - { - memLayer.ML.setSessionVal("IdxMacchina", IdxMacchina); - Response.Redirect(string.Format("~/DettaglioMacchina?IdxMacchina={0}", IdxMacchina)); - } - } - - /// - /// caricamento pagina - /// - /// - /// - protected void Page_Load(object sender, EventArgs e) - { - //updateMe(); - } - - /// - /// metto a posto l'immagine - /// - protected void updateImg() - { - string urlMacchina; - if (_IdxMacchina != "nd") - { - urlMacchina = $"~/images/macchine/{resoconti.mngr.urlMacchina(IdxMacchina)}"; - if (urlMacchina == "thumb_") - { - urlMacchina = "~/images/empty.png"; - } - else - { - imgThumb.ToolTip = resoconti.mngr.nomeMacchina(IdxMacchina); - } - - string fullPath = Server.MapPath(urlMacchina); - if (!File.Exists(fullPath)) - { - // metto default Steamware - urlMacchina = "~/images/macchine/Steamware.png"; - } - - imgThumb.ImageUrl = urlMacchina; - } - else - { - urlMacchina = "~/images/empty.png"; - imgThumb.ImageUrl = urlMacchina; - } - } - - #endregion Protected Methods - - #region Public Methods - - /// - /// aggiorna controllo - /// - public void updateMe() - { - //SE E SOLO SE ho una macchina e/o locazione... - if (!string.IsNullOrEmpty(IdxMacchina) && !IdxMacchina.Contains("#") && (locazione != "00")) - { - // effettua update visualizzazione - try - { - retrieveData(); - updateLayout(); - updateText(); - updateImg(); - updateHL(); - // controllo se link attivo... - if (!_linkActive) - { - valMacchina.Enabled = false; - } - //logger.lg.scriviLog(string.Format("Retrieve: {0}", DateTime.Now.Subtract(tick).Milliseconds), tipoLog.INFO); - divSegnaposto.Visible = false; - } - catch (Exception exc) - { - logger.lg.scriviLog($"Eccezione in fase popolamento statoMacchina per IdxMacchina {IdxMacchina} - locazione {locazione}{Environment.NewLine}{exc}", tipoLog.EXCEPTION); - } - } - else - { - pnlMacchina.Visible = false; - } - } - - #endregion Public Methods } } \ No newline at end of file