From 7a5dc75e2b48fb6fce77b1c01efd6eabc504a9d3 Mon Sep 17 00:00:00 2001 From: "jozsef.b@aycode.com" <9Rj@D}fVwBaN> Date: Wed, 6 Mar 2024 12:08:45 +0100 Subject: [PATCH] Add ITransfeDestinationPrices; Fix TransferDestination prices; --- .../Transfers/ITransfeDestinationPrices.cs | 15 +++++++++++++++ TIAM.Entities/Transfers/TransferDestination.cs | 11 +++++++++-- .../Transfers/TransferDestinationToProduct.cs | 8 +++++--- .../User/SysAdmins/TransferDestinations.razor.cs | 2 +- .../Controllers/TransferDataAPIController.cs | 9 +++++---- .../TransferDestinationWizardModel.cs | 16 ++++++++++------ 6 files changed, 45 insertions(+), 16 deletions(-) create mode 100644 TIAM.Entities/Transfers/ITransfeDestinationPrices.cs diff --git a/TIAM.Entities/Transfers/ITransfeDestinationPrices.cs b/TIAM.Entities/Transfers/ITransfeDestinationPrices.cs new file mode 100644 index 00000000..36d7119c --- /dev/null +++ b/TIAM.Entities/Transfers/ITransfeDestinationPrices.cs @@ -0,0 +1,15 @@ +namespace TIAM.Entities.Transfers; + +public interface ITransfeDestinationPrices +{ + //public PriceType PriceType { get; set; } + public double Price { get; set; } + public double? Price2 { get; set; } + public double? Price3 { get; set; } + + public double? ExtraPrice { get; set; } + /// + /// Kihajtás v. behajtás az ExtraPrice! Ha null, akkor mindkettő... + /// + public bool? ExtraPriceType { get; set; } +} \ No newline at end of file diff --git a/TIAM.Entities/Transfers/TransferDestination.cs b/TIAM.Entities/Transfers/TransferDestination.cs index 92b530c6..50068157 100644 --- a/TIAM.Entities/Transfers/TransferDestination.cs +++ b/TIAM.Entities/Transfers/TransferDestination.cs @@ -8,7 +8,7 @@ using TIAM.Entities.Addresses; namespace TIAM.Entities.Transfers { [Table("TransferDestination")] - public class TransferDestination : IEntityGuid, ITimeStampInfo //LocationBase + public class TransferDestination : IEntityGuid, ITransfeDestinationPrices, ITimeStampInfo //LocationBase { [Key, DatabaseGenerated(DatabaseGeneratedOption.None)] public Guid Id { get; set; } @@ -24,8 +24,15 @@ namespace TIAM.Entities.Transfers public string Description { get; set; } - //public PriceType PriceType { get; set; } public double Price { get; set; } + public double? Price2 { get; set; } + public double? Price3 { get; set; } + + public double? ExtraPrice { get; set; } + /// + /// Kihajtás v. behajtás az ExtraPrice! Ha null, akkor mindkettő... + /// + public bool? ExtraPriceType { get; set; } //TEMPORARY!!! public string? AddressString { get; set; } diff --git a/TIAM.Entities/Transfers/TransferDestinationToProduct.cs b/TIAM.Entities/Transfers/TransferDestinationToProduct.cs index beee31b6..77d89a6f 100644 --- a/TIAM.Entities/Transfers/TransferDestinationToProduct.cs +++ b/TIAM.Entities/Transfers/TransferDestinationToProduct.cs @@ -8,7 +8,7 @@ using TIAM.Entities.Products; namespace TIAM.Entities.Transfers { [Table(nameof(TransferDestinationToProduct))] - public class TransferDestinationToProduct : IEntityGuid, ITimeStampInfo, IProductForeignKey + public class TransferDestinationToProduct : IEntityGuid, ITimeStampInfo, IProductForeignKey, ITransfeDestinationPrices { [Key, DatabaseGenerated(DatabaseGeneratedOption.None)] public Guid Id { get; set; } @@ -19,14 +19,16 @@ namespace TIAM.Entities.Transfers public Guid TransferDestinationId { get; set; } public virtual TransferDestination TransferDestination { get; set; } - //public PriceType PriceType { get; set; } public double Price { get; set; } public double? Price2 { get; set; } public double? Price3 { get; set; } public double? ExtraPrice { get; set; } + /// + /// Kihajtás v. behajtás az ExtraPrice! Ha null, akkor mindkettő... + /// public bool? ExtraPriceType { get; set; } - + public DateTime Created { get; set; } public DateTime Modified { get; set; } } diff --git a/TIAMSharedUI/Pages/User/SysAdmins/TransferDestinations.razor.cs b/TIAMSharedUI/Pages/User/SysAdmins/TransferDestinations.razor.cs index 98f7583d..de1cf910 100644 --- a/TIAMSharedUI/Pages/User/SysAdmins/TransferDestinations.razor.cs +++ b/TIAMSharedUI/Pages/User/SysAdmins/TransferDestinations.razor.cs @@ -176,7 +176,7 @@ namespace TIAMSharedUI.Pages.User.SysAdmins { //add new transferwizardmodel to transferData array TransferDataFromDb = ((TransferDestinationWizardModel[])TransferDataFromDb).Append( - new TransferDestinationWizardModel(item.Id, item.Name, item.Description, item.AddressString, item.Price, item.PriceType, item.Address)).ToArray(); + new TransferDestinationWizardModel(item.Id, item.Name, item.Description, item.AddressString, item.Price, item.Address)).ToArray(); logToBrowserConsole.LogToBC($"TransferDataFromDb: {item.Name}"); } diff --git a/TIAMWebApp/Server/Controllers/TransferDataAPIController.cs b/TIAMWebApp/Server/Controllers/TransferDataAPIController.cs index 134ee884..eef35a0f 100644 --- a/TIAMWebApp/Server/Controllers/TransferDataAPIController.cs +++ b/TIAMWebApp/Server/Controllers/TransferDataAPIController.cs @@ -102,9 +102,10 @@ namespace TIAMWebApp.Server.Controllers Console.WriteLine($"TransferDestination to be created: {transferDestination.AddressId}"); Console.WriteLine($"TransferDestination to be created: {transferDestination.Name}"); Console.WriteLine($"TransferDestination to be created: {transferDestination.Price}"); - //Console.WriteLine($"TransferDestination to be created: {transferDestination.Price2}"); - //Console.WriteLine($"TransferDestination to be created: {transferDestination.Price3}"); - Console.WriteLine($"TransferDestination to be created: {transferDestination.PriceType}"); + Console.WriteLine($"TransferDestination to be created: {transferDestination.Price2}"); + Console.WriteLine($"TransferDestination to be created: {transferDestination.Price3}"); + Console.WriteLine($"TransferDestination to be created: {transferDestination.ExtraPrice}"); + Console.WriteLine($"TransferDestination to be created: {transferDestination.ExtraPriceType}"); Console.WriteLine($"TransferDestination to be created: {transferDestination.AddressString}"); Console.WriteLine($"TransferDestination to be created: {transferDestination.Description}"); @@ -162,7 +163,7 @@ namespace TIAMWebApp.Server.Controllers Console.WriteLine($"TransferDestination to be updated new price: {transferDestination.Price}"); //Console.WriteLine($"TransferDestination to be updated new price: {transferDestination.Price2}"); //Console.WriteLine($"TransferDestination to be updated new price: {transferDestination.Price3}"); - Console.WriteLine($"TransferDestination to be updated new priceType: {transferDestination.PriceType}"); + //Console.WriteLine($"TransferDestination to be updated new priceType: {transferDestination.PriceType}"); Console.WriteLine($"TransferDestination to be updated new address: {transferDestination.AddressString}"); Console.WriteLine($"TransferDestination to be updated new description: {transferDestination.Description}"); diff --git a/TIAMWebApp/Shared/Models/ClientSide/UI/WizardModels/TransferDestinationWizardModel.cs b/TIAMWebApp/Shared/Models/ClientSide/UI/WizardModels/TransferDestinationWizardModel.cs index a2d29a81..e5f7f45f 100644 --- a/TIAMWebApp/Shared/Models/ClientSide/UI/WizardModels/TransferDestinationWizardModel.cs +++ b/TIAMWebApp/Shared/Models/ClientSide/UI/WizardModels/TransferDestinationWizardModel.cs @@ -57,9 +57,9 @@ namespace TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels public TransferDestinationWizardModel() { } - public TransferDestinationWizardModel(string name, string description, string addressString, double price, PriceType priceType, Address address) :this(Guid.NewGuid(), name, description, addressString, price, priceType, address) + public TransferDestinationWizardModel(string name, string description, string addressString, double price, Address address) :this(Guid.NewGuid(), name, description, addressString, price, address) { } - public TransferDestinationWizardModel(Guid id, string name, string description, string addressString, double price, PriceType priceType, Address address) + public TransferDestinationWizardModel(Guid id, string name, string description, string addressString, double price, Address address) { Id = id.ToString(); @@ -67,7 +67,10 @@ namespace TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels Description = description; AddressString = addressString; Price = price; - PriceType = priceType; + //Price2 = price2; + //Price3 = price3; + //ExtraPrice = extraPrice; + //ExtraPriceType= extraPriceType; Address = address; } @@ -81,9 +84,10 @@ namespace TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels destination.Description = model.Description; destination.AddressString = model.AddressString; destination.Price = model.Price; - //destination.Price2 = model.Price; - //destination.Price3 = model.Price; - destination.PriceType = model.PriceType; + destination.Price2 = model.Price; + destination.Price3 = model.Price; + //destination.ExtraPrice = model.ExtraPrice; + //destination.ExtraPriceType= model.ExtraPriceType; destination.Address = model.Address; if (destination.Address == null)