本文整理汇总了C#中IProductAttributeParser.AreProductAttributesEqual方法的典型用法代码示例。如果您正苦于以下问题:C# IProductAttributeParser.AreProductAttributesEqual方法的具体用法?C# IProductAttributeParser.AreProductAttributesEqual怎么用?C# IProductAttributeParser.AreProductAttributesEqual使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IProductAttributeParser
的用法示例。
在下文中一共展示了IProductAttributeParser.AreProductAttributesEqual方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MergeWithCombination
public static ProductVariantAttributeCombination MergeWithCombination(this Product product, string selectedAttributes, IProductAttributeParser productAttributeParser)
{
Guard.ArgumentNotNull(productAttributeParser, "productAttributeParser");
if (selectedAttributes.IsNullOrEmpty())
return null;
// let's find appropriate record
var combination = product
.ProductVariantAttributeCombinations
.Where(x => x.IsActive == true)
.FirstOrDefault(x => productAttributeParser.AreProductAttributesEqual(x.AttributesXml, selectedAttributes));
if (combination != null)
{
product.MergeWithCombination(combination);
}
return combination;
}
示例2: GetSkuMpnGtin
/// <summary>
/// Gets SKU, Manufacturer part number and GTIN
/// </summary>
/// <param name="productVariant">Product variant</param>
/// <param name="selectedAttributes">Selected attributes (XML format)</param>
/// <param name="productAttributeParser">Product attribute service (used when attributes are specified)</param>
/// <param name="sku">SKU</param>
/// <param name="manufacturerPartNumber">Manufacturer part number</param>
/// <param name="gtin">GTIN</param>
private static void GetSkuMpnGtin(this ProductVariant productVariant, string selectedAttributes, IProductAttributeParser productAttributeParser,
out string sku, out string manufacturerPartNumber, out string gtin)
{
if (productVariant == null)
throw new ArgumentNullException("productVariant");
sku = null;
manufacturerPartNumber = null;
gtin = null;
if (productVariant.ManageInventoryMethod == ManageInventoryMethod.ManageStockByAttributes)
{
//manage stock by attribute combinations
if (productAttributeParser == null)
throw new ArgumentNullException("productAttributeParser");
//let's find appropriate record
var combination = productVariant
.ProductVariantAttributeCombinations
.FirstOrDefault(x => productAttributeParser.AreProductAttributesEqual(x.AttributesXml, selectedAttributes));
if (combination != null)
{
sku = combination.Sku;
manufacturerPartNumber = combination.ManufacturerPartNumber;
gtin = combination.Gtin;
}
}
if (String.IsNullOrEmpty(sku))
sku = productVariant.Sku;
if (String.IsNullOrEmpty(manufacturerPartNumber))
manufacturerPartNumber = productVariant.ManufacturerPartNumber;
if (String.IsNullOrEmpty(gtin))
gtin = productVariant.Gtin;
}