85 lines
2.5 KiB
C#
85 lines
2.5 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.Cargos;
|
|
|
|
public class GridCargoTruckBase: FruitBankGridBase<CargoTruck>, IGrid
|
|
{
|
|
private bool _isFirstInitializeParameterCore;
|
|
private bool _isFirstInitializeParameters;
|
|
|
|
public GridCargoTruckBase() : base()
|
|
{
|
|
//GetAllMessageTag = SignalRTags.GetCargoTrucks;
|
|
AddMessageTag = SignalRTags.AddCargoTruck;
|
|
UpdateMessageTag = SignalRTags.UpdateCargoTruck;
|
|
|
|
//RemoveMessageTag = SignalRTags.;
|
|
}
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
if (GetAllMessageTag > 0) return;
|
|
|
|
if (IsMasterGrid) GetAllMessageTag = SignalRTags.GetCargoTrucks;
|
|
else
|
|
{
|
|
if (ContextIds == null || ContextIds.Length == 0) ContextIds = [ParentDataItem!.Id];
|
|
|
|
switch (ParentDataItem)
|
|
{
|
|
case ICargoPartner:
|
|
GetAllMessageTag = SignalRTags.GetCargoTrucksByCargoPartnerId;
|
|
if (KeyFieldNameToParentId.IsNullOrWhiteSpace()) KeyFieldNameToParentId = nameof(CargoTruck.CargoPartnerId);
|
|
|
|
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;
|
|
}
|
|
}
|
|
} |