Fix metodi gestione utente GPW x spostamento licenze
This commit is contained in:
@@ -42,9 +42,9 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<asp:LinkButton runat="server" ID="lbtActivate" CssClass="btn btn-block btn-success" Visible='<%# canActivate(Eval("attivo"), Eval("dataAssunzione"), Eval("dataCessazione")) %>' OnClick="lbtActivate_Click">Attiva licenza <i class="fa fa-link" aria-hidden="true"></i></asp:LinkButton>
|
||||
<asp:LinkButton runat="server" ID="lbtActivate" CssClass="btn btn-block btn-success" Visible='<%# canActivate(Eval("attivo"), Eval("dataAssunzione"), Eval("dataCessazione")) %>' OnClick="lbtActivate_Click">Attiva Utente <i class="fa fa-link" aria-hidden="true"></i></asp:LinkButton>
|
||||
<asp:LinkButton runat="server" ID="lbrRelease" CssClass="btn btn-block btn-danger" Visible='<%# canRemove(Eval("attivo"), Eval("dataAssunzione"), Eval("dataCessazione")) %>' OnClick="lbrRelease_Click">Rimuovi licenza <i class="fa fa-unlink" aria-hidden="true"></i></asp:LinkButton>
|
||||
<asp:LinkButton runat="server" ID="lbtReissue" CssClass="btn btn-block btn-info" Visible='<%# canReissue(Eval("attivo"), Eval("dataAssunzione"), Eval("dataCessazione")) %>' OnClick="lbtReissue_Click">Riassegna licenza <i class="fa fa-exclamation-triangle" aria-hidden="true"></i></asp:LinkButton>
|
||||
<asp:LinkButton runat="server" ID="lbtReissue" CssClass="btn btn-block btn-info" Visible='<%# canReissue(Eval("attivo"), Eval("dataAssunzione"), Eval("dataCessazione")) %>' OnClick="lbtReissue_Click">Assegna licenza <i class="fa fa-exclamation-triangle" aria-hidden="true"></i></asp:LinkButton>
|
||||
</div>
|
||||
</div>
|
||||
</ItemTemplate>
|
||||
|
||||
@@ -70,17 +70,33 @@ namespace GPW_Admin.WebUserControls
|
||||
protected void lbrRelease_Click(object sender, EventArgs e)
|
||||
{
|
||||
// riesegue controllo ed disattiva
|
||||
DataProxy.DP.taDipendenti.updateActive(false, idxDipSel);
|
||||
Dictionary<string, string> ParamList = new Dictionary<string, string>();
|
||||
ParamList.Add(CodImpiego, ChiaveUtente);
|
||||
bool fatto = licenzeGPW.tryDeactivation(ParamList).Result;
|
||||
if (fatto)
|
||||
{
|
||||
DataProxy.DP.taDipendenti.updateActive(false, idxDipSel);
|
||||
}
|
||||
frmView.DataBind();
|
||||
raiseReset();
|
||||
}
|
||||
|
||||
protected void lbtActivate_Click(object sender, EventArgs e)
|
||||
{
|
||||
// riesegue controllo ed attiva
|
||||
DataProxy.DP.taDipendenti.updateActive(true, idxDipSel);
|
||||
// verifica SE ci sono licenze disponibili
|
||||
if (licenzeGPW.licenzeOnline > licenzeGPW.attivazioniOnline)
|
||||
{
|
||||
// effettua riassegnazione
|
||||
bool fatto = licenzeGPW.tryActivation(CodImpiego, ChiaveUtente).Result;
|
||||
if (fatto)
|
||||
{
|
||||
// attiva utente
|
||||
DataProxy.DP.taDipendenti.updateActive(true, idxDipSel);
|
||||
}
|
||||
}
|
||||
|
||||
frmView.DataBind();
|
||||
raiseReset();
|
||||
raiseAddNew();
|
||||
}
|
||||
|
||||
protected void lbtReissue_Click(object sender, EventArgs e)
|
||||
@@ -90,13 +106,8 @@ namespace GPW_Admin.WebUserControls
|
||||
{
|
||||
// effettua riassegnazione
|
||||
bool fatto = licenzeGPW.tryActivation(CodImpiego, ChiaveUtente).Result;
|
||||
if (fatto)
|
||||
{
|
||||
bool step1 = licenzeGPW.RefreshAppInfo().Result;
|
||||
bool step2 = licenzeGPW.RefreshActInfo().Result;
|
||||
bool step3 = licenzeGPW.RefreshLicInfo().Result;
|
||||
raiseReset();
|
||||
}
|
||||
frmView.DataBind();
|
||||
raiseAddNew();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+14
-14
@@ -1,10 +1,10 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <generato automaticamente>
|
||||
// Codice generato da uno strumento.
|
||||
// <auto-generated>
|
||||
// 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.
|
||||
// </generato automaticamente>
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace GPW_Admin.WebUserControls
|
||||
@@ -15,29 +15,29 @@ namespace GPW_Admin.WebUserControls
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Controllo frmView.
|
||||
/// frmView control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 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.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.FormView frmView;
|
||||
|
||||
/// <summary>
|
||||
/// Controllo ods.
|
||||
/// ods control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 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.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.ObjectDataSource ods;
|
||||
|
||||
/// <summary>
|
||||
/// Controllo hfIdxDip.
|
||||
/// hfIdxDip control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 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.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.HiddenField hfIdxDip;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<div class="p-2">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="p-2">
|
||||
<span class="border border-info p-2" runat="server" id="divDB"><i class="fa fa-database" aria-hidden="true"></i> Licenze locali: disponibili <b><%: numLicenze %></b> / attivate <b><%: utentiAttivi %></b>
|
||||
<span class="border border-info p-2" runat="server" id="divDB"><i class="fa fa-database" aria-hidden="true"></i> Licenze locali: disponibili <b><%: numLicenze %></b> / utenti attivi <b><%: utentiAttivi %></b>
|
||||
</span>
|
||||
</div>
|
||||
<div class="p-2">
|
||||
|
||||
@@ -68,6 +68,12 @@ namespace GPW_Admin.WebUserControls
|
||||
bool refreshAct = licenzeGPW.RefreshActInfo().Result;
|
||||
}
|
||||
|
||||
private void fixVisibility()
|
||||
{
|
||||
lbtFixMissing.Visible = (numLicenzeOnline == numLicenze && attivazioniOnline != utentiAttivi);
|
||||
grView.PageSize = utils.pageSize;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Protected Methods
|
||||
@@ -213,12 +219,16 @@ namespace GPW_Admin.WebUserControls
|
||||
{
|
||||
raiseReset();
|
||||
}
|
||||
|
||||
// cmq faccio refresh
|
||||
fullRefresh();
|
||||
}
|
||||
}
|
||||
|
||||
protected void lbtRefresh_Click(object sender, EventArgs e)
|
||||
{
|
||||
fullRefresh();
|
||||
grView.DataBind();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -251,8 +261,7 @@ namespace GPW_Admin.WebUserControls
|
||||
{
|
||||
fullRefresh();
|
||||
}
|
||||
lbtFixMissing.Visible = (numLicenzeOnline == numLicenze && attivazioniOnline != utentiAttivi);
|
||||
grView.PageSize = utils.pageSize;
|
||||
fixVisibility();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -374,7 +383,8 @@ namespace GPW_Admin.WebUserControls
|
||||
|
||||
public void doUpdate()
|
||||
{
|
||||
grView.PageSize = utils.pageSize;
|
||||
fullRefresh();
|
||||
fixVisibility();
|
||||
grView.DataBind();
|
||||
}
|
||||
|
||||
|
||||
@@ -37,9 +37,16 @@ namespace GPW_Admin
|
||||
fixDisplay();
|
||||
}
|
||||
|
||||
private void Cmp_userLicense_eh_addNew(object sender, EventArgs e)
|
||||
{
|
||||
mod_adminDipendenti1.doUpdate();
|
||||
fixDisplay();
|
||||
}
|
||||
|
||||
private void Cmp_userLicense_eh_doReset(object sender, EventArgs e)
|
||||
{
|
||||
//IdxDipSel = 0;
|
||||
mod_adminDipendenti1.doUpdate();
|
||||
fixDisplay();
|
||||
}
|
||||
|
||||
@@ -92,6 +99,7 @@ namespace GPW_Admin
|
||||
mod_adminDipendenti1.eh_addNew += Mod_adminDipendenti1_eh_addNew;
|
||||
mod_adminDipendenti1.eh_doReset += Mod_adminDipendenti1_eh_doReset;
|
||||
cmp_userLicense.eh_doReset += Cmp_userLicense_eh_doReset;
|
||||
cmp_userLicense.eh_addNew += Cmp_userLicense_eh_addNew;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
+38
-3
@@ -16,10 +16,10 @@ namespace GPW_data
|
||||
#region Protected Fields
|
||||
|
||||
/// <summary>
|
||||
/// Urla di abse chiamate API gestione licenze
|
||||
/// protected static string apiUrl = "https://localhost:44351/";
|
||||
/// Url di base chiamate API gestione licenze
|
||||
/// </summary>
|
||||
protected static string apiUrl = "https://iis01.egalware.com/ELM.API/";
|
||||
//protected static string apiUrl = "https://iis01.egalware.com/ELM.API/";
|
||||
protected static string apiUrl = "https://localhost:44351/";
|
||||
|
||||
/// <summary>
|
||||
/// Durata cache statica locale dati licenza
|
||||
@@ -543,6 +543,41 @@ namespace GPW_data
|
||||
return await Task.FromResult(answ);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tenta disattivazione licenza dato codice impiego
|
||||
/// </summary>
|
||||
/// <param name="ParamsList">Dizionario codici da eliminare (CodImpiego/MasterKey)</param>
|
||||
/// <returns></returns>
|
||||
public static async Task<bool> tryDeactivation(Dictionary<string, string> ParamsList)
|
||||
{
|
||||
bool answ = false;
|
||||
// cerco attivazione...
|
||||
var refreshDone = RefreshActInfo().Result;
|
||||
if (refreshDone)
|
||||
{
|
||||
// cerco online
|
||||
RestClient client = new RestClient(apiUrl);
|
||||
//client.Authenticator = new HttpBasicAuthenticator("username", "password");
|
||||
var request = new RestRequest($"/api/attivazioni", DataFormat.Json);
|
||||
UserLicenseRequest newBody = new UserLicenseRequest()
|
||||
{
|
||||
MasterKey = MasterKey,
|
||||
ParamDict = ParamsList
|
||||
};
|
||||
request.AddJsonBody(newBody);
|
||||
var response = client.Delete(request);
|
||||
// controllo risposta
|
||||
if (response.StatusCode == System.Net.HttpStatusCode.OK)
|
||||
{
|
||||
// verifico risposta
|
||||
string rawData = response.Content;
|
||||
bool.TryParse(rawData, out answ);
|
||||
}
|
||||
}
|
||||
|
||||
return await Task.FromResult(answ);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user