191 lines
4.7 KiB
C#
191 lines
4.7 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 Protected Properties
|
|
|
|
[Inject]
|
|
protected IJSRuntime JSRuntime { get; set; }
|
|
|
|
[Inject]
|
|
protected MpDataService MDService { get; set; }
|
|
|
|
[Inject]
|
|
protected MessageService MsgService { get; set; }
|
|
|
|
[Inject]
|
|
protected NavigationManager NavManager { get; set; }
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected void ForceReload(int newNum)
|
|
{
|
|
numRecord = newNum;
|
|
}
|
|
|
|
protected void ForceReloadPage(int newNum)
|
|
{
|
|
currPage = newNum;
|
|
}
|
|
|
|
protected async Task pgResetReq(bool doReset)
|
|
{
|
|
if (doReset)
|
|
{
|
|
await pagerODL.resetCurrPage();
|
|
}
|
|
}
|
|
|
|
|
|
private MP.Data.DatabaseModels.ODLModel? currRecordOdl = null;
|
|
private MP.Data.DatabaseModels.PODLModel? currRecordPOdl = null;
|
|
|
|
/// <summary>
|
|
/// Crea nuovo record e va in editing...
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
protected async Task addNew()
|
|
{
|
|
currRecordPOdl = new MP.Data.DatabaseModels.PODLModel()
|
|
{
|
|
CodArticolo = $"_NEW_{DateTime.Now:yyyyMMdd.HHmmss}"
|
|
};
|
|
await Task.Delay(1);
|
|
}
|
|
|
|
protected async Task cancel()
|
|
{
|
|
currRecordOdl = null;
|
|
currRecordPOdl = null;
|
|
await reloadData();
|
|
await Task.Delay(1);
|
|
}
|
|
|
|
protected DataPager pagerODL;
|
|
|
|
protected bool reqNew = false;
|
|
|
|
|
|
/// <summary>
|
|
/// Crea nuovo record e va in editing...
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
protected async Task reqNewPODL()
|
|
{
|
|
reqNew = !reqNew;
|
|
await Task.Delay(1);
|
|
}
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
// abilito ricerca...
|
|
MsgService.ShowSearch = true;
|
|
// resetto search
|
|
MsgService.SearchVal = "";
|
|
ListAziende = await MDService.ElencoAziende();
|
|
ListStati = await MDService.AnagStatiComm();
|
|
// carico dati
|
|
await reloadData();
|
|
}
|
|
|
|
private string currAzienda { get; set; } = "*";
|
|
|
|
private List<MP.Data.DatabaseModels.AnagGruppi>? ListAziende;
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Fields
|
|
|
|
private List<MP.Data.DatabaseModels.ListValues>? ListStati;
|
|
|
|
#endregion Private Fields
|
|
|
|
#region Private Properties
|
|
|
|
private int currPage
|
|
{
|
|
get => MsgService.currPage;
|
|
set => MsgService.currPage = value;
|
|
}
|
|
|
|
private bool isLoading { get; set; } = false;
|
|
|
|
private int numRecord
|
|
{
|
|
get => MsgService.numRecord;
|
|
set => MsgService.numRecord = value;
|
|
}
|
|
|
|
private string selStato { get; set; } = "*";
|
|
#if false
|
|
private string selStato
|
|
{
|
|
get => _selStato;
|
|
set
|
|
{
|
|
if (!_selStato.Equals(value))
|
|
{
|
|
_selStato = value;
|
|
addEnabled = selStato != "*";
|
|
////StateHasChanged();
|
|
//var pUpd = Task.Run(async () =>
|
|
//{
|
|
// //await reloadData();
|
|
// await Task.Delay(1);
|
|
// await InvokeAsync(() => StateHasChanged());
|
|
//});
|
|
//pUpd.Wait();
|
|
}
|
|
}
|
|
}
|
|
#endif
|
|
|
|
//private bool showODL { get; set; } = false;
|
|
|
|
private bool addEnabled = false;
|
|
|
|
//private string textToggle
|
|
//{
|
|
// get => showODL ? "In Corso" : "Programmati";
|
|
//}
|
|
|
|
private int totalCount
|
|
{
|
|
get => MsgService.totalCount;
|
|
set => MsgService.totalCount = value;
|
|
}
|
|
|
|
#endregion Private Properties
|
|
|
|
#region Private Methods
|
|
|
|
private async Task reloadData()
|
|
{
|
|
isLoading = true;
|
|
await Task.Delay(1);
|
|
isLoading = false;
|
|
}
|
|
|
|
//private async Task toggleCurrent()
|
|
//{
|
|
// //NavManager.NavigateTo("/PODL");
|
|
// showODL = !showODL;
|
|
// await Task.Delay(1);
|
|
//}
|
|
private async Task navToPODL()
|
|
{
|
|
NavManager.NavigateTo("/PODL");
|
|
//showODL = !showODL;
|
|
await Task.Delay(1);
|
|
}
|
|
|
|
#endregion Private Methods
|
|
}
|
|
} |