/// <summary>
 /// 同步一次性加载
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 private ActionResult SyncQueryLoad(QueryModel query)
 {
     List<ParameterViewModel> parameterTreeNodes = ParameterRepository.FindByQuery(Sql.Builder.OrderBy("SortId ASC")).Select(parameter => parameter.ToDto()).ToList();
     //CommonHelper.SetState(parameterTreeNodes, ParameterLoadMode);//返回treegrid数据时会进行处理
     PagedList<ParameterViewModel> result =new PagedList<ParameterViewModel>(parameterTreeNodes, query.Page, query.Rows);
     return new TreeGridResult(result, ParameterLoadMode != LoadMode.Sync, result.TotalItemCount).GetResult();
 }
 /// <summary>
 /// 同步一次性加载
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 private ActionResult SyncQueryLoad(QueryModel query)
 {
     List<MenuViewModel> treeNodes = MenuRepository.FindByQuery(Sql.Builder.OrderBy("SortId ASC")).Select(menu => menu.ToDto()).ToList();
     CommonHelper.SetState(treeNodes,MenuLoadMode);
     PagedList<MenuViewModel> result = new PagedList<MenuViewModel>(treeNodes, query.Page, query.Rows);
     return new TreeGridResult(result, true, result.TotalItemCount).GetResult();
 }
 public ActionResult Query(QueryModel query)
 {
     switch (ParameterLoadMode)
     {
         case LoadMode.Async:
             return AsyncQueryLoad(query);
         case LoadMode.Sync:
             return SyncQueryLoad(query);
         default:
             return AsyncQueryLoad(query);
     }
 }
 /// <summary>
 /// 异步,一次只加载一级节点
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 private ActionResult AsyncQueryLoad(QueryModel query)
 {
     List<ParameterViewModel> treeNodes;
     if (query.Id == null)
     {
         treeNodes = ParameterRepository.GetAllTopLevel().Select(parameter=>parameter.ToDto()).ToList();
         CommonHelper.SetState(treeNodes, ParameterLoadMode);
         PagedList<ParameterViewModel> result = new PagedList<ParameterViewModel>(treeNodes, query.Page, query.Rows);
         return new TreeGridResult(result, true, result.TotalItemCount).GetResult();
     }
     else
     {
         treeNodes = ParameterRepository.GetChidrenLevel(new Guid(query.Id)).Select(parameter => parameter.ToDto()).ToList();
         CommonHelper.SetState(treeNodes, ParameterLoadMode);
         return new TreeGridResult(treeNodes, true, -1).GetResult();
     }
 }
 public PartialViewResult GetIconTab(int width, int height, QueryModel query)
 {
     Sql sql = new Sql();
     sql.Where("Width=@0", width).Where("Height=@0", height);
     PagedList<IconViewModel> result = IconRepository.PagedLists(query.Page, query.Rows,sql);
     IconListViewModel iconListViewModel = new IconListViewModel(width, height, result);
     return PartialView("IconsControl/Tab", iconListViewModel);
 }