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


C# ExtendedDataCollection.AddProductVariantValues方法代码示例

本文整理汇总了C#中ExtendedDataCollection.AddProductVariantValues方法的典型用法代码示例。如果您正苦于以下问题:C# ExtendedDataCollection.AddProductVariantValues方法的具体用法?C# ExtendedDataCollection.AddProductVariantValues怎么用?C# ExtendedDataCollection.AddProductVariantValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ExtendedDataCollection的用法示例。


在下文中一共展示了ExtendedDataCollection.AddProductVariantValues方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Can_Convert_A_LineItem_Of_Type_ItemCacheLineItem_To_A_InvoiceLineItem

        public void Can_Convert_A_LineItem_Of_Type_ItemCacheLineItem_To_A_InvoiceLineItem()
        {
            //// Arrange
            var product = MockProductDataMaker.MockProductForInserting();
            var extendedData = new ExtendedDataCollection();
            extendedData.AddProductVariantValues(((Product)product).MasterVariant);
            var itemCacheLineItem = new ItemCacheLineItem(LineItemType.Product, product.Name,
                                                          product.Sku, 2, 2*product.Price, extendedData);

            //// Act
            var invoiceLineItem = itemCacheLineItem.AsLineItemOf<InvoiceLineItem>();

            //// Assert
            Assert.NotNull(invoiceLineItem);
            Assert.AreEqual(Guid.Empty, invoiceLineItem.ContainerKey);
            Assert.AreEqual(typeof(InvoiceLineItem), invoiceLineItem.GetType());
        }
开发者ID:BatJan,项目名称:Merchello,代码行数:17,代码来源:LineItemTests.cs

示例2: AddItem

        /// <summary>
        /// Adds a line item to the wish list
        /// </summary>
        /// <param name="productVariant">
        /// The product Variant.
        /// </param>
        /// <param name="name">
        /// The name.
        /// </param>
        /// <param name="quantity">
        /// The quantity.
        /// </param>
        /// <param name="extendedData">
        /// The extended Data.
        /// </param>
        public void AddItem(IProductVariant productVariant, string name, int quantity, ExtendedDataCollection extendedData)
        {
            if (!extendedData.DefinesProductVariant()) extendedData.AddProductVariantValues(productVariant);

            var onSale = productVariant.OnSale ? extendedData.GetSalePriceValue() : extendedData.GetPriceValue();

            AddItem(string.IsNullOrEmpty(name) ? productVariant.Name : name, productVariant.Sku, quantity, onSale, extendedData);
        }
开发者ID:arknu,项目名称:Merchello,代码行数:23,代码来源:Wishlist.cs

示例3: AddItem

        /// <summary>
        /// Adds a line item to the basket
        /// </summary>
        public void AddItem(IProductVariant productVariant, string name, int quantity, ExtendedDataCollection extendedData)
        {
            if(!extendedData.DefinesProductVariant()) extendedData.AddProductVariantValues(productVariant);

            AddItem(
                string.IsNullOrEmpty(name) ? productVariant.Name : name,
                productVariant.Sku,
                quantity,
                productVariant.OnSale ?
                extendedData.GetSalePriceValue()
                : extendedData.GetPriceValue(), extendedData); // get the price information from extended data in case it has been overriden

            //productVariant.SalePrice.Value : productVariant.Price
        }
开发者ID:BatJan,项目名称:Merchello,代码行数:17,代码来源:Basket.cs

示例4: AddItem

        /// <summary>
        /// Adds a <see cref="ProductVariantDisplay"/> to the item cache
        /// </summary>
        /// <param name="productVariant">
        /// The product variant to be added
        /// </param>
        /// <param name="name">
        /// The name.
        /// </param>
        /// <param name="quantity">
        /// The quantity to be represented
        /// </param>
        /// <param name="extendedData">
        /// The extended Data.
        /// </param>
        public void AddItem(ProductVariantDisplay productVariant, string name, int quantity, ExtendedDataCollection extendedData)
        {
            if (EnableDataModifiers)
            {
                var attempt = _productDataModifier.Value.Modify(productVariant);
                if (attempt.Success)
                {
                    var modified = attempt.Result as ProductVariantDisplay;
                    if (modified != null)
                    {
                        extendedData.MergeDataModifierLogs(modified);
                        if (!extendedData.DefinesProductVariant()) extendedData.AddProductVariantValues(modified);
                        productVariant = modified;
                    }
                }
            }
            else
            {
                extendedData.MergeDataModifierLogs(productVariant);
                if (!extendedData.DefinesProductVariant()) extendedData.AddProductVariantValues(productVariant);
            }

            var price = productVariant.OnSale ? extendedData.GetSalePriceValue() : extendedData.GetPriceValue();

            AddItem(string.IsNullOrEmpty(name) ? productVariant.Name : name, productVariant.Sku, quantity, price, extendedData);
        }
开发者ID:drpeck,项目名称:Merchello,代码行数:41,代码来源:CustomerItemCacheBase.cs

示例5: Init

 public void Init()
 {
     _extendedData = new ExtendedDataCollection();
     var product = MockProductDataMaker.MockProductComplete(Guid.NewGuid());
     _extendedData.AddProductVariantValues(((Product)product).MasterVariant);
 }
开发者ID:naepalm,项目名称:Merchello,代码行数:6,代码来源:ExtendedDataExtensionTests.cs


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