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


C# Catalog.Product类代码示例

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


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

示例1: Can_delete_mappings_for_entity

        public void Can_delete_mappings_for_entity()
        {
            var product = new Product { Id = 5 };

            _service.DeleteSyncMappingsFor(product);
            _rs.Table.Count().ShouldEqual(38);
        }
开发者ID:mandocaesar,项目名称:Mesinku,代码行数:7,代码来源:SyncMappingServiceTests.cs

示例2: Entity_should_not_equal_transient_entity

        public void Entity_should_not_equal_transient_entity() {
            
            var p1 = new Product { Id = 1 };
            var p2 = new Product();

            Assert.AreNotEqual(p1, p2, "Entity and transient entity should not be equal");
        }
开发者ID:JeffersonNascimento,项目名称:SmartStoreNET,代码行数:7,代码来源:EntityEqualityTests.cs

示例3: Entities_with_different_id_should_not_be_equal

        public void Entities_with_different_id_should_not_be_equal() {
            
            var p1 = new Product { Id = 2 };
            var p2 = new Product { Id = 5 };

            Assert.AreNotEqual(p1, p2, "Entities with different ids should not be equal");
        }
开发者ID:JeffersonNascimento,项目名称:SmartStoreNET,代码行数:7,代码来源:EntityEqualityTests.cs

示例4: Two_transient_entities_should_not_be_equal

        public void Two_transient_entities_should_not_be_equal() {
            
            var p1 = new Product();
            var p2 = new Product();

            Assert.AreNotEqual(p1, p2, "Different transient entities should not be equal");
        }
开发者ID:JeffersonNascimento,项目名称:SmartStoreNET,代码行数:7,代码来源:EntityEqualityTests.cs

示例5: Two_references_to_same_transient_entity_should_be_equal

        public void Two_references_to_same_transient_entity_should_be_equal() {
            
            var p1 = new Product();
            var p2 = p1;

            Assert.AreEqual(p1, p2, "Two references to the same transient entity should be equal");
        }
开发者ID:JeffersonNascimento,项目名称:SmartStoreNET,代码行数:7,代码来源:EntityEqualityTests.cs

示例6: Entities_with_same_id_but_different_type_should_not_be_equal

        public void Entities_with_same_id_but_different_type_should_not_be_equal() {
            int id = 10;
            var p1 = new Product { Id = id };

            var c1 = new Category { Id = id };

            Assert.AreNotEqual(p1, c1, "Entities of different types should not be equal, even if they have the same id");
        }
开发者ID:JeffersonNascimento,项目名称:SmartStoreNET,代码行数:8,代码来源:EntityEqualityTests.cs

示例7: Can_check_taxExempt_product

 public void Can_check_taxExempt_product()
 {
     var product = new Product();
     product.IsTaxExempt = true;
     _taxService.IsTaxExempt(product, null).ShouldEqual(true);
     product.IsTaxExempt = false;
     _taxService.IsTaxExempt(product, null).ShouldEqual(false);
 }
开发者ID:GloriousOnion,项目名称:SmartStoreNET,代码行数:8,代码来源:TaxServiceTests.cs

示例8: Two_references_with_the_same_id_should_be_equal

        public void Two_references_with_the_same_id_should_be_equal() {
            
            int id = 10;
            var p1 = new Product { Id = id };
            var p2 = new Product { Id = id };

            Assert.AreEqual(p1, p2, "Entities with the same id should be equal");
        }
开发者ID:JeffersonNascimento,项目名称:SmartStoreNET,代码行数:8,代码来源:EntityEqualityTests.cs

示例9: CreateAllProductVariantAttributeCombinations

        public virtual void CreateAllProductVariantAttributeCombinations(Product product)
        {
            // delete all existing combinations
            foreach(var itm in product.ProductVariantAttributeCombinations)
            {
                DeleteProductVariantAttributeCombination(itm);
            }

            var attributes = GetProductVariantAttributesByProductId(product.Id);
            if (attributes == null || attributes.Count <= 0)
                return;

            var toCombine = new List<List<ProductVariantAttributeValue>>();
            var resultMatrix = new List<List<ProductVariantAttributeValue>>();
            var tmp = new List<ProductVariantAttributeValue>();

            foreach (var attr in attributes)
            {
                var attributeValues = attr.ProductVariantAttributeValues.ToList();
                if (attributeValues.Count > 0)
                    toCombine.Add(attributeValues);
            }

            if (toCombine.Count > 0)
            {
                CombineAll(toCombine, resultMatrix, 0, tmp);

                foreach (var values in resultMatrix)
                {
                    string attrXml = "";
                    foreach (var x in values)
                    {
                        attrXml = attributes[values.IndexOf(x)].AddProductAttribute(attrXml, x.Id.ToString());
                    }

                    var combination = new ProductVariantAttributeCombination
                    {
                        ProductId = product.Id,
                        AttributesXml = attrXml,
                        StockQuantity = 10000,
                        AllowOutOfStockOrders = true,
                        IsActive = true
                    };

                    _productVariantAttributeCombinationRepository.Insert(combination);
                    _eventPublisher.EntityInserted(combination);
                }
            }

            //foreach (var y in resultMatrix) {
            //	StringBuilder sb = new StringBuilder();
            //	foreach (var x in y) {
            //		sb.AppendFormat("{0} ", x.Name);
            //	}
            //	sb.ToString().Dump();
            //}
        }
开发者ID:mandocaesar,项目名称:Mesinku,代码行数:57,代码来源:ProductAttributeService.cs

示例10: Can_load_mapping_by_entity

        public void Can_load_mapping_by_entity()
        {
            var product = new Product { Id = 5 };

            var mapping = _service.GetSyncMappingByEntity(product, "App2");
            Assert.NotNull(mapping);
            mapping.EntityName.ShouldEqual("Product");
            mapping.EntityId.ShouldEqual(5);
            mapping.SourceKey.ShouldEqual("e5");
        }
开发者ID:mandocaesar,项目名称:Mesinku,代码行数:10,代码来源:SyncMappingServiceTests.cs

示例11: Equality_works_using_operators

        public void Equality_works_using_operators() {

            var p1 = new Product { Id = 1 };
            var p2 = new Product { Id = 1 };

            Assert.IsTrue(p1 == p2);

            var p3 = new Product();

            Assert.IsTrue(p1 != p3);
        }
开发者ID:JeffersonNascimento,项目名称:SmartStoreNET,代码行数:11,代码来源:EntityEqualityTests.cs

示例12: Can_parse_required_product_ids

		public void Can_parse_required_product_ids()
		{
			var product = new Product
			{
				RequiredProductIds = "1, 4,7 ,a,"
			};

			var ids = product.ParseRequiredProductIds();
			ids.Length.ShouldEqual(3);
			ids[0].ShouldEqual(1);
			ids[1].ShouldEqual(4);
			ids[2].ShouldEqual(7);
		}
开发者ID:JeffersonNascimento,项目名称:SmartStoreNET,代码行数:13,代码来源:ProductExtensionTests.cs

示例13: Can_parse_allowed_quantities

        public void Can_parse_allowed_quantities()
        {
            var product = new Product()
            {
                AllowedQuantities = "1, 5,4,10,sdf"
            };

            var result = product.ParseAllowedQuatities();
            result.Length.ShouldEqual(4);
            result[0].ShouldEqual(1);
            result[1].ShouldEqual(5);
            result[2].ShouldEqual(4);
            result[3].ShouldEqual(10);
        }
开发者ID:JeffersonNascimento,项目名称:SmartStoreNET,代码行数:14,代码来源:ProductExtensionTests.cs

示例14: GetAllowedDiscounts

        /// <summary>
        /// Gets allowed discounts
        /// </summary>
		/// <param name="product">Product</param>
        /// <param name="customer">Customer</param>
        /// <returns>Discounts</returns>
        protected virtual IList<Discount> GetAllowedDiscounts(Product product, Customer customer)
        {
            var allowedDiscounts = new List<Discount>();
            if (_catalogSettings.IgnoreDiscounts)
                return allowedDiscounts;

			if (product.HasDiscountsApplied)
            {
                //we use this property ("HasDiscountsApplied") for performance optimziation to avoid unnecessary database calls
				foreach (var discount in product.AppliedDiscounts)
                {
					if (_discountService.IsDiscountValid(discount, customer) &&
						discount.DiscountType == DiscountType.AssignedToSkus &&
						!allowedDiscounts.ContainsDiscount(discount))
					{
						allowedDiscounts.Add(discount);
					}
                }
            }

            //performance optimization
            //load all category discounts just to ensure that we have at least one
            if (_discountService.GetAllDiscounts(DiscountType.AssignedToCategories).Any())
            {
				var productCategories = _categoryService.GetProductCategoriesByProductId(product.Id);
                if (productCategories != null)
                {
                    foreach (var productCategory in productCategories)
                    {
                        var category = productCategory.Category;

                        if (category.HasDiscountsApplied)
                        {
                            //we use this property ("HasDiscountsApplied") for performance optimziation to avoid unnecessary database calls
                            var categoryDiscounts = category.AppliedDiscounts;
                            foreach (var discount in categoryDiscounts)
                            {
								if (_discountService.IsDiscountValid(discount, customer) &&
									discount.DiscountType == DiscountType.AssignedToCategories &&
									!allowedDiscounts.ContainsDiscount(discount))
								{
									allowedDiscounts.Add(discount);
								}
                            }
                        }
                    }
                }
            }
            return allowedDiscounts;
        }
开发者ID:boatengfrankenstein,项目名称:SmartStoreNET,代码行数:56,代码来源:PriceCalculationService.cs

示例15: Can_get_final_product_price_with_additionalFee

        public void Can_get_final_product_price_with_additionalFee()
        {
            var product = new Product
            {
                Id = 1,
                Name = "Product name 1",
                Price = 12.34M,
                CustomerEntersPrice = false,
                Published = true,
            };

            //customer
            Customer customer = null;

            _priceCalcService.GetFinalPrice(product, customer, 5, false, 1).ShouldEqual(17.34M);
        }
开发者ID:mandocaesar,项目名称:Mesinku,代码行数:16,代码来源:PriceCalculationServiceTests.cs


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