本文整理汇总了C#中OrderInfo.FireAfterOrderLineUpdatedEvent方法的典型用法代码示例。如果您正苦于以下问题:C# OrderInfo.FireAfterOrderLineUpdatedEvent方法的具体用法?C# OrderInfo.FireAfterOrderLineUpdatedEvent怎么用?C# OrderInfo.FireAfterOrderLineUpdatedEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OrderInfo
的用法示例。
在下文中一共展示了OrderInfo.FireAfterOrderLineUpdatedEvent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddOrUpdateOrderLine
//.........这里部分代码省略.........
if (action == "update")
{
var beforeUpdatedEventArgs = order.FireBeforeOrderLineUpdatedEvent(orderLine);
if (beforeUpdatedEventArgs == null || !beforeUpdatedEventArgs.Cancel) // todo: test the cancel
{
if (orderLine == null)
{
order.FireBeforeOrderLineCreatedEvent();
if (orderLineId == 0)
{
orderLine = OrderProduct(productId, variants, itemCount, order);
if (!order.OrderLines.Any())
{
orderLine.OrderLineId = 1;
}
else
{
var firstOrDefault = order.OrderLines.OrderByDescending(x => x.OrderLineId).FirstOrDefault();
if (firstOrDefault != null)
{
var highestOrderLineId = firstOrDefault.OrderLineId;
orderLine.OrderLineId = highestOrderLineId + 1;
}
}
}
if (orderLine == null)
{
throw new Exception("Order line not found");
}
order.OrderLines.Add(orderLine);
order.FireAfterOrderLineCreatedEvent(orderLine);
}
if (orderLineId != 0)
{
orderLine.ProductInfo.ItemCount = itemCount; // todo: double with a few lines below?
// onderstaande regel gooit variants weg als ze niet in de lijst met ids zitten, dat is by design
orderLine.ProductInfo.ProductVariants = variants.Select(
variant => new ProductVariantInfo(DomainHelper.GetProductVariantById(variant), orderLine.ProductInfo, itemCount)).ToList();
}
orderLine.ProductInfo.ChangedOn = DateTime.Now;
orderLine.ProductInfo.ItemCount = itemCount;
UpdateProductInfoDiscountInformation(orderLine.ProductInfo);
foreach (var variant in orderLine.ProductInfo.ProductVariants)
variant.ChangedOn = DateTime.Now;
order.FireAfterOrderLineUpdatedEvent(orderLine);
}
//Log.Instance.LogDebug("AddOrUpdateOrderLine() UPDATE END: " + DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fff tt"));
}
#endregion
#region delete
if (action == "delete")
{
BeforeOrderLineDeletedEventArgs beforeDeletedEventArgs = order.FireBeforeOrderLineDeletedEvent(orderLine);
if (beforeDeletedEventArgs == null || !beforeDeletedEventArgs.Cancel)
{
order.OrderLines.Remove(orderLine);
order.FireAfterOrderLineDeletedEvent();
}
}
#endregion
// UPDATE SHIPPING & SET UPDATESHIPPINGCOSTS TO TRUE AFTER BASKET UPDATE
//Log.Instance.LogDebug( "AddOrUpdateOrderLine() AutoSelectShippingProvider START: " + DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fff tt"));
//AutoSelectShippingProvider();
//Log.Instance.LogDebug( "AddOrUpdateOrderLine() AutoSelectShippingProvider END: " + DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fff tt"));
order.ShippingCostsMightBeOutdated = true;
//Log.Instance.LogDebug( "AddOrUpdateOrderLine() function END: " + DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fff tt"));
if (fields == null) return;
var xDoc = new XDocument(new XElement("Fields"));
Log.Instance.LogDebug("AddOrUpdateOrderLine Before xdoc");
if (orderLine != null && orderLine.ProductInfo != null && orderLine.ProductInfo.CatalogProduct != null)
{
AddFieldsToXDocumentBasedOnCMSDocumentType(xDoc, fields, orderLine.ProductInfo.CatalogProduct.NodeTypeAlias());
orderLine._customData = xDoc;
}
}