Update pagina about in GPW x check licenze attive e server online

This commit is contained in:
Samuele Locatelli
2022-04-22 18:10:34 +02:00
parent 5178714d4f
commit aaab7b7011
4 changed files with 104 additions and 14 deletions
+10 -1
View File
@@ -18,6 +18,15 @@
<div runat="server" id="divCheck" class="alert alert-warning">
<h4>Info installazione</h4>
<hr />
<div runat="server" id="divServer" class="d-flex justify-content-between">
<div class="px-2">
<i class="fa fa-server" aria-hidden="true"></i> Remote Server:
</div>
<div class="px-2">
<b>
<asp:Label runat="server" ID="lblLimanServer" /></b>
</div>
</div>
<div class="d-flex justify-content-between">
<div class="px-2">
<i class="fa fa-certificate" aria-hidden="true"></i> Cliente:
@@ -45,7 +54,7 @@
<asp:Label runat="server" ID="lblNumLic" /></b>
</div>
</div>
<div class="d-flex justify-content-between">
<div runat="server" id="divExpiry" class="d-flex justify-content-between">
<div class="px-2">
<i class="fa fa-calendar-check-o" aria-hidden="true"></i> Scadenza:
</div>
+41 -8
View File
@@ -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;
}
}
+27
View File
@@ -23,6 +23,24 @@ namespace GPW_Admin
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlGenericControl divCheck;
/// <summary>
/// divServer control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlGenericControl divServer;
/// <summary>
/// lblLimanServer control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblLimanServer;
/// <summary>
/// lblInstallation control.
/// </summary>
@@ -50,6 +68,15 @@ namespace GPW_Admin
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblNumLic;
/// <summary>
/// divExpiry control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlGenericControl divExpiry;
/// <summary>
/// lblExpiryDate control.
/// </summary>
+26 -5
View File
@@ -671,6 +671,27 @@ namespace GPW_data
return await Task.FromResult(answ);
}
/// <summary>
/// Verifica stato server licenze
/// </summary>
/// <param name="CodImpiego"></param>
/// <returns></returns>
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);
}
/// <summary>
/// Effettua refresh ActivationInfo con chiamata remota (sovrascrivendo info locali Redis)
/// </summary>
@@ -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);