public JsonResult Create(ProductCategoryType obj)
 {
     try
     {
         NSession.SaveOrUpdate(obj);
         NSession.Flush();
     }
     catch (Exception ee)
     {
         return Json(new { IsSuccess = false, ErrorMsg = "出错了" });
     }
     return Json(new { IsSuccess = true  });
 }
 private void GetChildren(IList<ProductCategoryType> objList, ProductCategoryType item, List<SystemTree> trees)
 {
     foreach (ProductCategoryType k in item.children)
     {
         SystemTree tree = trees.Find(p => p.id == k.Id.ToString());
         List<ProductCategoryType> kList = objList.Where(p => p.ParentId == k.Id).OrderByDescending(p => p.SortCode).ToList();
         k.children = kList;
         List<SystemTree> mlist = ConvertToTree(kList);
         tree.children = mlist;
         GetChildren(objList, k, mlist);
     }
 }
 private void GetChildren(IList<ProductCategoryType> objList, ProductCategoryType item)
 {
     foreach (ProductCategoryType k in item.children)
     {
         List<ProductCategoryType> kList = objList.Where(p => p.ParentId == k.Id).OrderByDescending(p => p.SortCode).ToList();
         k.children = kList;
         GetChildren(objList, k);
     }
 }