Ancora update riassegnazione icenze
This commit is contained in:
@@ -103,7 +103,14 @@ namespace GPW_Admin.WebUserControls
|
||||
// solo se già attivo
|
||||
if (isAttivo)
|
||||
{
|
||||
answ = !canRemove(attivo, dtAssunzione, dtCessazione);
|
||||
// refresh licenze
|
||||
licenzeGPW.RefreshActInfo().ConfigureAwait(false);
|
||||
// verifico se ci sia licenza locale..
|
||||
if (!licenzeGPW.checkActivation(CodImpiego).Result)
|
||||
{
|
||||
// verifica sia sbloccabile la licenza (online)
|
||||
answ = !licenzeGPW.checkActivationUnlocked(CodImpiego).Result;
|
||||
}
|
||||
}
|
||||
|
||||
return answ;
|
||||
@@ -131,7 +138,7 @@ namespace GPW_Admin.WebUserControls
|
||||
if (tabDip != null && tabDip.Rows.Count == 1)
|
||||
{
|
||||
// verifica sia sbloccabile la licenza (online)
|
||||
answ = licenzeGPW.checkActivation(CodImpiego).Result;
|
||||
answ = licenzeGPW.checkActivationUnlocked(CodImpiego).Result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -169,6 +176,9 @@ namespace GPW_Admin.WebUserControls
|
||||
bool fatto = licenzeGPW.tryActivation(CodImpiego).Result;
|
||||
if (fatto)
|
||||
{
|
||||
bool step1 = licenzeGPW.RefreshAppInfo().Result;
|
||||
bool step2 = licenzeGPW.RefreshActInfo().Result;
|
||||
bool step3 = licenzeGPW.RefreshLicInfo().Result;
|
||||
raiseReset();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -330,6 +330,37 @@ namespace GPW_data
|
||||
/// <param name="CodImpiego"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<bool> 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<AttivazioneDTO>(rawData);
|
||||
answ = datiAttivazione != null && datiAttivazione.CodImpiego == CodImpiego;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return await Task.FromResult(answ);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifica attivazione licenza dato codice impiego
|
||||
/// </summary>
|
||||
/// <param name="CodImpiego"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<bool> checkActivationUnlocked(string CodImpiego)
|
||||
{
|
||||
bool answ = false;
|
||||
// cerco online
|
||||
|
||||
Reference in New Issue
Block a user