93 lines
3.0 KiB
C#
93 lines
3.0 KiB
C#
using AyCode.Core.Interfaces;
|
|
using AyCode.Utils.Extensions;
|
|
using DevExpress.Blazor;
|
|
using FruitBank.Common.Entities;
|
|
using FruitBank.Common.Interfaces;
|
|
using FruitBank.Common.SignalRs;
|
|
using FruitBankHybrid.Shared.Pages;
|
|
using Microsoft.AspNetCore.Components;
|
|
|
|
namespace FruitBankHybrid.Shared.Components.Grids.ShippingDocuments;
|
|
|
|
public class GridShippingDocumentBase : FruitBankGridBase<ShippingDocument>, IGrid
|
|
{
|
|
private bool _isFirstInitializeParameterCore;
|
|
private bool _isFirstInitializeParameters;
|
|
|
|
public GridShippingDocumentBase () : base()
|
|
{
|
|
AddMessageTag = SignalRTags.AddShippingDocument;
|
|
UpdateMessageTag = SignalRTags.UpdateShippingDocument;
|
|
|
|
//RemoveMessageTag = SignalRTags.;
|
|
}
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
if (GetAllMessageTag > 0) return;
|
|
|
|
if (IsMasterGrid) GetAllMessageTag = SignalRTags.GetShippingDocuments;
|
|
else
|
|
{
|
|
if (ContextIds == null || ContextIds.Length == 0) ContextIds = [ParentDataItem!.Id];
|
|
|
|
switch (ParentDataItem)
|
|
{
|
|
case IShipping:
|
|
GetAllMessageTag = SignalRTags.GetShippingDocumentsByShippingId;
|
|
if (KeyFieldNameToParentId.IsNullOrWhiteSpace()) KeyFieldNameToParentId = nameof(ShippingDocument.ShippingId);
|
|
break;
|
|
|
|
case IProductDto:
|
|
AddMessageTag = 0;//SignalRTags.None;
|
|
GetAllMessageTag = SignalRTags.GetShippingDocumentsByProductId;
|
|
break;
|
|
|
|
case IPartner:
|
|
GetAllMessageTag = SignalRTags.GetShippingDocumentsByPartnerId;
|
|
if (KeyFieldNameToParentId.IsNullOrWhiteSpace()) KeyFieldNameToParentId = nameof(ShippingDocument.PartnerId);
|
|
break;
|
|
}
|
|
}
|
|
|
|
await base.OnInitializedAsync();
|
|
}
|
|
|
|
protected override void OnParametersSet()
|
|
{
|
|
base.OnParametersSet();
|
|
|
|
if (!_isFirstInitializeParameters)
|
|
{
|
|
//if (!IsMasterGrid && (ContextIds == null || ContextIds.Length == 0))
|
|
//{
|
|
// ContextIds = [ParentDataItem!.Id];
|
|
// GetAllMessageTag = SignalRTags.GetShippingItemsByDocumentId;
|
|
//}
|
|
|
|
_isFirstInitializeParameters = false;
|
|
}
|
|
}
|
|
|
|
protected override async Task SetParametersAsyncCore(ParameterView parameters)
|
|
{
|
|
await base.SetParametersAsyncCore(parameters);
|
|
|
|
if (!_isFirstInitializeParameterCore)
|
|
{
|
|
//if (!IsMasterGrid && (ContextIds == null || ContextIds.Length == 0))
|
|
//{
|
|
// ContextIds = [ParentDataItem!.Id];
|
|
// GetAllMessageTag = SignalRTags.GetShippingItemsByDocumentId;
|
|
//}
|
|
|
|
//ShowFilterRow = true;
|
|
//ShowGroupPanel = true;
|
|
//AllowSort = false;
|
|
|
|
//etc...
|
|
|
|
_isFirstInitializeParameterCore = false;
|
|
}
|
|
}
|
|
} |