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