Files
mapo-core/MP.SPEC/Pages/ODL.razor.cs
T
zaccaria.majid 56c3ba4064 Fix loop ram
2022-10-18 15:56:14 +02:00

178 lines
4.2 KiB
C#

using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using MP.SPEC.Components;
using MP.SPEC.Data;
namespace MP.SPEC.Pages
{
public partial class ODL
{
#region Public Methods
/// <summary>
/// Inizializzazione con periodo e arrotondamento
/// </summary>
/// <param name="minRound"></param>
/// <returns></returns>
public static DateTime RoundDatetime(int minRound)
{
TimeSpan DayElapsed = DateTime.Now.Subtract(DateTime.Today);
int minDay = (int)Math.Ceiling((double)(DayElapsed.TotalMinutes / minRound)) * minRound;
DateTime endRounded = DateTime.Today.AddMinutes(minDay);
return endRounded;
}
#endregion Public Methods
#region Protected Fields
protected DataPager pagerODL;
#endregion Protected Fields
#region Protected Properties
protected bool isActive
{
get => currFilter.IsActive;
set => currFilter.IsActive = value;
}
[Inject]
protected IJSRuntime JSRuntime { get; set; } = null!;
[Inject]
protected MpDataService MDService { get; set; } = null!;
#if false
[Inject]
protected MessageService MsgService { get; set; } = null!;
#endif
protected DateTime selDtEnd
{
get => currFilter.DtEnd;
set
{
if (currFilter.DtEnd != value)
{
currFilter.DtEnd = value;
}
}
}
protected DateTime selDtStart
{
get => currFilter.DtStart;
set
{
if (currFilter.DtStart != value)
{
currFilter.DtStart = value;
}
}
}
#endregion Protected Properties
#region Protected Methods
protected void ForceReload(int newNum)
{
numRecord = newNum;
}
protected void ForceReloadPage(int newNum)
{
currPage = newNum;
}
protected override async Task OnInitializedAsync()
{
ListStati = await MDService.AnagStatiComm();
ListMacchine = await MDService.MacchineWithFlux();
#if false
// carico dati
await reloadData();
#endif
}
protected async Task pgResetReq(bool doReset)
{
if (doReset)
{
await pagerODL.resetCurrPage();
}
}
protected void setDtMax()
{
// copio il filtro
currFilter.DtEnd = RoundDatetime(5);
currFilter.DtStart = RoundDatetime(5).AddDays(-1);
}
protected void UpdateTotCount(int newTotCount)
{
#if false
totalCount = newTotCount;
#endif
}
#endregion Protected Methods
#region Private Fields
private List<MP.Data.DatabaseModels.ListValues>? ListStati;
private List<string>? ListMacchine;
#endregion Private Fields
#region Private Properties
private SelectOdlParams currFilter { get; set; } = new SelectOdlParams();
private int currPage
{
get => currFilter.CurrPage;
set => currFilter.CurrPage = value;
}
private bool isLoading { get; set; } = false;
private string leftStringCSS
{
get => isActive ? "text-secondary" : "text-dark fw-bold";
}
private int numRecord
{
get => currFilter.NumRec;
set => currFilter.NumRec = value;
}
private string rightStringCSS
{
get => isActive ? "text-dark fw-bold" : "text-secondary";
}
private string selStato
{
get => currFilter.CodStato;
set => currFilter.CodStato = value;
}
private string selMacchina
{
get => currFilter.IdxMacchina;
set => currFilter.IdxMacchina = value;
}
private int totalCount
{
get => currFilter.TotCount;
set => currFilter.TotCount = value;
}
#endregion Private Properties
}
}