public ActionResult AdminListJsonProvide() { IList <Ocean.Entity.Admin> listAdmin = _adminService.GetALL(); IList <JsonObject> listJsonObject = new List <JsonObject>(); foreach (Ocean.Entity.Admin item in listAdmin) { JsonObject jsonObject = new JsonObject(); jsonObject["id"] = new JsonProperty(item.Id.ToString()); jsonObject["text"] = new JsonProperty(item.Name); listJsonObject.Add(jsonObject); } return(Content(JsonHelper.AnalysisJsons(listJsonObject, true))); }
public ActionResult EnumTypeTreeProvide() { IQueryable <EnumType> query = _enumTypeService.Table.OrderBy(e => e.Sort); IList <EnumType> listEnumType = query.ToList(); IList <JsonObject> listJsonObject = new List <JsonObject>(); foreach (EnumType item in listEnumType) { JsonObject jsonObject = new JsonObject(); jsonObject["id"] = new JsonProperty(item.Id.ToString()); jsonObject["text"] = new JsonProperty(item.Name); listJsonObject.Add(jsonObject); } return(Content(JsonHelper.AnalysisJsons(listJsonObject, true))); }
public ActionResult PermissionRoleListProvide() { if (!base.HasPermission("role", PermissionOperate.manager)) { return(null); } IList <PermissionRole> listPermissionRole = _permissionRoleService.GetALL(); IList <JsonObject> listJsonObject = new List <JsonObject>(); foreach (PermissionRole item in listPermissionRole) { JsonObject jsonObject = new JsonObject(); jsonObject["id"] = new JsonProperty(item.Id.ToString()); jsonObject["text"] = new JsonProperty(item.Name); listJsonObject.Add(jsonObject); } return(Content(JsonHelper.AnalysisJsons(listJsonObject, true))); }
public ActionResult PermissionModuleListProvide() { if (!base.HasPermission("module", PermissionOperate.manager)) { return(null); } bool isBuildTree = !string.IsNullOrWhiteSpace(Request["buildTree"]); IQueryable <PermissionModule> query = _permissionModuleService.Table .Where(m => (m.ParentId == Guid.Empty || m.ParentId == null)).OrderBy(m => m.Sort); IList <PermissionModule> listPermissionModule = query.ToList(); IList <JsonObject> listJsonObject = new List <JsonObject>(); foreach (PermissionModule item in listPermissionModule) { JsonObject jsonObject = new JsonObject(); if (isBuildTree) { BuildTree <PermissionModule>(item, _permissionModuleService, jsonObject, "ParentId", "Name", _permissionModuleService.Table.OrderBy(m => m.Sort).ToList()); } else { BuildGridTree <PermissionModule>(item, _permissionModuleService, jsonObject, "ParentId", new string[] { "Name", "Identifying", "Url", "Sort" }.ToList(), _permissionModuleService.Table.OrderBy(m => m.Sort).ToList()); } listJsonObject.Add(jsonObject); } if (isBuildTree) { return(Content(JsonHelper.AnalysisJsons(listJsonObject, true))); } else { return(Content(JsonHelper.AnalysisJsons(listJsonObject))); } }