130 lines
3.0 KiB
C#
130 lines
3.0 KiB
C#
using Microsoft.AspNetCore.Components;
|
|
using SHERPA.BBM.UI.Data;
|
|
|
|
namespace SHERPA.BBM.UI.Components
|
|
{
|
|
public partial class CustExtCard : IDisposable
|
|
{
|
|
#region Public Properties
|
|
|
|
[Parameter]
|
|
public EventCallback<bool> E_DataUpdated { get; set; }
|
|
|
|
[Parameter]
|
|
public bool ShowImport { get; set; } = false;
|
|
|
|
[Parameter]
|
|
public bool ShowOnlyMissing { get; set; } = false;
|
|
|
|
[Parameter]
|
|
public string Title { get; set; } = "Clienti";
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Public Methods
|
|
|
|
public void Dispose()
|
|
{
|
|
MServ.EA_SearchUpdated -= MServ_EA_SearchUpdated;
|
|
}
|
|
|
|
#endregion Public Methods
|
|
|
|
#region Protected Properties
|
|
|
|
[Inject]
|
|
protected BBM_EFService BBMService { get; set; } = null!;
|
|
|
|
[Inject]
|
|
protected MessageService MServ { get; set; } = null!;
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected async Task DoReload(bool forceReload)
|
|
{
|
|
await Task.Delay(1);
|
|
await E_DataUpdated.InvokeAsync(forceReload);
|
|
}
|
|
|
|
protected async Task ImportExtCust()
|
|
{
|
|
isLoading = true;
|
|
await Task.Delay(50);
|
|
await BBMService.CustDecodedImport();
|
|
await ReportUpdated(true);
|
|
}
|
|
|
|
protected override void OnInitialized()
|
|
{
|
|
MServ.EA_SearchUpdated += MServ_EA_SearchUpdated;
|
|
}
|
|
|
|
protected async Task ReportUpdated(bool forceReload)
|
|
{
|
|
await E_DataUpdated.InvokeAsync(forceReload);
|
|
}
|
|
|
|
protected void SetCount(int newNum)
|
|
{
|
|
totalCount = newNum;
|
|
isLoading = false;
|
|
}
|
|
|
|
protected void SetCurrPage(int newNum)
|
|
{
|
|
currPage = newNum;
|
|
}
|
|
|
|
protected void SetNumRec(int newNum)
|
|
{
|
|
numRecord = newNum;
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Fields
|
|
|
|
private bool isLoading = false;
|
|
|
|
private int totalCount = 0;
|
|
|
|
#endregion Private Fields
|
|
|
|
#region Private Properties
|
|
|
|
private int currPage
|
|
{
|
|
get => CurrPagInfo.CurrPage;
|
|
set => CurrPagInfo.CurrPage = value;
|
|
}
|
|
|
|
private PagInfo CurrPagInfo { get; set; } = new PagInfo() { NumRec = 5 };
|
|
|
|
private int numRecord
|
|
{
|
|
get => CurrPagInfo.NumRec;
|
|
set => CurrPagInfo.NumRec = value;
|
|
}
|
|
|
|
private string searchVal { get; set; } = "";
|
|
|
|
#endregion Private Properties
|
|
|
|
#region Private Methods
|
|
|
|
private async void MServ_EA_SearchUpdated()
|
|
{
|
|
int oldNum = numRecord;
|
|
numRecord = 1;
|
|
searchVal = MServ.SearchVal;
|
|
await Task.Delay(50);
|
|
currPage = 1;
|
|
numRecord = oldNum;
|
|
await InvokeAsync(StateHasChanged);
|
|
}
|
|
|
|
#endregion Private Methods
|
|
}
|
|
} |