155 lines
3.6 KiB
C#
155 lines
3.6 KiB
C#
using Microsoft.AspNetCore.Components;
|
|
using MP.MONO.Data.DbModels;
|
|
|
|
namespace MP.MONO.UI.Components
|
|
{
|
|
public partial class MaintTaskExecHist
|
|
{
|
|
#region Private Fields
|
|
|
|
private int _MaxRecord = 1000;
|
|
|
|
private List<PendingMaintModel>? ListRecords = null;
|
|
|
|
// FARE!!! filtro macchina
|
|
private int MachineId = 1;
|
|
|
|
private List<PendingMaintModel>? SearchRecords = null;
|
|
|
|
#endregion Private Fields
|
|
|
|
#region Public Properties
|
|
|
|
[Parameter]
|
|
public int currPMTaskId
|
|
{
|
|
get => _currPMTaskId;
|
|
set
|
|
{
|
|
if (_currPMTaskId != value)
|
|
{
|
|
_currPMTaskId = value;
|
|
var pUpd = Task.Run(async () => await ReloadData());
|
|
pUpd.Wait();
|
|
}
|
|
}
|
|
}
|
|
|
|
[Parameter]
|
|
public EventCallback<bool> reqClose { get; set; }
|
|
|
|
[Parameter]
|
|
public PrevMaintTaskModel currParentRec { get; set; } = null!;
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Private Properties
|
|
|
|
private int _currPage { get; set; } = 1;
|
|
|
|
private int _currPMTaskId { get; set; } = 0;
|
|
|
|
private int _numRecord { get; set; } = 10;
|
|
|
|
private int currPage
|
|
{
|
|
get => _currPage;
|
|
set
|
|
{
|
|
if (_currPage != value)
|
|
{
|
|
_currPage = value;
|
|
var pUpd = Task.Run(async () => await ReloadData());
|
|
pUpd.Wait();
|
|
}
|
|
}
|
|
}
|
|
|
|
private bool isLoading { get; set; } = false;
|
|
|
|
private int MaxRecord
|
|
{
|
|
get
|
|
{
|
|
return _MaxRecord;
|
|
}
|
|
set
|
|
{
|
|
if (_MaxRecord != value)
|
|
{
|
|
_MaxRecord = value;
|
|
var pUpd = Task.Run(async () => await ReloadData());
|
|
pUpd.Wait();
|
|
}
|
|
}
|
|
}
|
|
|
|
private int numRecord
|
|
{
|
|
get => _numRecord;
|
|
set
|
|
{
|
|
if (_numRecord != value)
|
|
{
|
|
_numRecord = value;
|
|
var pUpd = Task.Run(async () => await ReloadData());
|
|
pUpd.Wait();
|
|
}
|
|
}
|
|
}
|
|
|
|
private int totalCount
|
|
{
|
|
get
|
|
{
|
|
int answ = 0;
|
|
if (SearchRecords != null)
|
|
{
|
|
answ = SearchRecords.Count;
|
|
}
|
|
return answ;
|
|
}
|
|
}
|
|
|
|
#endregion Private Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
await ReloadData();
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Methods
|
|
|
|
private void CloseDet()
|
|
{
|
|
reqClose.InvokeAsync(true);
|
|
}
|
|
|
|
private void ForceReload(int newNum)
|
|
{
|
|
numRecord = newNum;
|
|
}
|
|
|
|
private void ForceReloadPage(int newNum)
|
|
{
|
|
currPage = newNum;
|
|
}
|
|
|
|
private async Task ReloadData()
|
|
{
|
|
isLoading = true;
|
|
ListRecords = null;
|
|
await Task.Delay(1);
|
|
SearchRecords = await MMDataService.SchedMaintTaskGetByPMTask(MachineId, currPMTaskId, 0, MaxRecord);
|
|
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
|
|
await Task.Delay(1);
|
|
isLoading = false;
|
|
}
|
|
|
|
#endregion Private Methods
|
|
}
|
|
} |