improvements

This commit is contained in:
Loretta 2024-11-29 07:06:17 +01:00
parent 82876de785
commit 191119c427
4 changed files with 16 additions and 4 deletions

View File

@ -17,4 +17,5 @@ public interface IProductToAuctionDtoBase : IMgModelDtoBase
public int ProductAmount { get; set; }
public int SortIndex { get; set; }
public string BiddingNumber { get; set; }
}

View File

@ -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.
/// </summary>
public decimal StepAmount { get; set; }
public List<AuctionBidDto> 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)*/)
{
}
/// <summary>
///
@ -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;
}

View File

@ -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]

View File

@ -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.