69 lines
2.2 KiB
C#
69 lines
2.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.AspNetCore.Components;
|
|
using System.Net.Http;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Components.Authorization;
|
|
using Microsoft.AspNetCore.Components.Forms;
|
|
using Microsoft.AspNetCore.Components.Routing;
|
|
using Microsoft.AspNetCore.Components.Web;
|
|
using Microsoft.AspNetCore.Components.Web.Virtualization;
|
|
using Microsoft.JSInterop;
|
|
using GPW.CORE.Comp;
|
|
using GPW.CORE.Data.DbModels;
|
|
using GPW.CORE.Smart;
|
|
using GPW.CORE.Smart.Components;
|
|
using GPW.CORE.Smart.Shared;
|
|
using GPW.CORE.Smart.Data;
|
|
|
|
namespace GPW.CORE.Smart.Components
|
|
{
|
|
public partial class AdminTask
|
|
{
|
|
[Parameter]
|
|
public int IdxDipendente { get; set; } = 0;
|
|
|
|
protected override async Task OnParametersSetAsync()
|
|
{
|
|
if (IdxDipendente > 0)
|
|
{
|
|
await ReloadData();
|
|
await Task.Delay(1);
|
|
await InvokeAsync(StateHasChanged);
|
|
}
|
|
}
|
|
[Inject]
|
|
private CoreSmartDataService CDService { get; set; } = null!;
|
|
|
|
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;
|
|
}
|
|
}
|
|
|
|
private bool isAuthKeyAdmin = false;
|
|
private bool isApprAdmin = false;
|
|
|
|
private List<Dipendenti2RuoliModel>? listaRuoli { get; set; } = new List<Dipendenti2RuoliModel>();
|
|
|
|
#region Private Methods
|
|
|
|
//private async void MService_EA_DipUpdated()
|
|
//{
|
|
// //idxDipendente = MService.IdxDipendente;
|
|
// await Task.Delay(1);
|
|
// await ReloadData();
|
|
// await Task.Delay(1);
|
|
// await InvokeAsync(StateHasChanged);
|
|
//}
|
|
|
|
#endregion Private Methods
|
|
}
|
|
} |