diff --git a/GPW_Admin/About.aspx b/GPW_Admin/About.aspx index 96331b5..a9f5997 100644 --- a/GPW_Admin/About.aspx +++ b/GPW_Admin/About.aspx @@ -18,6 +18,15 @@

Info installazione


+
+
+ Remote Server: +
+
+ + +
+
Cliente: @@ -45,7 +54,7 @@
-
+
Scadenza:
diff --git a/GPW_Admin/About.aspx.cs b/GPW_Admin/About.aspx.cs index 6ff2902..566e640 100644 --- a/GPW_Admin/About.aspx.cs +++ b/GPW_Admin/About.aspx.cs @@ -15,21 +15,54 @@ namespace GPW_Admin { if (showInstall) { + var serverStatus = licenzeGPW.checkLimanServer(); + bool okScadenza = licenzeGPW.scadenzaLicenza >= DateTime.Now; + bool okRemoteSrv = serverStatus == "OK"; + bool okNumLic = ((licenzeGPW.licenzeAttive <= licenzeGPW.licenzeDb) && (licenzeGPW.licenzeDb <= licenzeGPW.licenzeOnline)); + + // mostro dati base + lblInstallation.Text = licenzeGPW.installazione; + lblInstallation.ToolTip = "Cliente / Installazione"; + lblApplication.Text = licenzeGPW.applicazione; + lblApplication.ToolTip = "Applicazione corrente"; + lblNumLic.Text = $"{licenzeGPW.licenzeAttive} / {licenzeGPW.licenzeDb} / {licenzeGPW.licenzeOnline}"; + lblNumLic.ToolTip = "# licenze Attive / # licenze DB / # licenze Online"; + lblExpiryDate.Text = licenzeGPW.scadenzaLicenza.ToShortDateString(); + lblExpiryDate.ToolTip = "Scadenza licenza"; + lblAuthKey.Text = licenzeGPW.authKey; + lblAuthKey.ToolTip = "Chiave licenza attiva"; + lblLimanServer.Text = serverStatus; + lblLimanServer.ToolTip = "Status del server lienze online"; + + // mostro dati secondo status colore da check divCheck.Attributes.Remove("class"); - if (licenzeGPW.scadenzaLicenza >= DateTime.Now) + if (okScadenza && okNumLic) { divCheck.Attributes.Add("class", "alert alert-success shadowBox"); } else { - divCheck.Attributes.Add("class", "alert alert-danger shadowBox"); + divCheck.Attributes.Add("class", "alert alert-warning shadowBox"); + } + + divExpiry.Attributes.Remove("class"); + if (okScadenza) + { + divExpiry.Attributes.Add("class", "d-flex justify-content-between"); + } + else + { + divExpiry.Attributes.Add("class", "d-flex justify-content-between bg-danger text-warning"); + } + divServer.Attributes.Remove("class"); + if (okRemoteSrv) + { + divServer.Attributes.Add("class", "d-flex justify-content-between"); + } + else + { + divServer.Attributes.Add("class", "d-flex justify-content-between bg-danger text-warning"); } - lblInstallation.Text = licenzeGPW.installazione; - lblApplication.Text = licenzeGPW.applicazione; - lblNumLic.Text = string.Format("{1} ({0} disp)", licenzeGPW.licenzeAttive, licenzeGPW.licenzeDb); - lblNumLic.ToolTip = "licenze valide (licenze su db)"; - lblExpiryDate.Text = licenzeGPW.scadenzaLicenza.ToShortDateString(); - lblAuthKey.Text = licenzeGPW.authKey; } } diff --git a/GPW_Admin/About.aspx.designer.cs b/GPW_Admin/About.aspx.designer.cs index 3e6e0bd..8af1998 100644 --- a/GPW_Admin/About.aspx.designer.cs +++ b/GPW_Admin/About.aspx.designer.cs @@ -23,6 +23,24 @@ namespace GPW_Admin /// protected global::System.Web.UI.HtmlControls.HtmlGenericControl divCheck; + /// + /// divServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl divServer; + + /// + /// lblLimanServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblLimanServer; + /// /// lblInstallation control. /// @@ -50,6 +68,15 @@ namespace GPW_Admin /// protected global::System.Web.UI.WebControls.Label lblNumLic; + /// + /// divExpiry control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl divExpiry; + /// /// lblExpiryDate control. /// diff --git a/GPW_Data/licenzeGPW.cs b/GPW_Data/licenzeGPW.cs index 67c97e3..2bfa15d 100644 --- a/GPW_Data/licenzeGPW.cs +++ b/GPW_Data/licenzeGPW.cs @@ -671,6 +671,27 @@ namespace GPW_data return await Task.FromResult(answ); } + /// + /// Verifica stato server licenze + /// + /// + /// + public static string checkLimanServer() + { + string answ = "ND"; + // cerco online + RestClient client = new RestClient(apiUrl); + var request = new RestRequest($"/api/health", DataFormat.Json); + var response = client.Get(request); + // controllo risposta + if (response.StatusCode == System.Net.HttpStatusCode.OK) + { + // verifico risposta + answ = response.Content.Replace("\"", ""); + } + return answ; + } + public static DS_Applicazione.DipendentiDataTable getDipAttivi() { DS_Applicazione.DipendentiDataTable answ = new DS_Applicazione.DipendentiDataTable(); @@ -690,11 +711,6 @@ namespace GPW_data return answ; } - public static void resetDipAttivi() - { - memLayer.ML.setRSV(rkeyDipAct, "", 1); - } - /// /// Effettua refresh ActivationInfo con chiamata remota (sovrascrivendo info locali Redis) /// @@ -813,6 +829,11 @@ namespace GPW_data return await Task.FromResult(answ); } + public static void resetDipAttivi() + { + memLayer.ML.setRSV(rkeyDipAct, "", 1); + } + public static void resetLicenseData() { memLayer.ML.setRSV(rkeyDipAct, "", 1);