OrderItemGrid improvement, fixes

This commit is contained in:
Loretta 2025-11-21 17:16:59 +01:00
parent 34be547e85
commit 7c1cd6574e
1 changed files with 24 additions and 29 deletions

View File

@ -10,7 +10,7 @@
@inject FruitBankSignalRClient FruitBankSignalRClient @inject FruitBankSignalRClient FruitBankSignalRClient
<MgGridBase @ref="Grid" Data="OrderItemDtos" IsMasterGrid="IsMasterGrid" <MgGridBase @ref="Grid" Data="OrderItemDtos" IsMasterGrid="IsMasterGrid"
PageSize="@(IsMasterGrid ? 15 : 50)" ShowFilterRow="IsMasterGrid" ShowGroupPanel="IsMasterGrid" PageSize="@(IsMasterGrid ? 20 : 50)" ShowFilterRow="IsMasterGrid" ShowGroupPanel="IsMasterGrid"
AutoExpandAllGroupRows="false" AutoSaveLayoutName="GridDetailOrderItemDto" AutoExpandAllGroupRows="false" AutoSaveLayoutName="GridDetailOrderItemDto"
ColumnResizeMode="GridColumnResizeMode.NextColumn" ColumnResizeMode="GridColumnResizeMode.NextColumn"
CssClass="@GridCss" CssClass="@GridCss"
@ -94,21 +94,14 @@
private async Task ReloadDataFromDb(bool forceReload = false) private async Task ReloadDataFromDb(bool forceReload = false)
{ {
LoadingPanelVisibility.Visible = true; LoadingPanelVisibility.Visible = true;
//using (await ObjectLock.GetSemaphore<ProductDto>().UseWaitAsync())
{
// if (ProductDtos == null || !ProductDtos.Any())
// {
// ProductDtos = await Database.ProductDtoTable.LoadDataAsync(!forceReload);
// // Database.ProductDtoTable.LoadDataAsync(!forceReload).ContinueWith(x => using (await ObjectLock.GetSemaphore<ProductDto>().UseWaitAsync())
// // { {
// // ProductDtos = x.Result; if (ProductDtos == null || !ProductDtos.Any() || forceReload) ProductDtos = await Database.ProductDtoTable.LoadDataAsync(!forceReload);
// // }).Forget();
// }
} }
if (!IsMasterGrid) return; if (IsMasterGrid)
{
using (await ObjectLock.GetSemaphore<OrderItemDto>().UseWaitAsync()) using (await ObjectLock.GetSemaphore<OrderItemDto>().UseWaitAsync())
{ {
if (OrderItemDtos == null) OrderItemDtos = await FruitBankSignalRClient.GetAllOrderItemDtos() ?? []; if (OrderItemDtos == null) OrderItemDtos = await FruitBankSignalRClient.GetAllOrderItemDtos() ?? [];
@ -119,18 +112,20 @@
} }
} }
// if (ProductDtos == null || !ProductDtos.Any() || forceReload)
// {
// //ProductDtos = await Database.ProductDtoTable.LoadDataAsync(!forceReload);
// Database.ProductDtoTable.LoadDataAsync(!forceReload).ContinueWith(x =>
// {
// ProductDtos = x.Result;
// }).Forget();
// }
//if (forceReload) //if (forceReload)
Grid?.Reload(); Grid?.Reload();
if (ProductDtos == null || !ProductDtos.Any() || forceReload)
{
//ProductDtos = await Database.ProductDtoTable.LoadDataAsync(!forceReload);
Database.ProductDtoTable.LoadDataAsync(!forceReload).ContinueWith(x =>
{
ProductDtos = x.Result;
}).Forget();
} }
LoadingPanelVisibility.Visible = false; LoadingPanelVisibility.Visible = false;
} }
} }