50d65eebaa
- renaming classi gestione DbModels in - spostamento anagrafica flussi da auth a generale
137 lines
3.3 KiB
C#
137 lines
3.3 KiB
C#
using global::Microsoft.AspNetCore.Components;
|
|
using MP.Data.DbModels;
|
|
using MP.Data.Services;
|
|
using NLog;
|
|
|
|
namespace MP_TAB3.Pages
|
|
{
|
|
public partial class TCHistory : IDisposable
|
|
{
|
|
#region Public Methods
|
|
|
|
public void Dispose()
|
|
{
|
|
IdxMacc = "";
|
|
TotalCount = 0;
|
|
ListComplete = new List<ODLExpModel>();
|
|
//GC.Collect();
|
|
}
|
|
|
|
#endregion Public Methods
|
|
#region Protected Fields
|
|
|
|
protected string BaseAddr = "";
|
|
|
|
protected string CodArt = "";
|
|
|
|
protected string IdxMacc = "*";
|
|
|
|
protected bool isLoading = false;
|
|
|
|
protected int NumRecPage = 5;
|
|
|
|
protected int PageNum = 1;
|
|
|
|
protected int SearchMinChar = 3;
|
|
|
|
protected int TotalCount = 0;
|
|
|
|
#endregion Protected Fields
|
|
|
|
#region Protected Properties
|
|
|
|
[Inject]
|
|
protected IConfiguration config { get; set; } = null!;
|
|
|
|
[Inject]
|
|
protected OrderDataSrv CtrDataServ { get; set; } = null!;
|
|
|
|
protected List<ODLExpModel> ListComplete { get; set; } = new List<ODLExpModel>();
|
|
|
|
protected List<ODLExpModel> ListODL { get; set; } = new List<ODLExpModel>();
|
|
|
|
protected int MatrOpr
|
|
{
|
|
get => MServ.MatrOpr;
|
|
}
|
|
|
|
[Inject]
|
|
protected MessageService MServ { get; set; } = null!;
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
BaseAddr = config.GetValue<string>("ServerConf:BaseAddr") ?? (config.GetValue<string>("OptConf:BaseAddr") ?? "");
|
|
await ReloadData();
|
|
}
|
|
|
|
protected async Task ReloadData()
|
|
{
|
|
isLoading = true;
|
|
if (!string.IsNullOrEmpty(CodArt))
|
|
{
|
|
try
|
|
{
|
|
ListComplete = await CtrDataServ.ListODLFilt(CodArt, IdxMacc);
|
|
TotalCount = ListComplete.Count;
|
|
// esegue paginazione
|
|
UpdateTable();
|
|
}
|
|
catch (Exception exc)
|
|
{
|
|
Log.Error($"Error on dataload{Environment.NewLine}{exc}");
|
|
}
|
|
}
|
|
|
|
isLoading = false;
|
|
}
|
|
|
|
protected void SaveNumRec(int newNum)
|
|
{
|
|
NumRecPage = newNum;
|
|
UpdateTable();
|
|
}
|
|
|
|
protected void SavePage(int newNum)
|
|
{
|
|
PageNum = newNum;
|
|
UpdateTable();
|
|
}
|
|
|
|
protected async Task SelCodArt(string newCodArt)
|
|
{
|
|
CodArt = newCodArt;
|
|
await ReloadData();
|
|
}
|
|
|
|
protected async Task SelIdxMacc(string newIdxMacc)
|
|
{
|
|
IdxMacc = newIdxMacc;
|
|
await ReloadData();
|
|
}
|
|
|
|
protected void UpdateTable()
|
|
{
|
|
// esegue paginazione
|
|
if (TotalCount > NumRecPage)
|
|
{
|
|
ListODL = ListComplete.Skip((PageNum - 1) * NumRecPage).Take(NumRecPage).ToList();
|
|
}
|
|
else
|
|
{
|
|
ListODL = ListComplete;
|
|
}
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Fields
|
|
|
|
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
|
|
|
#endregion Private Fields
|
|
}
|
|
} |