OrderItemGrid improvement, fixes
This commit is contained in:
parent
34be547e85
commit
7c1cd6574e
|
|
@ -10,7 +10,7 @@
|
|||
@inject FruitBankSignalRClient FruitBankSignalRClient
|
||||
|
||||
<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"
|
||||
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
||||
CssClass="@GridCss"
|
||||
|
|
@ -94,43 +94,38 @@
|
|||
private async Task ReloadDataFromDb(bool forceReload = false)
|
||||
{
|
||||
LoadingPanelVisibility.Visible = true;
|
||||
//using (await ObjectLock.GetSemaphore<ProductDto>().UseWaitAsync())
|
||||
|
||||
using (await ObjectLock.GetSemaphore<ProductDto>().UseWaitAsync())
|
||||
{
|
||||
// if (ProductDtos == null || !ProductDtos.Any())
|
||||
// {
|
||||
// ProductDtos = await Database.ProductDtoTable.LoadDataAsync(!forceReload);
|
||||
|
||||
// // Database.ProductDtoTable.LoadDataAsync(!forceReload).ContinueWith(x =>
|
||||
// // {
|
||||
// // ProductDtos = x.Result;
|
||||
// // }).Forget();
|
||||
// }
|
||||
if (ProductDtos == null || !ProductDtos.Any() || forceReload) ProductDtos = await Database.ProductDtoTable.LoadDataAsync(!forceReload);
|
||||
}
|
||||
|
||||
if (!IsMasterGrid) return;
|
||||
|
||||
using (await ObjectLock.GetSemaphore<OrderItemDto>().UseWaitAsync())
|
||||
if (IsMasterGrid)
|
||||
{
|
||||
if (OrderItemDtos == null) OrderItemDtos = await FruitBankSignalRClient.GetAllOrderItemDtos() ?? [];
|
||||
else if (OrderItemDtos.Count == 0 || forceReload)
|
||||
using (await ObjectLock.GetSemaphore<OrderItemDto>().UseWaitAsync())
|
||||
{
|
||||
OrderItemDtos.Clear();
|
||||
OrderItemDtos.AddRange(await FruitBankSignalRClient.GetAllOrderItemDtos() ?? []);
|
||||
if (OrderItemDtos == null) OrderItemDtos = await FruitBankSignalRClient.GetAllOrderItemDtos() ?? [];
|
||||
else if (OrderItemDtos.Count == 0 || forceReload)
|
||||
{
|
||||
OrderItemDtos.Clear();
|
||||
OrderItemDtos.AddRange(await FruitBankSignalRClient.GetAllOrderItemDtos() ?? []);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//if (forceReload)
|
||||
// if (ProductDtos == null || !ProductDtos.Any() || forceReload)
|
||||
// {
|
||||
// //ProductDtos = await Database.ProductDtoTable.LoadDataAsync(!forceReload);
|
||||
|
||||
// Database.ProductDtoTable.LoadDataAsync(!forceReload).ContinueWith(x =>
|
||||
// {
|
||||
// ProductDtos = x.Result;
|
||||
// }).Forget();
|
||||
// }
|
||||
|
||||
//if (forceReload)
|
||||
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;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue