Bozza gestione ticket da LiMan/GPW
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
@if (FullEdit)
|
||||
@if (CurrMode == EditMode.FullEdit)
|
||||
{
|
||||
<div class="row g-2">
|
||||
<div class="col-md-3">
|
||||
@@ -139,7 +139,106 @@
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
else if (CurrMode == EditMode.ResetRequest)
|
||||
{
|
||||
<div class="row g-2">
|
||||
<div class="col-8">
|
||||
<div class="row">
|
||||
<div class="col-4 pe-0">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@ReqReset.Richiedente">
|
||||
<label class="small"><i class="fa-solid fa-user"></i> Richiedente</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 px-0">
|
||||
<div class="form-floating">
|
||||
<input type="email" class="form-control" @bind="@ReqReset.Email">
|
||||
<label class="small"><i class="fa-regular fa-envelope"></i> Email</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 ps-0">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@ReqReset.Telefono">
|
||||
<label class="small"><i class="fa-solid fa-phone"></i> Telefono</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item d-flex justify-content-between" aria-current="true">
|
||||
<div class="px-1">Anagr:</div>
|
||||
<div class="px-1">@($"{CurrRecord.DataNascita:yyyy-MM-dd}") @CurrRecord.LuogoNascita (@CurrRecord.ProvNascita | @CurrRecord.NazNascita)</div>
|
||||
</li>
|
||||
<li class="list-group-item d-flex justify-content-between" aria-current="true">
|
||||
<div class="px-1">@CurrRecord.Cf</div>
|
||||
<div class="px-1">@CurrRecord.Email</div>
|
||||
</li>
|
||||
<li class="list-group-item d-flex justify-content-between" aria-current="true">
|
||||
<div class="px-1">
|
||||
@if (CurrRecord.DataCessazione <= DateTime.Today)
|
||||
{
|
||||
<span>Periodo:</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span>Assunzione:</span>
|
||||
}
|
||||
</div>
|
||||
<div class="px-1">
|
||||
<span>@($"{CurrRecord.DataAssunzione:yyyy-MM-dd}")</span>
|
||||
@if (CurrRecord.DataCessazione <= DateTime.Today)
|
||||
{
|
||||
<span>
|
||||
→ @($"{CurrRecord.DataCessazione:yyyy-MM-dd}")
|
||||
</span>
|
||||
}
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item d-flex justify-content-between" aria-current="true">
|
||||
<div class="px-1">Lock Licenza</div>
|
||||
<div class="px-1">
|
||||
<span class="text-danger">
|
||||
<i class="fa-solid fa-lock"></i> <b>@($"{UnlockDateLic:dddd dd MMMM yyyy}")</b>
|
||||
</span>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="row">
|
||||
@*
|
||||
<div class="col-12">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@ReqReset.Richiedente">
|
||||
<label class="small"><i class="fa-solid fa-user"></i> Richiedente</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 pe-0">
|
||||
<div class="form-floating">
|
||||
<input type="email" class="form-control" @bind="@ReqReset.Email">
|
||||
<label class="small"><i class="fa-regular fa-envelope"></i> Email</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 ps-0">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@ReqReset.Telefono">
|
||||
<label class="small"><i class="fa-solid fa-phone"></i> Telefono</label>
|
||||
</div>
|
||||
</div>
|
||||
*@
|
||||
<div class="col-12">
|
||||
<div class="form-floating">
|
||||
<textarea class="form-control" @bind="@ReqReset.Causale" style="min-height: 8rem;"></textarea>
|
||||
<label class="small"><i class="fa-regular fa-message"></i> Causale</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 text-center mt-2">
|
||||
<button class="btn btn-primary btn-lg my-1 w-100" @onclick="() => DoActivate()" title="Invio richiesta sblocco licenza">Invio Richiesta <i class="far fa-paper-plane"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else if (CurrMode == EditMode.KeyRegen)
|
||||
{
|
||||
<div class="row g-2">
|
||||
<div class="col-8">
|
||||
@@ -215,5 +314,8 @@ else
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="alert a fs-6">Modo controllo non definito</div>
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
using GPW.CORE.Data.DbModels;
|
||||
using GPW.CORE.Data.DTO;
|
||||
using GPW.CORE.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.EntityFrameworkCore.SqlServer.Query.Internal;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace GPW.CORE.ADM.Components.Compo
|
||||
{
|
||||
@@ -12,22 +15,22 @@ namespace GPW.CORE.ADM.Components.Compo
|
||||
public DipendentiModel? CurrRecord { get; set; } = null;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> EC_Activate { get; set; }
|
||||
public EventCallback<DipendentiModel> EC_Activate { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> EC_Reissue { get; set; }
|
||||
public EventCallback<DipendentiModel> EC_Reissue { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> EC_Release { get; set; }
|
||||
public EventCallback<DipendentiModel> EC_Release { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> EC_Resync { get; set; }
|
||||
public EventCallback<DipendentiModel> EC_Resync { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> EC_update { get; set; }
|
||||
public EventCallback<DipendentiModel> EC_update { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public bool FullEdit { get; set; } = false;
|
||||
public EditMode CurrMode { get; set; } = EditMode.None;
|
||||
|
||||
[Parameter]
|
||||
public List<DipendentiModel> ListDipendenti { get; set; } = null!;
|
||||
@@ -64,7 +67,7 @@ namespace GPW.CORE.ADM.Components.Compo
|
||||
NumDipAct = ListDipendenti.Where(x => x.Attivo ?? false).Count();
|
||||
if (CurrRecord != null)
|
||||
{
|
||||
// calcolo CodIMpiego
|
||||
// calcolo CodImpiego
|
||||
CodImpiego = LicServ.HashDip(CurrRecord);
|
||||
UnlockDateLic = LockExpiry();
|
||||
LockExpired = UnlockDateLic <= DateTime.Today.AddDays(1);
|
||||
@@ -119,6 +122,17 @@ namespace GPW.CORE.ADM.Components.Compo
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
/// <summary>
|
||||
/// Modalità Edit
|
||||
/// </summary>
|
||||
public enum EditMode
|
||||
{
|
||||
None = 0,
|
||||
KeyRegen,
|
||||
ResetRequest,
|
||||
FullEdit
|
||||
}
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
@@ -127,12 +141,12 @@ namespace GPW.CORE.ADM.Components.Compo
|
||||
/// <returns></returns>
|
||||
protected async Task DoActivate()
|
||||
{
|
||||
await EC_Activate.InvokeAsync(true);
|
||||
await EC_Activate.InvokeAsync(CurrRecord);
|
||||
}
|
||||
|
||||
protected async Task DoCancel()
|
||||
{
|
||||
await EC_update.InvokeAsync(true);
|
||||
await EC_update.InvokeAsync(CurrRecord);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -141,7 +155,7 @@ namespace GPW.CORE.ADM.Components.Compo
|
||||
/// <returns></returns>
|
||||
protected async Task DoReissue()
|
||||
{
|
||||
await EC_Reissue.InvokeAsync(true);
|
||||
await EC_Reissue.InvokeAsync(CurrRecord);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -150,16 +164,30 @@ namespace GPW.CORE.ADM.Components.Compo
|
||||
/// <returns></returns>
|
||||
protected async Task DoRelease()
|
||||
{
|
||||
await EC_Release.InvokeAsync(true);
|
||||
await EC_Release.InvokeAsync(CurrRecord);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Richiesta Rilascio Licenza
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected async Task DoReqUnlock()
|
||||
{
|
||||
// invio richiesta sblocco licenza prima della scadenza naturale lock
|
||||
|
||||
//await EC_Release.InvokeAsync(CurrRecord);
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Genera una nuova chiave utente + riassegna Licenza
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected async Task DoResync()
|
||||
{
|
||||
await EC_Resync.InvokeAsync(true);
|
||||
await EC_Resync.InvokeAsync(CurrRecord);
|
||||
}
|
||||
|
||||
protected async Task DoSave()
|
||||
@@ -167,6 +195,19 @@ namespace GPW.CORE.ADM.Components.Compo
|
||||
bool fatto = false;
|
||||
if (CurrRecord != null)
|
||||
{
|
||||
|
||||
DateTime adesso = DateTime.Now;
|
||||
|
||||
// chiama resync dati licenza (cod impiego / codAuth)
|
||||
bool fatto = LicServ.SendTicketReq(ReqReset.Richiedente.Trim(), ReqReset.Email.Trim(), ReqReset.Telefono.Trim(), ReqReset.Causale.Trim(), CodImpiego, idxSubLic);
|
||||
//chiudo
|
||||
licenzeGPW.resetTicketCache();
|
||||
|
||||
// reset richiesta
|
||||
ReqReset = new DatiReqResetDTO();
|
||||
// evento reset
|
||||
raiseReset();
|
||||
|
||||
#if false
|
||||
fatto = await GDataServ.AnagProjUpsert(CurrRecord);
|
||||
// se fatto ricalcolo...
|
||||
@@ -175,10 +216,13 @@ namespace GPW.CORE.ADM.Components.Compo
|
||||
await GDataServ.AnagProjForceUpdate();
|
||||
}
|
||||
#endif
|
||||
await EC_update.InvokeAsync(CurrRecord);
|
||||
}
|
||||
await EC_update.InvokeAsync(fatto);
|
||||
}
|
||||
|
||||
|
||||
private DatiReqResetDTO ReqReset = new DatiReqResetDTO();
|
||||
|
||||
#endregion Protected Methods
|
||||
}
|
||||
}
|
||||
@@ -5,18 +5,22 @@
|
||||
<div class="modal-content">
|
||||
<div class="modal-header d-flex justify-content-between">
|
||||
<div class="px-1 fs-4 modal-title">
|
||||
<b>@RecordEdit.Cognome</b> @RecordEdit.Nome
|
||||
@if(EnableFullEdit)
|
||||
<b>@RecordEdit.Cognome</b> @RecordEdit.Nome
|
||||
@if (CtrlMode == DipendentiEdit.EditMode.FullEdit)
|
||||
{
|
||||
<span>| Modifica Record @RecordEdit.IdxDipendente</span>
|
||||
}
|
||||
else if (CtrlMode == DipendentiEdit.EditMode.ResetRequest)
|
||||
{
|
||||
<span>| Sblocco Licenza</span>
|
||||
}
|
||||
</div>
|
||||
<div class="px-1">
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" @onclick=ForceReload></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-body p-1 small">
|
||||
<DipendentiEdit FullEdit="EnableFullEdit" CurrRecord="RecordEdit" EC_update="ForceReload" ListDipendenti="@ListDipendentiAttiviOrd" ListOrari="@ListOrari"></DipendentiEdit>
|
||||
<DipendentiEdit CurrMode="CtrlMode" CurrRecord="RecordEdit" EC_update="ForceReload" EC_Activate="DoActivate" ListDipendenti="@ListDipendentiAttiviOrd" ListOrari="@ListOrari"></DipendentiEdit>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -85,7 +89,14 @@
|
||||
<div class="px-2 mx-1 border border-2 border-info rounded rounded-3 align-content-center g-1"><i class="fa-solid fa-database"></i> Licenze Locali: disponibili <b>@NumLicDispLocal</b> / utenti attivi <b>@NumLicActLocal</b></div>
|
||||
<div class="px-2 mx-1 border border-2 border-success rounded rounded-3 align-content-center g-1"><i class="fa-solid fa-cloud"></i> Licenze Online: disponibili <b>@NumLicDispOnline</b> / utenti attivi <b>@NumLicActOnline</b></div>
|
||||
<button class="mx-1 btn btn-success" @onclick="DoRefresh"><i class="fa-solid fa-cloud-arrow-down g-1"></i> Refresh Status Online</button>
|
||||
<button class="mx-1 btn btn-primary" @onclick="DoFixMissing"><i class="fa-solid fa-cloud-arrow-up g-1"></i> Allocazione Licenze</button>
|
||||
@if (NeedAllocation)
|
||||
{
|
||||
<button class="mx-1 btn btn-primary" @onclick="DoFixMissing"><i class="fa-solid fa-cloud-arrow-up g-1"></i> Allocazione Licenze</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="mx-1 btn btn-secondary disabled" disabled><i class="fa-solid fa-cloud-arrow-up g-1"></i> Allocazione Licenze</button>
|
||||
}
|
||||
<button class="mx-1 btn btn-outline-secondary"><i class="fa-solid fa-ticket g-1"></i> Ticket Aperti <b>@NumTicket</b></button>
|
||||
<button class="mx-1 btn btn-warning g-1"><i class="fa-solid fa-key"></i> Rigenera AuthKey</button>
|
||||
</div>
|
||||
@@ -154,12 +165,21 @@
|
||||
{
|
||||
<tr class="@CheckSel(item)">
|
||||
<td class="text-nowrap">
|
||||
<button class="btn btn-info btn-sm" @onclick="() => DoSelect(item)"><i class="fa-solid fa-search"></i></button>
|
||||
<button class="btn btn-info btn-sm" @onclick="() => DoSelect(item)" title="Dettaglio Record"><i class="fa-solid fa-search"></i></button>
|
||||
@if (RecordEdit == null)
|
||||
{
|
||||
<button class="btn btn-primary btn-sm mx-1" @onclick="() => DoEdit(item)">
|
||||
<i class="fa-solid fa-edit"></i>
|
||||
</button>
|
||||
if (CheckFreeEdit(item.IdxDipendente))
|
||||
{
|
||||
<button class="btn btn-primary btn-sm mx-1" @onclick="() => DoEdit(item)" title="Modifica record">
|
||||
<i class="fa-solid fa-edit"></i>
|
||||
</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-warning btn-sm mx-1" @onclick="() => RequestReset(item)" title="Richiesta sblocco Licenza">
|
||||
<i class="fa-solid fa-question-circle"></i>
|
||||
</button>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -56,7 +56,12 @@ namespace GPW.CORE.ADM.Components.Compo
|
||||
|
||||
protected string modalSize
|
||||
{
|
||||
get => EnableFullEdit ? "modal-xl" : "modal-lg";
|
||||
get => CtrlMode == DipendentiEdit.EditMode.FullEdit ? "modal-xl" : "modal-lg";
|
||||
}
|
||||
|
||||
protected bool NeedAllocation
|
||||
{
|
||||
get => NumLicActOnline == NumLicActLocal && NumLicActOnline != NumLicActLocal;
|
||||
}
|
||||
|
||||
protected string TextQrLinkCore
|
||||
@@ -89,20 +94,64 @@ namespace GPW.CORE.ADM.Components.Compo
|
||||
|
||||
protected void DoEdit(DipendentiModel? selItem)
|
||||
{
|
||||
EnableFullEdit = true;
|
||||
CtrlMode = DipendentiEdit.EditMode.FullEdit;
|
||||
RecordEdit = selItem;
|
||||
}
|
||||
protected void RequestReset(DipendentiModel? selItem)
|
||||
{
|
||||
CtrlMode = DipendentiEdit.EditMode.ResetRequest;
|
||||
RecordEdit = selItem;
|
||||
}
|
||||
|
||||
protected async Task DoFixMissing()
|
||||
{
|
||||
// procedo SOLO SE il numero online/offline è differente in primis...
|
||||
if (NeedAllocation)
|
||||
{
|
||||
// ciclo tutti gli utenti attivi
|
||||
// verifico SE sia disponibile licenza...
|
||||
var activationsList = LicServ.ActivList;
|
||||
Dictionary<string, string> CodList = new Dictionary<string, string>();
|
||||
|
||||
// ciclo x ogni dip attivo...
|
||||
foreach (var item in ListDipendentiAttiviOrd)
|
||||
{
|
||||
// calcolo codImpiego
|
||||
string currCodImp = LicServ.HashDip(item);
|
||||
// cerco se abbia attivazione
|
||||
var currActiv = activationsList.Where(x => x.CodImpiego == currCodImp).FirstOrDefault();
|
||||
if (currActiv == null || currActiv.CodImpiego != currCodImp)
|
||||
{
|
||||
CodList.Add(currCodImp, item.AuthKey);
|
||||
}
|
||||
}
|
||||
// provo attivazione in blocco
|
||||
await LicServ.TryActivationMult(CodList);
|
||||
// cmq faccio refresh
|
||||
await FullRefresh();
|
||||
}
|
||||
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected async Task DoRefresh()
|
||||
{
|
||||
isLoading = true;
|
||||
await FullRefresh();
|
||||
await ReloadData();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
protected void DoSelect(DipendentiModel currRec)
|
||||
{
|
||||
EnableFullEdit = false;
|
||||
CtrlMode = DipendentiEdit.EditMode.KeyRegen;
|
||||
RecordEdit = currRec;
|
||||
}
|
||||
|
||||
protected async Task ForceReload()
|
||||
{
|
||||
currPage = 1;
|
||||
EnableFullEdit = false;
|
||||
CtrlMode = DipendentiEdit.EditMode.None;
|
||||
RecordEdit = null;
|
||||
await ReloadData();
|
||||
}
|
||||
@@ -115,65 +164,6 @@ namespace GPW.CORE.ADM.Components.Compo
|
||||
AppMServ.EA_SearchUpdated += AppMServ_EA_SearchUpdated;
|
||||
}
|
||||
|
||||
protected async Task DoRefresh()
|
||||
{
|
||||
await FullRefresh();
|
||||
await ReloadData();
|
||||
}
|
||||
protected async Task DoFixMissing()
|
||||
{
|
||||
// procedo SOLO SE il numero online/offline è differente in primis...
|
||||
#if false
|
||||
if (numLicenzeOnline == numLicenze && attivazioniOnline != utentiAttivi)
|
||||
{
|
||||
// ciclo tutti gli utenti attivi
|
||||
var localUserList = licenzeGPW.getDipAttivi();
|
||||
// verifico SE sia disponibile licenza...
|
||||
var activationsList = licenzeGPW.ListaAttivazioni;
|
||||
Dictionary<string, string> CodList = new Dictionary<string, string>();
|
||||
|
||||
// ciclo x ogni dip attivo...
|
||||
foreach (var item in localUserList)
|
||||
{
|
||||
// calcolo codImpiego
|
||||
string currCodImp = DataProxy.DP.hashCodImpiego(item);
|
||||
// cerco se abbia attivazione
|
||||
var currActiv = activationsList.Where(x => x.CodImpiego == currCodImp).FirstOrDefault();
|
||||
if (currActiv == null || currActiv.CodImpiego != currCodImp)
|
||||
{
|
||||
CodList.Add(currCodImp, item.authKey);
|
||||
}
|
||||
}
|
||||
// provo attivazione in blocco
|
||||
licenzeGPW.tryActivationMult(CodList).ConfigureAwait(false);
|
||||
|
||||
if (CodList.Count > 0)
|
||||
{
|
||||
raiseReset();
|
||||
}
|
||||
|
||||
// cmq faccio refresh
|
||||
await FullRefresh();
|
||||
}
|
||||
#endif
|
||||
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
private async Task FullRefresh()
|
||||
{
|
||||
LicServ.ResetLicenseData();
|
||||
// eseguo call di recupero da online
|
||||
bool refreshApp = await LicServ.RefreshApplic();
|
||||
bool refreshAct = await LicServ.RefreshLicense();
|
||||
// chiama update di TUTTE le authKey verso il server online
|
||||
foreach (var item in ListDipendentiAttiviOrd)
|
||||
{
|
||||
var CodImpiego = LicServ.HashDip(item);
|
||||
bool fatto = await LicServ.TryRefreshActivation(CodImpiego, item.AuthKey);
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task SetNumRec(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
@@ -203,7 +193,7 @@ namespace GPW.CORE.ADM.Components.Compo
|
||||
|
||||
private int currPage = 1;
|
||||
|
||||
private bool EnableFullEdit = false;
|
||||
private DipendentiEdit.EditMode CtrlMode = DipendentiEdit.EditMode.None;
|
||||
|
||||
private string gridKey = "DipendentiMan";
|
||||
|
||||
@@ -250,6 +240,69 @@ namespace GPW.CORE.ADM.Components.Compo
|
||||
ReloadData().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Verifica licenza (se sia libera x modifica o prima associazione)
|
||||
/// </summary>
|
||||
/// <param name="IdxDip"></param>
|
||||
/// <returns></returns>
|
||||
public bool CheckFreeEdit(int IdxDip)
|
||||
{
|
||||
bool answ = false;
|
||||
if (IdxDip > 0)
|
||||
{
|
||||
// cerco!
|
||||
var currUser = ListDipendentiAttiviOrd.Where(x => x.IdxDipendente == IdxDip).FirstOrDefault();
|
||||
if (currUser != null)
|
||||
{
|
||||
// verifico SE sia disponibile licenza...
|
||||
var activationsList = LicServ.ActivList;
|
||||
var currHash = LicServ.HashDip(currUser);
|
||||
var currAct = activationsList.Where(x => x.CodImpiego == currHash).FirstOrDefault();
|
||||
// se NON c'è licenza è ok (editabile)
|
||||
answ = (currAct == null);
|
||||
// ora verifico: se NON ha licenza OK, altrimenti deve essere scaduta...
|
||||
if (!answ)
|
||||
{
|
||||
answ = currAct.VetoUnlock <= DateTime.Today;
|
||||
}
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
private async Task DoActivate(DipendentiModel CurrRecord)
|
||||
{
|
||||
// verifica SE ci sono licenze disponibili
|
||||
if (NumLicDispOnline > NumLicActOnline)
|
||||
{
|
||||
// attiva utente
|
||||
GDataServ.DipUpdateActive(CurrRecord.IdxDipendente, true);
|
||||
|
||||
string CodImpiego = LicServ.HashDip(CurrRecord);
|
||||
|
||||
// effettua riassegnazione
|
||||
bool fatto = LicServ.TryActivation(CodImpiego, CurrRecord.AuthKey);
|
||||
}
|
||||
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
private async Task FullRefresh()
|
||||
{
|
||||
LicServ.ResetLicenseData();
|
||||
// eseguo call di recupero da online
|
||||
bool refreshApp = await LicServ.RefreshApplic();
|
||||
bool refreshAct = await LicServ.RefreshLicense();
|
||||
bool refreshPay = LicServ.RefreshPayload();
|
||||
// chiama update di TUTTE le authKey verso il server online
|
||||
foreach (var item in ListDipendentiAttiviOrd)
|
||||
{
|
||||
var CodImpiego = LicServ.HashDip(item);
|
||||
bool fatto = await LicServ.TryRefreshActivation(CodImpiego, item.AuthKey);
|
||||
}
|
||||
}
|
||||
|
||||
private void RefreshLicData()
|
||||
{
|
||||
if (LicServ.HasAppData)
|
||||
@@ -299,6 +352,9 @@ namespace GPW.CORE.ADM.Components.Compo
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sorting e paging tabella
|
||||
/// </summary>
|
||||
private void SortTable()
|
||||
{
|
||||
if (SearchRecords != null)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Version>4.1.2506.2419</Version>
|
||||
<Version>4.1.2506.2518</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -2031,6 +2031,37 @@ namespace GPW.CORE.Data.Controllers
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ricalcola Tag Mensili dato dipendente, periodo, tag
|
||||
/// </summary>
|
||||
/// <param name="idxDipendente">IdxDipendente</param>
|
||||
/// <param name="attivo">Stato attivo richiesto</param>
|
||||
/// <returns></returns>
|
||||
public bool DipUpdateActive(int idxDipendente, bool attivo)
|
||||
{
|
||||
// init dati necessari
|
||||
bool fatto = false;
|
||||
// cerco su DB recuperando set di dati....
|
||||
using (GPWContext dbCtx = new GPWContext(_configuration))
|
||||
{
|
||||
try
|
||||
{
|
||||
var pAttivo = new SqlParameter("@attivo", attivo);
|
||||
var pIdxDip = new SqlParameter("@Original_idxDipendente", idxDipendente);
|
||||
|
||||
var dbResult = dbCtx
|
||||
.Database
|
||||
.ExecuteSqlRaw("EXEC dbo.stp_AD_updateActive @attivo, @Original_idxDipendente", pAttivo, pIdxDip);
|
||||
fatto = dbResult > 0;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Errore in DipUpdateActive:{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Log.Info("Dispose di GPWController");
|
||||
@@ -2570,6 +2601,7 @@ namespace GPW.CORE.Data.Controllers
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ricalcola Tag Mensili dato dipendente, periodo, tag
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GPW.CORE.Data.DTO
|
||||
{
|
||||
public class DatiReqResetDTO
|
||||
{
|
||||
public string Richiedente { get; set; } = "";
|
||||
public string Email { get; set; } = "";
|
||||
public string Telefono { get; set; } = "";
|
||||
public string Causale { get; set; } = "";
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,28 @@ namespace GPW.CORE.Data
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Calcolo Hash data stringa input
|
||||
/// </summary>
|
||||
/// <param name="rawData"></param>
|
||||
/// <returns></returns>
|
||||
public static string CalcHash(string rawData)
|
||||
{
|
||||
string hash = "";
|
||||
// hashing!
|
||||
using (var md5 = MD5.Create())
|
||||
{
|
||||
byte[] InputBytes = Encoding.UTF8.GetBytes(rawData);
|
||||
var byteHash = md5.ComputeHash(InputBytes);
|
||||
hash = BitConverter.ToString(byteHash).Replace("-", "").ToLowerInvariant();
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private DipendentiModel? rigaDip = null;
|
||||
@@ -55,6 +77,8 @@ namespace GPW.CORE.Data
|
||||
}
|
||||
if (!string.IsNullOrEmpty(buffData))
|
||||
{
|
||||
hash = CalcHash(buffData);
|
||||
#if false
|
||||
// hashing!
|
||||
using (var md5 = MD5.Create())
|
||||
{
|
||||
@@ -62,6 +86,7 @@ namespace GPW.CORE.Data
|
||||
var byteHash = md5.ComputeHash(InputBytes);
|
||||
hash = BitConverter.ToString(byteHash).Replace("-", "").ToLowerInvariant();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace GPW.CORE.Data
|
||||
ND = 0,
|
||||
Lavoro = 1
|
||||
}
|
||||
|
||||
//public enum TestUser
|
||||
//{
|
||||
// LocatelliSamuele = 1,
|
||||
|
||||
@@ -48,6 +48,16 @@ namespace GPW.CORE.Data
|
||||
CheckSumKey
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tipologia di ticket
|
||||
/// </summary>
|
||||
public enum TipologiaTicket
|
||||
{
|
||||
ND = 0,
|
||||
Licenze,
|
||||
FileUpload
|
||||
}
|
||||
|
||||
#endregion Public Enums
|
||||
|
||||
#region Public Classes
|
||||
@@ -127,6 +137,7 @@ namespace GPW.CORE.Data
|
||||
|
||||
public string MasterKey { get; set; } = "";
|
||||
public string ReqBody { get; set; } = "";
|
||||
public TipologiaTicket Tipo { get; set; } = TipologiaTicket.ND;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
@@ -217,4 +228,4 @@ namespace GPW.CORE.Data
|
||||
|
||||
#endregion Public Classes
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -163,6 +163,7 @@ namespace GPW.CORE.Data.Services
|
||||
Log.Debug($"AnagClientiAll | {source} in: {ts.TotalMilliseconds} ms");
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupera l'elenco fasi (tutte)
|
||||
/// </summary>
|
||||
@@ -941,6 +942,7 @@ namespace GPW.CORE.Data.Services
|
||||
Log.Debug($"AnagProjAll | {source} in: {ts.TotalMilliseconds} ms");
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupera elenco record da idx cliente
|
||||
/// </summary>
|
||||
@@ -2008,6 +2010,20 @@ namespace GPW.CORE.Data.Services
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ricalcola Tag Mensili dato dipendente, periodo, tag
|
||||
/// </summary>
|
||||
/// <param name="idxDipendente">IdxDipendente</param>
|
||||
/// <param name="attivo">Stato attivo richiesto</param>
|
||||
/// <returns></returns>
|
||||
public bool DipUpdateActive(int idxDipendente, bool attivo)
|
||||
{
|
||||
bool answ = dbController.DipUpdateActive(idxDipendente, attivo);
|
||||
// svuoto cache
|
||||
ExecFlushRedisPattern((RedisValue)$"{rKeyDipendenti}:*");
|
||||
return answ;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Clear database controller
|
||||
|
||||
@@ -7,6 +7,7 @@ using RestSharp;
|
||||
using StackExchange.Redis;
|
||||
using System.Web;
|
||||
using static GPW.CORE.Data.LiManObj;
|
||||
using static System.Net.Mime.MediaTypeNames;
|
||||
|
||||
namespace GPW.CORE.Data.Services
|
||||
{
|
||||
@@ -215,56 +216,6 @@ namespace GPW.CORE.Data.Services
|
||||
string hash = cDV.HashDip;
|
||||
return hash;
|
||||
}
|
||||
/// <summary>
|
||||
/// Tenta refresh licenza dato codice impiego (aggiorna la authKey...)
|
||||
/// </summary>
|
||||
/// <param name="CodImpiego"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> TryRefreshActivation(string CodImpiego, string Chiave)
|
||||
{
|
||||
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/refreshKey");
|
||||
Dictionary<string, string> parDict = new Dictionary<string, string>();
|
||||
parDict.Add(CodImpiego, Chiave);
|
||||
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
|
||||
{
|
||||
if (rawData.StartsWith("["))
|
||||
{
|
||||
// deserializzo
|
||||
List<AttivazioneDTO> datiAttivazione = JsonConvert.DeserializeObject<List<AttivazioneDTO>>(rawData);
|
||||
answ = datiAttivazione != null;
|
||||
}
|
||||
else
|
||||
{
|
||||
// deserializzo singolo
|
||||
AttivazioneDTO datiAttivazione = JsonConvert.DeserializeObject<AttivazioneDTO>(rawData);
|
||||
answ = datiAttivazione != null;
|
||||
ResetLicenseData();
|
||||
await RefreshLicense();
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
Log.Info($"Richiesta TryRefreshActivation | CodImpiego: {CodImpiego}");
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Init della classe con variabili di base da Redis/DB
|
||||
@@ -295,7 +246,6 @@ namespace GPW.CORE.Data.Services
|
||||
fatto = await setAppLicData(AppLicense, numDays);
|
||||
}
|
||||
}
|
||||
await Task.Delay(1);
|
||||
return fatto;
|
||||
}
|
||||
|
||||
@@ -317,10 +267,45 @@ namespace GPW.CORE.Data.Services
|
||||
fatto = await setActivList(onlineAct, numDays);
|
||||
}
|
||||
}
|
||||
await Task.Delay(1);
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua refresh Payload su server (Remoto) e recupera info licenza in locale (sovrascrivendo info locali Redis)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool RefreshPayload()
|
||||
{
|
||||
bool answ = false;
|
||||
// svuoto payload calcolato
|
||||
ExecFlushRedisPattern((RedisValue)$"{rkeyPayload}:*");
|
||||
// cerco online
|
||||
RestClient client = new RestClient(apiUrl);
|
||||
string MKeyEnc = HttpUtility.UrlEncode(MasterKey);
|
||||
var request = new RestRequest($"/api/licenza/refreshPayload");
|
||||
string newEnigma = DataValidator.CalcHash($"{DateTime.Now:yyyyMMddHHmmss}");
|
||||
LicenseCoord newBody = new LicenseCoord()
|
||||
{
|
||||
MasterKey = MasterKey,
|
||||
CodInst = Installazione,
|
||||
CodApp = Applicazione,
|
||||
Enigma = newEnigma
|
||||
};
|
||||
request.AddJsonBody(newBody);
|
||||
var response = client.Post(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
|
||||
setRSV(rKeyLic, rawData, TimeSpan.FromDays(7));
|
||||
}
|
||||
Log.Info($"Richiesta RefreshPayload eseguita");
|
||||
return answ;
|
||||
}
|
||||
|
||||
public async Task<bool> resetActivList()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
@@ -346,6 +331,8 @@ namespace GPW.CORE.Data.Services
|
||||
{
|
||||
ExecFlushRedisPattern((RedisValue)$"{rKeyAttByLic}:*");
|
||||
ExecFlushRedisPattern((RedisValue)$"{rKeyLic}:*");
|
||||
ExecFlushRedisPattern((RedisValue)$"{rkeyPayload}:*");
|
||||
ExecFlushRedisPattern((RedisValue)$"{rkeyTickets}:*");
|
||||
}
|
||||
|
||||
public async Task<bool> setActivList(List<LiManObj.AttivazioneDTO> newActList, int numDays)
|
||||
@@ -353,7 +340,7 @@ namespace GPW.CORE.Data.Services
|
||||
bool fatto = false;
|
||||
string rKey = $"{rKeyAttByLic}:{MasterKey}";
|
||||
var rawData = JsonConvert.SerializeObject(newActList);
|
||||
await setRSV(rKey, rawData, numDays * 24);
|
||||
await setRSVAsync(rKey, rawData, numDays * 24);
|
||||
fatto = true;
|
||||
if (EA_InfoUpdated != null)
|
||||
{
|
||||
@@ -367,7 +354,7 @@ namespace GPW.CORE.Data.Services
|
||||
bool fatto = false;
|
||||
string cacheKey = $"{rKeyLic}:{MasterKey}";
|
||||
var rawData = JsonConvert.SerializeObject(newAppDto);
|
||||
await setRSV(cacheKey, rawData, numDays * 24);
|
||||
await setRSVAsync(cacheKey, rawData, numDays * 24);
|
||||
fatto = true;
|
||||
if (EA_InfoUpdated != null)
|
||||
{
|
||||
@@ -376,6 +363,254 @@ namespace GPW.CORE.Data.Services
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tenta attivazione licenza dato codice impiego
|
||||
/// </summary>
|
||||
/// <param name="CodImpiego"></param>
|
||||
/// <returns></returns>
|
||||
public bool TryActivation(string CodImpiego, string Chiave)
|
||||
{
|
||||
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");
|
||||
Dictionary<string, string> parDict = new Dictionary<string, string>();
|
||||
parDict.Add(CodImpiego, Chiave);
|
||||
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<AttivazioneDTO>(rawData);
|
||||
answ = datiAttivazione != null;
|
||||
ResetLicenseData();
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
Log.Info($"Richiesta tryActivation | CodImpiego: {CodImpiego}");
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tenta attivazione licenze dato dizionario codici impiego + chiavi
|
||||
/// </summary>
|
||||
/// <param name="ParamsList">Dizionario parametri attivazione di tipo (CodImpiego,Chiave)</param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> TryActivationMult(Dictionary<string, string> ParamsList)
|
||||
{
|
||||
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");
|
||||
UserLicenseRequest newBody = new UserLicenseRequest()
|
||||
{
|
||||
MasterKey = MasterKey,
|
||||
ParamDict = ParamsList
|
||||
};
|
||||
request.AddJsonBody(newBody);
|
||||
var response = client.Post(request);
|
||||
// controllo risposta
|
||||
if (response.StatusCode == System.Net.HttpStatusCode.OK)
|
||||
{
|
||||
// verifico risposta
|
||||
string rawData = $"{response.Content}";
|
||||
try
|
||||
{
|
||||
if (rawData.Contains("["))
|
||||
{
|
||||
// deserializzo
|
||||
List<AttivazioneDTO> datiAttivazione = JsonConvert.DeserializeObject<List<AttivazioneDTO>>(rawData);
|
||||
answ = datiAttivazione != null;
|
||||
}
|
||||
else
|
||||
{
|
||||
// deserializzo singolo
|
||||
AttivazioneDTO datiAttivazione = JsonConvert.DeserializeObject<AttivazioneDTO>(rawData);
|
||||
answ = datiAttivazione != null;
|
||||
ResetLicenseData();
|
||||
await RefreshLicense();
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
Log.Info($"Richiesta tryActivationMult | num params: {ParamsList.Count}");
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tenta refresh licenza dato codice impiego (aggiorna la authKey...)
|
||||
/// </summary>
|
||||
/// <param name="CodImpiego"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> TryRefreshActivation(string CodImpiego, string Chiave)
|
||||
{
|
||||
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/refreshKey");
|
||||
Dictionary<string, string> parDict = new Dictionary<string, string>();
|
||||
parDict.Add(CodImpiego, Chiave);
|
||||
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
|
||||
{
|
||||
if (rawData.Contains("["))
|
||||
{
|
||||
// deserializzo
|
||||
List<AttivazioneDTO> datiAttivazione = JsonConvert.DeserializeObject<List<AttivazioneDTO>>(rawData);
|
||||
answ = datiAttivazione != null;
|
||||
}
|
||||
else
|
||||
{
|
||||
// deserializzo singolo
|
||||
AttivazioneDTO datiAttivazione = JsonConvert.DeserializeObject<AttivazioneDTO>(rawData);
|
||||
answ = datiAttivazione != null;
|
||||
ResetLicenseData();
|
||||
await RefreshLicense();
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
Log.Info($"Richiesta TryRefreshActivation | CodImpiego: {CodImpiego}");
|
||||
return answ;
|
||||
}
|
||||
public void ResetTicketCache()
|
||||
{
|
||||
ExecFlushRedisPattern((RedisValue)$"{rkeyTickets}:*");
|
||||
// ricarico
|
||||
var newList = getTickets();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Recupera num ticket da sistema LiMan online
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task<List<TicketDTO>> getTickets()
|
||||
{
|
||||
List<TicketDTO> answ = new List<TicketDTO>();
|
||||
#if false
|
||||
// cerco in cache locale...
|
||||
string rawData = memLayer.ML.getRSV(rkeyTickets);
|
||||
if (!string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
answ = JsonConvert.DeserializeObject<List<TicketDTO>>(rawData);
|
||||
}
|
||||
// se vuoto rileggo
|
||||
if (answ.Count == 0)
|
||||
{
|
||||
// cerco online
|
||||
RestClient client = new RestClient(apiUrl);
|
||||
//client.Authenticator = new HttpBasicAuthenticator("username", "password");
|
||||
string MKeyEnc = HttpUtility.UrlEncode(MasterKey);
|
||||
var request = new RestRequest($"/api/ticket/{installazione}?CodApp={applicazione}&Chiave={MKeyEnc}");
|
||||
var response = client.Get(request);
|
||||
// controllo risposta
|
||||
if (response.StatusCode == System.Net.HttpStatusCode.OK)
|
||||
{
|
||||
// salvo in redis contenuto serializzato
|
||||
rawData = response.Content;
|
||||
// deserializzo
|
||||
answ = JsonConvert.DeserializeObject<List<TicketDTO>>(rawData);
|
||||
// salvo in redis per TTL std
|
||||
memLayer.ML.setRSV(rkeyTickets, rawData, 20);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tenta invio di un ticket x licenza indicata
|
||||
/// </summary>
|
||||
/// <param name="contName"></param>
|
||||
/// <param name="contEmail"></param>
|
||||
/// <param name="contPhone"></param>
|
||||
/// <param name="reqBody"></param>
|
||||
/// <param name="codImpiego"></param>
|
||||
/// <param name="idxSubLic"></param>
|
||||
/// <returns></returns>
|
||||
public bool SendTicketReq(string contName, string contEmail, string contPhone, string reqBody, string codImpiego, int idxSubLic)
|
||||
{
|
||||
bool answ = false;
|
||||
// cerco online
|
||||
RestClient client = new RestClient(apiUrl);
|
||||
string MKeyEnc = HttpUtility.UrlEncode(MasterKey);
|
||||
var request = new RestRequest($"/api/ticket/sendReq");
|
||||
|
||||
SupportRequest richiesta = new SupportRequest()
|
||||
{
|
||||
ContactName = contName,
|
||||
ContactEmail = contEmail,
|
||||
ContactPhone = contPhone,
|
||||
ReqBody = reqBody,
|
||||
CodInst = Installazione,
|
||||
CodApp = Applicazione,
|
||||
MasterKey = MasterKey,
|
||||
idxSubLic = idxSubLic,
|
||||
CodImp = codImpiego,
|
||||
Tipo = TipologiaTicket.Licenze
|
||||
};
|
||||
|
||||
request.AddJsonBody(richiesta);
|
||||
var response = client.Post(request);
|
||||
|
||||
// controllo risposta
|
||||
if (response.StatusCode == System.Net.HttpStatusCode.OK)
|
||||
{
|
||||
// verifico risposta
|
||||
string rawData = response.Content;
|
||||
try
|
||||
{
|
||||
if (rawData.StartsWith("["))
|
||||
{
|
||||
// deserializzo
|
||||
List<TicketDTO> tickets = JsonConvert.DeserializeObject<List<TicketDTO>>(rawData);
|
||||
answ = tickets != null;
|
||||
}
|
||||
else
|
||||
{
|
||||
// deserializzo singolo
|
||||
TicketDTO tickets = JsonConvert.DeserializeObject<TicketDTO>(rawData);
|
||||
answ = tickets != null;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
Log.Info($"Richiesta SendTicketReq inviata | idxSub: {idxSubLic}");
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
@@ -383,12 +618,22 @@ namespace GPW.CORE.Data.Services
|
||||
/// <summary>
|
||||
/// Chiave redis x attivazioni della licenza
|
||||
/// </summary>
|
||||
protected const string rKeyAttByLic = "LongCache:AttByLic";
|
||||
protected const string rKeyAttByLic = "GPW.CORE:LongCache:AttByLic";
|
||||
|
||||
/// <summary>
|
||||
/// Chiave redis x info licenza
|
||||
/// </summary>
|
||||
protected const string rKeyLic = "LongCache:LicData";
|
||||
protected const string rKeyLic = "GPW.CORE:LongCache:LicData";
|
||||
|
||||
/// <summary>
|
||||
/// Info payload
|
||||
/// </summary>
|
||||
protected const string rkeyPayload = "GPW.CORE:LongCache:Payload";
|
||||
|
||||
/// <summary>
|
||||
/// Info tickets
|
||||
/// </summary>
|
||||
protected const string rkeyTickets = "GPW.CORE:LongCache:Tickets";
|
||||
|
||||
protected Random rnd = new Random();
|
||||
|
||||
@@ -539,13 +784,41 @@ namespace GPW.CORE.Data.Services
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Salvataggio chiave in redis
|
||||
/// Salvataggio chiave in Redis
|
||||
/// </summary>
|
||||
/// <param name="rKey"></param>
|
||||
/// <param name="rVal"></param>
|
||||
/// <param name="TTL"></param>
|
||||
/// <returns></returns>
|
||||
protected bool setRSV(string rKey, string rVal, TimeSpan TTL)
|
||||
{
|
||||
bool fatto = false;
|
||||
fatto = redisDb.StringSet(rKey, rVal, TTL);
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Salvataggio chiave in Redis Async
|
||||
/// </summary>
|
||||
/// <param name="rKey"></param>
|
||||
/// <param name="rVal"></param>
|
||||
/// <param name="TTL"></param>
|
||||
/// <returns></returns>
|
||||
protected async Task<bool> setRSVAsync(string rKey, string rVal, TimeSpan TTL)
|
||||
{
|
||||
bool fatto = false;
|
||||
fatto = await redisDb.StringSetAsync(rKey, rVal, TTL);
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Salvataggio chiave in Redis Async
|
||||
/// </summary>
|
||||
/// <param name="rKey"></param>
|
||||
/// <param name="rVal"></param>
|
||||
/// <param name="cacheMult"></param>
|
||||
/// <returns></returns>
|
||||
protected async Task<bool> setRSV(string rKey, string rVal, int cacheMult)
|
||||
protected async Task<bool> setRSVAsync(string rKey, string rVal, int cacheMult)
|
||||
{
|
||||
bool fatto = false;
|
||||
fatto = await redisDb.StringSetAsync(rKey, rVal, getCache(cacheMult));
|
||||
@@ -553,15 +826,15 @@ namespace GPW.CORE.Data.Services
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Salvataggio chiave INT in redis
|
||||
/// Salvataggio chiave INT in Redis Async
|
||||
/// </summary>
|
||||
/// <param name="rKey"></param>
|
||||
/// <param name="rValInt"></param>
|
||||
/// <param name="cacheMult"></param>
|
||||
/// <returns></returns>
|
||||
protected async Task<bool> setRSV(string rKey, int rValInt, int cacheMult)
|
||||
protected async Task<bool> setRSVAsync(string rKey, int rValInt, int cacheMult)
|
||||
{
|
||||
return await setRSV(rKey, $"{rValInt}", cacheMult);
|
||||
return await setRSVAsync(rKey, $"{rValInt}", cacheMult);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>GPW - Gestione Presenze Web</i>
|
||||
<h4>Versione: 4.1.2506.2419</h4>
|
||||
<h4>Versione: 4.1.2506.2518</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
4.1.2506.2419
|
||||
4.1.2506.2518
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>4.1.2506.2419</version>
|
||||
<version>4.1.2506.2518</version>
|
||||
<url>http://nexus.steamware.net/repository/SWS/GPW/stable/GPW.UI.zip</url>
|
||||
<changelog>http://nexus.steamware.net/repository/SWS/GPW/stable/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
Reference in New Issue
Block a user