Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/qt/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在订单状态更改时添加注释,nopcommerce 3.0来源_C#_Asp.net_Asp.net Mvc 4_Nopcommerce - Fatal编程技术网

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

C# 在订单状态更改时添加注释,nopcommerce 3.0来源,c#,asp.net,asp.net-mvc-4,nopcommerce,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 h

有人能帮我吗?我正试图让它在订单状态更改时向系统添加注释,到目前为止,我让它添加注释,但它显示为订单状态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
     });

我接下来的步骤是什么?

我现在已经完成了

我只需要传递字符串变量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
                 });

你的问题不清楚?显示便笺的代码在哪里?@Falaque添加便笺的代码是order.OrderNotes.Add(new OrderNote(),括号内的部分是添加到便笺的信息。我的意思是,在UI中,您需要查看使用了哪个引用,order.OrderStatusId或order.OrderNotes。