/// <summary> /// Converts a line item of one type to a line item of another type while preserving the key. /// </summary> /// <param name="lineItem"> /// The line item. /// </param> /// <typeparam name="T"> /// The type of the line item /// </typeparam> /// <returns> /// The <see cref="T"/>. /// </returns> public static T AsLineItemWithKeyOf <T>(this ILineItem lineItem) where T : class, ILineItem { var clone = lineItem.AsLineItemOf <T>(); clone.Key = lineItem.Key; return(clone); }
/// <summary> /// The visit. /// </summary> /// <param name="lineItem"> /// The line item. /// </param> public void Visit(ILineItem lineItem) { // For the first release we are going to assume everything shippable is a product listed in the Merchello catalog if (lineItem.ExtendedData.ContainsProductVariantKey() && lineItem.ExtendedData.GetShippableValue() && lineItem.LineItemType == LineItemType.Product) { _lineItems.Add(lineItem.AsLineItemOf <OrderLineItem>()); } }
/// <summary> /// The visit. /// </summary> /// <param name="lineItem"> /// The line item. /// </param> public void Visit(ILineItem lineItem) { // For the first release we are going to assume everything shippable is a product listed in the Merchello catalog if (lineItem.ExtendedData.ContainsProductVariantKey() && lineItem.ExtendedData.GetShippableValue() && lineItem.LineItemType == LineItemType.Product) { _lineItems.Add(lineItem.AsLineItemOf<OrderLineItem>()); } }