From 191119c42787c0fff64586ba27bcf11116007afb Mon Sep 17 00:00:00 2001 From: Loretta Date: Fri, 29 Nov 2024 07:06:17 +0100 Subject: [PATCH] improvements --- .../Dtos/Interfaces/IProductToAuctionDtoBase.cs | 1 + .../Domains/Dtos/ProductToAuctionDto.cs | 15 ++++++++++++--- .../Domains/Entities/ProductToAuctionMapping.cs | 1 + .../Services/AuctionService.cs | 3 ++- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Nop.Plugin.Misc.AuctionPlugin/Domains/Dtos/Interfaces/IProductToAuctionDtoBase.cs b/Nop.Plugin.Misc.AuctionPlugin/Domains/Dtos/Interfaces/IProductToAuctionDtoBase.cs index 204d436..0e82738 100644 --- a/Nop.Plugin.Misc.AuctionPlugin/Domains/Dtos/Interfaces/IProductToAuctionDtoBase.cs +++ b/Nop.Plugin.Misc.AuctionPlugin/Domains/Dtos/Interfaces/IProductToAuctionDtoBase.cs @@ -17,4 +17,5 @@ public interface IProductToAuctionDtoBase : IMgModelDtoBase public int ProductAmount { get; set; } public int SortIndex { get; set; } + public string BiddingNumber { get; set; } } \ No newline at end of file diff --git a/Nop.Plugin.Misc.AuctionPlugin/Domains/Dtos/ProductToAuctionDto.cs b/Nop.Plugin.Misc.AuctionPlugin/Domains/Dtos/ProductToAuctionDto.cs index 4b1bfb2..b7f06ca 100644 --- a/Nop.Plugin.Misc.AuctionPlugin/Domains/Dtos/ProductToAuctionDto.cs +++ b/Nop.Plugin.Misc.AuctionPlugin/Domains/Dtos/ProductToAuctionDto.cs @@ -12,6 +12,7 @@ public class ProductToAuctionDto : IProductToAuctionDto public int ProductId { get; set; } public int AuctionId { get; set; } public int WinnerCustomerId { get; set; } + public string BiddingNumber { get; set; } public AuctionStatus AuctionStatus { get; set; } public decimal StartingPrice { get; set; } public decimal CurrentPrice { get; set; } @@ -22,14 +23,20 @@ public class ProductToAuctionDto : IProductToAuctionDto /// EGYELŐRE NE HASZNÁLD!!! - J. /// public decimal StepAmount { get; set; } + public List AuctionBidDtos { get; } = []; public bool IsActiveItem => AuctionStatus is AuctionStatus.Active or AuctionStatus.FirstWarning or AuctionStatus.SecondWarning; public decimal BidPrice { get; set; } - public ProductToAuctionDto() { } - public ProductToAuctionDto(ProductToAuctionMapping productToAuction) : this(productToAuction, 0/*AuctionService.GetStepAmount(productToAuction.BidPrice)*/) { } + public ProductToAuctionDto() + { + } + + public ProductToAuctionDto(ProductToAuctionMapping productToAuction) : this(productToAuction, 0 /*AuctionService.GetStepAmount(productToAuction.BidPrice)*/) + { + } /// /// @@ -42,7 +49,7 @@ public class ProductToAuctionDto : IProductToAuctionDto if (stepAmount > 0) StepAmount = stepAmount; //else StepAmount = AuctionService.GetStepAmount(productToAuction.BidPrice); - + Id = productToAuction.Id; ProductId = productToAuction.ProductId; @@ -53,6 +60,7 @@ public class ProductToAuctionDto : IProductToAuctionDto ProductAmount = productToAuction.ProductAmount; SortIndex = productToAuction.SortIndex; WinnerCustomerId = productToAuction.WinnerCustomerId; + BiddingNumber = productToAuction.BiddingNumber; } public ProductToAuctionMapping CreateMainEntity() @@ -68,6 +76,7 @@ public class ProductToAuctionDto : IProductToAuctionDto mainEntity.ProductAmount = ProductAmount; mainEntity.SortIndex = SortIndex; mainEntity.WinnerCustomerId = WinnerCustomerId; + mainEntity.BiddingNumber = BiddingNumber; return mainEntity; } diff --git a/Nop.Plugin.Misc.AuctionPlugin/Domains/Entities/ProductToAuctionMapping.cs b/Nop.Plugin.Misc.AuctionPlugin/Domains/Entities/ProductToAuctionMapping.cs index b08fa12..22e7858 100644 --- a/Nop.Plugin.Misc.AuctionPlugin/Domains/Entities/ProductToAuctionMapping.cs +++ b/Nop.Plugin.Misc.AuctionPlugin/Domains/Entities/ProductToAuctionMapping.cs @@ -17,6 +17,7 @@ public partial class ProductToAuctionMapping : MgEntityBase, IProductToAuctionMa public int OrderId { get; set; } public Guid? OrderGuid { get; set; } public int WinnerCustomerId { get; set; } + public string BiddingNumber { get; set; } [NotMapped] [NotColumn] diff --git a/Nop.Plugin.Misc.AuctionPlugin/Services/AuctionService.cs b/Nop.Plugin.Misc.AuctionPlugin/Services/AuctionService.cs index 798deec..66fdd3d 100644 --- a/Nop.Plugin.Misc.AuctionPlugin/Services/AuctionService.cs +++ b/Nop.Plugin.Misc.AuctionPlugin/Services/AuctionService.cs @@ -255,7 +255,8 @@ public class AuctionService( CustomerId = productToAuction.WinnerCustomerId, OrderTotal = productToAuction.CurrentPrice, }; - processPaymentRequest.CustomValues.Add("ProductToAuctionMappingId", productToAuction.Id); + processPaymentRequest.CustomValues.Add("TÉTEL: ", $"#{productToAuction.SortIndex}"); + processPaymentRequest.CustomValues.Add("PTAID", $"#{productToAuction.Id}"); var product = await productService.GetProductByIdAsync(productToAuction.ProductId); product.DisableBuyButton = false; //TODO: ezt automatikusan kéne false-ra állítani, mikor Assign-oljuk a ProductToAuctionItem-hez! vagy valami hasonló... - J.