Fix reload malattie altrui!

This commit is contained in:
Samuele Locatelli
2023-01-05 14:01:16 +01:00
parent 980dbfd45c
commit 544ff232a9
10 changed files with 196 additions and 215 deletions
+12 -9
View File
@@ -887,16 +887,19 @@ namespace GPW.CORE.Data.Controllers
public List<RegMalattieModel> RegMalattieGetByDip(int idxDipendente, int maxRecord)
{
List<RegMalattieModel> dbResult = new List<RegMalattieModel>();
using (GPWContext localDbCtx = new GPWContext(_configuration))
if (idxDipendente > 0)
{
DateTime oggi = DateTime.Today;
dbResult = localDbCtx
.DbSetRegMalattie
.Where(x => (idxDipendente == 0 || x.IdxDipendente == idxDipendente))
.Include(d => d.DipNav)
.OrderByDescending(x => x.DtInizio)
.Take(maxRecord)
.ToList();
using (GPWContext localDbCtx = new GPWContext(_configuration))
{
DateTime oggi = DateTime.Today;
dbResult = localDbCtx
.DbSetRegMalattie
.Where(x => x.IdxDipendente == idxDipendente)
.Include(d => d.DipNav)
.OrderByDescending(x => x.DtInizio)
.Take(maxRecord)
.ToList();
}
}
return dbResult;
}
@@ -31,9 +31,6 @@ namespace GPW.CORE.WRKLOG.Components
#region Protected Properties
[Inject]
protected MessageService AppMServ { get; set; } = null!;
[Inject]
protected GpwDataService DataService { get; set; } = null!;
@@ -46,7 +43,7 @@ namespace GPW.CORE.WRKLOG.Components
#region Protected Methods
protected override async Task OnInitializedAsync()
protected override async Task OnParametersSetAsync()
{
await ReloadData();
}
@@ -76,6 +73,8 @@ namespace GPW.CORE.WRKLOG.Components
ListRecords = null;
await Task.Delay(1);
ListRecords = await DataService.RegMalattieGetByDip(IdxDipendente, 10);
await Task.Delay(1);
await InvokeAsync(StateHasChanged);
}
#endregion Private Methods
+6 -48
View File
@@ -126,79 +126,37 @@ namespace GPW.CORE.WRKLOG.Components
protected string leftString
{
get => SelFilter.leftString;
set
{
if (SelFilter.leftString != value)
{
SelFilter.leftString = value;
reportChange();
}
}
set => SelFilter.leftString = value;
}
protected string leftStringCSS
{
get => SelFilter.leftStringCSS;
set
{
if (SelFilter.leftStringCSS != value)
{
SelFilter.leftStringCSS = value;
reportChange();
}
}
set => SelFilter.leftStringCSS = value;
}
protected string rightString
{
get => SelFilter.rightString;
set
{
if (SelFilter.rightString != value)
{
SelFilter.rightString = value;
reportChange();
}
}
set => SelFilter.rightString = value;
}
protected string rightStringCSS
{
get => SelFilter.rightStringCSS;
set
{
if (SelFilter.rightStringCSS != value)
{
SelFilter.rightStringCSS = value;
reportChange();
}
}
set => SelFilter.rightStringCSS = value;
}
protected string toolTip
{
get => SelFilter.toolTip;
set=> SelFilter.toolTip = value;
//{
// if (SelFilter.toolTip != value)
// {
// SelFilter.toolTip = value;
// reportChange();
// }
//}
set => SelFilter.toolTip = value;
}
protected string placardCss
{
get => SelFilter.placardCss;
set=> SelFilter.placardCss = value;
//{
// if (SelFilter.placardCss != value)
// {
// SelFilter.placardCss = value;
// reportChange();
// }
//}
set => SelFilter.placardCss = value;
}
#endregion Protected Properties
+1 -1
View File
@@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Version>3.0.2301.0510</Version>
<Version>3.0.2301.0514</Version>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
+5 -4
View File
@@ -38,12 +38,12 @@ namespace GPW.CORE.WRKLOG.Pages
await Task.Delay(1);
// aggiorno display...
await Task.Delay(1);
ReloadData();
await ReloadData();
}
protected override void OnInitialized()
protected override async Task OnParametersSetAsync()
{
ReloadData();
await ReloadData();
}
#endregion Protected Methods
@@ -62,8 +62,9 @@ namespace GPW.CORE.WRKLOG.Pages
#region Private Methods
private void ReloadData()
private async Task ReloadData()
{
await Task.Delay(1);
isLoading = true;
currRecord = new RegMalattieModel()
{
-146
View File
@@ -22,149 +22,3 @@
</div>
</AuthorizeView>
@code {
[Inject]
private NavigationManager NavManager { get; set; } = null!;
private string userName = "";
protected override async Task OnInitializedAsync()
{
//effettuo eventuale recupero dati dipendente
if (AppMServ.RigaDip == null)
{
await LoadUtente();
}
// verifica attivazione
await VerifyActiv();
}
protected async Task DoReloadUtente()
{
AppMServ.RigaDip = null;
await Task.Delay(250);
await LoadUtente();
// verifico attivazione dipendente...
await checkUserLicense();
}
protected async Task DoVerifyActiv()
{
AppMServ.PayloadOk = false;
await Task.Delay(250);
await VerifyActiv();
}
protected async Task LoadUtente()
{
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
var user = authState.User;
// verifico se ho utente loggato...
if (user.Identity != null && user.Identity.IsAuthenticated)
{
userName = $"{user.Identity.Name}";
// cerco su DB
var listaDip = await GDataServ.DipendentiGetAll();
DipendentiModel? rigaDip = listaDip
.Where(x => $"{x.Dominio}\\{x.Utente}".ToLower() == userName.ToLower())
.FirstOrDefault();
if (rigaDip != null)
{
// salvo riga info dipendente
AppMServ.RigaDip = rigaDip;
userName = $"{rigaDip.Cognome} {rigaDip.Nome}";
}
}
else
{
userName = "N.A.";
}
}
protected async Task VerifyActiv()
{
// preliminarmente verifica shared info
await checkSharedInfo();
// refresh attivazioni se necessario
await checkActivations();
// verifico e salvo dati attivazione dipendente...
await checkUserLicense();
}
/// <summary>
/// Verifica informazioni condivise applicazione
/// </summary>
/// <returns></returns>
protected async Task<bool> checkSharedInfo()
{
bool allOk = false;
if (!LicServ.ValidData)
{
// salvo cod app da Conf...
LicServ.Applicazione = GDataServ.CodApp;
// effettuo lettura dati preliminari da AKV (eventualmente in cache...)
List<AnagKeyValueModel>? rawAkvList = await GDataServ.AKVList();
if (rawAkvList != null)
{
LicServ.AKVList = rawAkvList;
allOk = LicServ.InitAkv();
}
}
await Task.Delay(1);
return allOk;
}
/// <summary>
/// Verifica informazioni condivise applicazione
/// </summary>
/// <returns></returns>
protected async Task<bool> checkActivations()
{
bool allOk = false;
if (LicServ.ValidData)
{
// se non fosse tutto ok
if (!LicServ.HasActivData)
{
// chiamo refresh licenze da remoto
allOk = await LicServ.RefreshLicense();
}
}
await Task.Delay(1);
return allOk;
}
/// <summary>
/// Verifica info specifiche utente
/// </summary>
/// <returns></returns>
protected async Task<bool> checkUserLicense()
{
bool answ = false;
// verifico utente attivo
answ = AppMServ.IsActive;
if (answ)
{
var rawActList = LicServ.ActivList;
// recupero hash utente
string hashImpiego = AppMServ.HashDip;
// confronto con elenco attivazioni dello shared service...
var foundRec = rawActList.Where(x => x.CodImpiego == hashImpiego);
answ = foundRec.Count() > 0;
// salvo status payloadOk
AppMServ.PayloadOk = answ;
}
await Task.Delay(1);
return answ;
}
protected string cssActive
{
get => AppMServ.IsActive ? "text-success" : "text-danger";
}
protected string cssLicOk
{
get => AppMServ.PayloadOk ? "text-success" : "text-danger";
}
}
@@ -0,0 +1,166 @@
using GPW.CORE.Data.DbModels;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Authorization;
namespace GPW.CORE.WRKLOG.Shared
{
public partial class LoginDisplay
{
#region Protected Properties
protected string cssActive { get => AppMServ.IsActive ? "text-success" : "text-danger"; }
protected string cssLicOk { get => AppMServ.PayloadOk ? "text-success" : "text-danger"; }
#endregion Protected Properties
#region Protected Methods
/// <summary>
/// Verifica informazioni condivise applicazione
/// </summary>
/// <returns></returns>
protected async Task<bool> checkActivations()
{
bool allOk = false;
if (LicServ.ValidData)
{
// se non fosse tutto ok
if (!LicServ.HasActivData)
{
// chiamo refresh licenze da remoto
allOk = await LicServ.RefreshLicense();
}
}
await Task.Delay(1);
return allOk;
}
/// <summary>
/// Verifica informazioni condivise applicazione
/// </summary>
/// <returns></returns>
protected async Task<bool> checkSharedInfo()
{
bool allOk = false;
if (!LicServ.ValidData)
{
// salvo cod app da Conf...
LicServ.Applicazione = GDataServ.CodApp;
// effettuo lettura dati preliminari da AKV (eventualmente in cache...)
List<AnagKeyValueModel>? rawAkvList = await GDataServ.AKVList();
if (rawAkvList != null)
{
LicServ.AKVList = rawAkvList;
allOk = LicServ.InitAkv();
}
}
await Task.Delay(1);
return allOk;
}
/// <summary>
/// Verifica info specifiche utente
/// </summary>
/// <returns></returns>
protected async Task<bool> checkUserLicense()
{
bool answ = false;
// verifico utente attivo
answ = AppMServ.IsActive;
if (answ)
{
var rawActList = LicServ.ActivList;
// recupero hash utente
string hashImpiego = AppMServ.HashDip;
// confronto con elenco attivazioni dello shared service...
var foundRec = rawActList.Where(x => x.CodImpiego == hashImpiego);
answ = foundRec.Count() > 0;
// salvo status payloadOk
AppMServ.PayloadOk = answ;
}
await Task.Delay(1);
return answ;
}
protected async Task DoReloadUtente()
{
AppMServ.RigaDip = null;
await Task.Delay(250);
await LoadUtente();
// verifico attivazione dipendente...
await checkUserLicense();
}
protected async Task DoVerifyActiv()
{
AppMServ.PayloadOk = false;
await Task.Delay(250);
await VerifyActiv();
}
protected async Task LoadUtente()
{
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
var user = authState.User;
// verifico se ho utente loggato...
if (user.Identity != null && user.Identity.IsAuthenticated)
{
userName = $"{user.Identity.Name}";
// cerco su DB
var listaDip = await GDataServ.DipendentiGetAll();
DipendentiModel? rigaDip = listaDip.Where(x => $"{x.Dominio}\\{x.Utente}".ToLower() == userName.ToLower()).FirstOrDefault();
if (rigaDip != null)
{
// salvo riga info dipendente
AppMServ.RigaDip = rigaDip;
userName = $"{rigaDip.Cognome} {rigaDip.Nome}";
}
}
else
{
userName = "N.A.";
}
}
protected override async Task OnInitializedAsync()
{
//effettuo eventuale recupero dati dipendente
if (AppMServ.RigaDip == null)
{
await LoadUtente();
}
// verifica attivazione
await VerifyActiv();
}
protected async Task VerifyActiv()
{
// preliminarmente verifica shared info
await checkSharedInfo();
// refresh attivazioni se necessario
await checkActivations();
// verifico e salvo dati attivazione dipendente...
await checkUserLicense();
}
#endregion Protected Methods
#region Private Fields
private string userName = "";
#endregion Private Fields
#region Private Properties
[Inject]
private NavigationManager NavManager { get; set; } = null!;
#endregion Private Properties
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>GPW - Gestione Presenze Web</i>
<h4>Versione: 3.0.2301.0510</h4>
<h4>Versione: 3.0.2301.0514</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
3.0.2301.0510
3.0.2301.0514
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>3.0.2301.0510</version>
<version>3.0.2301.0514</version>
<url>http://nexus.steamware.net/repository/SWS/GWMS/stable/0/GWMS.UI.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/GWMS/stable/0/ChangeLog.html</changelog>
<mandatory>false</mandatory>