/// <summary>
 /// This is a helper contructor for unit testing
 /// </summary>
 internal ProductVariantApiController(MerchelloContext merchelloContext, UmbracoContext umbracoContext)
     : base(merchelloContext, umbracoContext)
 {
     _productService = MerchelloContext.Services.ProductService;
     _productVariantService = MerchelloContext.Services.ProductVariantService;
     _warehouseService = MerchelloContext.Services.WarehouseService;
 }
 public GoogleBaseManagerTests()
 {
     _productVariantService = A.Fake<IProductVariantService>();
     _googleBaseShippingService = A.Fake<IGoogleBaseShippingService>();
     _getStockRemainingQuantity = A.Fake<IGetStockRemainingQuantity>();
     _googleBaseManager = new GoogleBaseManager(Session, _productVariantService, _googleBaseShippingService,_getStockRemainingQuantity);
 }
示例#3
0
 public TaxRateManager(ISession session, IProductVariantService productVariantService,
     IGetDefaultTaxRate getDefaultTaxRate)
 {
     _session = session;
     _productVariantService = productVariantService;
     _getDefaultTaxRate = getDefaultTaxRate;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="BasketItemInventoryValidation"/> class.
        /// </summary>
        /// <param name="productVariantService">
        /// The <see cref="ProductVariantService"/>.
        /// </param>
        public BasketItemInventoryValidation(IProductVariantService productVariantService)
        {
            Mandate.ParameterNotNull(productVariantService, "productVariantService");

            _productVariantService = productVariantService;
            this._failedInventoryValidation = new List<InventoryValidation>();
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="RemoveShipmentOrderItemsFromInventoryAndPersistShipmentTask"/> class.
 /// </summary>
 /// <param name="merchelloContext">
 /// The merchello context.
 /// </param>
 /// <param name="order">
 /// The order.
 /// </param>
 /// <param name="keysToShip">
 /// The keys to ship.
 /// </param>
 public RemoveShipmentOrderItemsFromInventoryAndPersistShipmentTask(IMerchelloContext merchelloContext, IOrder order, IEnumerable<Guid> keysToShip) 
     : base(merchelloContext, order, keysToShip)
 {
     _productVariantService = MerchelloContext.Services.ProductVariantService;
     _shipmentService = MerchelloContext.Services.ShipmentService;
     _orderService = MerchelloContext.Services.OrderService;
 }
        public ExportProductsManagerTests()
        {
            _productVariantService = A.Fake<IProductVariantService>();

            _getStockRemainingQuantity = A.Fake<IGetStockRemainingQuantity>();
            _exportProductsManager = new ExportProductsManager(_productVariantService, _getStockRemainingQuantity);
        }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="merchelloContext"></param>
 public ProductVariantApiController(MerchelloContext merchelloContext)
     : base(merchelloContext)
 {
     _productService = MerchelloContext.Services.ProductService;
     _productVariantService = MerchelloContext.Services.ProductVariantService;
     _warehouseService = MerchelloContext.Services.WarehouseService;
 }
示例#8
0
 public GoogleBaseManager(ISession session, IProductVariantService productVariantService,
     IGoogleBaseShippingService googleBaseShippingService,IGetStockRemainingQuantity getStockRemainingQuantity)
 {
     _session = session;
     _productVariantService = productVariantService;
     _googleBaseShippingService = googleBaseShippingService;
     _getStockRemainingQuantity = getStockRemainingQuantity;
 }
 public AmazonListingServiceTests()
 {
     _amazonLogService = A.Fake<IAmazonLogService>();
     _amazonProductsApiService = A.Fake<IAmazonProductsApiService>();
     _productVariantService = A.Fake<IProductVariantService>();
     _optionService = A.Fake<IOptionService>();
     _amazonListingService = new AmazonListingService(Session,_amazonLogService,_productVariantService,_optionService,_amazonProductsApiService);
 }
示例#10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProductApiController"/> class. 
        /// Constructor
        /// </summary>
        /// <param name="merchelloContext">
        /// The <see cref="IMerchelloContext"/>
        /// </param>
        public ProductApiController(IMerchelloContext merchelloContext)
            : base(merchelloContext)
        {
            _productService = MerchelloContext.Services.ProductService;
            _productVariantService = MerchelloContext.Services.ProductVariantService;
            _warehouseService = MerchelloContext.Services.WarehouseService;

            _merchello = new MerchelloHelper(MerchelloContext.Services, false);
        }
示例#11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProductApiController"/> class. 
        /// Constructor
        /// </summary>
        /// <param name="merchelloContext">
        /// The <see cref="IMerchelloContext"/>
        /// </param>
        public ProductApiController(IMerchelloContext merchelloContext)
            : base(merchelloContext)
        {
            _productService = MerchelloContext.Services.ProductService;
            _productVariantService = MerchelloContext.Services.ProductVariantService;
            _warehouseService = MerchelloContext.Services.WarehouseService;

            _merchello = new MerchelloHelper(MerchelloContext.Services, false, DetachedValuesConversionType.Editor);
        }
        public override void FixtureSetup()
        {
            base.FixtureSetup();

            _productService = MerchelloContext.Current.Services.ProductService;
            _productVariantService = MerchelloContext.Current.Services.ProductVariantService;

            DbPreTestDataWorker.DeleteAllProducts();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="WarehouseCatalogService"/> class.
        /// </summary>
        /// <param name="provider">
        /// The provider.
        /// </param>
        /// <param name="repositoryFactory">
        /// The repository factory.
        /// </param>
        /// <param name="productVariantService">
        /// The product Variant Service.
        /// </param>
        internal WarehouseCatalogService(IDatabaseUnitOfWorkProvider provider, RepositoryFactory repositoryFactory, IProductVariantService productVariantService)
        {
            Mandate.ParameterNotNull(provider, "provider");
            Mandate.ParameterNotNull(repositoryFactory, "repositoryFactory");
            Mandate.ParameterNotNull(productVariantService, "productVariantService");

            _uowProvider = provider;
            _repositoryFactory = repositoryFactory;
            _productVariantService = productVariantService;
        }
示例#14
0
 public AmazonListingService(ISession session,
     IAmazonLogService amazonLogService, 
     IProductVariantService productVariantService, IOptionService optionService, IAmazonProductsApiService amazonProductsApiService)
 {
     _session = session;
     _amazonLogService = amazonLogService;
     _productVariantService = productVariantService;
     _optionService = optionService;
     _amazonProductsApiService = amazonProductsApiService;
 }
 public PrepareForSyncAmazonListingServiceTests()
 {
     _amazonListingService = A.Fake<IAmazonListingService>();
     _amazonListingGroupService = A.Fake<IAmazonListingGroupService>();
     _ecommerceSettings = A.Fake<EcommerceSettings>();
     _amazonSellerSettings = A.Fake<AmazonSellerSettings>();
     _productVariantService = A.Fake<IProductVariantService>();
     _getStockRemainingQuantity = A.Fake<IGetStockRemainingQuantity>();
     _prepareForSyncAmazonListingService = new PrepareForSyncAmazonListingService(_amazonListingService,_amazonListingGroupService,
     _ecommerceSettings,_amazonSellerSettings,_productVariantService, _getStockRemainingQuantity);
 }
		public OrderUpdatingService(ICMSApplication cmsApplication, IProductService productService, IProductVariantService productVariantService, 
			ICouponCodeService couponCodeService, IOrderService orderService, IOrderNumberService orderNumberService, IOrderRepository orderRepository)
		{
			_cmsApplication = cmsApplication;
			_productService = productService;
			_productVariantService = productVariantService;
			_couponCodeService = couponCodeService;
			_orderService = orderService;
			_orderNumberService = orderNumberService;
			_orderRepository = orderRepository;
		}
        public GoogleBaseControllerTests()
        {
            _configurationProvider = A.Fake<IConfigurationProvider>();
            _googleBaseSettings = A.Fake<GoogleBaseSettings>();
            _googleBaseManager = A.Fake<IGoogleBaseManager>();
            _productVariantService = A.Fake<IProductVariantService>();
            _optionService = A.Fake<IOptionService>();

            _googleBaseController = new GoogleBaseController(_configurationProvider, _googleBaseSettings, _optionService,
                _productVariantService,_googleBaseManager);
        }
示例#18
0
 public PriceAccountant(IDiscountCouponService discountCouponService, IUserService userService, ICartItemService cartItemService, IProductService productService, ITaxAccountant taxAccountant, TaxSettings taxSettings, ICartService cartService, IProductVariantService productVariantService, IRoundingService roundingService, IOrderService orderService)
 {
     _discountCouponService = discountCouponService;
     _userService           = userService;
     _cartItemService       = cartItemService;
     _productService        = productService;
     _taxAccountant         = taxAccountant;
     _taxSettings           = taxSettings;
     _cartService           = cartService;
     _productVariantService = productVariantService;
     _roundingService       = roundingService;
     _orderService          = orderService;
 }
示例#19
0
        public ProductService(IDatabaseUnitOfWorkProvider provider, RepositoryFactory repositoryFactory, IProductVariantService productVariantService)
        {
            Mandate.ParameterNotNull(provider, "provider");
            Mandate.ParameterNotNull(repositoryFactory, "repositoryFactory");
            Mandate.ParameterNotNull(productVariantService, "productVariantService");

            _uowProvider = provider;
            _repositoryFactory = repositoryFactory;

            // included the ProductVariantService so that events will trigger if variants
            // need to be deleted due to a product save removing attributes
            _productVariantService = productVariantService;
        }
示例#20
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProductService"/> class.
        /// </summary>
        /// <param name="provider">
        /// The provider.
        /// </param>
        /// <param name="repositoryFactory">
        /// The repository factory.
        /// </param>
        /// <param name="productVariantService">
        /// The product variant service.
        /// </param>
        public ProductService(IDatabaseUnitOfWorkProvider provider, RepositoryFactory repositoryFactory, IProductVariantService productVariantService)
        {
            Mandate.ParameterNotNull(provider, "provider");
            Mandate.ParameterNotNull(repositoryFactory, "repositoryFactory");
            Mandate.ParameterNotNull(productVariantService, "productVariantService");

            _uowProvider       = provider;
            _repositoryFactory = repositoryFactory;

            // included the ProductVariantService so that events will trigger if variants
            // need to be deleted due to a product save removing attributes
            _productVariantService = productVariantService;
        }
示例#21
0
 public SetTaxDetailsTests()
 {
     _amazonSyncSettings = new AmazonSyncSettings()
     {
         UseDefaultTaxRateForShippingTax = true, TryCalculateVat = true
     };
     _taxSettings = new TaxSettings()
     {
         TaxesEnabled = true, ShippingRateTaxesEnabled = true
     };
     _taxRateManager        = A.Fake <ITaxRateManager>();
     _productVariantService = A.Fake <IProductVariantService>();
     _productPricingMethod  = A.Fake <IProductPricingMethod>();
     _setTaxes = new SetTaxDetails(_amazonSyncSettings, _taxSettings, _taxRateManager, _productPricingMethod, _productVariantService, _getProductVariantTaxRatePercentage);
 }
 public PrepareForSyncAmazonListingService(
     IAmazonListingService amazonListingService,
     IAmazonListingGroupService amazonListingGroupService,
     EcommerceSettings ecommerceSettings,
     AmazonSellerSettings amazonSellerSettings,
     IProductVariantService productVariantService,
     IGetStockRemainingQuantity getStockRemainingQuantity)
 {
     _amazonListingService = amazonListingService;
     _amazonListingGroupService = amazonListingGroupService;
     _ecommerceSettings = ecommerceSettings;
     _amazonSellerSettings = amazonSellerSettings;
     _productVariantService = productVariantService;
     _getStockRemainingQuantity = getStockRemainingQuantity;
 }
示例#23
0
 public PrepareForSyncAmazonListingService(
     IAmazonListingService amazonListingService,
     IAmazonListingGroupService amazonListingGroupService,
     EcommerceSettings ecommerceSettings,
     AmazonSellerSettings amazonSellerSettings,
     IProductVariantService productVariantService,
     IGetStockRemainingQuantity getStockRemainingQuantity)
 {
     _amazonListingService      = amazonListingService;
     _amazonListingGroupService = amazonListingGroupService;
     _ecommerceSettings         = ecommerceSettings;
     _amazonSellerSettings      = amazonSellerSettings;
     _productVariantService     = productVariantService;
     _getStockRemainingQuantity = getStockRemainingQuantity;
 }
示例#24
0
 public ProductsController(IProductService productService, ICategoryService categoryService, CatalogSettings catalogSettings, IModelMapper modelMapper, IProductRelationService productRelationService, IProductVariantService productVariantService, IDataSerializer dataSerializer, IPriceAccountant priceAccountant, TaxSettings taxSettings, IReviewService reviewService, GeneralSettings generalSettings, IProductModelFactory productModelFactory, IDownloadService downloadService, IUploadService uploadService, ILocalFileProvider localFileProvider)
 {
     _productService         = productService;
     _categoryService        = categoryService;
     _catalogSettings        = catalogSettings;
     _modelMapper            = modelMapper;
     _productRelationService = productRelationService;
     _productVariantService  = productVariantService;
     _dataSerializer         = dataSerializer;
     _priceAccountant        = priceAccountant;
     _taxSettings            = taxSettings;
     _reviewService          = reviewService;
     _generalSettings        = generalSettings;
     _productModelFactory    = productModelFactory;
     _downloadService        = downloadService;
     _uploadService          = uploadService;
     _localFileProvider      = localFileProvider;
 }
		public UmbracoApplicationCacheManagingService(IProductService productService, IProductVariantService productVariantService, IProductVariantGroupService productVariantGroupService, ICategoryService categoryService, 
			IOrderDiscountService orderDiscountService, IProductDiscountService productDiscountService,
			IProductRepository productRepository, ICategoryRepository categoryRepository, IProductVariantGroupRepository productVariantGroupRepository, IProductVariantRepository productVariantRepository,
			IStoreService storeService, IApplicationCacheService applicationCacheService)
		{
			_productService = productService;
			_productVariantService = productVariantService;
			_productVariantGroupService = productVariantGroupService;
			_categoryService = categoryService;
			_orderDiscountService = orderDiscountService;
			_productDiscountService = productDiscountService;
			_productRepository = productRepository;
			_categoryRepository = categoryRepository;
			_productVariantGroupRepository = productVariantGroupRepository;
			_productVariantRepository = productVariantRepository;
			_storeService = storeService;
			_applicationCacheService = applicationCacheService;

			_manageUmbracoXMLCacheWhenLoadBalanced = System.Web.Configuration.WebConfigurationManager.
				AppSettings["uWebshopLoadBalancedNoUmbraco"] != "true";
		}
        public UmbracoApplicationCacheManagingService(IProductService productService, IProductVariantService productVariantService, IProductVariantGroupService productVariantGroupService, ICategoryService categoryService,
                                                      IOrderDiscountService orderDiscountService, IProductDiscountService productDiscountService,
                                                      IProductRepository productRepository, ICategoryRepository categoryRepository, IProductVariantGroupRepository productVariantGroupRepository, IProductVariantRepository productVariantRepository,
                                                      IStoreService storeService, IApplicationCacheService applicationCacheService)
        {
            _productService                = productService;
            _productVariantService         = productVariantService;
            _productVariantGroupService    = productVariantGroupService;
            _categoryService               = categoryService;
            _orderDiscountService          = orderDiscountService;
            _productDiscountService        = productDiscountService;
            _productRepository             = productRepository;
            _categoryRepository            = categoryRepository;
            _productVariantGroupRepository = productVariantGroupRepository;
            _productVariantRepository      = productVariantRepository;
            _storeService            = storeService;
            _applicationCacheService = applicationCacheService;

            _manageUmbracoXMLCacheWhenLoadBalanced = System.Web.Configuration.WebConfigurationManager.
                                                     AppSettings["uWebshopLoadBalancedNoUmbraco"] != "true";
        }
示例#27
0
 public ProductService(RepositoryFactory repositoryFactory, IProductVariantService productVariantService)
     : this(new PetaPocoUnitOfWorkProvider(), repositoryFactory, productVariantService)
 {
 }
示例#28
0
 /// <summary>
 /// Removes a product variant from the index
 /// </summary>
 static void ProductVariantServiceDeleted(IProductVariantService sender, DeleteEventArgs <IProductVariant> e)
 {
     e.DeletedEntities.ForEach(DeleteProductVariantFromIndex);
 }
示例#29
0
 public TaxRateManagerTests()
 {
     _productVariantService = A.Fake <IProductVariantService>();
     _getDefaultTaxRate     = A.Fake <IGetDefaultTaxRate>();
     _taxRateManager        = new TaxRateManager(Session, _productVariantService, _getDefaultTaxRate);
 }
示例#30
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WarehouseCatalogService"/> class.
 /// </summary>
 /// <param name="repositoryFactory">
 /// The repository factory.
 /// </param>
 /// <param name="logger">
 /// The logger.
 /// </param>
 /// <param name="productVariantService">
 /// The product Variant Service.
 /// </param>
 internal WarehouseCatalogService(RepositoryFactory repositoryFactory, ILogger logger, IProductVariantService productVariantService)
     : this(new PetaPocoUnitOfWorkProvider(logger), repositoryFactory, logger, productVariantService)
 {
 }
示例#31
0
 public ExportProductsManager(IProductVariantService productVariantService, IGetStockRemainingQuantity getStockRemainingQuantity)
 {
     _productVariantService = productVariantService;
     _getStockRemainingQuantity = getStockRemainingQuantity;
 }
示例#32
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WarehouseCatalogService"/> class.
 /// </summary>
 /// <param name="provider">
 /// The provider.
 /// </param>
 /// <param name="repositoryFactory">
 /// The repository factory.
 /// </param>
 /// <param name="logger">
 /// The logger.
 /// </param>
 /// <param name="productVariantService">
 /// The product Variant Service.
 /// </param>
 internal WarehouseCatalogService(IDatabaseUnitOfWorkProvider provider, RepositoryFactory repositoryFactory, ILogger logger, IProductVariantService productVariantService)
     : this(provider, repositoryFactory, logger, new TransientMessageFactory(), productVariantService)
 {
 }
示例#33
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WarehouseCatalogService"/> class.
 /// </summary>
 /// <param name="provider">
 /// The provider.
 /// </param>
 /// <param name="repositoryFactory">
 /// The repository factory.
 /// </param>
 /// <param name="logger">
 /// The logger.
 /// </param>
 /// <param name="eventMessagesFactory">
 /// The event messages factory.
 /// </param>
 /// <param name="productVariantService">
 /// The product variant service.
 /// </param>
 internal WarehouseCatalogService(IDatabaseUnitOfWorkProvider provider, RepositoryFactory repositoryFactory, ILogger logger, IEventMessagesFactory eventMessagesFactory, IProductVariantService productVariantService)
     : base(provider, repositoryFactory, logger, eventMessagesFactory)
 {
     Mandate.ParameterNotNull(productVariantService, "productVariantService");
     _productVariantService = productVariantService;
 }
示例#34
0
 public ProductVariantsController(IProductVariantService productVariantService)
 {
     this._productVariantService = productVariantService;
 }
示例#35
0
 public ExportProductsManager(IProductVariantService productVariantService, IGetStockRemainingQuantity getStockRemainingQuantity)
 {
     _productVariantService     = productVariantService;
     _getStockRemainingQuantity = getStockRemainingQuantity;
 }
示例#36
0
 public ProductService(IProductDal productDal, IProductDescriptionService productDescriptionService, IProductAttributeService productAttributeService, IProductVariantService productVariantService, IProductColorFabricBlendService productColorFabricBlendService, IHttpContextAccessor httpContextAccessor, IUserService userService)
 {
     _productDal = productDal;
     _productDescriptionService      = productDescriptionService;
     _productAttributeService        = productAttributeService;
     _productVariantService          = productVariantService;
     _productColorFabricBlendService = productColorFabricBlendService;
     _userService = userService;
 }
示例#37
0
 /// <summary>
 /// Removes a product variant from the index
 /// </summary>
 static void ProductVariantServiceDeleted(IProductVariantService sender, DeleteEventArgs<IProductVariant> e)
 {
     e.DeletedEntities.ForEach(DeleteProductVariantFromIndex);
 }
示例#38
0
 public CartController(ICartService cartService, IDataSerializer dataSerializer, IProductService productService, IProductVariantService productVariantService, ICartItemService cartItemService, OrderSettings orderSettings)
 {
     _cartService           = cartService;
     _dataSerializer        = dataSerializer;
     _productService        = productService;
     _productVariantService = productVariantService;
     _cartItemService       = cartItemService;
     _orderSettings         = orderSettings;
 }
示例#39
0
 public PriceBreakController(IProductVariantService productVariantService)
 {
     _productVariantService = productVariantService;
 }
示例#40
0
 public productApi(IServiceFactory servicefactory, ILogger <productApi> logger)
 {
     _productDetailsService = servicefactory.GetServiceInstance <IProductService>();
     _productVariantService = servicefactory.GetServiceInstance <IProductVariantService>();
 }
示例#41
0
 public SetTaxDetails(AmazonSyncSettings amazonSyncSettings, TaxSettings taxSettings,
                      ITaxRateManager taxRateManager, IProductPricingMethod productPricingMethod, IProductVariantService productVariantService, IGetProductVariantTaxRatePercentage getProductVariantTaxRatePercentage)
 {
     _amazonSyncSettings    = amazonSyncSettings;
     _taxSettings           = taxSettings;
     _taxRateManager        = taxRateManager;
     _productPricingMethod  = productPricingMethod;
     _productVariantService = productVariantService;
     _getProductVariantTaxRatePercentage = getProductVariantTaxRatePercentage;
 }
示例#42
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ProductService"/> class.
 /// </summary>
 /// <param name="repositoryFactory">
 /// The repository factory.
 /// </param>
 /// <param name="productVariantService">
 /// The product variant service.
 /// </param>
 public ProductService(RepositoryFactory repositoryFactory, IProductVariantService productVariantService)
     : this(new PetaPocoUnitOfWorkProvider(), repositoryFactory, productVariantService)
 {
 }
示例#43
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WarehouseCatalogService"/> class.
 /// </summary>
 /// <param name="repositoryFactory">
 /// The repository factory.
 /// </param>
 /// <param name="logger">
 /// The logger.
 /// </param>
 /// <param name="productVariantService">
 /// The product Variant Service.
 /// </param>
 internal WarehouseCatalogService(RepositoryFactory repositoryFactory, ILogger logger, IProductVariantService productVariantService)
     : this(new PetaPocoUnitOfWorkProvider(logger), repositoryFactory, logger, productVariantService)
 {
 }
 public ProductVariantProductDoesntAlreadyExist(IProductService productService, IProductVariantService productVariantService)
 {
     _productService = productService;
     _productVariantService = productVariantService;
 }
示例#45
0
 public ProductAttributesComponent(IProductService productService, IProductModelFactory productModelFactory, IProductVariantService productVariantService, IPriceAccountant priceAccountant, TaxSettings taxSettings)
 {
     _productService        = productService;
     _productModelFactory   = productModelFactory;
     _productVariantService = productVariantService;
     _priceAccountant       = priceAccountant;
     _taxSettings           = taxSettings;
 }
示例#46
0
        public void Init()
        {
            _warehouse = PreTestDataWorker.WarehouseService.GetDefaultWarehouse();

            PreTestDataWorker.DeleteAllProducts();
            _productService = PreTestDataWorker.ProductService;
            _productVariantService = PreTestDataWorker.ProductVariantService;

            _product = PreTestDataWorker.MakeExistingProduct();
            _product.ProductOptions.Add(new ProductOption("Color"));
            _product.ProductOptions.First(x => x.Name == "Color").Choices.Add(new ProductAttribute("Black", "Blk"));
            _product.ProductOptions.First(x => x.Name == "Color").Choices.Add(new ProductAttribute("Blue", "Blu"));
            _product.ProductOptions.First(x => x.Name == "Color").Choices.Add(new ProductAttribute("Red", "Red"));
            _product.ProductOptions.First(x => x.Name == "Color").Choices.Add(new ProductAttribute("Green", "Gre"));
            _product.ProductOptions.Add(new ProductOption("Size"));
            _product.ProductOptions.First(x => x.Name == "Size").Choices.Add(new ProductAttribute("Small", "Sm"));
            _product.ProductOptions.First(x => x.Name == "Size").Choices.Add(new ProductAttribute("Medium", "M"));
            _product.ProductOptions.First(x => x.Name == "Size").Choices.Add(new ProductAttribute("Large", "Lg"));
            _product.ProductOptions.First(x => x.Name == "Size").Choices.Add(new ProductAttribute("X-Large", "XL"));
            _product.Height = 20;
            _product.Weight = 20;
            _product.Length = 20;
            _product.Width = 20;
            _product.Shippable = true;
            _productService.Save(_product);
        }
示例#47
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WarehouseCatalogService"/> class.
 /// </summary>
 /// <param name="provider">
 /// The provider.
 /// </param>
 /// <param name="repositoryFactory">
 /// The repository factory.
 /// </param>
 /// <param name="logger">
 /// The logger.
 /// </param>
 /// <param name="eventMessagesFactory">
 /// The event messages factory.
 /// </param>
 /// <param name="productVariantService">
 /// The product variant service.
 /// </param>
 internal WarehouseCatalogService(IDatabaseUnitOfWorkProvider provider, RepositoryFactory repositoryFactory, ILogger logger, IEventMessagesFactory eventMessagesFactory, IProductVariantService productVariantService)
     : base(provider, repositoryFactory, logger, eventMessagesFactory)
 {
     Mandate.ParameterNotNull(productVariantService, "productVariantService");
     _productVariantService = productVariantService;
 }
示例#48
0
 public UmbracoProductRepository(ISettingsService settingsService, IStoreService storeService, IProductVariantService variantService, IProductVariantGroupService variantGroupService, IProductAliassesService productAliassesService)
 {
     _settingsService     = settingsService;
     _storeService        = storeService;
     _variantService      = variantService;
     _variantGroupService = variantGroupService;
     _aliasses            = productAliassesService;
 }
示例#49
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WarehouseCatalogService"/> class.
 /// </summary>
 /// <param name="provider">
 /// The provider.
 /// </param>
 /// <param name="repositoryFactory">
 /// The repository factory.
 /// </param>
 /// <param name="logger">
 /// The logger.
 /// </param>
 /// <param name="productVariantService">
 /// The product Variant Service.
 /// </param>
 internal WarehouseCatalogService(IDatabaseUnitOfWorkProvider provider, RepositoryFactory repositoryFactory, ILogger logger, IProductVariantService productVariantService)
     : this(provider, repositoryFactory, logger, new TransientMessageFactory(), productVariantService)
 {
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="WarehouseCatalogService"/> class.
        /// </summary>
        /// <param name="provider">
        /// The provider.
        /// </param>
        /// <param name="repositoryFactory">
        /// The repository factory.
        /// </param>
        /// <param name="productVariantService">
        /// The product Variant Service.
        /// </param>
        internal WarehouseCatalogService(IDatabaseUnitOfWorkProvider provider, RepositoryFactory repositoryFactory, IProductVariantService productVariantService)
        {
            Mandate.ParameterNotNull(provider, "provider");
            Mandate.ParameterNotNull(repositoryFactory, "repositoryFactory");
            Mandate.ParameterNotNull(productVariantService, "productVariantService");

            _uowProvider           = provider;
            _repositoryFactory     = repositoryFactory;
            _productVariantService = productVariantService;
        }
示例#51
0
 /// <summary>
 /// Adds or updates a product variant to the index
 /// </summary>
 static void ProductVariantServiceSaved(IProductVariantService sender, SaveEventArgs <IProductVariant> e)
 {
     e.SavedEntities.ForEach(IndexProductVariant);
 }
示例#52
0
        protected void Setup()
        {
            _warehouseService               = Resolve <IWarehouseService>();
            _warehouseInventoryService      = Resolve <IWarehouseInventoryService>();
            _productService                 = Resolve <IProductService>();
            _orderAccountant                = Resolve <IOrderAccountant>();
            _productAttributeService        = Resolve <IProductAttributeService>();
            _availableAttributeService      = Resolve <IAvailableAttributeService>();
            _availableAttributeValueService = Resolve <IAvailableAttributeValueService>();
            _productVariantService          = Resolve <IProductVariantService>();
            _addressService                 = Resolve <IAddressService>();

            var address = new Address()
            {
                CountryId   = 1,
                AddressType = AddressType.Home,
                Name        = "abc"
            };

            _addressService.Insert(address);
            _w1 = new Warehouse()
            {
                AddressId = address.Id
            };
            _w2 = new Warehouse()
            {
                AddressId = address.Id
            };
            _warehouseService.Insert(_w1);
            _warehouseService.Insert(_w2);

            _sizeAvailableAttribute = new AvailableAttribute()
            {
                Name = "Size"
            };
            _colorAvailableAttribute = new AvailableAttribute()
            {
                Name = "Color"
            };
            var availableAttributes = new[]
            {
                _sizeAvailableAttribute, _colorAvailableAttribute
            };

            _availableAttributeService.Insert(availableAttributes);

            var attributeValues = new[]
            {
                new AvailableAttributeValue()
                {
                    AvailableAttributeId = _sizeAvailableAttribute.Id,
                    Value = "S"
                },
                new AvailableAttributeValue()
                {
                    AvailableAttributeId = _sizeAvailableAttribute.Id,
                    Value = "M"
                },
                new AvailableAttributeValue()
                {
                    AvailableAttributeId = _sizeAvailableAttribute.Id,
                    Value = "L"
                },
                new AvailableAttributeValue()
                {
                    AvailableAttributeId = _colorAvailableAttribute.Id,
                    Value = "Red"
                },
                new AvailableAttributeValue()
                {
                    AvailableAttributeId = _colorAvailableAttribute.Id,
                    Value = "Green"
                },
                new AvailableAttributeValue()
                {
                    AvailableAttributeId = _colorAvailableAttribute.Id,
                    Value = "Blue"
                },
            };

            _availableAttributeValueService.Insert(attributeValues);

            _p1 = new Product()
            {
                Name = "Microsoft Surface Pro",
                CanOrderWhenOutOfStock = true,
                ChargeTaxes            = true,
                ComparePrice           = 100,
                Price                 = 80,
                CreatedOn             = DateTime.UtcNow,
                UpdatedOn             = DateTime.UtcNow,
                IsShippable           = true,
                IsFeatured            = true,
                IsVisibleIndividually = true,
                DisplayOrder          = 1,
                Mpn            = "1",
                Gtin           = "2",
                Sku            = "SUR12",
                IsDownloadable = false,
                Description    =
                    "Surface Pro delivers even more speed and performance thanks to a powerful Intel® Core™ processor — with up to 50% more battery life1 than Surface Pro 4 and 2.5x more performance than Surface Pro 3.",
                Summary =
                    "Surface Pro delivers even more speed and performance thanks to a powerful Intel® Core™ processor — with up to 50% more battery life1 than Surface Pro 4 and 2.5x more performance than Surface Pro 3.",
                Published      = true,
                Deleted        = false,
                TrackInventory = true,
            };

            _p2 = new Product()
            {
                Name = "Microsoft Surface Pro",
                CanOrderWhenOutOfStock = true,
                ChargeTaxes            = true,
                ComparePrice           = 100,
                Price                 = 80,
                CreatedOn             = DateTime.UtcNow,
                UpdatedOn             = DateTime.UtcNow,
                IsShippable           = true,
                IsFeatured            = true,
                IsVisibleIndividually = true,
                DisplayOrder          = 1,
                Mpn            = "1",
                Gtin           = "2",
                Sku            = "SUR12",
                IsDownloadable = false,
                Description    =
                    "Surface Pro delivers even more speed and performance thanks to a powerful Intel® Core™ processor — with up to 50% more battery life1 than Surface Pro 4 and 2.5x more performance than Surface Pro 3.",
                Summary =
                    "Surface Pro delivers even more speed and performance thanks to a powerful Intel® Core™ processor — with up to 50% more battery life1 than Surface Pro 4 and 2.5x more performance than Surface Pro 3.",
                Published      = true,
                Deleted        = false,
                TrackInventory = true,
            };

            _productService.Insert(_p1);
            _productService.Insert(_p2);

            //link product attributes
            var productAttributeValuesSize = new List <ProductAttributeValue>()
            {
                new ProductAttributeValue()
                {
                    AvailableAttributeValueId = attributeValues[0].Id
                },
                new ProductAttributeValue()
                {
                    AvailableAttributeValueId = attributeValues[1].Id
                },
                new ProductAttributeValue()
                {
                    AvailableAttributeValueId = attributeValues[2].Id
                },
            };

            var productAttributeSize = new ProductAttribute()
            {
                AvailableAttributeId   = availableAttributes[0].Id,
                ProductId              = _p1.Id,
                ProductAttributeValues = productAttributeValuesSize
            };

            _productAttributeService.Insert(productAttributeSize);

            var productAttributeValuesColor = new List <ProductAttributeValue>()
            {
                new ProductAttributeValue()
                {
                    AvailableAttributeValueId = attributeValues[3].Id
                },
                new ProductAttributeValue()
                {
                    AvailableAttributeValueId = attributeValues[4].Id
                },
            };

            var productAttributeColor = new ProductAttribute()
            {
                AvailableAttributeId   = availableAttributes[1].Id,
                ProductId              = _p1.Id,
                ProductAttributeValues = productAttributeValuesColor
            };

            _productAttributeService.Insert(productAttributeColor);


            //generate variations
            // s + red
            var sRedVariant = _productVariantService.AddVariant(_p1, new ProductVariant()
            {
                ProductVariantAttributes = new List <ProductVariantAttribute>()
                {
                    new ProductVariantAttribute()
                    {
                        ProductAttributeId      = productAttributeSize.Id,
                        ProductAttributeValueId = productAttributeValuesSize[0].Id,
                    },
                    new ProductVariantAttribute()
                    {
                        ProductAttributeId      = productAttributeColor.Id,
                        ProductAttributeValueId = productAttributeValuesColor[0].Id
                    }
                },
                TrackInventory = true
            });

            _warehouseInventoryService.Insert(new WarehouseInventory()
            {
                ProductId        = _p1.Id,
                ProductVariantId = sRedVariant.Id,
                TotalQuantity    = 5,
                ReservedQuantity = 0,
                WarehouseId      = _w1.Id
            });
            // s + green
            var sGreenVariant = _productVariantService.AddVariant(_p1, new ProductVariant()
            {
                ProductVariantAttributes = new List <ProductVariantAttribute>()
                {
                    new ProductVariantAttribute()
                    {
                        ProductAttributeId      = productAttributeSize.Id,
                        ProductAttributeValueId = productAttributeValuesSize[0].Id
                    },
                    new ProductVariantAttribute()
                    {
                        ProductAttributeId      = productAttributeColor.Id,
                        ProductAttributeValueId = productAttributeValuesColor[1].Id
                    }
                },
                TrackInventory = false
            });

            _warehouseInventoryService.Insert(new WarehouseInventory()
            {
                ProductId        = _p1.Id,
                ProductVariantId = sGreenVariant.Id,
                TotalQuantity    = 5,
                ReservedQuantity = 0,
                WarehouseId      = _w1.Id
            });

            // m + red
            var mRedVariant = _productVariantService.AddVariant(_p1, new ProductVariant()
            {
                ProductVariantAttributes = new List <ProductVariantAttribute>()
                {
                    new ProductVariantAttribute()
                    {
                        ProductAttributeId      = productAttributeSize.Id,
                        ProductAttributeValueId = productAttributeValuesSize[1].Id
                    },
                    new ProductVariantAttribute()
                    {
                        ProductAttributeId      = productAttributeColor.Id,
                        ProductAttributeValueId = productAttributeValuesColor[0].Id
                    }
                },
                TrackInventory = true
            });

            _warehouseInventoryService.Insert(new WarehouseInventory()
            {
                ProductId        = _p1.Id,
                ProductVariantId = mRedVariant.Id,
                TotalQuantity    = 0,
                ReservedQuantity = 0,
                WarehouseId      = _w1.Id
            });

            _warehouseInventoryService.Insert(new WarehouseInventory()
            {
                ProductId        = _p2.Id,
                WarehouseId      = _w1.Id,
                ReservedQuantity = 1,
                TotalQuantity    = 1
            });
            _warehouseInventoryService.Insert(new WarehouseInventory()
            {
                ProductId        = _p2.Id,
                WarehouseId      = _w2.Id,
                ReservedQuantity = 1,
                TotalQuantity    = 2
            });

            _o1 = new Order()
            {
                Id         = 1,
                OrderItems = new List <OrderItem>()
                {
                    new OrderItem()
                    {
                        OrderId          = 1,
                        ProductId        = _p1.Id,
                        ProductVariantId = sRedVariant.Id,
                        Quantity         = 2,
                        Id = 1
                    },
                    new OrderItem()
                    {
                        OrderId          = 1,
                        ProductId        = _p1.Id,
                        ProductVariantId = sGreenVariant.Id,
                        Quantity         = 1,
                        Id = 2
                    }
                }
            };

            _o2 = new Order()
            {
                Id         = 2,
                OrderItems = new List <OrderItem>()
                {
                    new OrderItem()
                    {
                        OrderId   = 2,
                        ProductId = _p2.Id,
                        Quantity  = 1,
                        Id        = 3
                    }
                }
            };

            _o3 = new Order()
            {
                Id         = 3,
                OrderItems = new List <OrderItem>()
                {
                    new OrderItem()
                    {
                        OrderId   = 2,
                        ProductId = _p2.Id,
                        Quantity  = 3,
                        Id        = 4
                    }
                }
            };

            _o4 = new Order()
            {
                Id         = 4,
                OrderItems = new List <OrderItem>()
                {
                    new OrderItem()
                    {
                        OrderId          = 1,
                        ProductId        = _p1.Id,
                        ProductVariantId = sRedVariant.Id,
                        Quantity         = 2,
                        Id = 5
                    },
                    new OrderItem()
                    {
                        OrderId          = 1,
                        ProductId        = _p1.Id,
                        ProductVariantId = sGreenVariant.Id,
                        Quantity         = 1,
                        Id = 6
                    },
                    new OrderItem()
                    {
                        OrderId   = 2,
                        ProductId = _p2.Id,
                        Quantity  = 1,
                        Id        = 7
                    }
                }
            };
        }
示例#53
0
 public PlainProductRepository(ISettingsService settingsService, IStoreService storeService, IProductVariantService variantService, IProductVariantGroupService variantGroupService, IProductAliassesService productAliassesService)
 {
     _oldRepo = new UmbracoProductRepository(settingsService, storeService, variantService, variantGroupService, productAliassesService);
 }
示例#54
0
 public ProductVariantProductDoesntAlreadyExist(IProductService productService, IProductVariantService productVariantService)
 {
     _productService        = productService;
     _productVariantService = productVariantService;
 }
示例#55
0
 /// <summary>
 /// Adds or updates a product variant to the index if the product variant has an identity
 /// </summary>
 static void ProductVariantServiceCreated(IProductVariantService sender, Core.Events.NewEventArgs<IProductVariant> e)
 {
     if (e.Entity.HasIdentity) IndexProductVariant(e.Entity);
 }
示例#56
0
 /// <summary>
 /// The product variant service on deleted.
 /// </summary>
 /// <param name="sender">
 /// The sender.
 /// </param>
 /// <param name="deleteEventArgs">
 /// The delete event args.
 /// </param>
 protected void ProductVariantServiceOnDeleted(IProductVariantService sender, DeleteEventArgs <IProductVariant> deleteEventArgs)
 {
     ClearCache();
 }
示例#57
0
 /// <summary>
 /// Adds or updates a product variant to the index
 /// </summary>
 static void ProductVariantServiceSaved(IProductVariantService sender, SaveEventArgs<IProductVariant> e)
 {
     e.SavedEntities.ForEach(IndexProductVariant);
 }
示例#58
0
 public ProductAccountant(IProductVariantService productVariantService)
 {
     _productVariantService = productVariantService;
 }
示例#59
0
 public OrderUpdatingService(ICMSApplication cmsApplication, IProductService productService, IProductVariantService productVariantService,
                             ICouponCodeService couponCodeService, IOrderService orderService, IOrderNumberService orderNumberService, IOrderRepository orderRepository)
 {
     _cmsApplication        = cmsApplication;
     _productService        = productService;
     _productVariantService = productVariantService;
     _couponCodeService     = couponCodeService;
     _orderService          = orderService;
     _orderNumberService    = orderNumberService;
     _orderRepository       = orderRepository;
 }
示例#60
0
 /// <summary>
 /// The product variant service on saved.
 /// </summary>
 /// <param name="sender">
 /// The sender.
 /// </param>
 /// <param name="saveEventArgs">
 /// The save event args.
 /// </param>
 protected void ProductVariantServiceOnSaved(IProductVariantService sender, SaveEventArgs <IProductVariant> saveEventArgs)
 {
     ClearCache();
 }