Mango.Nop.Plugins/Nop.Plugin.Misc.AIPlugin/Domains/DataLayer/StockTakingDbContext.cs

74 lines
3.2 KiB
C#

#nullable enable
using AyCode.Core.Loggers;
using FruitBank.Common.Dtos;
using Mango.Nop.Core.Entities;
using Mango.Nop.Core.Loggers;
using Mango.Nop.Data.Repositories;
using Nop.Core;
using Nop.Core.Caching;
using Nop.Core.Domain.Catalog;
using Nop.Core.Domain.Common;
using Nop.Core.Domain.Orders;
using Nop.Core.Events;
using Nop.Data;
using Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer.Interfaces;
using Nop.Plugin.Misc.FruitBankPlugin.Services;
using Nop.Services.Catalog;
namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer;
public class StockTakingDbContext : MgDbContextBase,
IStockTakingDbSet<StockTakingDbTable>,
IStockTakingItemDbSet<StockTakingItemDbTable>,
IStockTakingItemPalletDbSet<StockTakingItemPalletDbTable>
{
public ProductDtoDbTable ProductDtos { get; set; }
public StockTakingDbTable StockTakings { get; set; }
public StockTakingItemDbTable StockTakingItems { get; set; }
public StockTakingItemPalletDbTable StockTakingItemPallets { get; set; }
public StockQuantityHistoryDtoDbTable StockQuantityHistoryDtos { get; set; }
public IRepository<GenericAttribute> GenericAttributes { get; set; }
public IRepository<StockQuantityHistory> StockQuantityHistories { get; set; }
public IRepository<StockQuantityHistoryExt> StockQuantityHistoriesExt { get; set; }
private readonly IStoreContext _storeContext;
private readonly IProductService _productService;
private readonly IStaticCacheManager _staticCacheManager;
protected readonly IEventPublisher _eventPublisher;
public StockTakingDbContext(INopDataProvider dataProvider, ILockService lockService, IStoreContext storeContext,
ProductDtoDbTable productDtoDbTable,
StockQuantityHistoryDtoDbTable stockQuantityHistoryDtos,
StockTakingDbTable stockTakingDbTable,
StockTakingItemDbTable stockTakingItemDbTable,
StockTakingItemPalletDbTable stockTakingItemPalletDbTable,
IProductService productService, IStaticCacheManager staticCacheManager,
IRepository<Order> orderRepository,
IRepository<OrderItem> orderItemRepository,
IRepository<Product> productRepository,
IRepository<GenericAttribute> genericAttributes,
IRepository<StockQuantityHistory> stockQuantityHistories,
IRepository<StockQuantityHistoryExt> stockQuantityHistoriesExt,
IEventPublisher eventPublisher,
IEnumerable<IAcLogWriterBase> logWriters) : base(productRepository, orderRepository, orderItemRepository, dataProvider, lockService, new Logger<StockTakingDbContext>(logWriters.ToArray()))
{
_eventPublisher = eventPublisher;
_storeContext = storeContext;
_productService = productService;
_staticCacheManager = staticCacheManager;
ProductDtos = productDtoDbTable;
GenericAttributes = genericAttributes;
StockQuantityHistories = stockQuantityHistories;
StockQuantityHistoriesExt = stockQuantityHistoriesExt;
StockQuantityHistoryDtos = stockQuantityHistoryDtos;
StockTakings = stockTakingDbTable;
StockTakingItems = stockTakingItemDbTable;
StockTakingItemPallets = stockTakingItemPalletDbTable;
}
}