From a000d5891495ae944c073311466e560ff58798e8 Mon Sep 17 00:00:00 2001 From: Loretta Date: Sun, 7 Jul 2024 17:15:42 +0200 Subject: [PATCH 1/2] improvements, fixes, etc... --- .../TransferToDriverGridComponent.razor | 2 +- .../Shared/Services/AdminSignalRClient.cs | 6 +- .../SignalRClientTest.cs | 61 ++++++++++++++++--- 3 files changed, 57 insertions(+), 12 deletions(-) diff --git a/TIAMSharedUI/Pages/User/SysAdmins/TransferToDriverGridComponent.razor b/TIAMSharedUI/Pages/User/SysAdmins/TransferToDriverGridComponent.razor index 6c230d0a..3eb0b3f5 100644 --- a/TIAMSharedUI/Pages/User/SysAdmins/TransferToDriverGridComponent.razor +++ b/TIAMSharedUI/Pages/User/SysAdmins/TransferToDriverGridComponent.razor @@ -219,7 +219,7 @@ private Task LoadComboBoxItems() { //TODO: CarModelDtoMin-t megcsinálni és azt lekérni a ComboBox-hoz! - J. - return AdminSignalRClient.GetAllCarsAndDriversByProductIdAsync(_cars, _drivers, TiamConstClient.TransferProductId, StateHasChanged); + return AdminSignalRClient.GetAllCarsAndDriversByProductIdAsync(TiamConstClient.TransferProductId, _cars, _drivers, StateHasChanged); } private void DataItemChanged(GridDataItemChangedEventArgs args) diff --git a/TIAMWebApp/Shared/Services/AdminSignalRClient.cs b/TIAMWebApp/Shared/Services/AdminSignalRClient.cs index b7528428..36e90108 100644 --- a/TIAMWebApp/Shared/Services/AdminSignalRClient.cs +++ b/TIAMWebApp/Shared/Services/AdminSignalRClient.cs @@ -43,9 +43,9 @@ namespace TIAMWebApp.Shared.Application.Services return await GetAllAsync>(SignalRTags.GetAllCarsByProductId, [productId]) ?? []; } - public Task GetAllCarsAndDriversByProductIdAsync(List intoCars, List intoDrivers, Guid productId, Action? callback = null) + public Task GetAllCarsAndDriversByProductIdAsync(Guid productId, List intoCars, List intoDrivers, Action? callback = null) { - return GetAllCarsByProductIdAsync(intoCars, productId, () => + return GetAllCarsByProductIdAsync(productId, intoCars, () => { intoDrivers.Clear(); intoDrivers.AddRange(intoCars.DistinctBy(x => x.UserProductMappingId).Select(x => x.UserProductMapping)); @@ -54,7 +54,7 @@ namespace TIAMWebApp.Shared.Application.Services }); } - public Task GetAllCarsByProductIdAsync(List intoCars, Guid productId, Action? callback = null) + public Task GetAllCarsByProductIdAsync(Guid productId, List intoCars, Action? callback = null) { Logger.Detail($"GetAllCarsByProductIdAsync client called; productId: {productId}"); diff --git a/Tiam.Services.Client.Tests/SignalRClientTest.cs b/Tiam.Services.Client.Tests/SignalRClientTest.cs index 53fc458a..25709da6 100644 --- a/Tiam.Services.Client.Tests/SignalRClientTest.cs +++ b/Tiam.Services.Client.Tests/SignalRClientTest.cs @@ -7,9 +7,11 @@ using Azure; using DevExpress.Data.Filtering; using DevExpress.Data.Linq; using DevExpress.Data.Linq.Helpers; +using TIAM.Core.Consts; using TIAM.Core.Enums; using TIAM.Core.Loggers; using TIAM.Database.Test; +using TIAM.Entities.Drivers; using TIAM.Entities.ServiceProviders; using TIAM.Entities.Transfers; using TIAM.Entities.Users; @@ -28,11 +30,13 @@ namespace Tiam.Services.Client.Tests [TestInitialize] public void TestInitialize() - { } + { + } [TestCleanup] public void TearDown() - { } + { + } [DataTestMethod] [DataRow(CompanyIdString)] @@ -130,7 +134,7 @@ namespace Tiam.Services.Client.Tests transferDest.Address.AddressText = modifiedAddress; transferDest = await _signalRClient.PostDataAsync(SignalRTags.UpdateTransferDestination, transferDest); - + Assert.IsNotNull(transferDest); Assert.IsNotNull(transferDest.Address); @@ -176,12 +180,12 @@ namespace Tiam.Services.Client.Tests var transferDestinationToProducts = await _signalRClient.GetByIdAsync>(SignalRTags.GetTransferDestinationToProductsByTransferDestinationId, transferDestId); Assert.IsNotNull(transferDestinationToProducts); Assert.IsTrue(transferDestinationToProducts.Count > 0); - Assert.IsTrue(transferDestinationToProducts.All(x=>x.TransferDestinationId == transferDestId)); + Assert.IsTrue(transferDestinationToProducts.All(x => x.TransferDestinationId == transferDestId)); transferDestinationToProducts = await _signalRClient.GetByIdAsync>(SignalRTags.GetTransferDestinationToProductsByProductId, productId); Assert.IsNotNull(transferDestinationToProducts); Assert.IsTrue(transferDestinationToProducts.Count > 0); - Assert.IsTrue(transferDestinationToProducts.All(x=>x.ProductId == productId)); + Assert.IsTrue(transferDestinationToProducts.All(x => x.ProductId == productId)); await _signalRClient.PostDataAsync(SignalRTags.RemoveTransferDestinationToProduct, transferDestinationToProduct); //mielõbb kitöröljük, h ne maradjon szemét a db-ben - J. @@ -199,16 +203,16 @@ namespace Tiam.Services.Client.Tests var criteriaString = CriteriaOperator.FromLambda(x => x.UserId == userId && statuses.Contains(x.TransferStatusType)).ToString(); //var criteria = CriteriaOperator.Parse(criteriaString); - + //_signalRDataSource.AsQueryable().Expression. //var filteredData = new List().AsQueryable().AppendWhere(converter, criteria) as IQueryable; - var transfers = await _signalRClient.GetAllAsync>(SignalRTags.GetTransfersByFilterText, [criteriaString]); + var transfers = await _signalRClient.GetTransfersByFilterText(criteriaString); //var transfers = await _signalRClient.GetAllAsync>(SignalRTags.GetTransfersByExpression, [userId, filteredData!.Expression]); Assert.IsNotNull(transfers); Assert.IsTrue(transfers.Count > 0); - Assert.IsTrue(transfers.All(x=>statuses.Contains(x.TransferStatusType))); + Assert.IsTrue(transfers.All(x => statuses.Contains(x.TransferStatusType))); //var converter = new CriteriaToExpressionConverter(); ////CriteriaOperator critOps = CriteriaOperator.Parse(tdashboard.EmployeeFilter); @@ -227,5 +231,46 @@ namespace Tiam.Services.Client.Tests //Assert.IsNotNull(filteredTransfers); //Assert.IsTrue(filteredTransfers.All(x => x.LuggageCount == 1)); } + + [TestMethod] + public async Task GetAllTransfersTest_ReturnTransfers_WhenHasTransfers() + { + var transfers = await _signalRClient.GetTransfers(); + + Assert.IsNotNull(transfers); + Assert.IsTrue(transfers.Count > 0); + } + + [TestMethod] + [DataRow("540271F6-C604-4C16-8160-D5A7CAFEDF00")] + public async Task GetTransfersByUserIdTest_ReturnTransfers_WhenAllTransfersByUserId(string userIdString) + { + var userId = Guid.Parse(userIdString); + var transfers = await _signalRClient.GetTransfersByUserId(userId); + + Assert.IsNotNull(transfers); + + Assert.IsTrue(transfers.Count > 0); + Assert.IsTrue(transfers.All(x => x.UserId == userId)); + } + + [TestMethod] + [DataRow("")] + public async Task GetAllCarsAndDriversByProductIdAsyncTest_ReturnCarsAndDrivers_WhenHasCarsAndDrivers(string productIdString) + { + var cars = new List(); + var drivers = new List(); + var productId = TiamConstClient.TransferProductId; //Guid.Parse(productIdString); + + await _signalRClient.GetAllCarsAndDriversByProductIdAsync(productId, cars, drivers); + + await TaskHelper.WaitToAsync(() => drivers.Count > 0, 5000, 50); + + Assert.IsTrue(cars.Count > 0); + Assert.IsTrue(drivers.Count > 0); + + Assert.IsTrue(cars.All(car => drivers.Any(driver => driver.Id == car.UserProductMappingId && driver.ProductId == productId))); + Assert.IsTrue(drivers.All(driver => driver.ProductId == productId && cars.Any(car => car.UserProductMappingId == driver.Id))); + } } } \ No newline at end of file From a26eb45d9f3c4091a885511883aa2ac249dbfae9 Mon Sep 17 00:00:00 2001 From: Loretta Date: Mon, 8 Jul 2024 07:31:22 +0200 Subject: [PATCH 2/2] Add Revenue to Transfer; improvements, fixes, etc... --- TIAM.Entities/Transfers/Transfer.cs | 2 ++ .../Components/EditComponents/DynamicEditForm.razor | 3 ++- TIAMSharedUI/Pages/Components/FullNameEditor.razor | 11 ++++++----- .../Pages/Components/FullNameEditor.razor.cs | 9 +++++---- TIAMSharedUI/Pages/Components/InputWizard.razor | 2 +- TIAMSharedUI/Pages/Login.razor | 4 ++-- TIAMSharedUI/Pages/Register.razor | 2 +- .../User/CardComponents/TransferCardComponent.razor | 2 +- .../Pages/User/Drivers/DriverManageCars.razor | 2 +- .../Pages/User/Drivers/DriverManageTransfers.razor | 6 +++--- TIAMSharedUI/Pages/User/Hotels/HotelComponent.razor | 10 +++++----- .../Pages/User/ManageMyServiceProvider.razor | 2 +- TIAMSharedUI/Pages/User/MyServiceProviders.razor | 2 +- TIAMSharedUI/Pages/User/SysAdmins/LogViewer.razor | 2 +- TIAMSharedUI/Pages/User/SysAdmins/ManageCars.razor | 2 +- .../Pages/User/SysAdmins/ManageDrivers.razor | 2 +- .../Pages/User/SysAdmins/ManageProducts.razor | 2 +- .../User/SysAdmins/ManageServiceProviders.razor | 2 +- .../ManageTransferDestinationToProducts.razor | 2 +- .../User/SysAdmins/ManageTransferDestinations.razor | 2 +- .../Pages/User/SysAdmins/ManageTransfers.razor | 5 +++-- .../User/SysAdmins/ManageUserProductMappings.razor | 2 +- TIAMSharedUI/Pages/User/SysAdmins/ManageUsers.razor | 2 +- .../Pages/User/SysAdmins/SysAdminComponent.razor | 12 ++++++------ 24 files changed, 49 insertions(+), 43 deletions(-) diff --git a/TIAM.Entities/Transfers/Transfer.cs b/TIAM.Entities/Transfers/Transfer.cs index f11a2b59..da467b03 100644 --- a/TIAM.Entities/Transfers/Transfer.cs +++ b/TIAM.Entities/Transfers/Transfer.cs @@ -42,6 +42,8 @@ public class Transfer: IEntityGuid, IAcFullName, ITimeStampInfo, IProductForeign public bool Paid { get; set; } public double? Price { get; set; } + public double? Revenue { get; set; } + public byte PassengerCount { get; set; } public byte LuggageCount { get; set; } diff --git a/TIAMSharedUI/Pages/Components/EditComponents/DynamicEditForm.razor b/TIAMSharedUI/Pages/Components/EditComponents/DynamicEditForm.razor index 115f70a4..bd8840dd 100644 --- a/TIAMSharedUI/Pages/Components/EditComponents/DynamicEditForm.razor +++ b/TIAMSharedUI/Pages/Components/EditComponents/DynamicEditForm.razor @@ -3,6 +3,7 @@ @using System.ComponentModel.DataAnnotations @using AyCode.Services.Loggers @using System.Reflection +@using AyCode.Blazor.Components.Components @using TIAM.Entities.Transfers @using TIAMSharedUI.Shared @using TIAMWebApp.Shared.Application.Utility @@ -227,7 +228,7 @@ else else if (property.PropertyType == typeof(IEnumerable) && property.Name == "Occupation") { - editor.OpenComponent>(j); + editor.OpenComponent>(j); editor.AddAttribute(j++, "Data", AdditionalData.Occupations); editor.AddAttribute(j++, "Value", property.GetValue(Data)); editor.AddAttribute(j++, "ValueExpression", lambda); diff --git a/TIAMSharedUI/Pages/Components/FullNameEditor.razor b/TIAMSharedUI/Pages/Components/FullNameEditor.razor index 9ccb75cc..844a735b 100644 --- a/TIAMSharedUI/Pages/Components/FullNameEditor.razor +++ b/TIAMSharedUI/Pages/Components/FullNameEditor.razor @@ -1,19 +1,20 @@ -

+@using AyCode.Blazor.Components.Components +

@NullText

- - - + - + @code { diff --git a/TIAMSharedUI/Pages/Components/FullNameEditor.razor.cs b/TIAMSharedUI/Pages/Components/FullNameEditor.razor.cs index 76267243..4ac49034 100644 --- a/TIAMSharedUI/Pages/Components/FullNameEditor.razor.cs +++ b/TIAMSharedUI/Pages/Components/FullNameEditor.razor.cs @@ -1,11 +1,12 @@ -using DevExpress.Blazor; +using AyCode.Blazor.Components.Components; +using DevExpress.Blazor; +using DevExpress.Blazor.Base; using Microsoft.AspNetCore.Components; namespace TIAMSharedUI.Pages.Components { public partial class FullNameEditor : ComponentBase { - [Parameter] public string FirstName { get; set; } @@ -24,8 +25,8 @@ namespace TIAMSharedUI.Pages.Components public EventCallback LastNameChanged { get; set; } public int InputDelay { get; set; } = 500; - public DxTextBox firstNameTextField; - public DxTextBox lastNameTextField; + public AcTextBox firstNameTextField; + public AcTextBox lastNameTextField; void OnFirstNameChanged(string newValue) { diff --git a/TIAMSharedUI/Pages/Components/InputWizard.razor b/TIAMSharedUI/Pages/Components/InputWizard.razor index e53f73de..0a19994c 100644 --- a/TIAMSharedUI/Pages/Components/InputWizard.razor +++ b/TIAMSharedUI/Pages/Components/InputWizard.razor @@ -2,7 +2,7 @@ @using System.ComponentModel.DataAnnotations @using BlazorAnimation -@* *@ +@* *@
- +
@@ -63,7 +63,7 @@
- +

Welcome back to Budapest Airport Transfer Services! We're delighted to have you return to our platform. Please sign in to access your account and manage your bookings effortlessly. If you're new here, feel free to create an account to unlock exclusive benefits and enjoy a seamless booking experience. diff --git a/TIAMSharedUI/Pages/Register.razor b/TIAMSharedUI/Pages/Register.razor index 79b36773..312b79d8 100644 --- a/TIAMSharedUI/Pages/Register.razor +++ b/TIAMSharedUI/Pages/Register.razor @@ -18,7 +18,7 @@

- +