merge
This commit is contained in:
commit
ef7ced8439
|
|
@ -531,10 +531,10 @@ namespace TIAM.Database.Test
|
||||||
|
|
||||||
[DataTestMethod]
|
[DataTestMethod]
|
||||||
[DataRow(["069089cd-66d4-4f0d-851b-2eea14fa62a4", "be709d9b-87dc-4c94-bf9e-d6254db3fa3e"])]
|
[DataRow(["069089cd-66d4-4f0d-851b-2eea14fa62a4", "be709d9b-87dc-4c94-bf9e-d6254db3fa3e"])]
|
||||||
public async Task TransferDestinationCrudTest(string[] transferDestIdaddressIdStrings)
|
public async Task TransferDestinationCrudTest(string[] transferDestIdAddressIdStrings)
|
||||||
{
|
{
|
||||||
var transferDestId = Guid.Parse(transferDestIdaddressIdStrings[0]);
|
var transferDestId = Guid.Parse(transferDestIdAddressIdStrings[0]);
|
||||||
var addressId = Guid.Parse(transferDestIdaddressIdStrings[1]);
|
var addressId = Guid.Parse(transferDestIdAddressIdStrings[1]);
|
||||||
|
|
||||||
await Dal.RemoveTransferDestinationAsync(transferDestId, true); //kitöröljük a szemetet, ha korábbról bentmaradt - J.
|
await Dal.RemoveTransferDestinationAsync(transferDestId, true); //kitöröljük a szemetet, ha korábbról bentmaradt - J.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,7 @@ namespace TIAM.Database.DataLayers.Admins
|
||||||
|
|
||||||
#region TransferDestination
|
#region TransferDestination
|
||||||
public TransferDestination? GetTransferDestinationById(Guid transferDestinationId) => Session(ctx=>ctx.GetTransferDestinationById(transferDestinationId));
|
public TransferDestination? GetTransferDestinationById(Guid transferDestinationId) => Session(ctx=>ctx.GetTransferDestinationById(transferDestinationId));
|
||||||
|
public Task<TransferDestination?> GetTransferDestinationByIdAsync(Guid transferDestinationId) => SessionAsync(ctx=>ctx.GetTransferDestinationById(transferDestinationId));
|
||||||
public string? GetTransferDestinationJsonById(Guid transferDestinationId) => Session(ctx => ctx.GetTransferDestinationById(transferDestinationId)?.ToJson());
|
public string? GetTransferDestinationJsonById(Guid transferDestinationId) => Session(ctx => ctx.GetTransferDestinationById(transferDestinationId)?.ToJson());
|
||||||
|
|
||||||
public Task<bool> AddTransferDestinationAsync(TransferDestination transferDestination) => TransactionAsync(ctx => ctx.AddTransferDestination(transferDestination));
|
public Task<bool> AddTransferDestinationAsync(TransferDestination transferDestination) => TransactionAsync(ctx => ctx.AddTransferDestination(transferDestination));
|
||||||
|
|
@ -97,7 +98,7 @@ namespace TIAM.Database.DataLayers.Admins
|
||||||
|
|
||||||
public Task<bool> AddTransferDestinationToProductAsync(TransferDestinationToProduct transferDestinationToProduct) => TransactionAsync(ctx => ctx.AddTransferDestinationToProduct(transferDestinationToProduct));
|
public Task<bool> AddTransferDestinationToProductAsync(TransferDestinationToProduct transferDestinationToProduct) => TransactionAsync(ctx => ctx.AddTransferDestinationToProduct(transferDestinationToProduct));
|
||||||
public Task<bool> UpdateTransferDestinationToProductAsync(TransferDestinationToProduct transferDestinationToProduct) => TransactionAsync(ctx => ctx.UpdateTransferDestinationToProduct(transferDestinationToProduct));
|
public Task<bool> UpdateTransferDestinationToProductAsync(TransferDestinationToProduct transferDestinationToProduct) => TransactionAsync(ctx => ctx.UpdateTransferDestinationToProduct(transferDestinationToProduct));
|
||||||
public Task<bool> RemoveTransferDestinationToProductAsync(TransferDestinationToProduct transferDestinationToProduct) => TransactionAsync(ctx => ctx.RemoveTransferDestinationToProduct(transferDestinationToProduct));
|
public Task<bool> RemoveTransferDestinationToProductAsync(TransferDestinationToProduct transferDestinationToProduct) => TransactionAsync(ctx => ctx.RemoveTransferDestinationToProduct(transferDestinationToProduct.Id));
|
||||||
public Task<bool> RemoveTransferDestinationToProductAsync(Guid transferDestinationToProductId) => TransactionAsync(ctx => ctx.RemoveTransferDestinationToProduct(transferDestinationToProductId));
|
public Task<bool> RemoveTransferDestinationToProductAsync(Guid transferDestinationToProductId) => TransactionAsync(ctx => ctx.RemoveTransferDestinationToProduct(transferDestinationToProductId));
|
||||||
#endregion TransferDestinationToProduct
|
#endregion TransferDestinationToProduct
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,13 @@
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using TIAM.Database.DbSets.Profiles;
|
using TIAM.Database.DbSets.Profiles;
|
||||||
|
using TIAM.Database.DbSets.Transfers;
|
||||||
using TIAM.Database.DbSets.Users;
|
using TIAM.Database.DbSets.Users;
|
||||||
using TIAM.Entities.Addresses;
|
using TIAM.Entities.Addresses;
|
||||||
using TIAM.Entities.Products;
|
using TIAM.Entities.Products;
|
||||||
|
|
||||||
namespace TIAM.Database.DbSets.Products;
|
namespace TIAM.Database.DbSets.Products;
|
||||||
|
|
||||||
public interface IProductDbSet : IProfileDbSet, IUserProductMappingDbSet
|
public interface IProductDbSet : IProfileDbSet, IUserProductMappingDbSet, ITransferDestinationDbSet
|
||||||
{
|
{
|
||||||
public DbSet<Product> Products { get; set; }
|
public DbSet<Product> Products { get; set; }
|
||||||
}
|
}
|
||||||
|
|
@ -5,6 +5,7 @@ using AyCode.Interfaces.Entities;
|
||||||
using AyCode.Interfaces.Profiles;
|
using AyCode.Interfaces.Profiles;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
||||||
|
using TIAM.Database.DbSets.Transfers;
|
||||||
using TIAM.Database.DbSets.Users;
|
using TIAM.Database.DbSets.Users;
|
||||||
using TIAM.Entities.Addresses;
|
using TIAM.Entities.Addresses;
|
||||||
using TIAM.Entities.Products;
|
using TIAM.Entities.Products;
|
||||||
|
|
@ -39,6 +40,7 @@ public static class ProductDbSetExtensions
|
||||||
{
|
{
|
||||||
ctx.RemoveProfile(product.ProfileId);
|
ctx.RemoveProfile(product.ProfileId);
|
||||||
ctx.RemoveUserProductMappingsByProductId(product.Id);
|
ctx.RemoveUserProductMappingsByProductId(product.Id);
|
||||||
|
ctx.RemoveTransferDestinationToProductByProductId(product.Id);
|
||||||
|
|
||||||
//TODO: Transfer, etc... - J.
|
//TODO: Transfer, etc... - J.
|
||||||
return ctx.Products.Remove(product).State == EntityState.Deleted;
|
return ctx.Products.Remove(product).State == EntityState.Deleted;
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@ public static class TransferDbSetExtensions
|
||||||
{
|
{
|
||||||
if (removeAddress) ctx.Addresses.Remove(transferDestination.Address);
|
if (removeAddress) ctx.Addresses.Remove(transferDestination.Address);
|
||||||
|
|
||||||
|
ctx.RemoveTransferDestinationToProductByTransferDestinationId(transferDestination.Id);
|
||||||
return ctx.TransferDestinations.Remove(transferDestination).State == EntityState.Deleted;
|
return ctx.TransferDestinations.Remove(transferDestination).State == EntityState.Deleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -70,7 +71,7 @@ public static class TransferDbSetExtensions
|
||||||
public static bool UpdateTransferDestinationToProduct(this ITransferDestinationToProductDbSet ctx, TransferDestinationToProduct transferDestinationToProduct)
|
public static bool UpdateTransferDestinationToProduct(this ITransferDestinationToProductDbSet ctx, TransferDestinationToProduct transferDestinationToProduct)
|
||||||
=> ctx.TransferDestinationToProducts.Update(transferDestinationToProduct).State == EntityState.Modified;
|
=> ctx.TransferDestinationToProducts.Update(transferDestinationToProduct).State == EntityState.Modified;
|
||||||
|
|
||||||
public static bool RemoveTransferDestinationToProduct(this ITransferDestinationToProductDbSet ctx, TransferDestinationToProduct transferDestinationToProduct)
|
private static bool RemoveTransferDestinationToProduct(this ITransferDestinationToProductDbSet ctx, TransferDestinationToProduct transferDestinationToProduct)
|
||||||
{
|
{
|
||||||
return ctx.TransferDestinationToProducts.Remove(transferDestinationToProduct).State == EntityState.Deleted;
|
return ctx.TransferDestinationToProducts.Remove(transferDestinationToProduct).State == EntityState.Deleted;
|
||||||
}
|
}
|
||||||
|
|
@ -80,5 +81,18 @@ public static class TransferDbSetExtensions
|
||||||
var transferDestinationToProduct = ctx.GetTransferDestinationToProductById(transferDestinationToProductId);
|
var transferDestinationToProduct = ctx.GetTransferDestinationToProductById(transferDestinationToProductId);
|
||||||
return transferDestinationToProduct == null || ctx.RemoveTransferDestinationToProduct(transferDestinationToProduct);
|
return transferDestinationToProduct == null || ctx.RemoveTransferDestinationToProduct(transferDestinationToProduct);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool RemoveTransferDestinationToProductByProductId(this ITransferDestinationToProductDbSet ctx, Guid productId)
|
||||||
|
{
|
||||||
|
ctx.TransferDestinationToProducts.RemoveRange(ctx.TransferDestinationToProducts.Where(x => x.ProductId == productId));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool RemoveTransferDestinationToProductByTransferDestinationId(this ITransferDestinationToProductDbSet ctx, Guid transferDestinationId)
|
||||||
|
{
|
||||||
|
ctx.TransferDestinationToProducts.RemoveRange(ctx.TransferDestinationToProducts.Where(x => x.TransferDestinationId == transferDestinationId));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion TransferDestinationToProduct
|
#endregion TransferDestinationToProduct
|
||||||
}
|
}
|
||||||
|
|
@ -37,7 +37,7 @@
|
||||||
Click="ColumnChooserButton_Click" />
|
Click="ColumnChooserButton_Click" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<TransferDestinationToProductGridComponent DetailExpandButtonDisplayMode="GridDetailExpandButtonDisplayMode.Auto" GetAllTag="SignalRTags.GetAllTransferDestinationToProducts"></TransferDestinationToProductGridComponent>
|
<TransferDestinationToProductGridComponent DetailExpandButtonDisplayMode="GridDetailExpandButtonDisplayMode.Auto"></TransferDestinationToProductGridComponent>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,13 +17,14 @@
|
||||||
@using TIAMWebApp.Shared.Application.Services
|
@using TIAMWebApp.Shared.Application.Services
|
||||||
@using AyCode.Interfaces.Addresses
|
@using AyCode.Interfaces.Addresses
|
||||||
@using AyCode.Core
|
@using AyCode.Core
|
||||||
|
@using AyCode.Core.Extensions
|
||||||
@inject IStringLocalizer<TIAMResources> Localizer
|
@inject IStringLocalizer<TIAMResources> Localizer
|
||||||
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
||||||
@inject AdminSignalRClient AdminSignalRClient;
|
@inject AdminSignalRClient AdminSignalRClient;
|
||||||
|
|
||||||
|
|
||||||
<ProductDetailGrid @ref="_productGrid"
|
<ProductDetailGrid @ref="_productGrid"
|
||||||
ContextIds="new[] {ContextId}"
|
ContextIds="@(ContextId.IsNullOrEmpty() ? throw new InvalidDataException($"ContextId.IsNullOrEmpty(); ContextId: {ContextId}") : [ContextId.Value])"
|
||||||
DataSource="ParentData?.Products ?? []"
|
DataSource="ParentData?.Products ?? []"
|
||||||
GetAllMessageTag="GetAllTag"
|
GetAllMessageTag="GetAllTag"
|
||||||
Logger="_logger"
|
Logger="_logger"
|
||||||
|
|
@ -85,7 +86,7 @@
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
[Parameter] public bool KeyboardNavigationEnabled { get; set; }
|
[Parameter] public bool KeyboardNavigationEnabled { get; set; }
|
||||||
[Parameter] public Guid ContextId { get; set; }
|
[Parameter] public Guid? ContextId { get; set; }
|
||||||
[Parameter] public IProductsRelation? ParentData { get; set; } = null!;
|
[Parameter] public IProductsRelation? ParentData { get; set; } = null!;
|
||||||
[Parameter] public EventCallback<GridEditModelSavingEventArgs> OnGridEditModelSaving { get; set; }
|
[Parameter] public EventCallback<GridEditModelSavingEventArgs> OnGridEditModelSaving { get; set; }
|
||||||
[Parameter] public int GetAllTag { get; set; } = SignalRTags.GetProductsByContextId;
|
[Parameter] public int GetAllTag { get; set; } = SignalRTags.GetProductsByContextId;
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@
|
||||||
<TransferDestinationToProductDetailGridComponent GetAllTag="SignalRTags.GetTransferDestinationToProductByProductId" ContextIds="new [] {((Product)context.DataItem).Id}" KeyboardNavigationEnabled="true" />
|
<TransferDestinationToProductDetailGridComponent GetAllTag="SignalRTags.GetTransferDestinationToProductByProductId" ContextIds="new [] {((Product)context.DataItem).Id}" KeyboardNavigationEnabled="true" />
|
||||||
</DxTabPage>
|
</DxTabPage>
|
||||||
<DxTabPage Text="Permissions">
|
<DxTabPage Text="Permissions">
|
||||||
<UserProductMappingGridComponent DetailExpandButtonDisplayMode="GridDetailExpandButtonDisplayMode.Never" ContextIds="new [] {((Product)context.DataItem).Id}" GetAllTag="SignalRTags.GetUserProductMappingsByProductId">
|
<UserProductMappingGridComponent DetailExpandButtonDisplayMode="GridDetailExpandButtonDisplayMode.Never" ContextIds="new[] { ((Product)context.DataItem).Id }" GetAllTag="SignalRTags.GetUserProductMappingsByProductId">
|
||||||
</UserProductMappingGridComponent>
|
</UserProductMappingGridComponent>
|
||||||
</DxTabPage>
|
</DxTabPage>
|
||||||
<DxTabPage Text="Profile">
|
<DxTabPage Text="Profile">
|
||||||
|
|
@ -63,7 +63,7 @@
|
||||||
</DetailRowTemplate>
|
</DetailRowTemplate>
|
||||||
<EditFormTemplate Context="editFormContext">
|
<EditFormTemplate Context="editFormContext">
|
||||||
@{
|
@{
|
||||||
var transfer2 = (Product)editFormContext.EditModel;
|
var product = (Product)editFormContext.EditModel;
|
||||||
}
|
}
|
||||||
<DxFormLayout CssClass="w-100">
|
<DxFormLayout CssClass="w-100">
|
||||||
<DxFormLayoutItem Caption=@Localizer.GetString(ResourceKeys.ProductName) ColSpanMd="4">
|
<DxFormLayoutItem Caption=@Localizer.GetString(ResourceKeys.ProductName) ColSpanMd="4">
|
||||||
|
|
@ -98,8 +98,6 @@
|
||||||
protected override void OnInitialized()
|
protected override void OnInitialized()
|
||||||
{
|
{
|
||||||
_logger = new LoggerClient<ProductGridComponent>(LogWriters.ToArray());
|
_logger = new LoggerClient<ProductGridComponent>(LogWriters.ToArray());
|
||||||
//DataSource = new List<Address>();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override async Task OnParametersSetAsync()
|
protected override async Task OnParametersSetAsync()
|
||||||
|
|
|
||||||
|
|
@ -10,26 +10,25 @@
|
||||||
@using AyCode.Services.Loggers
|
@using AyCode.Services.Loggers
|
||||||
@using TIAM.Core.Loggers
|
@using TIAM.Core.Loggers
|
||||||
@using AyCode.Core
|
@using AyCode.Core
|
||||||
|
@using AyCode.Core.Extensions
|
||||||
@using TIAMSharedUI.Shared.Components.Grids
|
@using TIAMSharedUI.Shared.Components.Grids
|
||||||
@inject IServiceProviderDataService ServiceProviderDataService
|
@inject IServiceProviderDataService ServiceProviderDataService
|
||||||
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
||||||
@inject AdminSignalRClient AdminSignalRClient;
|
@inject AdminSignalRClient AdminSignalRClient;
|
||||||
|
|
||||||
<TransferDestinationToProductGrid
|
<TransferDestinationToProductGrid
|
||||||
Logger="_logger"
|
Logger="_logger"
|
||||||
SignalRClient="AdminSignalRClient"
|
SignalRClient="AdminSignalRClient"
|
||||||
ContextIds="ContextIds"
|
ContextIds="@(ContextId.IsNullOrEmpty() ? throw new InvalidDataException($"ContextId.IsNullOrEmpty(); ContextId: {ContextId}") : [ContextId.Value])"
|
||||||
PageSize="5"
|
PageSize="10"
|
||||||
AutoExpandAllGroupRows="true"
|
KeyboardNavigationEnabled="KeyboardNavigationEnabled"
|
||||||
KeyboardNavigationEnabled="KeyboardNavigationEnabled"
|
KeyFieldName="Id"
|
||||||
KeyFieldName="Id"
|
ValidationEnabled="false"
|
||||||
ValidationEnabled="false"
|
EditMode="GridEditMode.EditForm"
|
||||||
EditMode="GridEditMode.EditForm"
|
ColumnResizeMode="GridColumnResizeMode.NextColumn">
|
||||||
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
|
||||||
ShowFilterRow="true">
|
|
||||||
<Columns>
|
<Columns>
|
||||||
<DxGridCommandColumn Width="135" MinWidth="135" FixedPosition="GridColumnFixedPosition.Left" />
|
<DxGridCommandColumn Width="135" MinWidth="135" FixedPosition="GridColumnFixedPosition.Left" />
|
||||||
<DxGridDataColumn FieldName="Id" GroupIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" />
|
<DxGridDataColumn FieldName="Id" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" />
|
||||||
<DxGridDataColumn FieldName="ProductId" />
|
<DxGridDataColumn FieldName="ProductId" />
|
||||||
<DxGridDataColumn FieldName="TransferDestinationId"/>
|
<DxGridDataColumn FieldName="TransferDestinationId"/>
|
||||||
<DxGridDataColumn FieldName="Price" />
|
<DxGridDataColumn FieldName="Price" />
|
||||||
|
|
@ -38,37 +37,30 @@
|
||||||
<DxGridDataColumn FieldName="ProductCommis" />
|
<DxGridDataColumn FieldName="ProductCommis" />
|
||||||
</Columns>
|
</Columns>
|
||||||
<DetailRowTemplate>
|
<DetailRowTemplate>
|
||||||
|
|
||||||
<DxTabs>
|
<DxTabs>
|
||||||
<DxTabPage Text="Partner">
|
<DxTabPage Text="Partner">
|
||||||
|
|
||||||
</DxTabPage>
|
</DxTabPage>
|
||||||
|
|
||||||
</DxTabs>
|
</DxTabs>
|
||||||
|
|
||||||
|
|
||||||
</DetailRowTemplate>
|
</DetailRowTemplate>
|
||||||
<EditFormTemplate Context="EditFormContext">
|
<EditFormTemplate Context="editFormContext">
|
||||||
@{
|
@{
|
||||||
var serviceProvider = (Company)EditFormContext.EditModel;
|
var transferDestinationToProduct = (TransferDestinationToProduct)editFormContext.EditModel;
|
||||||
}
|
}
|
||||||
<DxFormLayout CssClass="w-100">
|
<DxFormLayout CssClass="w-100">
|
||||||
<DxFormLayoutItem Caption="Price" ColSpanMd="4">
|
<DxFormLayoutItem Caption="Price" ColSpanMd="4">
|
||||||
@EditFormContext.GetEditor("Price")
|
@editFormContext.GetEditor("Price")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
<DxFormLayoutItem Caption="Price2" ColSpanMd="4">
|
<DxFormLayoutItem Caption="Price2" ColSpanMd="4">
|
||||||
@EditFormContext.GetEditor("Price2")
|
@editFormContext.GetEditor("Price2")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
<DxFormLayoutItem Caption="Price3" ColSpanMd="4">
|
<DxFormLayoutItem Caption="Price3" ColSpanMd="4">
|
||||||
@EditFormContext.GetEditor("Price3")
|
@editFormContext.GetEditor("Price3")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
|
|
||||||
<DxFormLayoutItem Caption="Commission rate" ColSpanMd="4">
|
<DxFormLayoutItem Caption="Commission rate" ColSpanMd="4">
|
||||||
@EditFormContext.GetEditor("ProductCommis")
|
@editFormContext.GetEditor("ProductCommis")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</DxFormLayout>
|
</DxFormLayout>
|
||||||
</EditFormTemplate>
|
</EditFormTemplate>
|
||||||
|
|
||||||
|
|
@ -79,21 +71,13 @@
|
||||||
[Parameter] public GridDetailExpandButtonDisplayMode DetailExpandButtonDisplayMode { get; set; } = GridDetailExpandButtonDisplayMode.Never;
|
[Parameter] public GridDetailExpandButtonDisplayMode DetailExpandButtonDisplayMode { get; set; } = GridDetailExpandButtonDisplayMode.Never;
|
||||||
[Parameter] public Guid? ContextId { get; set; }
|
[Parameter] public Guid? ContextId { get; set; }
|
||||||
|
|
||||||
[Parameter] public int GetAllTag { get; set; }
|
|
||||||
|
|
||||||
public Guid[]? ContextIds = new Guid[1];
|
|
||||||
|
|
||||||
private LoggerClient<TransferDestinationToProductGridComponent> _logger = null!;
|
private LoggerClient<TransferDestinationToProductGridComponent> _logger = null!;
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override void OnInitialized()
|
||||||
{
|
{
|
||||||
_logger = new LoggerClient<TransferDestinationToProductGridComponent>(LogWriters.ToArray());
|
_logger = new LoggerClient<TransferDestinationToProductGridComponent>(LogWriters.ToArray());
|
||||||
|
|
||||||
// ReSharper disable once NullCoalescingConditionIsAlwaysNotNullAccordingToAPIContract
|
base.OnInitialized();
|
||||||
//_detailGridData = UserModelDtoDetail.ServiceProviders ?? [];
|
|
||||||
//_availableServices = await ServiceProviderDataService.GetServiceProvidersAsync();
|
|
||||||
|
|
||||||
//_logger.Info($"DetailGridData: {_detailGridData.Count}");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnParametersSet()
|
protected override void OnParametersSet()
|
||||||
|
|
|
||||||
|
|
@ -57,9 +57,9 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
//[HttpGet]
|
//[HttpGet]
|
||||||
//[Route(APIUrls.GetTransferDriversByTransferIdRouteName)]
|
//[Route(APIUrls.GetTransferDriversByTransferIdRouteName)]
|
||||||
[SignalR(SignalRTags.GetTransferDestinationById)]
|
[SignalR(SignalRTags.GetTransferDestinationById)]
|
||||||
public TransferDestination? GetTransferDestinationById(Guid transferDestinationId)
|
public async Task<TransferDestination?> GetTransferDestinationById(Guid transferDestinationId)
|
||||||
{
|
{
|
||||||
var transferDestination = _adminDal.GetTransferDestinationById(transferDestinationId);
|
var transferDestination = await _adminDal.GetTransferDestinationByIdAsync(transferDestinationId);
|
||||||
return transferDestination;
|
return transferDestination;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -93,10 +93,10 @@ namespace Tiam.Services.Client.Tests
|
||||||
|
|
||||||
[DataTestMethod]
|
[DataTestMethod]
|
||||||
[DataRow(["cfb27fc2-54c2-4f07-8471-587d6b79b019", "7385c4e3-3c1e-4c5e-9926-8c0ea60dcb38"])]
|
[DataRow(["cfb27fc2-54c2-4f07-8471-587d6b79b019", "7385c4e3-3c1e-4c5e-9926-8c0ea60dcb38"])]
|
||||||
public async Task TransferDestinationCrudTest(string[] transferDestIdaddressIdStrings)
|
public async Task TransferDestinationCrudTest(string[] transferDestIdAddressIdStrings)
|
||||||
{
|
{
|
||||||
var transferDestId = Guid.Parse(transferDestIdaddressIdStrings[0]);
|
var transferDestId = Guid.Parse(transferDestIdAddressIdStrings[0]);
|
||||||
var addressId = Guid.Parse(transferDestIdaddressIdStrings[1]);
|
var addressId = Guid.Parse(transferDestIdAddressIdStrings[1]);
|
||||||
|
|
||||||
var transferDest = TestHelper.CreateTransferDestination(transferDestId, addressId);
|
var transferDest = TestHelper.CreateTransferDestination(transferDestId, addressId);
|
||||||
|
|
||||||
|
|
@ -129,5 +129,44 @@ namespace Tiam.Services.Client.Tests
|
||||||
transferDest = await _signalRClient.GetByIdAsync<TransferDestination>(SignalRTags.GetTransferDestinationById, transferDestId);
|
transferDest = await _signalRClient.GetByIdAsync<TransferDestination>(SignalRTags.GetTransferDestinationById, transferDestId);
|
||||||
Assert.IsNull(transferDest); //a korábbi törlés miatt NULL kell legyen - J.
|
Assert.IsNull(transferDest); //a korábbi törlés miatt NULL kell legyen - J.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[DataTestMethod]
|
||||||
|
[DataRow(["cfb27fc2-54c2-4f07-8471-587d6b79b019", "7385c4e3-3c1e-4c5e-9926-8c0ea60dcb38"])]
|
||||||
|
public async Task TransferDestinationToProductCrudTest(string[] transferDestIdAddressIdStrings)
|
||||||
|
{
|
||||||
|
var transferDestId = Guid.Parse(transferDestIdAddressIdStrings[0]);
|
||||||
|
var addressId = Guid.Parse(transferDestIdAddressIdStrings[1]);
|
||||||
|
|
||||||
|
var transferDest = TestHelper.CreateTransferDestination(transferDestId, addressId);
|
||||||
|
|
||||||
|
await _signalRClient.PostDataAsync(SignalRTags.RemoveTransferDestinationToProduct, transferDest);
|
||||||
|
|
||||||
|
transferDest = await _signalRClient.PostDataAsync(SignalRTags.CreateTransferDestination, transferDest);
|
||||||
|
Assert.IsNotNull(transferDest);
|
||||||
|
|
||||||
|
transferDest = await _signalRClient.GetByIdAsync<TransferDestination>(SignalRTags.GetTransferDestinationById, transferDestId);
|
||||||
|
|
||||||
|
Assert.IsNotNull(transferDest);
|
||||||
|
Assert.IsNotNull(transferDest.Address);
|
||||||
|
|
||||||
|
var modifiedAddress = "modified; " + transferDest.Address.AddressText;
|
||||||
|
|
||||||
|
transferDest.Price = 20000;
|
||||||
|
transferDest.Address.AddressText = modifiedAddress;
|
||||||
|
|
||||||
|
transferDest = await _signalRClient.PostDataAsync(SignalRTags.UpdateTransferDestination, transferDest);
|
||||||
|
|
||||||
|
Assert.IsNotNull(transferDest);
|
||||||
|
Assert.IsNotNull(transferDest.Address);
|
||||||
|
|
||||||
|
Assert.IsTrue((int)transferDest.Price == 20000);
|
||||||
|
Assert.IsTrue(transferDest.Address.AddressText == modifiedAddress);
|
||||||
|
Assert.IsTrue(transferDest.Id == transferDestId, "transferDest.Id != transferDestId");
|
||||||
|
|
||||||
|
await _signalRClient.PostDataAsync(SignalRTags.RemoveTransferDestination, transferDest); //mielõbb kitöröljük, h ne maradjon szemét a db-ben - J.
|
||||||
|
|
||||||
|
transferDest = await _signalRClient.GetByIdAsync<TransferDestination>(SignalRTags.GetTransferDestinationById, transferDestId);
|
||||||
|
Assert.IsNull(transferDest); //a korábbi törlés miatt NULL kell legyen - J.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue