在订单状态更改时添加注释,nopcommerce 3.0源

时间:2014-01-22 11:38:05

标签: c# asp.net asp.net-mvc-4 nopcommerce

任何人都可以帮我这个,我试图让它在订单状态改变时向系统添加注释,到目前为止我已经添加了注释但是它将其显示为订单状态ID号而不是它的字符串引用

代码已插入OrderController.cs

 int osid = order.OrderStatusId;
     //order notes, notifications
     order.OrderNotes.Add(new OrderNote()
     {
         Note = string.Format("Order status has been changed to {0}",  osid.ToString()),
         DisplayToCustomer = false,
         CreatedOnUtc = DateTime.UtcNow
     });

我的下一步是什么?

1 个答案:

答案 0 :(得分:0)

我现在已经完成了这个,

我只需要传递字符串变量order.OrderStatus而不是ID,

修改后的代码

 order.OrderStatusId = model.OrderStatusId;
                 var os = order.OrderStatus;
                 //order notes, notifications
                 order.OrderNotes.Add(new OrderNote()
                 {
                     Note = string.Format("Order status has been changed to {0}", os.ToString()),
                     DisplayToCustomer = false,
                     CreatedOnUtc = DateTime.UtcNow
                 });