/// <summary> /// 获取员工界面左边树 /// </summary> /// <param name="args"></param> /// <returns></returns> public JsonResult GetStaffTree(CommonAjaxArgs args) { CommonTreeNodeEntity treeNode = JsonConvert.DeserializeObject <CommonTreeNodeEntity>(args.GetStr("treeNode")); var result = OrgTreeService.GetStaffTree(treeNode); return(MyJson(result)); }
public virtual JsonResult Gets(CommonAjaxArgs args) { EntityResponseDto res = new EntityResponseDto(); var predicate = ExpressionUtil.GetSearchExpression(typeof(T), args.Query.Searchs) as Expression <Func <T, bool> >; var page = args.Query.Page; if (page.PageSize <= 0) { page.PageSize = 500; } Sorter sort = new Sorter() { SortField = "ID", SortOrder = System.Data.SqlClient.SortOrder.Descending }; if (args.Query.Sorters != null && args.Query.Sorters.Count > 0) { sort = args.Query.Sorters.First(); } string[] includes = args.Query.IncludeEntityPaths == null ? null : args.Query.IncludeEntityPaths.ToArray(); res.Count = Repository.GetQueryExp <T>(predicate, includes).Count(); res.Entitys = Repository.QueryPage <T>(predicate, new Pagination() { page = page.PageIndex, rows = page.PageSize, sidx = sort.SortField, sord = sort.SortOrder == System.Data.SqlClient.SortOrder.Ascending ? "asc" : "desc" }, includes); res.Success = true; return(MyJson(res)); }
public virtual JsonResult Read(CommonAjaxArgs args) { EntityResponseDto res = new EntityResponseDto(); var predicate = ExpressionUtil.GetSearchExpression(typeof(T), args.Filter) as Expression <Func <T, bool> >; args.Limit = args.Limit <= 0 ? 50 : args.Limit; args.Page = args.Page == 0 ? 1 : args.Page; Sorter sort = new Sorter() { SortField = "ID", SortOrder = System.Data.SqlClient.SortOrder.Descending }; if (args.Query.Sorters != null && args.Query.Sorters.Count > 0) { sort = args.Query.Sorters.First(); } string[] includes = args.Include; res.Count = Repository.GetQueryExp <T>(predicate, includes).Count(); res.Entitys = Repository.QueryPage <T>(predicate, new Pagination() { page = args.Page, rows = args.Limit, sidx = sort.SortField, sord = sort.SortOrder == System.Data.SqlClient.SortOrder.Ascending ? "asc" : "desc" }, includes); res.Success = true; return(MyJson(res)); }
public virtual JsonResult Read(CommonAjaxArgs args) { EntityResponseDto res = new EntityResponseDto(); var predicate = ExpressionUtil.GetSearchExpression(typeof(T), args.Filter) as Expression <Func <T, bool> >; args.Limit = args.Limit <= 0 ? 50 : args.Limit; args.Page = args.Page == 0 ? 1 : args.Page; if (string.IsNullOrWhiteSpace(args.Sort)) { args.Sort = "ID"; args.SortDir = "desc"; } string[] includes = args.Include; res.Count = Repository.GetQueryExp <T>(predicate, includes).Count(); res.Entitys = Repository.QueryPage <T>(predicate, new Pagination() { page = args.Page, rows = args.Limit, sidx = args.Sort, sord = args.SortDir }, includes); res.Success = true; return(MyJson(res)); }
public virtual JsonResult Read([FromForm] CommonAjaxArgs args, [FromServices] IRepositoryBase repository) { EntityResponseDto res = new EntityResponseDto(); var predicate = ExpressionUtil.GetSearchExpression(typeof(T), args.Filter) as Expression <Func <T, bool> >; args.PageSize = args.PageSize <= 0 ? 50 : args.PageSize; args.PageIndex = args.PageIndex == 0 ? 1 : args.PageIndex; args.SortField = string.IsNullOrWhiteSpace(args.SortField) ? EntityConst.EntityIdName : args.SortField; args.SortOrder = string.IsNullOrWhiteSpace(args.SortOrder) ? "desc" : args.SortOrder; string[] includes = args.Include; res.Total = repository.GetQueryExp <T>(predicate, includes).Count(); res.Data = repository.QueryPage <T>(predicate, new Pagination() { page = args.PageIndex, rows = args.PageSize, SortField = args.SortField, SortOrder = args.SortOrder }, includes); res.Success = true; return(Json(res)); }