本文整理汇总了C#中OrderStatus.GetLocalizedEnum方法的典型用法代码示例。如果您正苦于以下问题:C# OrderStatus.GetLocalizedEnum方法的具体用法?C# OrderStatus.GetLocalizedEnum怎么用?C# OrderStatus.GetLocalizedEnum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OrderStatus
的用法示例。
在下文中一共展示了OrderStatus.GetLocalizedEnum方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetOrderStatus
/// <summary>
/// Sets an order status
/// </summary>
/// <param name="order">Order</param>
/// <param name="os">New order status</param>
/// <param name="notifyCustomer">True to notify customer</param>
protected void SetOrderStatus(Order order, OrderStatus os, bool notifyCustomer)
{
if (order == null)
throw new ArgumentNullException("order");
OrderStatus prevOrderStatus = order.OrderStatus;
if (prevOrderStatus == os)
return;
//set and save new order status
order.OrderStatusId = (int)os;
_orderService.UpdateOrder(order);
//order notes, notifications
order.OrderNotes.Add(new OrderNote()
{
Note = string.Format(T("OrderStatusChanged"), os.GetLocalizedEnum(_localizationService)),
DisplayToCustomer = false,
CreatedOnUtc = DateTime.UtcNow
});
_orderService.UpdateOrder(order);
if (prevOrderStatus != OrderStatus.Complete &&
os == OrderStatus.Complete
&& notifyCustomer)
{
//notification
int orderCompletedCustomerNotificationQueuedEmailId = _workflowMessageService.SendOrderCompletedCustomerNotification(order, order.CustomerLanguageId);
if (orderCompletedCustomerNotificationQueuedEmailId > 0)
{
order.OrderNotes.Add(new OrderNote()
{
Note = string.Format(T("CustomerCompletedEmailQueued"), orderCompletedCustomerNotificationQueuedEmailId),
DisplayToCustomer = false,
CreatedOnUtc = DateTime.UtcNow
});
_orderService.UpdateOrder(order);
}
}
if (prevOrderStatus != OrderStatus.Cancelled &&
os == OrderStatus.Cancelled
&& notifyCustomer)
{
//notification
int orderCancelledCustomerNotificationQueuedEmailId = _workflowMessageService.SendOrderCancelledCustomerNotification(order, order.CustomerLanguageId);
if (orderCancelledCustomerNotificationQueuedEmailId > 0)
{
order.OrderNotes.Add(new OrderNote()
{
Note = string.Format(T("CustomerCancelledEmailQueued"), orderCancelledCustomerNotificationQueuedEmailId),
DisplayToCustomer = false,
CreatedOnUtc = DateTime.UtcNow
});
_orderService.UpdateOrder(order);
}
}
//reward points
if (_rewardPointsSettings.PointsForPurchases_Awarded == order.OrderStatus)
{
AwardRewardPoints(order);
}
if (_rewardPointsSettings.PointsForPurchases_Canceled == order.OrderStatus)
{
ReduceRewardPoints(order);
}
//gift cards activation
if (_orderSettings.GiftCards_Activated_OrderStatusId > 0 &&
_orderSettings.GiftCards_Activated_OrderStatusId == (int)order.OrderStatus)
{
SetActivatedValueForPurchasedGiftCards(order, true);
}
//gift cards deactivation
if (_orderSettings.GiftCards_Deactivated_OrderStatusId > 0 &&
_orderSettings.GiftCards_Deactivated_OrderStatusId == (int)order.OrderStatus)
{
SetActivatedValueForPurchasedGiftCards(order, false);
}
}