diff --git a/Nop.Plugin.Misc.AuctionPlugin/Areas/Admin/Controllers/AnnouncementController.cs b/Nop.Plugin.Misc.AuctionPlugin/Areas/Admin/Controllers/AnnouncementController.cs index 125ebdd..cab1133 100644 --- a/Nop.Plugin.Misc.AuctionPlugin/Areas/Admin/Controllers/AnnouncementController.cs +++ b/Nop.Plugin.Misc.AuctionPlugin/Areas/Admin/Controllers/AnnouncementController.cs @@ -40,6 +40,7 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Areas.Admin.Controllers public AnnouncementController( IAnnouncementService announcementService, IHubContext announcementHubContext, + AuctionService auctionService, ILogger logger) { _announcementService = announcementService; @@ -97,7 +98,7 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Areas.Admin.Controllers var viewModel = new BidNotificationViewModel(); viewModel.ProductName = "Picasso - Önarckép"; viewModel.BidPrice = 200000; - viewModel.NextStepAmount = 50000; + viewModel.NextStepAmount = AuctionService.GetStepAmount(viewModel.BidPrice); return View("~/Plugins/Misc.AuctionPlugin/Areas/Admin/Views/BidNotification.cshtml", viewModel); } @@ -122,7 +123,7 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Areas.Admin.Controllers ProductName = viewModel.ProductName, CurrentPrice = viewModel.BidPrice, NextStepAmount = viewModel.NextStepAmount, - NextBidPrice = viewModel.BidPrice + viewModel.NextStepAmount + //NextBidPrice = AuctionService.GetNextBidPrice(viewModel.BidPrice, startingPrice, viewModel.NextStepAmount) }.ToJson() }; var jsonMessage = JsonConvert.SerializeObject(bid, Formatting.Indented, diff --git a/Nop.Plugin.Misc.AuctionPlugin/Components/AuctionPublicViewComponent.cs b/Nop.Plugin.Misc.AuctionPlugin/Components/AuctionPublicViewComponent.cs index d17e53b..156e6eb 100644 --- a/Nop.Plugin.Misc.AuctionPlugin/Components/AuctionPublicViewComponent.cs +++ b/Nop.Plugin.Misc.AuctionPlugin/Components/AuctionPublicViewComponent.cs @@ -47,7 +47,7 @@ public class AuctionPublicViewComponent : NopViewComponent IWorkContext workContext, IStoreContext storeContext, ICurrencyService currencyService, - AuctionService auctionService, + AuctionService auctionService, //AuctionSettings auctionSettings, ICustomerService customerService, IWebHelper webHelper, @@ -198,14 +198,14 @@ public class AuctionPublicViewComponent : NopViewComponent productBidBoxViewModel.AuctionStatus = status; productBidBoxViewModel.WidgetZone = widgetZone; //comes in WORKINGCURRENCY - productBidBoxViewModel.BasePrice = productDetailsModel.ProductPrice.OldPriceValue; + productBidBoxViewModel.BasePrice = productToAuction.StartingPrice; //comes in WORKINGCURRENCY - productBidBoxViewModel.CurrentPrice = productDetailsModel.ProductPrice.PriceValue; + productBidBoxViewModel.CurrentPrice = productToAuction.CurrentPrice; //productBidBoxViewModel.ProductToAuctionId = productToAuctionId.FirstOrDefault().Id; //productBidBoxViewModel.AuctionId = auctionId; productBidBoxViewModel.CustomerId = customer.Id; productBidBoxViewModel.WorkingCurrency = currency; - productBidBoxViewModel.ProductId = productDetailsModel.Id; + productBidBoxViewModel.ProductId = productToAuction.ProductId; //productBidBoxViewModel.NextProductUrl = Url.RouteUrl("Product", productDetailsModel.SeName); productBidBoxViewModel.NextProductUrl = nextUrl; productBidBoxViewModel.LastProductUrl = lastUrl; @@ -216,9 +216,9 @@ public class AuctionPublicViewComponent : NopViewComponent //comes in HUF productBidBoxViewModel.LicitStep = AuctionService.GetStepAmount(productToAuction.CurrentPrice); //add calculation //comes IN HUF - productBidBoxViewModel.LicitStepInWorkingCurrency = AuctionService.GetStepAmount(productToAuction.CurrentPrice) * currency.Rate; + productBidBoxViewModel.LicitStepInWorkingCurrency = productBidBoxViewModel.LicitStep * currency.Rate; //comes in HUF - productBidBoxViewModel.NextBidPrice = AuctionService.GetNextBidPrice(productToAuction.CurrentPrice, productBidBoxViewModel.LicitStep); + productBidBoxViewModel.NextBidPrice = AuctionService.GetNextBidPrice(productToAuction.CurrentPrice, productBidBoxViewModel.LicitStep, productToAuction.BidsCount > 0); productBidBoxViewModel.NextBidPriceInWorkingCurrency = productBidBoxViewModel.NextBidPrice * currency.Rate; if(productBidBoxViewModel.BasePrice != null) { diff --git a/Nop.Plugin.Misc.AuctionPlugin/Domains/DataLayer/ProductToAuctionDbTable.cs b/Nop.Plugin.Misc.AuctionPlugin/Domains/DataLayer/ProductToAuctionDbTable.cs index 7fed99f..07b97f8 100644 --- a/Nop.Plugin.Misc.AuctionPlugin/Domains/DataLayer/ProductToAuctionDbTable.cs +++ b/Nop.Plugin.Misc.AuctionPlugin/Domains/DataLayer/ProductToAuctionDbTable.cs @@ -8,6 +8,7 @@ using Nop.Data; using Nop.Plugin.Misc.AuctionPlugin.Domains.Entities; using Nop.Plugin.Misc.AuctionPlugin.Domains.Enums; using Nop.Plugin.Misc.AuctionPlugin.Hubs; +using Nop.Plugin.Misc.AuctionPlugin.Services; using Nop.Services.Events; using Nop.Services.Logging; @@ -44,6 +45,16 @@ public class ProductToAuctionDbTable : MgDbTableBase (!activeProductOnly || x.AuctionStatus == AuctionStatus.Active || x.AuctionStatus == AuctionStatus.FirstWarning || x.AuctionStatus == AuctionStatus.SecondWarning /*HasActiveAuctionStatus(x.AuctionStatus)*/)); } + public IQueryable GetNotClosedItemsByAuctionId(int auctionId) + { + return Table.Where(x => x.AuctionId == auctionId && x.AuctionStatus != AuctionStatus.Sold && x.AuctionStatus != AuctionStatus.NotSold); + } + + public Task GetNextItemByAuctionIdAsync(int auctionId) + { + return GetNotClosedItemsByAuctionId(auctionId).OrderBy(x => x.SortIndex).FirstOrDefaultAsync(); + } + public async Task ResetByProductIdAsync(int productId, decimal basePrice) => await ResetAsync(await GetByProductId(productId).FirstOrDefaultAsync(), basePrice); public async Task ResetByIdAsync(int productToAuctionId, decimal basePrice) => await ResetAsync(await GetByIdAsync(productToAuctionId), basePrice); public async Task ResetAsync(ProductToAuctionMapping productToAuction, decimal basePrice) @@ -63,6 +74,8 @@ public class ProductToAuctionDbTable : MgDbTableBase productToAuction.OrderItemId = 0; productToAuction.OrderId = 0; productToAuction.AuctionStatus = AuctionStatus.None; + productToAuction.BiddingNumber = null; + productToAuction.BidsCount = 0; await UpdateAsync(productToAuction); } diff --git a/Nop.Plugin.Misc.AuctionPlugin/Domains/Dtos/Interfaces/IProductToAuctionDtoBase.cs b/Nop.Plugin.Misc.AuctionPlugin/Domains/Dtos/Interfaces/IProductToAuctionDtoBase.cs index 2bc8b17..5c5d925 100644 --- a/Nop.Plugin.Misc.AuctionPlugin/Domains/Dtos/Interfaces/IProductToAuctionDtoBase.cs +++ b/Nop.Plugin.Misc.AuctionPlugin/Domains/Dtos/Interfaces/IProductToAuctionDtoBase.cs @@ -18,4 +18,6 @@ public interface IProductToAuctionDtoBase : IMgModelDtoBase public int ProductAmount { get; set; } public int SortIndex { get; set; } + public int? BiddingNumber { get; set; } + public int BidsCount { 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 0f97f9d..39b9803 100644 --- a/Nop.Plugin.Misc.AuctionPlugin/Domains/Dtos/ProductToAuctionDto.cs +++ b/Nop.Plugin.Misc.AuctionPlugin/Domains/Dtos/ProductToAuctionDto.cs @@ -18,6 +18,8 @@ public class ProductToAuctionDto : IProductToAuctionDto public decimal CurrentPrice { get; set; } public int ProductAmount { get; set; } public int SortIndex { get; set; } + public int? BiddingNumber { get; set; } + public int BidsCount { get; set; } /// /// EGYELŐRE NE HASZNÁLD!!! - J. @@ -28,7 +30,7 @@ public class ProductToAuctionDto : IProductToAuctionDto public bool IsActiveItem => AuctionStatus is AuctionStatus.Active or AuctionStatus.FirstWarning or AuctionStatus.SecondWarning; - public decimal BidPrice { get; set; } + //public decimal BidPrice { get; set; } //TODO: ez mire kell? - J. public ProductToAuctionDto() { @@ -60,6 +62,8 @@ public class ProductToAuctionDto : IProductToAuctionDto ProductAmount = productToAuction.ProductAmount; SortIndex = productToAuction.SortIndex; WinnerCustomerId = productToAuction.WinnerCustomerId; + BidsCount = productToAuction.BidsCount; + BiddingNumber = productToAuction.BiddingNumber; } public ProductToAuctionMapping CreateMainEntity() @@ -75,6 +79,8 @@ public class ProductToAuctionDto : IProductToAuctionDto mainEntity.ProductAmount = ProductAmount; mainEntity.SortIndex = SortIndex; mainEntity.WinnerCustomerId = WinnerCustomerId; + mainEntity.BidsCount = BidsCount; + mainEntity.BiddingNumber = BiddingNumber; return mainEntity; } diff --git a/Nop.Plugin.Misc.AuctionPlugin/Domains/Entities/Interfaces/IProductToAuctionMapping.cs b/Nop.Plugin.Misc.AuctionPlugin/Domains/Entities/Interfaces/IProductToAuctionMapping.cs index 3b81060..1588b64 100644 --- a/Nop.Plugin.Misc.AuctionPlugin/Domains/Entities/Interfaces/IProductToAuctionMapping.cs +++ b/Nop.Plugin.Misc.AuctionPlugin/Domains/Entities/Interfaces/IProductToAuctionMapping.cs @@ -5,8 +5,6 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Domains.Entities.Interfaces; public interface IProductToAuctionMapping : IProductToAuctionDtoBase, ITimeStampInfo //, ISoftRemoveEntityInt { - public int? BiddingNumber { get; set; } - - public int OrderId { get; set; } + public int OrderId { get; set; } public int OrderItemId { get; set; } } \ No newline at end of file diff --git a/Nop.Plugin.Misc.AuctionPlugin/Domains/Entities/ProductToAuctionMapping.cs b/Nop.Plugin.Misc.AuctionPlugin/Domains/Entities/ProductToAuctionMapping.cs index 38bc845..15690e2 100644 --- a/Nop.Plugin.Misc.AuctionPlugin/Domains/Entities/ProductToAuctionMapping.cs +++ b/Nop.Plugin.Misc.AuctionPlugin/Domains/Entities/ProductToAuctionMapping.cs @@ -18,6 +18,7 @@ public partial class ProductToAuctionMapping : MgEntityBase, IProductToAuctionMa public int OrderItemId { get; set; } public int WinnerCustomerId { get; set; } public int? BiddingNumber { get; set; } + public int BidsCount { get; set; } [NotMapped] [NotColumn] diff --git a/Nop.Plugin.Misc.AuctionPlugin/Domains/Enums/AuctionRequestMode.cs b/Nop.Plugin.Misc.AuctionPlugin/Domains/Enums/AuctionRequestMode.cs new file mode 100644 index 0000000..05ad38e --- /dev/null +++ b/Nop.Plugin.Misc.AuctionPlugin/Domains/Enums/AuctionRequestMode.cs @@ -0,0 +1,7 @@ +namespace Nop.Plugin.Misc.AuctionPlugin.Domains.Enums; + +public enum AuctionRequestMode : byte +{ + Normal = 0, + Edit = 5 +} \ No newline at end of file diff --git a/Nop.Plugin.Misc.AuctionPlugin/Hubs/SignalRMessageHandler.cs b/Nop.Plugin.Misc.AuctionPlugin/Hubs/SignalRMessageHandler.cs index 936126c..abd9d27 100644 --- a/Nop.Plugin.Misc.AuctionPlugin/Hubs/SignalRMessageHandler.cs +++ b/Nop.Plugin.Misc.AuctionPlugin/Hubs/SignalRMessageHandler.cs @@ -48,6 +48,7 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Hubs return; } + //TODO: az összes request-et egy base-ből származtatni és beletenni az AuctionRequestMode-ot! - J. using (_handleMessageMutex.UseWaitOne()) { try @@ -110,7 +111,11 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Hubs var revertLastBid = await auctionService.RevertAuctionBidByProductToAuctionIdAsync(productToAuction.Id); if (revertLastBid == null) await ResetProductToAuction(productToAuction); - else await SetAuctionBidPrice(revertLastBid.BidPrice, productToAuction, product, revertLastBid.CustomerId); + else + { + productToAuction.BidsCount = await auctionService.GetBidsCountByProductToAuctionIdAsync(productToAuction.Id); + await SetAuctionBidPrice(revertLastBid.BidPrice, productToAuction, product, revertLastBid.CustomerId); + } await SendAuctionBidMessageAsync(productToAuction, product, customer.Id); } @@ -206,13 +211,12 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Hubs SenderId = customer.Id, Data = new ProductToAuctionStatusNotification(await auctionService.GetAuctionDtoByProductToAuctionIdAsync(productToAuction.Id, true), bidsCount, "EMPTY").ToJson() }; - + await hubContext.Clients.All.SendAsync("send", productToauctionChangedNotification.ToJson()); - //if (productToAuction.AuctionStatus is AuctionStatus.FirstWarning or AuctionStatus.SecondWarning or AuctionStatus.Pause) return; - - //var isFeaturedProduct = productToAuction.IsActiveItem || productToAuction.AuctionStatus == AuctionStatus.Pause; - //await UpdateProductCategoryIsFeaturedAsync(isFeaturedProduct, auction.CategoryId, productToAuction.ProductId); + //TODO: gond van ha az Admin valamit módosít és újrazár egy régi ProductToAuction-t!!!! AuctionRequestMode.Normal...- J. + if (/*AuctionRequestMode.Normal &&*/ auction.AuctionType == AuctionType.AutomaticNext && productToAuction.AuctionStatus is AuctionStatus.Sold or AuctionStatus.NotSold) + await StepNextProductToAuctionAsync(customer, productToAuction, auctionProductStatusRequest); } catch (Exception ex) { @@ -220,6 +224,25 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Hubs } } + private async Task StepNextProductToAuctionAsync(Customer customer, ProductToAuctionMapping productToAuction, AuctionProductStatusRequest auctionProductStatusRequest) + { + var nextProductToAuction = await auctionService.GetNextProductToAuctionByAuctionIdAsync(productToAuction.AuctionId); + if (nextProductToAuction == null) return; + + await logger.InformationAsync($"SignalRMessageHandler.StepNextProductToAuctionAsync(); NextProductToAuctionId: {nextProductToAuction.Id};", null, customer); + + if (nextProductToAuction.AuctionStatus != AuctionStatus.None) + { + await logger.WarningAsync($"SignalRMessageHandler.StepNextProductToAuctionAsync(); (nextProductToAuction.AuctionStatus != AuctionStatus.None); NextProductToAuctionId: {nextProductToAuction.Id}; Status: {nextProductToAuction.AuctionStatus}({(int)nextProductToAuction.AuctionStatus})", null, customer); + return; //TODO: Ilyenkor mi legyen?! - J. + } + + auctionProductStatusRequest.AuctionStatus = AuctionStatus.Active; + auctionProductStatusRequest.ProductToAuctionId = nextProductToAuction.Id; + + await HandleProductToAuctionStatusChangedRequest(customer, auctionProductStatusRequest); + } + private async Task HandleBidRequest(Customer customer, AuctionBidRequest bidRequestMessage) { if (bidRequestMessage == null) @@ -249,12 +272,13 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Hubs var product = await auctionService.GetProductById(bidRequestMessage.ProductId); if (product == null) return; - if (!IsValidBidPrice(product.Price, activeProductAuction.CurrentPrice, bidRequestMessage.BidPrice, customer)) return; + if (!IsValidBidPrice(activeProductAuction.CurrentPrice, bidRequestMessage.BidPrice, activeProductAuction.BidsCount > 0, customer)) return; var auctionBid = bidRequestMessage.CreateMainEntity(); auctionBid.ProductAuctionMappingId = activeProductAuction.Id; await auctionService.InsertBidAsync(auctionBid); + activeProductAuction.BidsCount++; activeProductAuction.AuctionStatus = AuctionStatus.Active; if (!await SetAuctionBidPrice(auctionBid.BidPrice, activeProductAuction, product, customer.Id)) return; @@ -275,7 +299,7 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Hubs await productService.UpdateProductAsync(product); //activeProductAuction.StartingPrice = product.OldPrice; //TODO: ez biztosan kezelve van mikor összerendeljük? - J. - productToAuction.CurrentPrice = product.Price; + productToAuction.CurrentPrice = bidPrice; productToAuction.WinnerCustomerId = lastBidCustomerId; await auctionService.UpdateProductToAuctionMappingAsync(productToAuction); @@ -291,10 +315,11 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Hubs private async Task SendAuctionBidMessageAsync(ProductToAuctionMapping productToAuction, Product product, int customerId) { - var stepAmount = GetStepAmount(productToAuction.CurrentPrice); - var nextBidPrice = GetNextBidPrice(productToAuction.CurrentPrice, stepAmount); + var bidsCount = productToAuction.BidsCount;//await auctionService.GetBidsCountByProductToAuctionIdAsync(productToAuction.Id); + + var stepAmount = GetStepAmount(productToAuction.CurrentPrice); + var nextBidPrice = GetNextBidPrice(productToAuction.CurrentPrice, stepAmount, bidsCount > 0); - var bidsCount = await auctionService.GetBidsCountByProductToAuctionIdAsync(productToAuction.Id); var bidMessage = new MessageWrapper { MessageType = "bidNotification", @@ -341,20 +366,21 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Hubs } } - private bool IsValidBidPrice(decimal productPrice, decimal productToAuctionCurrentPrice, decimal bidRequestPrice, Customer customer = null) + private bool IsValidBidPrice(decimal productToAuctionCurrentPrice, decimal bidRequestPrice, bool hasAuctionBidInDb, Customer customer = null) { - if (productPrice >= bidRequestPrice || productToAuctionCurrentPrice >= bidRequestPrice || bidRequestPrice != GetNextBidPrice(productToAuctionCurrentPrice)) - { - logger.Warning($"SignalRMessageHandler.IsValidBidPrice(); (productPrice >= bidRequestPrice || productToAuctionCurrentPrice >= bidRequestPrice || bidRequestPrice != GetNextBidPrice(productToAuctionCurrentPrice)); productPrice: {productPrice}; productToAuctionCurrentPrice: {productToAuctionCurrentPrice}; bidRequestPrice: {bidRequestPrice}", null, customer); - return false; - } + var nextBidPrice = GetNextBidPrice(productToAuctionCurrentPrice, hasAuctionBidInDb); + if (bidRequestPrice != nextBidPrice) + { + logger.Warning($"SignalRMessageHandler.IsValidBidPrice(); (bidRequestPrice != nextBidPrice); productToAuctionCurrentPrice: {productToAuctionCurrentPrice}; bidRequestPrice: {bidRequestPrice}; hasAuctionBidInDb: {hasAuctionBidInDb}", null, customer); + return false; + } - return true; + return true; } private static decimal GetStepAmount(decimal currentBidPrice) => AuctionService.GetStepAmount(currentBidPrice); - private static decimal GetNextBidPrice(decimal currentBidPrice) => AuctionService.GetNextBidPrice(currentBidPrice, GetStepAmount(currentBidPrice)); - private static decimal GetNextBidPrice(decimal currentBidPrice, decimal stepAmount) => AuctionService.GetNextBidPrice(currentBidPrice, stepAmount); + private static decimal GetNextBidPrice(decimal currentBidPrice, bool hasAuctionBidInDb) => GetNextBidPrice(currentBidPrice, GetStepAmount(currentBidPrice), hasAuctionBidInDb); + private static decimal GetNextBidPrice(decimal currentBidPrice, decimal stepAmount, bool hasAuctionBidInDb) => AuctionService.GetNextBidPrice(currentBidPrice, stepAmount, hasAuctionBidInDb); private static bool IsValidRequestAuctionStatus(AuctionStatus newStatus, AuctionStatus oldStatus) { diff --git a/Nop.Plugin.Misc.AuctionPlugin/Services/AuctionService.cs b/Nop.Plugin.Misc.AuctionPlugin/Services/AuctionService.cs index 972b593..48a8f3b 100644 --- a/Nop.Plugin.Misc.AuctionPlugin/Services/AuctionService.cs +++ b/Nop.Plugin.Misc.AuctionPlugin/Services/AuctionService.cs @@ -85,10 +85,13 @@ public class AuctionService( //200 000 000 Ft fölött 20 000 000 Ft-tal } - public static decimal GetNextBidPrice(decimal currentBidPrice) => GetNextBidPrice(currentBidPrice, GetStepAmount(currentBidPrice)); - public static decimal GetNextBidPrice(decimal currentBidPrice, decimal stepAmount) + public async Task GetNextBidPrice(decimal currentBidPrice, int productToAuctionId) => GetNextBidPrice(currentBidPrice, GetStepAmount(currentBidPrice), await HasBidByProductToAuctionIdAsync(productToAuctionId)); + + public static decimal GetNextBidPrice(decimal currentBidPrice, bool hasAuctionBidInDb) => GetNextBidPrice(currentBidPrice, GetStepAmount(currentBidPrice), hasAuctionBidInDb); + + public static decimal GetNextBidPrice(decimal currentBidPrice, decimal stepAmount, bool hasAuctionBidInDb) { - return currentBidPrice + stepAmount; + return hasAuctionBidInDb ? currentBidPrice + stepAmount : currentBidPrice; } public async Task ResetProductToAuctionByProductId(int productId) @@ -106,6 +109,9 @@ public class AuctionService( public Task GetBidsCountByProductToAuctionIdAsync(int productToAuctionId) => ctx.GetBidsCountByProductToAuctionIdAsync(productToAuctionId); + public Task HasBidByProductToAuctionIdAsync(int productToAuctionId) + => ctx.HasBidByProductToAuctionIdAsync(productToAuctionId); + public Task RevertAuctionBidByProductToAuctionIdAsync(int productToAuctionId) => ctx.RevertAuctionBidByProductToAuctionId(productToAuctionId); @@ -396,9 +402,14 @@ public class AuctionService( } public async Task> GetProductToAuctionsByAuctionIdAsync(int auctionId, bool onlyActiveItems) - { - return await ctx.ProductToAuctions.GetProductToAuctionsByAuctionId(auctionId, onlyActiveItems).ToListAsync(); - } + => await ctx.ProductToAuctions.GetProductToAuctionsByAuctionId(auctionId, onlyActiveItems).OrderBy(x => x.SortIndex).ToListAsync(); + + public Task GetNextProductToAuctionByAuctionIdAsync(int auctionId) + => ctx.ProductToAuctions.GetNextItemByAuctionIdAsync(auctionId); + + public Task> GetNotClosedProductToAuctionsByAuctionId(int auctionId) + => ctx.ProductToAuctions.GetNotClosedItemsByAuctionId(auctionId).OrderBy(x => x.SortIndex).ToListAsync(); + #endregion #endregion diff --git a/Nop.Plugin.Misc.AuctionPlugin/Services/IAuctionService.cs b/Nop.Plugin.Misc.AuctionPlugin/Services/IAuctionService.cs index 13167e0..adbf352 100644 --- a/Nop.Plugin.Misc.AuctionPlugin/Services/IAuctionService.cs +++ b/Nop.Plugin.Misc.AuctionPlugin/Services/IAuctionService.cs @@ -29,6 +29,7 @@ public interface IAuctionService Task> GetAllBidsAsync(int customerId = 0, int pageIndex = 0, int pageSize = int.MaxValue); Task GetBidsCountByProductToAuctionIdAsync(int productToAuctionId); + Task HasBidByProductToAuctionIdAsync(int productToAuctionId); Task GetBidByIdAsync(int bidId); Task InsertBidAsync(AuctionBid auctionBid); @@ -44,11 +45,13 @@ public interface IAuctionService Task GetAuctionDtoWithAuctionBids(int auctionId, bool activeProductOnly, int maxBidsCount); Task> GetProductToAuctionsByAuctionIdAsync(int auctionId, bool onlyActiveItems); + Task GetNextProductToAuctionByAuctionIdAsync(int auctionId); + Task> GetNotClosedProductToAuctionsByAuctionId(int auctionId); Task GetAuctionByIdAsync(int auctionId); Task GetAuctionDtoByIdAsync(int auctionId, bool widthProducts, bool activeProductOnly); Task> GetProductToAuctionDtosByAuctionId(int auctionId, bool activeProductOnly); - + Task> GetProductToAuctionDtosByProductIdAsync(int productId); Task GetAuctionDtoWithProductByIdAsync(int auctionId, int productId, bool activeProductOnly);