public ActionResult Edit(PlacardType obj)
        {

            try
            {
                NSession.Update(obj);
                NSession.Flush();
            }
            catch (Exception ee)
            {
                return Json(new { IsSuccess = false, ErrorMsg = "出错了" });
            }
            return Json(new { IsSuccess = true  });
        }
 public JsonResult Create(PlacardType obj)
 {
     try
     {
         obj.CreateOn = DateTime.Now;
         obj.CreateBy = CurrentUser.Realname;
         NSession.Save(obj);
         NSession.Flush();
     }
     catch (Exception ee)
     {
         return Json(new { IsSuccess = false, ErrorMsg = "出错了" });
     }
     return Json(new { IsSuccess = true  });
 }
        public ActionResult EditStatus(string p, string s)
        {
            List<ProductType> products =
                NSession.CreateQuery("from ProductType where Id in(" + p + ")").List<ProductType>().ToList();
            foreach (ProductType productType in products)
            {
                productType.Status = s;
                NSession.Update(productType);
                NSession.Flush();
                LoggerUtil.GetProductRecord(productType, "订单产品属性修改",
                                                 "产品:" + productType.SKU + "状态修改为“" + s + "”",
                                                 CurrentUser, NSession);
                if (s == "停产")
                {
                    int count = 0;
                    string orderid = "";
                    List<OrderType> orderTypes =
                        NSession.CreateQuery(
                            "from OrderType where Id in(select OId from OrderProductType where SKU='" + productType.SKU + "') and Status='已处理' and Enabled=1")
                            .List<OrderType>().ToList();
                    foreach (OrderType orderType in orderTypes)
                    {
                        orderType.IsStop = 1;
                        NSession.Update(orderType);
                        NSession.Flush();
                        LoggerUtil.GetOrderRecord(orderType, "订单产品属性修改",
                                                  "产品:" + productType.SKU + "状态修改为“" + s + "”,同时订单属性设置为停售订单", CurrentUser, NSession);
                        orderid += orderType.OrderNo + "  ";
                        count++;
                    }
                    NSession.CreateQuery("update OrderProductType set IsQue=2 where SKU='" + productType.SKU + "'").UniqueResult();
                    PlacardType placard = new PlacardType { CardType = "产品", Title = productType.SKU + " 停产", Content = "相关" + count + "条订单编号: " + orderid, CreateBy = "系统自动", CreateOn = DateTime.Now, IsTop = 1 };
                    NSession.Save(placard);
                    NSession.Flush();

                }
            }
            return Json(new { IsSuccess = true });
        }