Files
gpw_next/GPW.CORE.WRKLOG.old/Components/ParetoRA.razor.cs
T

124 lines
2.7 KiB
C#

using GPW.CORE.Data.DbModels;
using Microsoft.AspNetCore.Components;
namespace GPW.CORE.WRKLOG.old.Components
{
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
protected List<ParetoRegAttModel>? ListRecords { 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
}
}