From 29d5e7cef43a217c2c1a50c1c40865c01d9b1b0c Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Wed, 9 Feb 2022 10:14:33 +0100 Subject: [PATCH 1/4] Fix comportamento selezione dettaglio progetti e inizio fix navigaizone progetti <--> fasi --- .../WebUserControls/cmp_homeButtons.ascx | 2 +- .../cmp_homeButtons.ascx.designer.cs | 22 ++--- .../WebUserControls/mod_adminProgetti.ascx.cs | 89 ++++++++++++++++--- .../mod_dettaglioProgetto.ascx | 9 +- .../mod_dettaglioProgetto.ascx.cs | 22 ++++- .../mod_dettaglioProgetto.ascx.designer.cs | 31 ++++--- 6 files changed, 131 insertions(+), 44 deletions(-) diff --git a/GPW_Admin/WebUserControls/cmp_homeButtons.ascx b/GPW_Admin/WebUserControls/cmp_homeButtons.ascx index 0104329..b40abff 100644 --- a/GPW_Admin/WebUserControls/cmp_homeButtons.ascx +++ b/GPW_Admin/WebUserControls/cmp_homeButtons.ascx @@ -2,7 +2,7 @@
-
+
diff --git a/GPW_Admin/WebUserControls/cmp_homeButtons.ascx.designer.cs b/GPW_Admin/WebUserControls/cmp_homeButtons.ascx.designer.cs index b286687..a67a1b4 100644 --- a/GPW_Admin/WebUserControls/cmp_homeButtons.ascx.designer.cs +++ b/GPW_Admin/WebUserControls/cmp_homeButtons.ascx.designer.cs @@ -1,10 +1,10 @@ //------------------------------------------------------------------------------ -// -// 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 GPW_Admin.WebUserControls @@ -15,20 +15,20 @@ namespace GPW_Admin.WebUserControls { /// - /// Controllo menu. + /// menu 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.Repeater menu; /// - /// Controllo XmlMenu. + /// XmlMenu 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.XmlDataSource XmlMenu; } diff --git a/GPW_Admin/WebUserControls/mod_adminProgetti.ascx.cs b/GPW_Admin/WebUserControls/mod_adminProgetti.ascx.cs index a673a19..396627a 100644 --- a/GPW_Admin/WebUserControls/mod_adminProgetti.ascx.cs +++ b/GPW_Admin/WebUserControls/mod_adminProgetti.ascx.cs @@ -178,14 +178,7 @@ namespace GPW_Admin.WebUserControls /// private void filtroCli_eh_selValore(object sender, EventArgs e) { - if (filtroCli.isChecked) - { - memLayer.ML.setSessionVal("idxCli_sel", filtroCli.valoreInt); - } - else - { - memLayer.ML.setSessionVal("idxCli_sel", 0); - } + idxCliSel = filtroCli.isChecked ? filtroCli.valoreInt : 0; // salvo! var tempFilt = currFiltProj; tempFilt.filtCli = filtroCli.isChecked; @@ -245,6 +238,7 @@ namespace GPW_Admin.WebUserControls showVuoti = currFilt.showEmpty; showOnlyStarred = currFilt.onlyStarred; filtroCli.isChecked = currFilt.filtCli; + idxCliSel = filtroCli.isChecked ? filtroCli.valoreInt : 0; filtroGrp.isChecked = currFilt.filtGrp; // se deselezionato --> svuoto if (!currFilt.filtGrp) @@ -376,6 +370,65 @@ namespace GPW_Admin.WebUserControls } } + protected int idxProjSel + { + get + { + return memLayer.ML.IntSessionObj("idxProgetto_sel"); + } + set + { + memLayer.ML.setSessionVal("idxProgetto_sel", $"{value}"); + } + } + protected int idxCliSel + { + get + { + return memLayer.ML.IntSessionObj("idxCli_sel"); + } + set + { + memLayer.ML.setSessionVal("idxCli_sel", $"{value}"); + } + } + + /// + /// Effettua salvataggio dati x progetto selezionato in sessione (cliente + progetto) + /// + /// + /// + protected bool saveProjSel(object idxProj) + { + bool fatto = false; + if (idxProj != null) + { + int idxProgetto = 0; + int.TryParse($"{idxProj}", out idxProgetto); + if (idxProgetto > 0) + { + try + { + // salvo progetto sel + idxProjSel = idxProgetto; + // salvo idxCli... + int idxCli = 0; + try + { + idxCli = DataProxy.DP.taAP.getByIdxPrj(idxProgetto)[0].idxCliente; + idxCliSel = idxCli; + } + catch + { } + fatto = true; + } + catch + { } + } + } + return fatto; + } + /// /// intercetto eventuale update fittizio x rimandare a pagina dett fasi /// @@ -386,18 +439,19 @@ namespace GPW_Admin.WebUserControls if (e != null) { // salvo progetto sel - memLayer.ML.setSessionVal("idxProgetto_sel", e.Keys["idxProgetto"]); + saveProjSel(e.Keys["idxProgetto"]); // quale comando? string _comando = ""; - if (SteamWare.memLayer.ML.isInSessionObject("nextObjCommand")) + if (memLayer.ML.isInSessionObject("nextObjCommand")) { - _comando = SteamWare.memLayer.ML.StringSessionObj("nextObjCommand"); - SteamWare.memLayer.ML.emptySessionVal("nextObjCommand"); + _comando = memLayer.ML.StringSessionObj("nextObjCommand"); + memLayer.ML.emptySessionVal("nextObjCommand"); } // verifico il tipo di richiesta (clona o update normale) switch (_comando) { case "dettFasi": +#if false // salvo idxCli... int idxCli = 0; try @@ -411,10 +465,11 @@ namespace GPW_Admin.WebUserControls var tempFilt = currFiltProj; tempFilt.filtCli = true; currFiltProj = tempFilt; - filtroCli.valore = $"{idxCli}"; - Response.Redirect("fasi"); + filtroCli.valore = $"{idxCli}"; +#endif // blocco update! e.Cancel = true; + Response.Redirect("fasi"); break; default: @@ -431,7 +486,13 @@ namespace GPW_Admin.WebUserControls /// protected void grView_SelectedIndexChanged(object sender, EventArgs e) { +#if false + saveProjSel(grView.SelectedDataKey["idxProgetto"]); memLayer.ML.setSessionVal("idxProgetto_sel", grView.SelectedDataKey["idxProgetto"]); +#endif + int idxProj = 0; + int.TryParse($"{grView.SelectedDataKey["idxProgetto"]}", out idxProj); + mod_dettaglioProgetto1.IdxProgetto = idxProj; mod_dettaglioProgetto1.Visible = true; raiseEvent(); } diff --git a/GPW_Admin/WebUserControls/mod_dettaglioProgetto.ascx b/GPW_Admin/WebUserControls/mod_dettaglioProgetto.ascx index bd6dc23..95734c4 100644 --- a/GPW_Admin/WebUserControls/mod_dettaglioProgetto.ascx +++ b/GPW_Admin/WebUserControls/mod_dettaglioProgetto.ascx @@ -92,18 +92,19 @@
-
+ <%--
-
+
--%>
- + - \ No newline at end of file + + \ No newline at end of file diff --git a/GPW_Admin/WebUserControls/mod_dettaglioProgetto.ascx.cs b/GPW_Admin/WebUserControls/mod_dettaglioProgetto.ascx.cs index eeeee42..557f66d 100644 --- a/GPW_Admin/WebUserControls/mod_dettaglioProgetto.ascx.cs +++ b/GPW_Admin/WebUserControls/mod_dettaglioProgetto.ascx.cs @@ -21,6 +21,22 @@ namespace GPW_Admin.WebUserControls /// public string _paginaCorrente { get; set; } + public int IdxProgetto + { + get + { + //memLayer.ML.IntSessionObj("idxProgetto_sel") + int answ = 0; + int.TryParse(hfIdxProgetto.Value, out answ); + return answ; + } + set + { + hfIdxProgetto.Value = $"{value}"; + + } + } + #endregion Public Properties #region Protected Methods @@ -32,7 +48,7 @@ namespace GPW_Admin.WebUserControls /// protected void btnFasi_Click(object sender, EventArgs e) { - Response.Redirect("fasi.aspx"); + Response.Redirect("fasi"); } /// @@ -46,7 +62,7 @@ namespace GPW_Admin.WebUserControls { // chiamo update attivo/non attivo... CheckBox chkBox = (CheckBox)sender; - DataProxy.DP.taAP.updateAttivo(chkBox.Checked, memLayer.ML.IntSessionObj("idxProgetto_sel")); + DataProxy.DP.taAP.updateAttivo(chkBox.Checked, IdxProgetto); fmView.DataBind(); if (eh_nuovoValore != null) { @@ -66,7 +82,7 @@ namespace GPW_Admin.WebUserControls { // chiamo update attivo/non attivo... CheckBox chkBox = (CheckBox)sender; - DataProxy.DP.taAP.updateStarred(chkBox.Checked, memLayer.ML.IntSessionObj("idxProgetto_sel")); + DataProxy.DP.taAP.updateStarred(chkBox.Checked, IdxProgetto); fmView.DataBind(); if (eh_nuovoValore != null) { diff --git a/GPW_Admin/WebUserControls/mod_dettaglioProgetto.ascx.designer.cs b/GPW_Admin/WebUserControls/mod_dettaglioProgetto.ascx.designer.cs index e9c8853..9b3612b 100644 --- a/GPW_Admin/WebUserControls/mod_dettaglioProgetto.ascx.designer.cs +++ b/GPW_Admin/WebUserControls/mod_dettaglioProgetto.ascx.designer.cs @@ -1,10 +1,10 @@ //------------------------------------------------------------------------------ -// -// 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 GPW_Admin.WebUserControls @@ -15,21 +15,30 @@ namespace GPW_Admin.WebUserControls { /// - /// Controllo fmView. + /// fmView 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.FormView fmView; /// - /// 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; + + /// + /// hfIdxProgetto control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.HiddenField hfIdxProgetto; } } From d1b38418cb5b2c8b33a6914353d01358d377df84 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Wed, 9 Feb 2022 10:17:53 +0100 Subject: [PATCH 2/4] refactor codice --- .../WebUserControls/mod_adminProgetti.ascx.cs | 139 ++++++++---------- 1 file changed, 60 insertions(+), 79 deletions(-) diff --git a/GPW_Admin/WebUserControls/mod_adminProgetti.ascx.cs b/GPW_Admin/WebUserControls/mod_adminProgetti.ascx.cs index 396627a..84aeee7 100644 --- a/GPW_Admin/WebUserControls/mod_adminProgetti.ascx.cs +++ b/GPW_Admin/WebUserControls/mod_adminProgetti.ascx.cs @@ -98,6 +98,30 @@ namespace GPW_Admin.WebUserControls } } + protected int idxCliSel + { + get + { + return memLayer.ML.IntSessionObj("idxCli_sel"); + } + set + { + memLayer.ML.setSessionVal("idxCli_sel", $"{value}"); + } + } + + protected int idxProjSel + { + get + { + return memLayer.ML.IntSessionObj("idxProgetto_sel"); + } + set + { + memLayer.ML.setSessionVal("idxProgetto_sel", $"{value}"); + } + } + #endregion Protected Properties #region Public Properties @@ -370,65 +394,6 @@ namespace GPW_Admin.WebUserControls } } - protected int idxProjSel - { - get - { - return memLayer.ML.IntSessionObj("idxProgetto_sel"); - } - set - { - memLayer.ML.setSessionVal("idxProgetto_sel", $"{value}"); - } - } - protected int idxCliSel - { - get - { - return memLayer.ML.IntSessionObj("idxCli_sel"); - } - set - { - memLayer.ML.setSessionVal("idxCli_sel", $"{value}"); - } - } - - /// - /// Effettua salvataggio dati x progetto selezionato in sessione (cliente + progetto) - /// - /// - /// - protected bool saveProjSel(object idxProj) - { - bool fatto = false; - if (idxProj != null) - { - int idxProgetto = 0; - int.TryParse($"{idxProj}", out idxProgetto); - if (idxProgetto > 0) - { - try - { - // salvo progetto sel - idxProjSel = idxProgetto; - // salvo idxCli... - int idxCli = 0; - try - { - idxCli = DataProxy.DP.taAP.getByIdxPrj(idxProgetto)[0].idxCliente; - idxCliSel = idxCli; - } - catch - { } - fatto = true; - } - catch - { } - } - } - return fatto; - } - /// /// intercetto eventuale update fittizio x rimandare a pagina dett fasi /// @@ -451,22 +416,6 @@ namespace GPW_Admin.WebUserControls switch (_comando) { case "dettFasi": -#if false - // salvo idxCli... - int idxCli = 0; - try - { - idxCli = DataProxy.DP.taAP.getByIdxPrj(memLayer.ML.IntSessionObj("idxProgetto_sel"))[0].idxCliente; - } - catch - { } - memLayer.ML.setSessionVal("idxCli_sel", idxCli); - // preseleziono filtro cliente... - var tempFilt = currFiltProj; - tempFilt.filtCli = true; - currFiltProj = tempFilt; - filtroCli.valore = $"{idxCli}"; -#endif // blocco update! e.Cancel = true; Response.Redirect("fasi"); @@ -486,10 +435,6 @@ namespace GPW_Admin.WebUserControls /// protected void grView_SelectedIndexChanged(object sender, EventArgs e) { -#if false - saveProjSel(grView.SelectedDataKey["idxProgetto"]); - memLayer.ML.setSessionVal("idxProgetto_sel", grView.SelectedDataKey["idxProgetto"]); -#endif int idxProj = 0; int.TryParse($"{grView.SelectedDataKey["idxProgetto"]}", out idxProj); mod_dettaglioProgetto1.IdxProgetto = idxProj; @@ -641,6 +586,42 @@ namespace GPW_Admin.WebUserControls } } + /// + /// Effettua salvataggio dati x progetto selezionato in sessione (cliente + progetto) + /// + /// + /// + protected bool saveProjSel(object idxProj) + { + bool fatto = false; + if (idxProj != null) + { + int idxProgetto = 0; + int.TryParse($"{idxProj}", out idxProgetto); + if (idxProgetto > 0) + { + try + { + // salvo progetto sel + idxProjSel = idxProgetto; + // salvo idxCli... + int idxCli = 0; + try + { + idxCli = DataProxy.DP.taAP.getByIdxPrj(idxProgetto)[0].idxCliente; + idxCliSel = idxCli; + } + catch + { } + fatto = true; + } + catch + { } + } + } + return fatto; + } + #endregion Protected Methods #region Public Methods From 0cfe759e081e643699448e4cd3c145dd4eabf7c1 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Wed, 9 Feb 2022 10:31:24 +0100 Subject: [PATCH 3/4] Fix selezione fasi progetti (sistemato sel proj) --- GPW_Admin/WebUserControls/mod_adminFasi.ascx | 6 ++---- GPW_Admin/WebUserControls/mod_adminFasi.ascx.cs | 1 + GPW_Admin/fasi.aspx.cs | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/GPW_Admin/WebUserControls/mod_adminFasi.ascx b/GPW_Admin/WebUserControls/mod_adminFasi.ascx index 3642f13..266fc82 100644 --- a/GPW_Admin/WebUserControls/mod_adminFasi.ascx +++ b/GPW_Admin/WebUserControls/mod_adminFasi.ascx @@ -12,14 +12,12 @@ Progetti
- +
- + diff --git a/GPW_Admin/WebUserControls/mod_adminFasi.ascx.cs b/GPW_Admin/WebUserControls/mod_adminFasi.ascx.cs index d3d3350..413eedc 100644 --- a/GPW_Admin/WebUserControls/mod_adminFasi.ascx.cs +++ b/GPW_Admin/WebUserControls/mod_adminFasi.ascx.cs @@ -146,6 +146,7 @@ namespace GPW_Admin.WebUserControls set { memLayer.ML.setSessionVal(string.Format("idxProj_{0}", sessionUid), value); + filtroPrj.valore = $"{value}"; } } diff --git a/GPW_Admin/fasi.aspx.cs b/GPW_Admin/fasi.aspx.cs index f39e8af..f7f8a0f 100644 --- a/GPW_Admin/fasi.aspx.cs +++ b/GPW_Admin/fasi.aspx.cs @@ -19,8 +19,8 @@ namespace GPW_Admin protected void Page_Load(object sender, EventArgs e) { // imposto fasi selezionate! - mod_adminFasi1.idxProgetto = memLayer.ML.IntSessionObj("idxProgetto_sel"); mod_adminFasi1.idxCliente = memLayer.ML.IntSessionObj("idxCli_sel"); + mod_adminFasi1.idxProgetto = memLayer.ML.IntSessionObj("idxProgetto_sel"); mod_pageSize.eh_nuovaSize += Mod_pageSize_eh_nuovaSize; } From b7f993863b0ab043aac030283a0774d2782e20a1 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Wed, 9 Feb 2022 10:54:44 +0100 Subject: [PATCH 4/4] Aggiunta refresh chiavi utenti senza scadenza licenza --- GPW_Admin/WebUserControls/cmp_menuTop.ascx | 2 +- .../WebUserControls/cmp_userLicense.ascx.cs | 4 ---- .../WebUserControls/mod_adminDipendenti.ascx | 3 +++ .../mod_adminDipendenti.ascx.cs | 20 ++++++++++++++++--- .../mod_adminDipendenti.ascx.designer.cs | 9 +++++++++ 5 files changed, 30 insertions(+), 8 deletions(-) diff --git a/GPW_Admin/WebUserControls/cmp_menuTop.ascx b/GPW_Admin/WebUserControls/cmp_menuTop.ascx index a5b5994..81e5b14 100644 --- a/GPW_Admin/WebUserControls/cmp_menuTop.ascx +++ b/GPW_Admin/WebUserControls/cmp_menuTop.ascx @@ -2,7 +2,7 @@
diff --git a/GPW_Admin/WebUserControls/mod_adminDipendenti.ascx.cs b/GPW_Admin/WebUserControls/mod_adminDipendenti.ascx.cs index 4f23db4..f3e9c2f 100644 --- a/GPW_Admin/WebUserControls/mod_adminDipendenti.ascx.cs +++ b/GPW_Admin/WebUserControls/mod_adminDipendenti.ascx.cs @@ -266,6 +266,23 @@ namespace GPW_Admin.WebUserControls grView.DataBind(); } + protected void lbtRegenUserKey_Click(object sender, EventArgs e) + { + // rigenera TUTTE le userkey utente + var elencoDip = licenzeGPW.getDipAttivi().ToList(); + // ciclo x ogni utente... + foreach (var dipendente in elencoDip) + { + DateTime adesso = DateTime.Now; + string newKey = $"{dipendente.CF}-{adesso:yyMMdd-HHmmss}"; + string md5UserAuthKey = SteamCrypto.EncryptString(newKey, "AuthGPW"); + // aggiorno su DB + DataProxy.DP.taDipendenti.stp_Dip_setAuthKey(dipendente.idxDipendente, md5UserAuthKey); + // chiama resync dati licenza (cod impiego / codAuth) + bool fatto = licenzeGPW.tryRefreshActivation(DataProxy.DP.hashCodImpiego(dipendente), md5UserAuthKey).Result; + } + } + /// /// Richiesta selezione utente /// @@ -350,11 +367,8 @@ namespace GPW_Admin.WebUserControls grView.EditIndex = -1; grView.DataBind(); } - } } - - } } } diff --git a/GPW_Admin/WebUserControls/mod_adminDipendenti.ascx.designer.cs b/GPW_Admin/WebUserControls/mod_adminDipendenti.ascx.designer.cs index 7dd66a5..666cf79 100644 --- a/GPW_Admin/WebUserControls/mod_adminDipendenti.ascx.designer.cs +++ b/GPW_Admin/WebUserControls/mod_adminDipendenti.ascx.designer.cs @@ -59,6 +59,15 @@ namespace GPW_Admin.WebUserControls /// protected global::System.Web.UI.WebControls.LinkButton lbtShowTickets; + /// + /// lbtRegenUserKey control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.LinkButton lbtRegenUserKey; + /// /// chkshowAll control. ///