Test grids: address grid, driver grid.. cast error onEditmodelSaving

This commit is contained in:
Adam 2024-06-01 16:02:48 +02:00
parent d8de723141
commit 30c5e8382d
7 changed files with 85 additions and 8 deletions

View File

@ -18,4 +18,13 @@ public class SignalRTags : AcSignalRTags
public const int UpdateCompanyAsync = 11; public const int UpdateCompanyAsync = 11;
public const int AddCompanyAsync = 12; public const int AddCompanyAsync = 12;
public const int RemoveCompanyAsync = 13; public const int RemoveCompanyAsync = 13;
public const int GetTransferToDriversAsync = 14;
public const int AddTransferToDriversAsync = 15;
public const int UpdateTransferToDriversAsync = 16;
public const int RemoveTransferToDriversAsync = 17;
public const int GetAddressesByContextIdAsync = 18;
public const int AddAddressToContextIdAsync = 19;
public const int UpdateAddressByContextIdAsync = 20;
public const int RemoveAddressByContextIdAsync = 21;
} }

View File

@ -9,6 +9,7 @@
@using AyCode.Services.Loggers @using AyCode.Services.Loggers
@using TIAM.Core.Loggers @using TIAM.Core.Loggers
@using TIAM.Entities.Addresses @using TIAM.Entities.Addresses
@using TIAMSharedUI.Shared.Components.Grids
@using TIAMSharedUI.Pages.Components.EditComponents @using TIAMSharedUI.Pages.Components.EditComponents
@inject IServiceProviderDataService serviceProviderDataService @inject IServiceProviderDataService serviceProviderDataService
@inject IUserDataService userDataService @inject IUserDataService userDataService
@ -16,7 +17,7 @@
@inject IEnumerable<IAcLogWriterClientBase> LogWriters @inject IEnumerable<IAcLogWriterClientBase> LogWriters
<DxGrid @ref="Grid" Data="_detailGridData" <AddressGrid @ref="Grid" Data="_detailGridData"
PageSize="5" PageSize="5"
AutoExpandAllGroupRows="true" AutoExpandAllGroupRows="true"
KeyboardNavigationEnabled="KeyboardNavigationEnabled" KeyboardNavigationEnabled="KeyboardNavigationEnabled"
@ -47,7 +48,7 @@
<EditAddressComponent Model="@((Address)context.EditModel)" OnAddressChanged="@((Address model) => SaveAddress(model))" /> <EditAddressComponent Model="@((Address)context.EditModel)" OnAddressChanged="@((Address model) => SaveAddress(model))" />
</EditFormTemplate> </EditFormTemplate>
</DxGrid> </AddressGrid>
@code { @code {
[Parameter] [Parameter]

View File

@ -1,6 +1,7 @@
@using TIAM.Entities.Transfers @using TIAM.Entities.Transfers
@using TIAM.Entities.Drivers @using TIAM.Entities.Drivers
@using TIAM.Models.Dtos.Users @using TIAM.Models.Dtos.Users
@using TIAMSharedUI.Shared.Components.Grids
@using TIAMWebApp.Shared.Application.Interfaces @using TIAMWebApp.Shared.Application.Interfaces
@using TIAMWebApp.Shared.Application.Utility @using TIAMWebApp.Shared.Application.Utility
@using TIAM.Core.Loggers @using TIAM.Core.Loggers
@ -11,7 +12,7 @@
<DxGrid Data="DetailGridData" <TransferToDriversGrid Data="DetailGridData"
PageSize="5" PageSize="5"
AutoExpandAllGroupRows="true" AutoExpandAllGroupRows="true"
KeyboardNavigationEnabled="KeyboardNavigationEnabled" KeyboardNavigationEnabled="KeyboardNavigationEnabled"
@ -29,7 +30,7 @@
<DxGridDataColumn FieldName="CarId" Width="40%" /> <DxGridDataColumn FieldName="CarId" Width="40%" />
<DxGridDataColumn FieldName="LicencePlate" /> <DxGridDataColumn FieldName="LicencePlate" />
</Columns> </Columns>
</DxGrid> </TransferToDriversGrid>
@code { @code {
[Parameter] [Parameter]
@ -66,9 +67,9 @@
{ {
if (e.IsNew) if (e.IsNew)
//add new orderData to orderData array //add new orderData to orderData array
_logger.Info("New orderData added"); _logger.Info("New driver added");
else else
_logger.Info("orderData updated"); _logger.Info("Driver updated");
await UpdateDataAsync(); await UpdateDataAsync();
} }
@ -76,7 +77,7 @@
async Task DataItemDeleting(GridDataItemDeletingEventArgs e) async Task DataItemDeleting(GridDataItemDeletingEventArgs e)
{ {
//remove orderData from orderData array //remove orderData from orderData array
_logger.Info("orderData deleted"); _logger.Info("driver deleted");
//await UpdateDataAsync(); //await UpdateDataAsync();
} }

View File

@ -147,7 +147,7 @@
<DxTabs> <DxTabs>
<DxTabPage Text="Driver"> <DxTabPage Text="Driver">
<Grid_MasterDetail_NestedGrid_DetailContent Customer="(TIAM.Entities.Transfers.Transfer)context.DataItem" KeyboardNavigationEnabled="true" /> <DriverGridComponent Transfer="(TIAM.Entities.Transfers.Transfer)context.DataItem" KeyboardNavigationEnabled="true" />
</DxTabPage> </DxTabPage>
</DxTabs> </DxTabs>

View File

@ -21,6 +21,7 @@
@using AyCode.Services.Loggers @using AyCode.Services.Loggers
@using TIAM.Core.Loggers @using TIAM.Core.Loggers
@using TIAM.Entities.Addresses @using TIAM.Entities.Addresses
@using TIAMSharedUI.Shared.Components.Grids
@layout AdminLayout @layout AdminLayout
@inject IEnumerable<IAcLogWriterClientBase> LogWriters @inject IEnumerable<IAcLogWriterClientBase> LogWriters
@inject IStringLocalizer<TIAMResources> Localizer @inject IStringLocalizer<TIAMResources> Localizer

View File

@ -0,0 +1,33 @@
using Microsoft.AspNetCore.Components;
using TIAM.Entities.Addresses;
using TIAM.Entities.Transfers;
using TIAM.Services;
namespace TIAMSharedUI.Shared.Components.Grids;
public class AddressGrid : TiamGrid<Address>
{
public AddressGrid() : base()
{
GridName = nameof(Address);
GetAllMessageTag = SignalRTags.GetAddressesByContextIdAsync;
AddMessageTag = SignalRTags.AddAddressToContextIdAsync;
UpdateMessageTag = SignalRTags.UpdateAddressByContextIdAsync;
RemoveMessageTag = SignalRTags.RemoveAddressByContextIdAsync;
}
protected override Task SetParametersAsyncCore(ParameterView parameters)
{
if (!IsFirstInitializeParameters)
{
//ShowFilterRow = true;
//ShowGroupPanel = true;
//AllowSort = false;
//etc...
}
return base.SetParametersAsyncCore(parameters);
}
}

View File

@ -0,0 +1,32 @@
using Microsoft.AspNetCore.Components;
using TIAM.Entities.Transfers;
using TIAM.Services;
namespace TIAMSharedUI.Shared.Components.Grids;
public class TransferToDriversGrid : TiamGrid<TransferToDriver>
{
public TransferToDriversGrid() : base()
{
GridName = nameof(TransferToDriver);
GetAllMessageTag = SignalRTags.GetTransferToDriversAsync;
AddMessageTag = SignalRTags.AddTransferToDriversAsync;
UpdateMessageTag = SignalRTags.UpdateTransferToDriversAsync;
RemoveMessageTag = SignalRTags.RemoveTransferToDriversAsync;
}
protected override Task SetParametersAsyncCore(ParameterView parameters)
{
if (!IsFirstInitializeParameters)
{
//ShowFilterRow = true;
//ShowGroupPanel = true;
//AllowSort = false;
//etc...
}
return base.SetParametersAsyncCore(parameters);
}
}