Files
samuele b1afa82a91 Continuo spostamento servizi in Data:
- GpwDataSrvice
- MessageService
- ogni dipendenza (aggiunti using, in _import non basta...)
2024-09-07 11:40:28 +02:00

138 lines
3.1 KiB
C#

using GPW.CORE.Data.DbModels;
using GPW.CORE.Data.Services;
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
namespace GPW.CORE.WRKLOG.Components.Compo
{
public partial class ParetoRA : IDisposable
{
#region Public Properties
[Parameter]
public int idxFase
{
get
{
return idxFaseSel;
}
set
{
idxFaseSel = value;
}
}
[Parameter]
public EventCallback<int> ItemSelected { get; set; }
#endregion Public Properties
#region Public Methods
public void Dispose()
{
AppMServ.EA_SearchUpdated -= OnSearchUpdated;
}
#endregion Public Methods
#region Protected Properties
[Inject]
protected MessageService AppMServ { get; set; } = null!;
[Inject]
protected GpwDataService GDataServ { get; set; } = null!;
[Inject]
protected IJSRuntime JSRuntime { get; set; } = null!;
protected List<ParetoRegAttModel>? ListRecords { get; set; } = null;
[Inject]
protected NavigationManager NavManager { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
protected string cssRiga(int idxFase)
{
string answ = "";
if (idxFase == idxFaseSel)
{
answ = "bg-info text-light";
}
return answ;
}
protected override async Task OnInitializedAsync()
{
await ReloadData();
AppMServ.EA_SearchUpdated += OnSearchUpdated;
}
protected void OnSearchUpdated()
{
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
protected async Task ReloadData()
{
idxFaseSel = 0;
if (AppMServ.IdxDipendente > 0)
{
ListRecords = await GDataServ.ParetoRegAtt(AppMServ.IdxDipendente, ggPrec, maxSugg);
}
}
protected async Task SelectRecord(int idxFase)
{
idxFaseSel = idxFase;
await ItemSelected.InvokeAsync(idxFase);
}
#endregion Protected Methods
#region Private Fields
private int _ggPrec = 60;
private int _maxSugg = 10;
private int idxFaseSel = 0;
#endregion Private Fields
#region Private Properties
private int ggPrec
{
get
{
return _ggPrec;
}
set
{
_ggPrec = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
}
private int maxSugg
{
get
{
return _maxSugg;
}
set
{
_maxSugg = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
}
#endregion Private Properties
}
}