Update x ricerca ODL

This commit is contained in:
Samuele Locatelli
2022-09-12 11:54:08 +02:00
parent 62359ac858
commit aec6271f5a
4 changed files with 47 additions and 17 deletions
+1 -1
View File
@@ -365,7 +365,7 @@ namespace MP.Data.Controllers
{
dbResult = dbCtx
.DbSetODL
.Where(x => ((inCorso && x.DataFine == null) || (!inCorso && x.DataFine != null)) && (x.KeyRichiesta.Contains(keyRichPart) || keyRichPart == "*") && (x.CodArticolo == codArt || codArt == "*"))
.Where(x => ((inCorso && x.DataFine == null) || (!inCorso && x.DataFine != null)) && (x.KeyRichiesta.Contains(keyRichPart) || keyRichPart == "*") && (x.CodArticolo.Contains(codArt) || codArt == "*"))
.AsNoTracking()
.OrderBy(x => x.IdxOdl)
.ToList();
+8 -1
View File
@@ -10,7 +10,8 @@
<div class="px-2">
<i class="fas fa-user-alt"></i> <b>@userName</b>
</div>
<div class="px-2 flex-grow-1">
<div class="px-2 flex-grow-1 text-end">
<span class="text-secondary">@TipoSearch</span>
</div>
<div class="px-2 text-end">
@if (ShowSearch)
@@ -29,6 +30,12 @@
private string userName = "";
private string TipoSearch
{
get => MService.TipoSearch;
set => MService.TipoSearch = value;
}
protected override async Task OnInitializedAsync()
{
MService.EA_ShowSearch += MService_EA_ShowSearch;
+23 -1
View File
@@ -63,6 +63,23 @@ namespace MP.SPEC.Components
protected override async Task OnInitializedAsync()
{
MessageService.EA_PageUpdated += MessageService_EA_PageUpdated;
MessageService.EA_SearchUpdated += OnSeachUpdated;
await reloadData();
}
protected async void OnSeachUpdated()
{
await InvokeAsync(() =>
{
currPage = 1;
Task task = UpdateData();
StateHasChanged();
});
}
protected async Task UpdateData()
{
currRecord = null;
await reloadData();
}
@@ -96,6 +113,11 @@ namespace MP.SPEC.Components
set => MessageService.numRecord = value;
}
private string SearchVal
{
get => string.IsNullOrEmpty(MessageService.SearchVal) ? "*" : MessageService.SearchVal;
}
private int totalCount
{
get => MessageService.totalCount;
@@ -114,7 +136,7 @@ namespace MP.SPEC.Components
private async Task reloadData()
{
isLoading = true;
SearchRecords = await MDService.ListODLFilt(true, "*", StatoSel);
SearchRecords = await MDService.ListODLFilt(true, SearchVal, StatoSel);
totalCount = SearchRecords.Count;
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
await Task.Delay(1);
+15 -14
View File
@@ -61,22 +61,22 @@
{
EA_ShowSearch?.Invoke();
}
#if false
if (showSearch)
}
}
}
public string TipoSearch
{
get => tipoSearch;
set
{
if (tipoSearch != value)
{
tipoSearch = value;
if (EA_ShowSearch != null)
{
if (EA_ShowSearch != null)
{
EA_ShowSearch?.Invoke();
}
EA_ShowSearch?.Invoke();
}
else
{
if (EA_HideSearch != null)
{
EA_HideSearch?.Invoke();
}
}
#endif
}
}
}
@@ -107,6 +107,7 @@
private string searchVal = "";
private bool showSearch;
private string tipoSearch = "*";
#endregion Private Fields