本文整理汇总了C#中OrderInfo.FireBeforeOrderLineCreatedEvent方法的典型用法代码示例。如果您正苦于以下问题:C# OrderInfo.FireBeforeOrderLineCreatedEvent方法的具体用法?C# OrderInfo.FireBeforeOrderLineCreatedEvent怎么用?C# OrderInfo.FireBeforeOrderLineCreatedEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OrderInfo
的用法示例。
在下文中一共展示了OrderInfo.FireBeforeOrderLineCreatedEvent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddOrUpdateOrderLine
//.........这里部分代码省略.........
}
if (HttpContext.Current != null && higherItemList.Any())
{ // todo: dit moet ook in handleobject komen
Session.Add(Constants.OrderedItemcountHigherThanStockKey, higherItemList);
}
if (HttpContext.Current != null) // todo: better decoupling
ClientErrorHandling.SetOrClearErrorMessage(!tooMuchStock, "Ordered higher quantity than available stock. Updated the basked to available stock count", "Stock", requestedItemCount.ToString());
}
if (itemCount < 1)
{
itemCount = 0;
}
if (action == "update" && itemCount == 0)
{
action = "delete";
}
Log.Instance.LogDebug("AddOrUpdateOrderLine Before update");
#region update
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?