예제 #1
0
 public JsonResult GetAllEvaluationSystem()
 {
     try
     {
         using (EvaluationSystemHelper helper = new EvaluationSystemHelper())
         {
             var result = helper.GetAllSystem().Select(p => new
             {
                 p.Id,
                 pId = p.ParentId,
                 p.Name,
                 p.Order,
                 p.Describe
             }).ToList().Select(p => new
             {
                 p.Id,
                 p.pId,
                 p.Name,
                 p.Order,
                 p.Describe,
                 //isParent=p.Count>0
             }).OrderBy(p => p.Order);
             return(Json(new { flag = true, result }, JsonRequestBehavior.AllowGet));
         }
     }
     catch (Exception e)
     {
         return(Json(new { flag = false, message = e.Message }, JsonRequestBehavior.AllowGet));
     }
 }
예제 #2
0
 public JsonResult GetAllSystemRecursion()
 {
     try
     {
         using (EvaluationSystemHelper helper = new EvaluationSystemHelper())
         {
             var result = helper.GetAllSystem().Where(p => p.ParentId == null).Select(p => new
             {
                 p.Id,
                 p.Name,
                 p.Order,
                 p.Describe,
                 Properties = p.EvaluationSystem1.Select(q => new
                 {
                     q.Id,
                     q.Name,
                     q.Order,
                     q.Describe,
                     Properties = q.EvaluationSystem1.Select(m => new
                     {
                         m.Id,
                         m.Name,
                         m.Order,
                         m.Describe,
                     })
                 })
             }).ToList().OrderBy(p => p.Order).Select(p => new
             {
                 p.Id,
                 p.Name,
                 p.Describe,
                 Properties = p.Properties.Select(q => new
                 {
                     q.Id,
                     q.Name,
                     q.Order,
                     q.Describe,
                     Properties = q.Properties.OrderBy(m => m.Order).ToList()
                 }).OrderBy(q => q.Order).ToList()
             });
             return(Json(new { flag = true, result }, JsonRequestBehavior.AllowGet));
         }
     }
     catch (Exception e)
     {
         return(Json(new { flag = false, message = e.Message }));
     }
 }