public ActionResult Edit(NoStockType obj)
 {
    
     try
     {
         NSession.Update(obj);
         NSession.Flush();
         List<NoStockLinkType> list1 = Newtonsoft.Json.JsonConvert.DeserializeObject<List<NoStockLinkType>>(obj.rowse);
         NSession.Delete("from NoStockLinkType where PId='" + obj.Id + "'");
         NSession.Flush();
         NSession.Clear();
         foreach (NoStockLinkType link in list1)
         {
             link.OldSKU = obj.OldSKU;
             link.SKU = obj.SKU;
             link.PId = obj.Id;
             link.CreateBy = CurrentUser.Realname;
             link.CreateOn = DateTime.Now;
             NSession.Save(link);
             NSession.Flush();
         }
     }
     catch (Exception ee)
     {
         return Json(new { errorMsg = "出错了" });
     }
     return Json(new { IsSuccess = "true" });
    
 }
 public JsonResult Create(NoStockType obj)
 {
     try
     {
         obj.Enabled = 1;
         obj.CreateBy = CurrentUser.Realname;
         obj.CreateOn = DateTime.Now;
         NSession.SaveOrUpdate(obj);
         NSession.Flush();
         List<NoStockLinkType> list1 = Newtonsoft.Json.JsonConvert.DeserializeObject<List<NoStockLinkType>>(obj.rows);
         foreach (NoStockLinkType link in list1)
         {
             link.OldSKU = obj.OldSKU;
             link.SKU = obj.SKU;
             link.PId = obj.Id;
             link.CreateBy = CurrentUser.Realname;
             link.CreateOn = DateTime.Now;
             NSession.Save(link);
             NSession.Flush();
         }
     }
     catch (Exception ee)
     {
         return Json(new { errorMsg = "出错了" });
     }
     return Json(new { IsSuccess = "true" });
 }