71 lines
1.9 KiB
C#
71 lines
1.9 KiB
C#
using GPW.CORE.Data.DbModels;
|
|
using GPW.CORE6.Smart.Data;
|
|
using Microsoft.AspNetCore.Components;
|
|
|
|
namespace GPW.CORE6.Smart.Components
|
|
{
|
|
public partial class AdminTask
|
|
{
|
|
#region Public Properties
|
|
|
|
[Parameter]
|
|
public int IdxDipendente { get; set; } = 0;
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected override async Task OnParametersSetAsync()
|
|
{
|
|
if (IdxDipendente > 0)
|
|
{
|
|
await ReloadData();
|
|
await Task.Delay(1);
|
|
await InvokeAsync(StateHasChanged);
|
|
}
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Fields
|
|
|
|
private bool isApprAdmin = false;
|
|
|
|
private bool isAuthKeyAdmin = false;
|
|
|
|
#endregion Private Fields
|
|
|
|
#region Private Properties
|
|
|
|
[Inject]
|
|
private CoreSmartDataService CDService { get; set; } = null!;
|
|
|
|
private List<Dipendenti2RuoliModel>? listaRuoli { get; set; } = new List<Dipendenti2RuoliModel>();
|
|
|
|
#endregion Private Properties
|
|
|
|
#region Private Methods
|
|
|
|
private async Task ReloadData()
|
|
{
|
|
// verifico se il dip sia admin...
|
|
listaRuoli = await CDService.Dip2RuoliGetAll();
|
|
if (listaRuoli != null)
|
|
{
|
|
isAuthKeyAdmin = listaRuoli.FirstOrDefault(x => x.IdxDipendente == IdxDipendente && x.CodRuolo == "ResetAuthKey") != null;
|
|
isApprAdmin = listaRuoli.FirstOrDefault(x => x.IdxDipendente == IdxDipendente && x.CodRuolo == "AppMancTimb") != null;
|
|
}
|
|
}
|
|
|
|
#endregion Private Methods
|
|
|
|
//private async void MService_EA_DipUpdated()
|
|
//{
|
|
// //idxDipendente = MService.IdxDipendente;
|
|
// await Task.Delay(1);
|
|
// await ReloadData();
|
|
// await Task.Delay(1);
|
|
// await InvokeAsync(StateHasChanged);
|
|
//}
|
|
}
|
|
} |