diff --git a/GPW_Barcode/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/GPW_Barcode/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache index 1867bc1..b78a9a7 100644 Binary files a/GPW_Barcode/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and b/GPW_Barcode/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/GPW_Data/licenzeGPW.cs b/GPW_Data/licenzeGPW.cs index e0c8e25..298e9f0 100644 --- a/GPW_Data/licenzeGPW.cs +++ b/GPW_Data/licenzeGPW.cs @@ -39,6 +39,51 @@ namespace GPW_data #region Private Properties + /// + /// Info applicativo corrente (da cache con eventuale recupero online...) + /// + private static LiManObj.ApplicativoDTO InfoApplicativo + { + get + { + LiManObj.ApplicativoDTO answ = new LiManObj.ApplicativoDTO(); + // cerco da cache + string rawData = memLayer.ML.getRSV(rkeyLicInfo); + // se no ci fosse --> refresh online! + if (string.IsNullOrEmpty(rawData)) + { + var fatto = RefreshAppInfo().Result; + if (fatto) + { + rawData = memLayer.ML.getRSV(rkeyLicInfo); + } + } + if (!string.IsNullOrEmpty(rawData)) + { + try + { + // verifico se ho 1 risultato o molti...se inizia per "[" è molti + if (rawData.StartsWith("[")) + { + // POTREBBE darmi + di 1 risultato, prendo + recente... + List infoList = JsonConvert.DeserializeObject>(rawData); + if (infoList != null) + { + answ = infoList.OrderByDescending(x => x.Scadenza).FirstOrDefault(); + } + } + else + { + answ = JsonConvert.DeserializeObject(rawData); + } + } + catch + { } + } + return answ; + } + } + /// /// Durata cache statica locale dati licenza, random circa 1 h /// @@ -51,6 +96,8 @@ namespace GPW_data } } + private static LiManObj.ApplicativoDTO myInfoApplicativo { get; set; } + #endregion Private Properties #region Public Properties @@ -134,7 +181,7 @@ namespace GPW_data /// private static int _attivazioniOnline() { - return InfoApplicativo().NumLicenzeAttive; + return InfoApplicativo.NumLicenzeAttive; } /// @@ -270,7 +317,7 @@ namespace GPW_data /// private static int _licenzeOnline() { - return InfoApplicativo().NumLicenze; + return InfoApplicativo.NumLicenze; } /// @@ -423,48 +470,6 @@ namespace GPW_data return answ; } - /// - /// Info applicativo corrente (da cache con eventuale recupero online...) - /// - private static LiManObj.ApplicativoDTO InfoApplicativo() - { - LiManObj.ApplicativoDTO answ = new LiManObj.ApplicativoDTO(); - // cerco da cache - string rawData = memLayer.ML.getRSV(rkeyLicInfo); - // se no ci fosse --> refresh online! - if (string.IsNullOrEmpty(rawData)) - { - var fatto = RefreshAppInfo().Result; - if (fatto) - { - rawData = memLayer.ML.getRSV(rkeyLicInfo); - } - } - if (!string.IsNullOrEmpty(rawData)) - { - try - { - // verifico se ho 1 risultato o molti...se inizia per "[" è molti - if (rawData.StartsWith("[")) - { - // POTREBBE darmi + di 1 risultato, prendo + recente... - List infoList = JsonConvert.DeserializeObject>(rawData); - if (infoList != null) - { - answ = infoList.OrderByDescending(x => x.Scadenza).FirstOrDefault(); - } - } - else - { - answ = JsonConvert.DeserializeObject(rawData); - } - } - catch - { } - } - return answ; - } - private static void tryCheckPayloadOnline(ref bool answ, ref string currPayload) { try @@ -478,7 +483,14 @@ namespace GPW_data memLayer.ML.setRSV(rkeyPayload, currPayload, LicCacheTTL); } // confronto payload calc con quello della licenza - answ = InfoApplicativo().Payload == currPayload; + var currInfo = InfoApplicativo; + answ = (InfoApplicativo.Payload == currPayload); + // se fallisce --> resetto payload calcolato + if (!answ) + { + memLayer.ML.setRSV(rkeyAppInfo, "", 1); + memLayer.ML.setRSV(rkeyPayload, "", 1); + } } catch { } diff --git a/GPW_Smart/WebUserControls/mod_enrollByAuthKey.ascx b/GPW_Smart/WebUserControls/mod_enrollByAuthKey.ascx index 02cd403..e1b5251 100644 --- a/GPW_Smart/WebUserControls/mod_enrollByAuthKey.ascx +++ b/GPW_Smart/WebUserControls/mod_enrollByAuthKey.ascx @@ -8,7 +8,7 @@ - + diff --git a/GPW_Smart/WebUserControls/mod_enrollByAuthKey.ascx.designer.cs b/GPW_Smart/WebUserControls/mod_enrollByAuthKey.ascx.designer.cs index ce91b74..72f24e2 100644 --- a/GPW_Smart/WebUserControls/mod_enrollByAuthKey.ascx.designer.cs +++ b/GPW_Smart/WebUserControls/mod_enrollByAuthKey.ascx.designer.cs @@ -1,68 +1,70 @@ //------------------------------------------------------------------------------ -// -// 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.WebUserControls { - - - public partial class mod_enrollByAuthKey { - +namespace GPW.WebUserControls +{ + + + public partial class mod_enrollByAuthKey + { + /// - /// Controllo ddlIdxDipendente. + /// ddlIdxDipendente 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.DropDownList ddlIdxDipendente; - + /// - /// Controllo odsDipendenti. + /// odsDipendenti 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 odsDipendenti; - + /// - /// Controllo txtUserAuthKey. + /// txtUserAuthKey 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.TextBox txtUserAuthKey; - + /// - /// Controllo lblWarning. + /// lblWarning 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.Label lblWarning; - + /// - /// Controllo btnConferma. + /// btnConferma 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.Button btnConferma; - + /// - /// Controllo btnAnnulla. + /// btnAnnulla 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.Button btnAnnulla; } diff --git a/GPW_Smart/WebUserControls/mod_resetUserAuthKey.ascx b/GPW_Smart/WebUserControls/mod_resetUserAuthKey.ascx index 02ace44..5c79303 100644 --- a/GPW_Smart/WebUserControls/mod_resetUserAuthKey.ascx +++ b/GPW_Smart/WebUserControls/mod_resetUserAuthKey.ascx @@ -11,7 +11,7 @@ - + diff --git a/GPW_Smart/WebUserControls/mod_resetUserAuthKey.ascx.cs b/GPW_Smart/WebUserControls/mod_resetUserAuthKey.ascx.cs index 84f26c5..7e0de42 100644 --- a/GPW_Smart/WebUserControls/mod_resetUserAuthKey.ascx.cs +++ b/GPW_Smart/WebUserControls/mod_resetUserAuthKey.ascx.cs @@ -11,43 +11,8 @@ namespace GPW.WebUserControls { public partial class mod_resetUserAuthKey : System.Web.UI.UserControl { - protected void Page_Load(object sender, EventArgs e) - { + #region Protected Methods - } - /// - /// salvo nuovo device... - /// - /// - /// - protected void btnConferma_Click(object sender, EventArgs e) - { - // controllo se ho i dati... - string UserAuthKey = txtUserAuthKey.Text.Trim(); - string AuthKey = txtAuthKey.Text.Trim(); - int idxDip = 0; - try - { - idxDip = Convert.ToInt32(ddlIdxDipendente.SelectedValue); - } - catch - { } - // controllo password... - if (AuthKey == memLayer.ML.confReadString("authKey")) - { - // calcolo il secret... - string md5UserAuthKey = SteamCrypto.EncryptString(UserAuthKey, "AuthGPW"); - DataProxy.DP.taDipendenti.stp_Dip_setAuthKey(idxDip, md5UserAuthKey); - // mostro esito! - lblWarning.Text = string.Format("AuthKey utente {0} aggiornata", idxDip); - lblWarning.Visible = true; - } - else - { - lblWarning.Text = "Key errata"; - lblWarning.Visible = true; - } - } /// /// resetto tutto /// @@ -60,5 +25,54 @@ namespace GPW.WebUserControls txtUserAuthKey.Text = ""; lblWarning.Visible = false; } + + /// + /// salvo nuovo device... + /// + /// + /// + protected void btnConferma_Click(object sender, EventArgs e) + { + // controllo se ho i dati... + string UserAuthKey = txtUserAuthKey.Text.Trim(); + string AuthKey = txtAuthKey.Text.Trim(); + int idxDip = 0; + bool fatto = false; + try + { + idxDip = Convert.ToInt32(ddlIdxDipendente.SelectedValue); + } + catch + { } + // controllo password... + if (AuthKey == memLayer.ML.confReadString("authKey")) + { + if (idxDip > 0) + { + var dipRow = DataProxy.DP.getRowDip(idxDip); + if (dipRow != null) + { + // calcolo il secret... + string md5UserAuthKey = SteamCrypto.EncryptString(UserAuthKey, "AuthGPW").ToLowerInvariant(); + DataProxy.DP.taDipendenti.stp_Dip_setAuthKey(idxDip, $"{dipRow.CF}.{md5UserAuthKey}"); + // mostro esito! + lblWarning.Text = string.Format("AuthKey utente {0} aggiornata", idxDip); + lblWarning.Visible = true; + fatto = true; + } + } + } + if (!fatto) + { + lblWarning.Text = "Key errata"; + lblWarning.Visible = true; + } + } + + protected void Page_Load(object sender, EventArgs e) + { + } + + #endregion Protected Methods } } \ No newline at end of file diff --git a/GPW_Smart/WebUserControls/mod_resetUserAuthKey.ascx.designer.cs b/GPW_Smart/WebUserControls/mod_resetUserAuthKey.ascx.designer.cs index 214c5e7..72ab316 100644 --- a/GPW_Smart/WebUserControls/mod_resetUserAuthKey.ascx.designer.cs +++ b/GPW_Smart/WebUserControls/mod_resetUserAuthKey.ascx.designer.cs @@ -1,95 +1,97 @@ //------------------------------------------------------------------------------ -// -// 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.WebUserControls { - - - public partial class mod_resetUserAuthKey { - +namespace GPW.WebUserControls +{ + + + public partial class mod_resetUserAuthKey + { + /// - /// Controllo ddlIdxDipendente. + /// ddlIdxDipendente 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.DropDownList ddlIdxDipendente; - + /// - /// Controllo odsDipendenti. + /// odsDipendenti 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 odsDipendenti; - + /// - /// Controllo txtUserAuthKey. + /// txtUserAuthKey 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.TextBox txtUserAuthKey; - + /// - /// Controllo rfvUserAuthKey. + /// rfvUserAuthKey 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.RequiredFieldValidator rfvUserAuthKey; - + /// - /// Controllo txtAuthKey. + /// txtAuthKey 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.TextBox txtAuthKey; - + /// - /// Controllo rfvAuthKey. + /// rfvAuthKey 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.RequiredFieldValidator rfvAuthKey; - + /// - /// Controllo lblWarning. + /// lblWarning 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.Label lblWarning; - + /// - /// Controllo lbtConferma. + /// lbtConferma 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.LinkButton lbtConferma; - + /// - /// Controllo lbtAnnulla. + /// lbtAnnulla 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.LinkButton lbtAnnulla; } diff --git a/GPW_Smart/WebUserControls/mod_sendAuthToEmail.ascx b/GPW_Smart/WebUserControls/mod_sendAuthToEmail.ascx index 04e7835..1c5e2a2 100644 --- a/GPW_Smart/WebUserControls/mod_sendAuthToEmail.ascx +++ b/GPW_Smart/WebUserControls/mod_sendAuthToEmail.ascx @@ -8,7 +8,7 @@ - + diff --git a/GPW_Smart/WebUserControls/mod_sendAuthToEmail.ascx.designer.cs b/GPW_Smart/WebUserControls/mod_sendAuthToEmail.ascx.designer.cs index 3a36b4a..e439d3c 100644 --- a/GPW_Smart/WebUserControls/mod_sendAuthToEmail.ascx.designer.cs +++ b/GPW_Smart/WebUserControls/mod_sendAuthToEmail.ascx.designer.cs @@ -1,59 +1,61 @@ //------------------------------------------------------------------------------ -// -// 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.WebUserControls { - - - public partial class mod_sendAuthToEmail { - +namespace GPW.WebUserControls +{ + + + public partial class mod_sendAuthToEmail + { + /// - /// Controllo ddlIdxDipendente. + /// ddlIdxDipendente 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.DropDownList ddlIdxDipendente; - + /// - /// Controllo odsDipendenti. + /// odsDipendenti 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 odsDipendenti; - + /// - /// Controllo lblWarning. + /// lblWarning 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.Label lblWarning; - + /// - /// Controllo lbtSendEmail. + /// lbtSendEmail 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.LinkButton lbtSendEmail; - + /// - /// Controllo lbtAnnulla. + /// lbtAnnulla 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.LinkButton lbtAnnulla; }