当前位置: 首页>>代码示例>>C#>>正文


C# Catalog.TierPrice类代码示例

本文整理汇总了C#中Nop.Core.Domain.Catalog.TierPrice的典型用法代码示例。如果您正苦于以下问题:C# TierPrice类的具体用法?C# TierPrice怎么用?C# TierPrice使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TierPrice类属于Nop.Core.Domain.Catalog命名空间,在下文中一共展示了TierPrice类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Can_save_and_load_tierPrice

        public void Can_save_and_load_tierPrice()
        {
            var tierPrice = new TierPrice
                      {
                          Quantity = 1,
                          Price = 2.1M,
                          ProductVariant = GetTestProductVariant(),
                      };

            var fromDb = SaveAndLoadEntity(tierPrice);
            fromDb.ShouldNotBeNull();
            fromDb.Quantity.ShouldEqual(1);
            fromDb.Price.ShouldEqual(2.1M);

            fromDb.ProductVariant.ShouldNotBeNull();
            fromDb.ProductVariant.Name.ShouldEqual("Product variant name 1");
        }
开发者ID:emretiryaki,项目名称:paymill-nopcommerce,代码行数:17,代码来源:TierPricePersistenceTests.cs

示例2: Can_save_and_load_tierPrice

        public void Can_save_and_load_tierPrice()
        {
            var tierPrice = new TierPrice
            {
                StoreId = 7,
                Quantity = 1,
                Price = 2.1M,
                Product = GetTestProduct(),
           };

            var fromDb = SaveAndLoadEntity(tierPrice);
            fromDb.ShouldNotBeNull();
            fromDb.StoreId.ShouldEqual(7);
            fromDb.Quantity.ShouldEqual(1);
            fromDb.Price.ShouldEqual(2.1M);

            fromDb.Product.ShouldNotBeNull();
        }
开发者ID:haithemChkel,项目名称:nopCommerce_33,代码行数:18,代码来源:TierPricePersistenceTests.cs

示例3: Can_save_and_load_tierPriceWithCustomerRole

        public void Can_save_and_load_tierPriceWithCustomerRole()
        {
            var tierPrice = new TierPrice
            {
                Quantity = 1,
                Price = 2,
                Product = GetTestProduct(),
                CustomerRole = new CustomerRole()
                {
                    Name = "Administrators",
                    FreeShipping = true,
                    TaxExempt = true,
                    Active = true,
                    IsSystemRole = true,
                    SystemName = "Administrators"
                }
            };

            var fromDb = SaveAndLoadEntity(tierPrice);
            fromDb.ShouldNotBeNull();

            fromDb.CustomerRole.ShouldNotBeNull();
            fromDb.CustomerRole.Name.ShouldEqual("Administrators");
        }
开发者ID:haithemChkel,项目名称:nopCommerce_33,代码行数:24,代码来源:TierPricePersistenceTests.cs

示例4: DeleteTierPrice

        /// <summary>
        /// Deletes a tier price
        /// </summary>
        /// <param name="tierPrice">Tier price</param>
        public virtual void DeleteTierPrice(TierPrice tierPrice)
        {
            if (tierPrice == null)
                throw new ArgumentNullException("tierPrice");

            _tierPriceRepository.Delete(tierPrice);

            _cacheManager.RemoveByPattern(PRODUCTS_PATTERN_KEY);

            //event notification
            _eventPublisher.EntityDeleted(tierPrice);
        }
开发者ID:RobinHoody,项目名称:nopCommerce,代码行数:16,代码来源:ProductService.cs

示例5: InsertTierPrice

        /// <summary>
        /// Inserts a tier price
        /// </summary>
        /// <param name="tierPrice">Tier price</param>
        public virtual void InsertTierPrice(TierPrice tierPrice)
        {
            if (tierPrice == null)
                throw new ArgumentNullException("tierPrice");

            _tierPriceRepository.Insert(tierPrice);

            _cacheManager.RemoveByPattern(PRODUCTS_PATTERN_KEY);
            _cacheManager.RemoveByPattern(PRODUCTVARIANTS_PATTERN_KEY);
            _cacheManager.RemoveByPattern(TIERPRICES_PATTERN_KEY);

            //event notification
            _eventPublisher.EntityInserted(tierPrice);
        }
开发者ID:alexgonchar,项目名称:WebArsenal,代码行数:18,代码来源:ProductService.cs

示例6: TierPriceInsert

        public ActionResult TierPriceInsert(ProductModel.TierPriceModel model)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageProducts))
                return AccessDeniedView();

            var product = _productService.GetProductById(model.ProductId);
            if (product == null)
                throw new ArgumentException("No product found with the specified id");

            //a vendor should have access only to his products
            if (_workContext.CurrentVendor != null && product.VendorId != _workContext.CurrentVendor.Id)
                return Content("This is not your product");

            var tierPrice = new TierPrice
            {
                ProductId = model.ProductId,
                StoreId = model.StoreId,
                CustomerRoleId = model.CustomerRoleId > 0 ? model.CustomerRoleId : (int?)null,
                Quantity = model.Quantity,
                Price = model.Price
            };
            _productService.InsertTierPrice(tierPrice);

            //update "HasTierPrices" property
            _productService.UpdateHasTierPricesProperty(product);

            return new NullJsonResult();
        }
开发者ID:AnnaLuiza94,项目名称:NopCommerce,代码行数:28,代码来源:ProductController.cs

示例7: UpdateTierPrice

        /// <summary>
        /// Updates the tier price
        /// </summary>
        /// <param name="tierPrice">Tier price</param>
        public virtual void UpdateTierPrice(TierPrice tierPrice)
        {
            if (tierPrice == null)
                throw new ArgumentNullException("tierPrice");


            var builder = Builders<Product>.Filter;
            var filter = builder.Eq(x => x.Id, tierPrice.ProductId);
            filter = filter & builder.Where(x => x.TierPrices.Any(y => y.Id == tierPrice.Id));

            var update = Builders<Product>.Update
                .Set(x => x.TierPrices.ElementAt(-1).Price, tierPrice.Price)
                .Set(x => x.TierPrices.ElementAt(-1).Quantity, tierPrice.Quantity)
                .Set(x => x.TierPrices.ElementAt(-1).StoreId, tierPrice.StoreId)
                .Set(x => x.TierPrices.ElementAt(-1).CustomerRoleId, tierPrice.CustomerRoleId);

            var result = _productRepository.Collection.UpdateManyAsync(filter, update).Result;

            //cache
            _cacheManager.RemoveByPattern(string.Format(PRODUCTS_BY_ID_KEY, tierPrice.ProductId));


            //event notification
            _eventPublisher.EntityUpdated(tierPrice);
        }
开发者ID:powareverb,项目名称:grandnode,代码行数:29,代码来源:ProductService.cs

示例8: InsertTierPrice

        /// <summary>
        /// Inserts a tier price
        /// </summary>
        /// <param name="tierPrice">Tier price</param>
        public virtual void InsertTierPrice(TierPrice tierPrice)
        {
            if (tierPrice == null)
                throw new ArgumentNullException("tierPrice");

            //_tierPriceRepository.Insert(tierPrice);
            
            var updatebuilder = Builders<Product>.Update;
            var update = updatebuilder.AddToSet(p => p.TierPrices, tierPrice);
            _productRepository.Collection.UpdateOneAsync(new BsonDocument("Id", tierPrice.ProductId), update);

            //cache
            _cacheManager.RemoveByPattern(string.Format(PRODUCTS_BY_ID_KEY, tierPrice.ProductId));

            //event notification
            _eventPublisher.EntityInserted(tierPrice);
        }
开发者ID:powareverb,项目名称:grandnode,代码行数:21,代码来源:ProductService.cs


注:本文中的Nop.Core.Domain.Catalog.TierPrice类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。