merge
This commit is contained in:
commit
fb106f2fe6
|
|
@ -0,0 +1,17 @@
|
|||
using AyCode.Core.Extensions;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.Entities;
|
||||
using Nop.Plugin.Misc.AuctionPlugin.Services;
|
||||
using Nop.Web.Areas.Admin.Controllers;
|
||||
|
||||
namespace Nop.Plugin.Misc.AuctionPlugin.Controllers;
|
||||
|
||||
public class AuctionController(AuctionService _auctionService) : BaseAdminController
|
||||
{
|
||||
// GET
|
||||
public IActionResult Index()
|
||||
{
|
||||
//var a = new Auction();
|
||||
return View();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
using Nop.Core;
|
||||
|
||||
namespace Nop.Plugin.Misc.AuctionPlugin.Domains
|
||||
{
|
||||
|
||||
public class AnnouncementEntity : BaseEntity
|
||||
|
||||
{
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public string Body { get; set; }
|
||||
|
||||
public bool IsActive { get; set; }
|
||||
|
||||
public DateTime Created { get; set; }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
using Nop.Core;
|
||||
|
||||
namespace Nop.Plugin.Misc.AuctionPlugin.Domains
|
||||
{
|
||||
|
||||
public class BidEntity : BaseEntity
|
||||
{
|
||||
public int CustomerId { get; set; }
|
||||
|
||||
public int ProductId { get; set; }
|
||||
|
||||
public bool IsWinner { get; set; }
|
||||
public int Value { get; set; }
|
||||
|
||||
public DateTime CreateDate { get; set; }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
using AyCode.Interfaces.Entities;
|
||||
using AyCode.Interfaces.TimeStampInfo;
|
||||
using Nop.Core;
|
||||
|
||||
namespace Nop.Plugin.Misc.AuctionPlugin.Domains.Entities
|
||||
{
|
||||
|
||||
public class Announcement : BaseEntity, IEntityInt, ITimeStampCreated
|
||||
|
||||
{
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public string Body { get; set; }
|
||||
|
||||
public bool IsActive { get; set; }
|
||||
|
||||
public DateTime Created { get; set; }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
using AyCode.Interfaces.Entities;
|
||||
using AyCode.Interfaces.TimeStampInfo;
|
||||
using Nop.Core;
|
||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.Enums;
|
||||
|
||||
namespace Nop.Plugin.Misc.AuctionPlugin.Domains.Entities;
|
||||
|
||||
public class Auction: BaseEntity, IEntityInt, ITimeStampInfo
|
||||
{
|
||||
public string AuctionName { get; set; }
|
||||
public AuctionType AuctionType{ get; set; }
|
||||
|
||||
public DateTime StartDateUtc { get; set; }
|
||||
public DateTime? EndDateUtc { get; set; }
|
||||
|
||||
public bool Closed { get; set; }
|
||||
|
||||
public DateTime Created { get; set; }
|
||||
public DateTime Modified { get; set; }
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
using AyCode.Interfaces.Entities;
|
||||
using AyCode.Interfaces.TimeStampInfo;
|
||||
using Nop.Core;
|
||||
|
||||
namespace Nop.Plugin.Misc.AuctionPlugin.Domains.Entities
|
||||
{
|
||||
public class AuctionBid : BaseEntity, IEntityInt, ITimeStampInfo
|
||||
{
|
||||
public int CustomerId { get; set; }
|
||||
|
||||
public int ProductId { get; set; }
|
||||
|
||||
public bool IsWinner { get; set; }
|
||||
public int BidPrice { get; set; }
|
||||
|
||||
public DateTime CreateDate { get; set; }
|
||||
|
||||
public DateTime Created { get; set; }
|
||||
public DateTime Modified { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
using AyCode.Interfaces.Entities;
|
||||
using AyCode.Interfaces.TimeStampInfo;
|
||||
using Nop.Core;
|
||||
|
||||
namespace Nop.Plugin.Misc.AuctionPlugin.Domains.Entities;
|
||||
|
||||
public class AuctionItem : BaseEntity, IEntityInt, ITimeStampInfo
|
||||
{
|
||||
public DateTime Created { get; set; }
|
||||
public DateTime Modified { get; set; }
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
using AyCode.Interfaces.Entities;
|
||||
using AyCode.Interfaces.TimeStampInfo;
|
||||
using Nop.Core;
|
||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.Enums;
|
||||
|
||||
namespace Nop.Plugin.Misc.AuctionPlugin.Domains.Entities;
|
||||
|
||||
public class ProductToAuctionMapping : BaseEntity, IEntityInt, ITimeStampInfo
|
||||
{
|
||||
public int ProductId { get; set; }
|
||||
public int AuctionId { get; set; }
|
||||
|
||||
public AuctionStatus AuctionStatus { get; set; } = AuctionStatus.None;
|
||||
|
||||
public int StartingPrice { get; set; }
|
||||
public int BidPrice { get; set; }
|
||||
|
||||
public int BidAmount { get; set; } = 1;
|
||||
public DateTime Created { get; set; }
|
||||
public DateTime Modified { get; set; }
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
namespace Nop.Plugin.Misc.AuctionPlugin.Domains.Enums;
|
||||
|
||||
public enum AuctionStatus : byte
|
||||
{
|
||||
None = 0,
|
||||
Active = 5,
|
||||
FirstWarning = 10,
|
||||
SecondWarning = 15,
|
||||
SoldOut = 20,
|
||||
NotSold = 25
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
namespace Nop.Plugin.Misc.AuctionPlugin.Domains.Enums;
|
||||
|
||||
public enum AuctionType : byte
|
||||
{
|
||||
//TODO: átbeszélni és kitalálni - J.
|
||||
Manual = 0,
|
||||
AutomaticNext = 5,
|
||||
}
|
||||
|
|
@ -31,7 +31,7 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Infrastructure
|
|||
|
||||
//register services and interfaces
|
||||
services.AddScoped<IAnnouncementService, AnnouncementService>();
|
||||
services.AddScoped<IBidService, BidService>();
|
||||
services.AddScoped<IAuctionService, AuctionService>();
|
||||
services.AddScoped<EventConsumer>();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
using Nop.Data.Extensions;
|
||||
using Nop.Data.Migrations;
|
||||
using Nop.Plugin.Misc.AuctionPlugin.Domains;
|
||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.Entities;
|
||||
|
||||
namespace Nop.Plugin.Misc.AuctionPlugin.Migrations
|
||||
{
|
||||
|
|
@ -13,8 +14,12 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Migrations
|
|||
/// </summary>
|
||||
public override void Up()
|
||||
{
|
||||
Create.TableFor<BidEntity>();
|
||||
Create.TableFor<AnnouncementEntity>();
|
||||
Create.TableFor<Auction>();
|
||||
//Create.TableFor<AuctionItem>();
|
||||
Create.TableFor<ProductToAuctionMapping>();
|
||||
Create.TableFor<AuctionBid>();
|
||||
|
||||
Create.TableFor<Announcement>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -68,7 +68,11 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\..\NopCommerce\Libraries\Nop.Core\Nop.Core.csproj" />
|
||||
<ProjectReference Include="..\..\..\..\NopCommerce\Libraries\Nop.Data\Nop.Data.csproj" />
|
||||
<ProjectReference Include="..\..\..\..\NopCommerce\Presentation\Nop.Web\Nop.Web.csproj" />
|
||||
<ProjectReference Include="..\..\Libraries\Mango.Nop.Core\Mango.Nop.Core.csproj" />
|
||||
<ProjectReference Include="..\..\Libraries\Mango.Nop.Services\Mango.Nop.Services.csproj" />
|
||||
<ClearPluginAssemblies Include="$(MSBuildProjectDirectory)\..\..\..\..\NopCommerce\Build\ClearPluginAssemblies.proj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
@ -95,6 +99,34 @@
|
|||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.10" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="AyCode.Core">
|
||||
<HintPath>..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="AyCode.Core.Server">
|
||||
<HintPath>..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Core.Server.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="AyCode.Entities">
|
||||
<HintPath>..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Entities.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="AyCode.Entities.Server">
|
||||
<HintPath>..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Entities.Server.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="AyCode.Interfaces">
|
||||
<HintPath>..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Interfaces.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="AyCode.Interfaces.Server">
|
||||
<HintPath>..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Interfaces.Server.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="AyCode.Utils">
|
||||
<HintPath>..\..\..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Utils.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<!-- This target execute after "Build" target -->
|
||||
<Target Name="NopTarget" AfterTargets="Build">
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.Entities;
|
||||
|
||||
namespace Nop.Plugin.Misc.AuctionPlugin.Services
|
||||
{
|
||||
|
|
@ -14,13 +15,13 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Services
|
|||
{
|
||||
#region Field
|
||||
|
||||
private readonly IRepository<AnnouncementEntity> _announcementRepository;
|
||||
private readonly IRepository<Announcement> _announcementRepository;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Ctr
|
||||
|
||||
public AnnouncementService(IRepository<AnnouncementEntity> announcementRepository)
|
||||
public AnnouncementService(IRepository<Announcement> announcementRepository)
|
||||
{
|
||||
|
||||
_announcementRepository = announcementRepository;
|
||||
|
|
@ -31,7 +32,7 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Services
|
|||
|
||||
#region Methods
|
||||
|
||||
public async Task DeleteAsync(AnnouncementEntity announcement)
|
||||
public async Task DeleteAsync(Announcement announcement)
|
||||
{
|
||||
|
||||
await _announcementRepository.DeleteAsync(announcement);
|
||||
|
|
@ -40,7 +41,7 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Services
|
|||
|
||||
|
||||
|
||||
public async Task<bool> UpdateAsync(AnnouncementEntity announcement)
|
||||
public async Task<bool> UpdateAsync(Announcement announcement)
|
||||
|
||||
{
|
||||
|
||||
|
|
@ -57,7 +58,7 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Services
|
|||
}
|
||||
|
||||
|
||||
public async Task InsertAsync(AnnouncementEntity announcement)
|
||||
public async Task InsertAsync(Announcement announcement)
|
||||
|
||||
{
|
||||
|
||||
|
|
@ -66,7 +67,7 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Services
|
|||
}
|
||||
|
||||
|
||||
public async Task<IPagedList<AnnouncementEntity>> GetAnnouncementsAsync(int pageIndex = 0, int pageSize = int.MaxValue)
|
||||
public async Task<IPagedList<Announcement>> GetAnnouncementsAsync(int pageIndex = 0, int pageSize = int.MaxValue)
|
||||
|
||||
{
|
||||
|
||||
|
|
@ -76,13 +77,13 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Services
|
|||
|
||||
var query2 = query.OrderBy(b => b.IsActive).ToList();
|
||||
|
||||
var liveAnnouncementDomain = new PagedList<AnnouncementEntity>(query2, pageIndex, pageSize);
|
||||
var liveAnnouncementDomain = new PagedList<Announcement>(query2, pageIndex, pageSize);
|
||||
|
||||
return liveAnnouncementDomain;
|
||||
|
||||
}
|
||||
|
||||
public async Task<AnnouncementEntity> GetAnnouncementDesignFirstAsync()
|
||||
public async Task<Announcement> GetAnnouncementDesignFirstAsync()
|
||||
|
||||
{
|
||||
var result = await _announcementRepository.GetAllAsync(query =>
|
||||
|
|
@ -105,7 +106,7 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Services
|
|||
|
||||
}
|
||||
|
||||
public async Task<AnnouncementEntity> GetAnnouncementByIdAsync(int Id)
|
||||
public async Task<Announcement> GetAnnouncementByIdAsync(int Id)
|
||||
|
||||
{
|
||||
|
||||
|
|
|
|||
|
|
@ -2,13 +2,14 @@
|
|||
using Nop.Core.Caching;
|
||||
using Nop.Data;
|
||||
using Nop.Plugin.Misc.AuctionPlugin.Domains;
|
||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.Entities;
|
||||
|
||||
namespace Nop.Plugin.Misc.AuctionPlugin.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Store pickup point service
|
||||
/// </summary>
|
||||
public class BidService : IBidService
|
||||
public class AuctionService : IAuctionService
|
||||
{
|
||||
#region Constants
|
||||
|
||||
|
|
@ -25,7 +26,7 @@ public class BidService : IBidService
|
|||
|
||||
#region Fields
|
||||
|
||||
protected readonly IRepository<BidEntity> _customerBidRepository;
|
||||
protected readonly IRepository<AuctionBid> _customerBidRepository;
|
||||
protected readonly IShortTermCacheManager _shortTermCacheManager;
|
||||
protected readonly IStaticCacheManager _staticCacheManager;
|
||||
|
||||
|
|
@ -39,7 +40,7 @@ public class BidService : IBidService
|
|||
/// <param name="customerBidRepository">Store pickup point repository</param>
|
||||
/// <param name="shortTermCacheManager">Short term cache manager</param>
|
||||
/// <param name="staticCacheManager">Cache manager</param>
|
||||
public BidService(IRepository<BidEntity> customerBidRepository,
|
||||
public AuctionService(IRepository<AuctionBid> customerBidRepository,
|
||||
IShortTermCacheManager shortTermCacheManager,
|
||||
IStaticCacheManager staticCacheManager)
|
||||
{
|
||||
|
|
@ -62,9 +63,9 @@ public class BidService : IBidService
|
|||
/// A task that represents the asynchronous operation
|
||||
/// The task result contains the bids
|
||||
/// </returns>
|
||||
public virtual async Task<IPagedList<BidEntity>> GetAllBidsAsync(int customerId = 0, int pageIndex = 0, int pageSize = int.MaxValue)
|
||||
public virtual async Task<IPagedList<AuctionBid>> GetAllBidsAsync(int customerId = 0, int pageIndex = 0, int pageSize = int.MaxValue)
|
||||
{
|
||||
var rez = new List<BidEntity>();
|
||||
var rez = new List<AuctionBid>();
|
||||
//var rez = await _shortTermCacheManager.GetAsync(async () => await _customerBidRepository.GetAllAsync(query =>
|
||||
//{
|
||||
// if (customerId > 0)
|
||||
|
|
@ -74,23 +75,23 @@ public class BidService : IBidService
|
|||
// return query;
|
||||
//}), _pickupPointAllKey, customerId);
|
||||
|
||||
return new PagedList<BidEntity>(rez, pageIndex, pageSize);
|
||||
return new PagedList<AuctionBid>(rez, pageIndex, pageSize);
|
||||
}
|
||||
|
||||
public virtual async Task<BidEntity> GetBidByIdAsync(int bidId)
|
||||
public virtual async Task<AuctionBid> GetBidByIdAsync(int bidId)
|
||||
{
|
||||
return await _customerBidRepository.GetByIdAsync(bidId);
|
||||
}
|
||||
|
||||
public virtual async Task InsertBidAsync(BidEntity bid)
|
||||
public virtual async Task InsertBidAsync(AuctionBid auctionBid)
|
||||
{
|
||||
await _customerBidRepository.InsertAsync(bid, false);
|
||||
await _customerBidRepository.InsertAsync(auctionBid, false);
|
||||
await _staticCacheManager.RemoveByPrefixAsync(AUCTION_PATTERN_KEY);
|
||||
}
|
||||
|
||||
public virtual async Task UpdateBidAsync(BidEntity bid)
|
||||
public virtual async Task UpdateBidAsync(AuctionBid auctionBid)
|
||||
{
|
||||
await _customerBidRepository.UpdateAsync(bid, false);
|
||||
await _customerBidRepository.UpdateAsync(auctionBid, false);
|
||||
await _staticCacheManager.RemoveByPrefixAsync(AUCTION_PATTERN_KEY);
|
||||
}
|
||||
|
||||
|
|
@ -99,7 +100,7 @@ public class BidService : IBidService
|
|||
/// </summary>
|
||||
/// <param name="pickupPoint">Pickup point</param>
|
||||
/// <returns>A task that represents the asynchronous operation</returns>
|
||||
public virtual async Task DeleteBidAsync(BidEntity pickupPoint)
|
||||
public virtual async Task DeleteBidAsync(AuctionBid pickupPoint)
|
||||
{
|
||||
await _customerBidRepository.DeleteAsync(pickupPoint, false);
|
||||
await _staticCacheManager.RemoveByPrefixAsync(AUCTION_PATTERN_KEY);
|
||||
|
|
@ -5,6 +5,7 @@ using Nop.Core;
|
|||
using Nop.Plugin.Misc.AuctionPlugin.Domains;
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.Entities;
|
||||
|
||||
namespace Nop.Plugin.Misc.AuctionPlugin.Services
|
||||
|
||||
|
|
@ -13,17 +14,17 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Services
|
|||
|
||||
{
|
||||
|
||||
public Task DeleteAsync(AnnouncementEntity announcement);
|
||||
public Task DeleteAsync(Announcement announcement);
|
||||
|
||||
public Task InsertAsync(AnnouncementEntity announcement);
|
||||
public Task InsertAsync(Announcement announcement);
|
||||
|
||||
public Task<bool> UpdateAsync(AnnouncementEntity announcement);
|
||||
public Task<bool> UpdateAsync(Announcement announcement);
|
||||
|
||||
public Task<IPagedList<AnnouncementEntity>> GetAnnouncementsAsync(int pageIndex = 0, int pageSize = int.MaxValue);
|
||||
public Task<IPagedList<Announcement>> GetAnnouncementsAsync(int pageIndex = 0, int pageSize = int.MaxValue);
|
||||
|
||||
public Task<AnnouncementEntity> GetAnnouncementDesignFirstAsync();
|
||||
public Task<Announcement> GetAnnouncementDesignFirstAsync();
|
||||
|
||||
public Task<AnnouncementEntity> GetAnnouncementByIdAsync(int Id);
|
||||
public Task<Announcement> GetAnnouncementByIdAsync(int Id);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
using Nop.Core;
|
||||
using Nop.Plugin.Misc.AuctionPlugin.Domains;
|
||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.Entities;
|
||||
|
||||
namespace Nop.Plugin.Misc.AuctionPlugin.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Store pickup point service interface
|
||||
/// </summary>
|
||||
public interface IBidService
|
||||
public interface IAuctionService
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets all bids
|
||||
|
|
@ -18,17 +19,17 @@ public interface IBidService
|
|||
/// A task that represents the asynchronous operation
|
||||
/// The task result contains the bids
|
||||
/// </returns>
|
||||
Task<IPagedList<BidEntity>> GetAllBidsAsync(int customerId = 0, int pageIndex = 0, int pageSize = int.MaxValue);
|
||||
Task<IPagedList<AuctionBid>> GetAllBidsAsync(int customerId = 0, int pageIndex = 0, int pageSize = int.MaxValue);
|
||||
|
||||
|
||||
Task<BidEntity> GetBidByIdAsync(int bidId);
|
||||
Task<AuctionBid> GetBidByIdAsync(int bidId);
|
||||
|
||||
|
||||
Task InsertBidAsync(BidEntity bidEntity);
|
||||
Task InsertBidAsync(AuctionBid auctionBid);
|
||||
|
||||
|
||||
Task UpdateBidAsync(BidEntity bid);
|
||||
Task UpdateBidAsync(AuctionBid auctionBid);
|
||||
|
||||
|
||||
Task DeleteBidAsync(BidEntity pickupPoint);
|
||||
Task DeleteBidAsync(AuctionBid pickupPoint);
|
||||
}
|
||||
Loading…
Reference in New Issue