50d65eebaa
- renaming classi gestione DbModels in - spostamento anagrafica flussi da auth a generale
114 lines
3.0 KiB
C#
114 lines
3.0 KiB
C#
using Microsoft.AspNetCore.Components;
|
|
using Microsoft.JSInterop;
|
|
using MP.Data.DbModels;
|
|
using MP.Data.Services;
|
|
using NLog;
|
|
|
|
namespace MP_TAB3.Components
|
|
{
|
|
public partial class ScrapKitMan
|
|
{
|
|
#region Public Properties
|
|
|
|
[Parameter]
|
|
public EventCallback<bool> E_Updated { get; set; }
|
|
|
|
[Parameter]
|
|
public RegistroScartiModel ParentKit { get; set; } = null!;
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Protected Properties
|
|
|
|
[Inject]
|
|
protected IJSRuntime JSRuntime { get; set; } = null!;
|
|
|
|
protected List<RegistroScartiKitModel> ListComplete { get; set; } = new List<RegistroScartiKitModel>();
|
|
|
|
protected List<RegistroScartiKitModel> ListPaged { get; set; } = new List<RegistroScartiKitModel>();
|
|
|
|
[Inject]
|
|
protected TabDataService TabDServ { get; set; } = null!;
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected async Task DeleteKitSplit()
|
|
{
|
|
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler eliminare il dettaglio del KIT scartato?"))
|
|
return;
|
|
|
|
if (ParentKit != null)
|
|
{
|
|
await TabDServ.RegScartiKitDelete(ParentKit);
|
|
await ReloadData();
|
|
await E_Updated.InvokeAsync(true);
|
|
}
|
|
}
|
|
|
|
protected override async Task OnParametersSetAsync()
|
|
{
|
|
await ReloadData();
|
|
}
|
|
|
|
protected void UpdateTable()
|
|
{
|
|
// esegue paginazione
|
|
if (TotalCount > NumRecPage)
|
|
{
|
|
ListPaged = ListComplete.Skip((PageNum - 1) * NumRecPage).Take(NumRecPage).ToList();
|
|
}
|
|
else
|
|
{
|
|
ListPaged = ListComplete;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Modifica qty del record
|
|
/// </summary>
|
|
/// <param name="currItem"></param>
|
|
/// <param name="delta"></param>
|
|
/// <returns></returns>
|
|
protected async Task modQty(RegistroScartiKitModel currItem, int delta)
|
|
{
|
|
currItem.Qta += delta;
|
|
await TabDServ.RegScartiKitUpdateQty(currItem);
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Fields
|
|
|
|
private static Logger Log = LogManager.GetCurrentClassLogger();
|
|
|
|
private bool isProcessing = false;
|
|
|
|
private int NumRecPage = 10;
|
|
|
|
private int PageNum = 1;
|
|
|
|
private int TotalCount = 0;
|
|
|
|
#endregion Private Fields
|
|
|
|
#region Private Methods
|
|
|
|
private async Task ReloadData()
|
|
{
|
|
isProcessing = true;
|
|
await Task.Delay(1);
|
|
if (ParentKit != null)
|
|
{
|
|
ListComplete = await TabDServ.RegScartiKitGetFilt(ParentKit);
|
|
TotalCount = ListComplete.Count;
|
|
// esegue paginazione
|
|
UpdateTable();
|
|
}
|
|
isProcessing = false;
|
|
await Task.Delay(1);
|
|
}
|
|
|
|
#endregion Private Methods
|
|
}
|
|
} |