+
-
+
+
+ Licenze locali: disponibili <%: numLicenze %> / attivate <%: utentiAttivi %>
+
+
+
+ Licenze online: disponibili <%: numLicenzeOnline %> / attivate <%: attivazioniOnline %>
+
+
+
+
+
+
+
-
+
@@ -126,50 +144,60 @@
-
+
-
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
+
+ -->
+
-
+
+
+
-
+
+
+
@@ -233,7 +292,7 @@
-
+
@@ -253,6 +312,8 @@
+
+
diff --git a/GPW_Admin/WebUserControls/mod_adminDipendenti.ascx.cs b/GPW_Admin/WebUserControls/mod_adminDipendenti.ascx.cs
index 072649d..f123a29 100644
--- a/GPW_Admin/WebUserControls/mod_adminDipendenti.ascx.cs
+++ b/GPW_Admin/WebUserControls/mod_adminDipendenti.ascx.cs
@@ -14,6 +14,35 @@ namespace GPW_Admin.WebUserControls
{
#region Public Properties
+ public int attivazioniOnline
+ {
+ get => licenzeGPW.attivazioniOnline;
+ }
+
+ public int IdxDipSel
+ {
+ get
+ {
+ int answ = 0;
+ if (grView.SelectedIndex >= 0)
+ {
+ var rawIdx = grView.SelectedValue.ToString();
+ int.TryParse(rawIdx, out answ);
+ }
+ return answ;
+ }
+ }
+
+ public int numLicenze
+ {
+ get => licenzeGPW.licenzeAttive;
+ }
+
+ public int numLicenzeOnline
+ {
+ get => licenzeGPW.licenzeOnline;
+ }
+
public bool showAll
{
get
@@ -22,8 +51,57 @@ namespace GPW_Admin.WebUserControls
}
}
+ public int utentiAttivi
+ {
+ get => licenzeGPW.utentiAttivi;
+ }
+
#endregion Public Properties
+ #region Public Methods
+
+ ///
+ /// determina se sia eliminabile il record (=non usato)
+ ///
+ ///
+ ///
+ public bool delEnabled(object idxObj)
+ {
+ bool answ = true;
+ // solo se ha diritti scrittura controllo
+ if (idxObj != null)
+ {
+ int trovati = 0;
+ int idxDip = 0;
+ _ = int.TryParse(idxObj.ToString(), out idxDip);
+ trovati = DataProxy.DP.taTimb.getLastByDip(idxDip).Count;
+ // controllo se ci sono record correlati...
+ if (trovati > 0)
+ {
+ answ = false;
+ }
+ }
+ return answ;
+ }
+
+ public void doUpdate()
+ {
+ grView.PageSize = utils.pageSize;
+ grView.DataBind();
+ }
+
+ ///
+ /// resetta la selezione dei valori in caso di modifiche su altri controlli
+ ///
+ public void resetSelezione()
+ {
+ grView.SelectedIndex = -1;
+ grView.DataBind();
+ raiseReset();
+ }
+
+ #endregion Public Methods
+
#region Protected Methods
///
@@ -104,6 +182,17 @@ namespace GPW_Admin.WebUserControls
}
}
+ protected void grView_RowEditing(object sender, GridViewEditEventArgs e)
+ {
+ resetSelezione();
+ }
+
+ protected void grView_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ // mostro gestione licenza DIP
+ raiseAddNew();
+ }
+
///
/// annulla inserimento nuovo valore da footer
///
@@ -126,6 +215,47 @@ namespace GPW_Admin.WebUserControls
ods.Insert();
}
+ protected void lbtFixMissing_Click(object sender, EventArgs e)
+ {
+ // procedo SOLO SE il numero online/offline è differente in primis...
+ if (numLicenzeOnline == numLicenze && attivazioniOnline != utentiAttivi)
+ {
+ // ciclo tutti gli utenti attivi
+ var localUserList = DataProxy.DP.taDipendenti.getAttivi(false);
+ // verifico SE sia disponibile licenza...
+ var activationsList = licenzeGPW.ListaAttivazioni;
+ List CodList = new List();
+
+ // ciclo x ogni dip attivo...
+ foreach (var item in localUserList)
+ {
+ // calcolo codImpiego
+ string currCodImp = DataProxy.DP.getCodImpiego(item.idxDipendente);
+ // cerco se abbia attivazione
+ var currActiv = activationsList.Where(x => x.CodImpiego == currCodImp).FirstOrDefault();
+ if (currActiv == null || currActiv.CodImpiego != currCodImp)
+ {
+ CodList.Add(currCodImp);
+ // provo attivazione
+ licenzeGPW.tryActivation(currCodImp).ConfigureAwait(false);
+ }
+ }
+
+ if (CodList.Count > 0)
+ {
+ raiseReset();
+ }
+ }
+ }
+
+ protected void lbtRefresh_Click(object sender, EventArgs e)
+ {
+ // eseguo call di recupero da online
+ bool refreshApp = licenzeGPW.RefreshAppInfo().Result;
+ bool refreshLic = licenzeGPW.RefreshLicInfo().Result;
+ bool refreshAct = licenzeGPW.RefreshActInfo().Result;
+ }
+
///
/// check licenze in fase di update...
///
@@ -152,6 +282,7 @@ namespace GPW_Admin.WebUserControls
///
protected void Page_Load(object sender, EventArgs e)
{
+ lbtFixMissing.Visible = (numLicenzeOnline == numLicenze && attivazioniOnline != utentiAttivi);
grView.PageSize = utils.pageSize;
}
@@ -207,9 +338,8 @@ namespace GPW_Admin.WebUserControls
}
tipoColonna = "";
}
- // attivo imposto a true!
- e.InputParameters["attivo"] = "true";
- // sistemo calendario!
+ // attivo imposto a FALSE!
+ e.InputParameters["attivo"] = "false";
}
else
{
@@ -221,49 +351,5 @@ namespace GPW_Admin.WebUserControls
}
#endregion Protected Methods
-
- #region Public Methods
-
- ///
- /// determina se sia eliminabile il record (=non usato)
- ///
- ///
- ///
- public bool delEnabled(object idxObj)
- {
- bool answ = true;
- // solo se ha diritti scrittura controllo
- if (idxObj != null)
- {
- int trovati = 0;
- int idxDip = 0;
- _ = int.TryParse(idxObj.ToString(), out idxDip);
- trovati = DataProxy.DP.taTimb.getLastByDip(idxDip).Count;
- // controllo se ci sono record correlati...
- if (trovati > 0)
- {
- answ = false;
- }
- }
- return answ;
- }
-
- public void doUpdate()
- {
- grView.PageSize = utils.pageSize;
- grView.DataBind();
- }
-
- ///
- /// resetta la selezione dei valori in caso di modifiche su altri controlli
- ///
- public void resetSelezione()
- {
- grView.SelectedIndex = -1;
- grView.DataBind();
- raiseReset();
- }
-
- #endregion Public Methods
}
}
\ No newline at end of file
diff --git a/GPW_Admin/WebUserControls/mod_adminDipendenti.ascx.designer.cs b/GPW_Admin/WebUserControls/mod_adminDipendenti.ascx.designer.cs
index a0a7972..520c5c8 100644
--- a/GPW_Admin/WebUserControls/mod_adminDipendenti.ascx.designer.cs
+++ b/GPW_Admin/WebUserControls/mod_adminDipendenti.ascx.designer.cs
@@ -14,6 +14,42 @@ namespace GPW_Admin.WebUserControls
public partial class mod_adminDipendenti
{
+ ///
+ /// Controllo divDB.
+ ///
+ ///
+ /// Campo generato automaticamente.
+ /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
+ ///
+ protected global::System.Web.UI.HtmlControls.HtmlGenericControl divDB;
+
+ ///
+ /// Controllo divOnline.
+ ///
+ ///
+ /// Campo generato automaticamente.
+ /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
+ ///
+ protected global::System.Web.UI.HtmlControls.HtmlGenericControl divOnline;
+
+ ///
+ /// Controllo lbtRefresh.
+ ///
+ ///
+ /// Campo generato automaticamente.
+ /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
+ ///
+ protected global::System.Web.UI.WebControls.LinkButton lbtRefresh;
+
+ ///
+ /// Controllo lbtFixMissing.
+ ///
+ ///
+ /// Campo generato automaticamente.
+ /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
+ ///
+ protected global::System.Web.UI.WebControls.LinkButton lbtFixMissing;
+
///
/// Controllo chkshowAll.
///
diff --git a/GPW_Admin/WebUserControls/mod_login.ascx.cs b/GPW_Admin/WebUserControls/mod_login.ascx.cs
index 9b50e51..661be6c 100644
--- a/GPW_Admin/WebUserControls/mod_login.ascx.cs
+++ b/GPW_Admin/WebUserControls/mod_login.ascx.cs
@@ -34,11 +34,16 @@ public partial class mod_login : ApplicationUserControl
protected override void traduciObj()
{
- lblPwd.Text = user_std.UtSn.Traduci("lblPwd");
- lblUser.Text = user_std.UtSn.Traduci("lblUser");
- lblDominio.Text = user_std.UtSn.Traduci("lblDominio");
- lblTitolo.Text = user_std.UtSn.Traduci("ForzaUtente");
- btnOk.Text = user_std.UtSn.Traduci("btnCommit");
+ try
+ {
+ lblPwd.Text = user_std.UtSn.Traduci("lblPwd");
+ lblUser.Text = user_std.UtSn.Traduci("lblUser");
+ lblDominio.Text = user_std.UtSn.Traduci("lblDominio");
+ lblTitolo.Text = user_std.UtSn.Traduci("ForzaUtente");
+ btnOk.Text = user_std.UtSn.Traduci("btnCommit");
+ }
+ catch
+ { }
}
///
diff --git a/GPW_Admin/dipendenti.aspx b/GPW_Admin/dipendenti.aspx
index 2ecfcaf..5b92afc 100644
--- a/GPW_Admin/dipendenti.aspx
+++ b/GPW_Admin/dipendenti.aspx
@@ -4,6 +4,7 @@
<%@ Register Src="~/WebUserControls/mod_pageSize.ascx" TagPrefix="uc1" TagName="mod_pageSize" %>
<%@ Register Src="~/WebUserControls/cmp_userCard.ascx" TagPrefix="uc1" TagName="cmp_userCard" %>
<%@ Register Src="~/WebUserControls/cmp_toggle.ascx" TagPrefix="uc1" TagName="cmp_toggle" %>
+<%@ Register Src="~/WebUserControls/cmp_userLicense.ascx" TagPrefix="uc1" TagName="cmp_userLicense" %>
@@ -21,6 +22,7 @@
+
diff --git a/GPW_Admin/dipendenti.aspx.cs b/GPW_Admin/dipendenti.aspx.cs
index ebb9422..95e2c88 100644
--- a/GPW_Admin/dipendenti.aspx.cs
+++ b/GPW_Admin/dipendenti.aspx.cs
@@ -9,6 +9,22 @@ namespace GPW_Admin
{
public partial class dipendenti : BasePage
{
+ #region Protected Properties
+
+ protected int IdxDipSel
+ {
+ get
+ {
+ return cmp_userLicense.idxDipSel;
+ }
+ set
+ {
+ cmp_userLicense.idxDipSel = value;
+ }
+ }
+
+ #endregion Protected Properties
+
#region Private Methods
private void Cmp_toggleCards_ehToggle(object sender, EventArgs e)
@@ -21,6 +37,12 @@ namespace GPW_Admin
fixDisplay();
}
+ private void Cmp_userLicense_eh_doReset(object sender, EventArgs e)
+ {
+ //IdxDipSel = 0;
+ fixDisplay();
+ }
+
private void fixDisplay()
{
mod_adminDipendenti1.Visible = !cmp_toggleCards.toggleValue;
@@ -29,10 +51,18 @@ namespace GPW_Admin
cmp_toggleLinkExt.Visible = cmp_toggleCards.toggleValue;
cmp_userCard.showAll = mod_adminDipendenti1.showAll;
cmp_userCard.showExt = cmp_toggleLinkExt.toggleValue;
+ cmp_userLicense.Visible = IdxDipSel > 0;
}
- private void Mod_adminDipendenti1_eh_resetSelezione(object sender, EventArgs e)
+ private void Mod_adminDipendenti1_eh_addNew(object sender, EventArgs e)
{
+ IdxDipSel = mod_adminDipendenti1.IdxDipSel;
+ fixDisplay();
+ }
+
+ private void Mod_adminDipendenti1_eh_doReset(object sender, EventArgs e)
+ {
+ IdxDipSel = 0;
fixDisplay();
}
@@ -57,9 +87,11 @@ namespace GPW_Admin
fixDisplay();
}
mod_pageSize.eh_nuovaSize += Mod_pageSize_eh_nuovaSize;
- mod_adminDipendenti1.eh_doReset += Mod_adminDipendenti1_eh_resetSelezione;
cmp_toggleCards.ehToggle += Cmp_toggleCards_ehToggle;
cmp_toggleLinkExt.ehToggle += Cmp_toggleLinkExt_ehToggle;
+ mod_adminDipendenti1.eh_addNew += Mod_adminDipendenti1_eh_addNew;
+ mod_adminDipendenti1.eh_doReset += Mod_adminDipendenti1_eh_doReset;
+ cmp_userLicense.eh_doReset += Cmp_userLicense_eh_doReset;
}
#endregion Protected Methods
diff --git a/GPW_Admin/dipendenti.aspx.designer.cs b/GPW_Admin/dipendenti.aspx.designer.cs
index 2cf6f72..7472f0a 100644
--- a/GPW_Admin/dipendenti.aspx.designer.cs
+++ b/GPW_Admin/dipendenti.aspx.designer.cs
@@ -32,6 +32,15 @@ namespace GPW_Admin
///
protected global::GPW_Admin.WebUserControls.cmp_toggle cmp_toggleLinkExt;
+ ///
+ /// cmp_userLicense control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::GPW_Admin.WebUserControls.cmp_userLicense cmp_userLicense;
+
///
/// mod_adminDipendenti1 control.
///
diff --git a/GPW_Barcode/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/GPW_Barcode/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
index 288904e..0e00260 100644
Binary files a/GPW_Barcode/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and b/GPW_Barcode/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ
diff --git a/GPW_Data/DS_Applicazione.Designer.cs b/GPW_Data/DS_Applicazione.Designer.cs
index dcf4655..c23500b 100644
--- a/GPW_Data/DS_Applicazione.Designer.cs
+++ b/GPW_Data/DS_Applicazione.Designer.cs
@@ -21709,7 +21709,7 @@ SELECT idxDipendente, matricola, CF, Cognome, Nome, dataNascita, luogoNascita, p
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private void InitCommandCollection() {
- this._commandCollection = new global::System.Data.SqlClient.SqlCommand[12];
+ this._commandCollection = new global::System.Data.SqlClient.SqlCommand[13];
this._commandCollection[0] = new global::System.Data.SqlClient.SqlCommand();
this._commandCollection[0].Connection = this.Connection;
this._commandCollection[0].CommandText = "SELECT *\r\nFROM Dipendenti";
@@ -21792,24 +21792,33 @@ SELECT idxDipendente, matricola, CF, Cognome, Nome, dataNascita, luogoNascita, p
this._commandCollection[10].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@authKey", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._commandCollection[11] = new global::System.Data.SqlClient.SqlCommand();
this._commandCollection[11].Connection = this.Connection;
- this._commandCollection[11].CommandText = "dbo.stp_AD_updateQuery";
+ this._commandCollection[11].CommandText = "dbo.stp_AD_updateActive";
this._commandCollection[11].CommandType = global::System.Data.CommandType.StoredProcedure;
this._commandCollection[11].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@RETURN_VALUE", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.ReturnValue, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
- this._commandCollection[11].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@matricola", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
- this._commandCollection[11].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@CF", global::System.Data.SqlDbType.NVarChar, 16, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
- this._commandCollection[11].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Cognome", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
- this._commandCollection[11].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Nome", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
- this._commandCollection[11].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@dataNascita", global::System.Data.SqlDbType.DateTime, 8, global::System.Data.ParameterDirection.Input, 23, 3, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
- this._commandCollection[11].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@luogoNascita", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
- this._commandCollection[11].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@provNascita", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
- this._commandCollection[11].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@nazNascita", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
- this._commandCollection[11].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@email", global::System.Data.SqlDbType.NVarChar, 250, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
- this._commandCollection[11].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@dominio", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
- this._commandCollection[11].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@utente", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
- this._commandCollection[11].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@codOrario", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._commandCollection[11].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@attivo", global::System.Data.SqlDbType.Bit, 1, global::System.Data.ParameterDirection.Input, 1, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
- this._commandCollection[11].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@gruppo", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._commandCollection[11].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_idxDipendente", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
+ this._commandCollection[12] = new global::System.Data.SqlClient.SqlCommand();
+ this._commandCollection[12].Connection = this.Connection;
+ this._commandCollection[12].CommandText = "dbo.stp_AD_updateQuery";
+ this._commandCollection[12].CommandType = global::System.Data.CommandType.StoredProcedure;
+ this._commandCollection[12].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@RETURN_VALUE", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.ReturnValue, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
+ this._commandCollection[12].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@matricola", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
+ this._commandCollection[12].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@CF", global::System.Data.SqlDbType.NVarChar, 16, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
+ this._commandCollection[12].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Cognome", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
+ this._commandCollection[12].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Nome", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
+ this._commandCollection[12].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@dataNascita", global::System.Data.SqlDbType.DateTime, 8, global::System.Data.ParameterDirection.Input, 23, 3, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
+ this._commandCollection[12].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@luogoNascita", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
+ this._commandCollection[12].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@provNascita", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
+ this._commandCollection[12].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@nazNascita", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
+ this._commandCollection[12].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@email", global::System.Data.SqlDbType.NVarChar, 250, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
+ this._commandCollection[12].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@dominio", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
+ this._commandCollection[12].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@utente", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
+ this._commandCollection[12].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@codOrario", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
+ this._commandCollection[12].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@attivo", global::System.Data.SqlDbType.Bit, 1, global::System.Data.ParameterDirection.Input, 1, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
+ this._commandCollection[12].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@gruppo", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
+ this._commandCollection[12].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@dataAssunzione", global::System.Data.SqlDbType.DateTime, 8, global::System.Data.ParameterDirection.Input, 23, 3, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
+ this._commandCollection[12].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@dataCessazione", global::System.Data.SqlDbType.DateTime, 8, global::System.Data.ParameterDirection.Input, 23, 3, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
+ this._commandCollection[12].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_idxDipendente", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -23108,9 +23117,60 @@ SELECT idxDipendente, matricola, CF, Cognome, Nome, dataNascita, luogoNascita, p
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
- [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Update, false)]
- public virtual int updateQuery(string matricola, string CF, string Cognome, string Nome, global::System.Nullable
dataNascita, string luogoNascita, string provNascita, string nazNascita, string email, string dominio, string utente, string codOrario, global::System.Nullable attivo, string gruppo, global::System.Nullable Original_idxDipendente) {
+ public virtual int updateActive(global::System.Nullable attivo, global::System.Nullable Original_idxDipendente) {
global::System.Data.SqlClient.SqlCommand command = this.CommandCollection[11];
+ if ((attivo.HasValue == true)) {
+ command.Parameters[1].Value = ((bool)(attivo.Value));
+ }
+ else {
+ command.Parameters[1].Value = global::System.DBNull.Value;
+ }
+ if ((Original_idxDipendente.HasValue == true)) {
+ command.Parameters[2].Value = ((int)(Original_idxDipendente.Value));
+ }
+ else {
+ command.Parameters[2].Value = global::System.DBNull.Value;
+ }
+ global::System.Data.ConnectionState previousConnectionState = command.Connection.State;
+ if (((command.Connection.State & global::System.Data.ConnectionState.Open)
+ != global::System.Data.ConnectionState.Open)) {
+ command.Connection.Open();
+ }
+ int returnValue;
+ try {
+ returnValue = command.ExecuteNonQuery();
+ }
+ finally {
+ if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) {
+ command.Connection.Close();
+ }
+ }
+ return returnValue;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
+ [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
+ [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Update, false)]
+ public virtual int updateQuery(
+ string matricola,
+ string CF,
+ string Cognome,
+ string Nome,
+ global::System.Nullable dataNascita,
+ string luogoNascita,
+ string provNascita,
+ string nazNascita,
+ string email,
+ string dominio,
+ string utente,
+ string codOrario,
+ global::System.Nullable attivo,
+ string gruppo,
+ global::System.Nullable dataAssunzione,
+ global::System.Nullable dataCessazione,
+ global::System.Nullable Original_idxDipendente) {
+ global::System.Data.SqlClient.SqlCommand command = this.CommandCollection[12];
if ((matricola == null)) {
command.Parameters[1].Value = global::System.DBNull.Value;
}
@@ -23195,12 +23255,24 @@ SELECT idxDipendente, matricola, CF, Cognome, Nome, dataNascita, luogoNascita, p
else {
command.Parameters[14].Value = ((string)(gruppo));
}
- if ((Original_idxDipendente.HasValue == true)) {
- command.Parameters[15].Value = ((int)(Original_idxDipendente.Value));
+ if ((dataAssunzione.HasValue == true)) {
+ command.Parameters[15].Value = ((System.DateTime)(dataAssunzione.Value));
}
else {
command.Parameters[15].Value = global::System.DBNull.Value;
}
+ if ((dataCessazione.HasValue == true)) {
+ command.Parameters[16].Value = ((System.DateTime)(dataCessazione.Value));
+ }
+ else {
+ command.Parameters[16].Value = global::System.DBNull.Value;
+ }
+ if ((Original_idxDipendente.HasValue == true)) {
+ command.Parameters[17].Value = ((int)(Original_idxDipendente.Value));
+ }
+ else {
+ command.Parameters[17].Value = global::System.DBNull.Value;
+ }
global::System.Data.ConnectionState previousConnectionState = command.Connection.State;
if (((command.Connection.State & global::System.Data.ConnectionState.Open)
!= global::System.Data.ConnectionState.Open)) {
diff --git a/GPW_Data/DS_Applicazione.xsd b/GPW_Data/DS_Applicazione.xsd
index bea44af..683ee01 100644
--- a/GPW_Data/DS_Applicazione.xsd
+++ b/GPW_Data/DS_Applicazione.xsd
@@ -1057,6 +1057,18 @@ SELECT idxDipendente, matricola, CF, Cognome, Nome, dataNascita, luogoNascita, p
+
+
+
+ dbo.stp_AD_updateActive
+
+
+
+
+
+
+
+
@@ -1077,6 +1089,8 @@ SELECT idxDipendente, matricola, CF, Cognome, Nome, dataNascita, luogoNascita, p
+
+
@@ -3014,7 +3028,7 @@ FROM v_CheckVC19
-
+
@@ -3038,7 +3052,7 @@ FROM v_CheckVC19
-
+
@@ -3095,7 +3109,7 @@ FROM v_CheckVC19
-
+
@@ -3133,7 +3147,7 @@ FROM v_CheckVC19
-
+
@@ -3261,7 +3275,7 @@ FROM v_CheckVC19
-
+
@@ -3361,7 +3375,7 @@ FROM v_CheckVC19
-
+
@@ -3413,7 +3427,7 @@ FROM v_CheckVC19
-
+
@@ -3427,7 +3441,7 @@ FROM v_CheckVC19
-
+
@@ -3477,7 +3491,7 @@ FROM v_CheckVC19
-
+
@@ -3513,7 +3527,7 @@ FROM v_CheckVC19
-
+
@@ -3533,7 +3547,7 @@ FROM v_CheckVC19
-
+
@@ -3554,7 +3568,7 @@ FROM v_CheckVC19
-
+
@@ -3590,7 +3604,7 @@ FROM v_CheckVC19
-
+
@@ -3615,7 +3629,7 @@ FROM v_CheckVC19
-
+
@@ -3631,7 +3645,7 @@ FROM v_CheckVC19
-
+
@@ -3652,7 +3666,7 @@ FROM v_CheckVC19
-
+
@@ -3718,7 +3732,7 @@ FROM v_CheckVC19
-
+
@@ -3775,7 +3789,7 @@ FROM v_CheckVC19
-
+
@@ -3816,7 +3830,7 @@ FROM v_CheckVC19
-
+
@@ -3837,7 +3851,7 @@ FROM v_CheckVC19
-
+
@@ -3846,7 +3860,7 @@ FROM v_CheckVC19
-
+
@@ -3854,7 +3868,7 @@ FROM v_CheckVC19
-
+
@@ -3985,12 +3999,12 @@ FROM v_CheckVC19
-
-
-
-
-
-
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GPW_Data/DS_Applicazione.xss b/GPW_Data/DS_Applicazione.xss
index b5ae635..6302262 100644
--- a/GPW_Data/DS_Applicazione.xss
+++ b/GPW_Data/DS_Applicazione.xss
@@ -9,7 +9,7 @@
-
+
@@ -21,13 +21,13 @@
-
-
+
+
-
+
@@ -42,7 +42,7 @@
-
+
1046
@@ -90,7 +90,7 @@
324
- 859
+ 954
diff --git a/GPW_Data/DataProxy.cs b/GPW_Data/DataProxy.cs
index 2ccf6fa..ca49218 100644
--- a/GPW_Data/DataProxy.cs
+++ b/GPW_Data/DataProxy.cs
@@ -203,6 +203,35 @@ namespace GPW_data
return answ;
}
+ public string getCodImpiego(int idxDip)
+ {
+ string answ = "";
+ var rigaDip = getRowDip(idxDip);
+ if (rigaDip != null)
+ {
+ answ = $"{rigaDip.idxDipendente}|{rigaDip.Cognome}.{rigaDip.Nome}|{rigaDip.CF}|{rigaDip.dataAssunzione:yyyyMMdd}|{rigaDip.email}|{rigaDip.matricola}";
+ }
+ return answ;
+ }
+
+ #endregion Public Methods
+
+ #region Protected Methods
+
+ public DS_Applicazione.DipendentiRow getRowDip(int idxDip)
+ {
+ DS_Applicazione.DipendentiRow answ = null;
+ if (idxDip > 0)
+ {
+ var tabDip = DP.taDipendenti.getByIdx(idxDip);
+ if (tabDip != null && tabDip.Rows.Count == 1)
+ {
+ answ = tabDip[0];
+ }
+ }
+ return answ;
+ }
+
///
/// Verifica se il dip RICHIESTO sia attivo
///
@@ -321,6 +350,6 @@ namespace GPW_data
return fatto;
}
- #endregion Public Methods
+ #endregion Protected Methods
}
}
\ No newline at end of file
diff --git a/GPW_Data/ObjLicenze.cs b/GPW_Data/ObjLicenze.cs
new file mode 100644
index 0000000..47ba6d0
--- /dev/null
+++ b/GPW_Data/ObjLicenze.cs
@@ -0,0 +1,98 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace GPW_data
+{
+ public class LiManObj
+ {
+ #region Public Enums
+
+ public enum TipoLicenza
+ {
+ ND = 0,
+
+ ///
+ /// Licenza LEgacy Steamware
+ ///
+ GLS,
+
+ ///
+ /// Master Key License, che ha una data di scadenza globale ed un token = numero di utenti/token massimi associati
+ ///
+ MasterKey,
+
+ ///
+ /// UserKey License (licenza che consuma un token utente della licenza master) - es GPW
+ ///
+ UserKey,
+
+ ///
+ /// Chiave tiupo Checksum basata su licenza masster + checksum MD5 di una serie di dati (child licenses)
+ ///
+ CheckSumKey
+ }
+
+ #endregion Public Enums
+
+ #region Public Classes
+
+ public class ApplicativoDTO
+ {
+ #region Public Properties
+
+ public string Chiave { get; set; } = "";
+ public string CodApp { get; set; } = "";
+ public string CodInst { get; set; } = "";
+ public DateTime DataEnigma { get; set; } = DateTime.Today.AddYears(-1);
+ public string Descrizione { get; set; } = "";
+ public string Enigma { get; set; } = "";
+ public int IdxLic { get; set; } = 0;
+
+ public bool IsActive
+ {
+ get => (Scadenza.Subtract(DateTime.Today).TotalDays > 0);
+ }
+
+ public bool Locked { get; set; } = false;
+ public int NumLicenze { get; set; } = 0;
+ public int NumLicenzeAttive { get; set; } = 0;
+ public string Payload { get; set; } = "";
+ public DateTime Scadenza { get; set; } = DateTime.Today.AddYears(-1);
+ public TipoLicenza Tipo { get; set; } = TipoLicenza.ND;
+
+ #endregion Public Properties
+ }
+
+ public class AttivazioneDTO
+ {
+ #region Public Properties
+
+ public string Chiave { get; set; } = "";
+ public string CodApp { get; set; } = "";
+ public string CodImpiego { get; set; } = "";
+ public string CodInst { get; set; } = "";
+ public string Descrizione { get; set; } = "";
+ public int IdxLic { get; set; } = 0;
+ public int IdxSubLic { get; set; } = 0;
+ public TipoLicenza Tipo { get; set; } = TipoLicenza.UserKey;
+ public DateTime VetoUnlock { get; set; } = DateTime.Today.AddMonths(2);
+
+ #endregion Public Properties
+ }
+
+ public class UserLicenseRequest
+ {
+ #region Public Properties
+
+ public string MasterKey { get; set; } = "";
+ public Dictionary ParamDict { get; set; } = new Dictionary();
+
+ #endregion Public Properties
+ }
+
+ #endregion Public Classes
+ }
+}
\ No newline at end of file
diff --git a/GPW_Data/licenzeGPW.cs b/GPW_Data/licenzeGPW.cs
index 674b912..6c083ac 100644
--- a/GPW_Data/licenzeGPW.cs
+++ b/GPW_Data/licenzeGPW.cs
@@ -1,10 +1,38 @@
using SteamWare;
using System;
+using RestSharp;
+using RestSharp.Authenticators;
+using System.Threading.Tasks;
+using Newtonsoft.Json;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using static GPW_data.LiManObj;
namespace GPW_data
{
public class licenzeGPW
{
+ #region Protected Fields
+
+ ///
+ /// Urla di abse chiamate API gestione licenze
+ /// protected static string apiUrl = "https://localhost:44351/";
+ ///
+ protected static string apiUrl = "https://iis01.egalware.com/ELM.API/";
+
+ ///
+ /// Durata cache statica locale dati licenza
+ /// protected static int LicCacheTTL = 60 * 60 * 24 * 7;
+ ///
+ protected static int LicCacheTTL = 120;
+
+ protected static string rkeyActInfo = memLayer.ML.redHash($"LiMan:ActInfo");
+ protected static string rkeyAppInfo = memLayer.ML.redHash($"LiMan:AppInfo");
+ protected static string rkeyLicInfo = memLayer.ML.redHash($"LiMan:LicInfo");
+
+ #endregion Protected Fields
+
#region Public Properties
///
@@ -19,6 +47,17 @@ namespace GPW_data
}
}
+ ///
+ /// numero di licenze attive da info online
+ ///
+ public static int attivazioniOnline
+ {
+ get
+ {
+ return InfoApplicativo.NumLicenzeAttive;
+ }
+ }
+
///
/// chaive licenza
///
@@ -86,6 +125,38 @@ namespace GPW_data
}
}
+ ///
+ /// Info applicativo corrente (da cache con eventuale recupero online...)
+ ///
+ public static LiManObj.ApplicativoDTO InfoApplicativo
+ {
+ get
+ {
+ LiManObj.ApplicativoDTO answ = new LiManObj.ApplicativoDTO();
+ // cerco da cache
+ string rawData = memLayer.ML.getRSV(rkeyAppInfo);
+ // se no ci fosse --> refresh online!
+ if (string.IsNullOrEmpty(rawData))
+ {
+ var fatto = RefreshAppInfo().Result;
+ if (fatto)
+ {
+ rawData = memLayer.ML.getRSV(rkeyAppInfo);
+ }
+ }
+ if (!string.IsNullOrEmpty(rawData))
+ {
+ // POTREBBE darmi + di 1 risultato, prendo + recente...
+ List infoList = JsonConvert.DeserializeObject>(rawData);
+ if (infoList != null)
+ {
+ answ = infoList.OrderByDescending(x => x.Scadenza).FirstOrDefault();
+ }
+ }
+ return answ;
+ }
+ }
+
///
/// nome installazione sw
///
@@ -147,6 +218,64 @@ namespace GPW_data
}
}
+ ///
+ /// numero di licenze disponibili da info online
+ ///
+ public static int licenzeOnline
+ {
+ get
+ {
+ return InfoApplicativo.NumLicenze;
+ }
+ }
+
+ ///
+ /// Elenco attivazioni attuali
+ ///
+ public static List ListaAttivazioni
+ {
+ get
+ {
+ List answ = new List();
+ // cerco da cache
+ string rawData = memLayer.ML.getRSV(rkeyActInfo);
+ // se no ci fosse --> refresh online!
+ if (string.IsNullOrEmpty(rawData))
+ {
+ var fatto = RefreshActInfo().Result;
+ if (fatto)
+ {
+ rawData = memLayer.ML.getRSV(rkeyActInfo);
+ }
+ }
+ if (!string.IsNullOrEmpty(rawData))
+ {
+ answ = JsonConvert.DeserializeObject>(rawData);
+ }
+ return answ;
+ }
+ }
+
+ ///
+ /// Chaive Licenza Master
+ ///
+ public static string MasterKey
+ {
+ get
+ {
+ string answ = "";
+ try
+ {
+ answ = DataProxy.DP.taAKV.getByKey(installazione)[0].valString;
+ }
+ catch (Exception exc)
+ {
+ logger.lg.scriviLog(string.Format("Errore recupero chiave MasterKey da AKV: {0}", exc), tipoLog.EXCEPTION);
+ }
+ return answ;
+ }
+ }
+
///
/// modalità applicazione (pagina test.aspx)
///
@@ -192,5 +321,191 @@ namespace GPW_data
}
#endregion Public Properties
+
+ #region Public Methods
+
+ ///
+ /// Verifica attivazione licenza dato codice impiego
+ ///
+ ///
+ ///
+ public static async Task checkActivation(string CodImpiego)
+ {
+ bool answ = false;
+ // cerco online
+ RestClient client = new RestClient(apiUrl);
+ //client.Authenticator = new HttpBasicAuthenticator("username", "password");
+ string MKeyEnc = HttpUtility.UrlEncode(MasterKey);
+ var request = new RestRequest($"/api/attivazioni/verifica?chiave={MKeyEnc}&CodImpiego={CodImpiego}", DataFormat.Json);
+ var response = client.Get(request);
+ // controllo risposta
+ if (response.StatusCode == System.Net.HttpStatusCode.OK)
+ {
+ // verifico risposta
+ string rawData = response.Content;
+ try
+ {
+ // deserializzo
+ AttivazioneDTO datiAttivazione = JsonConvert.DeserializeObject(rawData);
+ answ = datiAttivazione != null && datiAttivazione.CodImpiego == CodImpiego;
+ }
+ catch
+ { }
+ }
+ return await Task.FromResult(answ);
+ }
+
+ ///
+ /// Verifica attivazione licenza dato codice impiego
+ ///
+ ///
+ ///
+ public static async Task checkActivationUnlocked(string CodImpiego)
+ {
+ bool answ = false;
+ // cerco online
+ RestClient client = new RestClient(apiUrl);
+ //client.Authenticator = new HttpBasicAuthenticator("username", "password");
+ string MKeyEnc = HttpUtility.UrlEncode(MasterKey);
+ var request = new RestRequest($"/api/attivazioni/verifica?chiave={MKeyEnc}&CodImpiego={CodImpiego}", DataFormat.Json);
+ var response = client.Get(request);
+ // controllo risposta
+ if (response.StatusCode == System.Net.HttpStatusCode.OK)
+ {
+ // verifico risposta
+ string rawData = response.Content;
+ try
+ {
+ // deserializzo
+ AttivazioneDTO datiAttivazione = JsonConvert.DeserializeObject(rawData);
+ if (datiAttivazione != null)
+ {
+ // verifico se il veto sia scaduto
+ answ = datiAttivazione.VetoUnlock < DateTime.Today;
+ }
+ }
+ catch
+ { }
+ }
+ return await Task.FromResult(answ);
+ }
+
+ ///
+ /// Effettua refresh ActivationInfo con chiamata remota (sovrascrivendo info locali Redis)
+ ///
+ ///
+ public static async Task RefreshActInfo()
+ {
+ bool answ = false;
+
+ // cerco online
+ RestClient client = new RestClient(apiUrl);
+ //client.Authenticator = new HttpBasicAuthenticator("username", "password");
+ string MKeyEnc = HttpUtility.UrlEncode(MasterKey);
+ var request = new RestRequest($"/api/attivazioni/?chiave={MKeyEnc}", DataFormat.Json);
+ var response = client.Get(request);
+ // controllo risposta
+ if (response.StatusCode == System.Net.HttpStatusCode.OK)
+ {
+ answ = true;
+ // salvo in redis contenuto serializzato
+ string rawData = response.Content;
+ // salvo in redis per 7 gg
+ memLayer.ML.setRSV(rkeyActInfo, rawData, LicCacheTTL);
+ }
+ return await Task.FromResult(answ);
+ }
+
+ ///
+ /// Effettua refresh AppInfo con chiamata remota (sovrascrivendo info locali Redis)
+ ///
+ ///
+ public static async Task RefreshAppInfo()
+ {
+ bool answ = false;
+
+ // cerco online
+ RestClient client = new RestClient(apiUrl);
+ //client.Authenticator = new HttpBasicAuthenticator("username", "password");
+ var request = new RestRequest($"/api/applicazione/{installazione}?CodApp={applicazione}", DataFormat.Json);
+ var response = client.Get(request);
+ // controllo risposta
+ if (response.StatusCode == System.Net.HttpStatusCode.OK)
+ {
+ answ = true;
+ // salvo in redis contenuto serializzato
+ string rawData = response.Content;
+ // salvo in redis per 7 gg
+ memLayer.ML.setRSV(rkeyAppInfo, rawData, LicCacheTTL);
+ }
+ return await Task.FromResult(answ);
+ }
+
+ ///
+ /// Effettua refresh LicenseInfo con chiamata remota (sovrascrivendo info locali Redis)
+ ///
+ ///
+ public static async Task RefreshLicInfo()
+ {
+ bool answ = false;
+
+ // cerco online
+ RestClient client = new RestClient(apiUrl);
+ //client.Authenticator = new HttpBasicAuthenticator("username", "password");
+ string MKeyEnc = HttpUtility.UrlEncode(MasterKey);
+ var request = new RestRequest($"/api/licenza/{installazione}?CodApp={applicazione}&Chiave={MKeyEnc}", DataFormat.Json);
+ var response = client.Get(request);
+ // controllo risposta
+ if (response.StatusCode == System.Net.HttpStatusCode.OK)
+ {
+ answ = true;
+ // salvo in redis contenuto serializzato
+ string rawData = response.Content;
+ // salvo in redis per 7 gg
+ memLayer.ML.setRSV(rkeyLicInfo, rawData, LicCacheTTL);
+ }
+ return await Task.FromResult(answ);
+ }
+
+ ///
+ /// Tenta attivazione licenza dato codice impiego
+ ///
+ ///
+ ///
+ public static async Task tryActivation(string CodImpiego)
+ {
+ bool answ = false;
+ // cerco online
+ RestClient client = new RestClient(apiUrl);
+ //client.Authenticator = new HttpBasicAuthenticator("username", "password");
+ string MKeyEnc = HttpUtility.UrlEncode(MasterKey);
+ var request = new RestRequest($"/api/attivazioni", DataFormat.Json);
+ Dictionary parDict = new Dictionary();
+ parDict.Add(CodImpiego, "NoData");
+ UserLicenseRequest newBody = new UserLicenseRequest()
+ {
+ MasterKey = MasterKey,
+ ParamDict = parDict
+ };
+ request.AddJsonBody(newBody);
+ var response = client.Post(request);
+ // controllo risposta
+ if (response.StatusCode == System.Net.HttpStatusCode.OK)
+ {
+ // verifico risposta
+ string rawData = response.Content;
+ try
+ {
+ // deserializzo
+ AttivazioneDTO datiAttivazione = JsonConvert.DeserializeObject(rawData);
+ answ = datiAttivazione != null;
+ }
+ catch
+ { }
+ }
+ return await Task.FromResult(answ);
+ }
+
+ #endregion Public Methods
}
}
\ No newline at end of file
diff --git a/GPW_Data/packages.config b/GPW_Data/packages.config
index 3b45909..856a37b 100644
--- a/GPW_Data/packages.config
+++ b/GPW_Data/packages.config
@@ -15,6 +15,7 @@
+
diff --git a/GPW_data/GPW_data.csproj b/GPW_data/GPW_data.csproj
index 8c355ff..448815d 100644
--- a/GPW_data/GPW_data.csproj
+++ b/GPW_data/GPW_data.csproj
@@ -85,6 +85,9 @@
..\packages\Pipelines.Sockets.Unofficial.2.2.0\lib\net461\Pipelines.Sockets.Unofficial.dll
True
+
+ ..\packages\RestSharp.106.13.0\lib\net452\RestSharp.dll
+
..\packages\SharpCompress.0.28.1\lib\netstandard2.0\SharpCompress.dll
@@ -207,6 +210,7 @@
+
True