本文整理汇总了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());
}
示例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);
}
示例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
}
示例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);
}
示例5: Init
public void Init()
{
_extendedData = new ExtendedDataCollection();
var product = MockProductDataMaker.MockProductComplete(Guid.NewGuid());
_extendedData.AddProductVariantValues(((Product)product).MasterVariant);
}