Files
mapo-core/MP.SPEC/Pages/FluxLogStatus.razor.cs
T
Samuele Locatelli 571ac2cea8 SPEC:
- inizio pagina gest fluxLog e pareto eventi
- ok visualizzazione ultimo mese
2023-10-20 18:54:28 +02:00

107 lines
2.6 KiB
C#

using global::Microsoft.AspNetCore.Components;
using MP.SPEC.Data;
using NLog;
using System;
using static EgwCoreLib.Utils.DtUtils;
namespace MP.SPEC.Pages
{
public partial class FluxLogStatus
{
#region Protected Fields
protected int numRecPage = 10;
protected int pageNum = 1;
protected int totalCount = 0;
#endregion Protected Fields
#region Protected Properties
protected Dictionary<string, string> ListMacchineAll { get; set; } = new Dictionary<string, string>();
[Inject]
protected MpDataService MDataServ { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
protected override async Task OnInitializedAsync()
{
await ReloadData();
}
protected async Task ReloadMacchine()
{
if (ListMacchineAll == null || ListMacchineAll.Count == 0)
{
var rawData = await MDataServ.MacchineGetFilt("*");
// trasformo!
if (rawData != null)
{
ListMacchineAll = rawData.ToDictionary(x => x.IdxMacchina, x => $"{x.IdxMacchina} | {x.Nome}");
}
}
}
protected void SaveNumRec(int newNum)
{
if (numRecPage >= newNum)
{
numRecPage = newNum;
}
}
protected void SavePage(int newNum)
{
if (pageNum >= newNum)
{
pageNum = newNum;
}
}
protected async Task SetPeriodo(Periodo newPeriodo)
{
if (!CurrPeriodo.Equals(newPeriodo))
{
CurrPeriodo = newPeriodo;
}
await Task.Delay(1);
}
protected async Task SetTotCount(int numRec)
{
totalCount = numRec;
await Task.Delay(1);
}
#endregion Protected Methods
#region Private Fields
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
#region Private Properties
private Periodo CurrPeriodo { get; set; } = new Periodo();
private string idxMaccSel { get; set; } = "";
#endregion Private Properties
#region Private Methods
private async Task ReloadData()
{
await ReloadMacchine();
DateTime dtEnd = DateTime.Today.AddDays(1);
DateTime dtStart = dtEnd.AddMonths(-1);
CurrPeriodo = new Periodo(dtStart, dtEnd);
}
#endregion Private Methods
}
}