public RBACResourceInfo GetRBACResourceByID(int cate_id) { return(MyBLL.GetRBACResourceByID(cate_id, Public.GetUserPrivilege())); }
public string GetRBACPrivileges() { int RBAC_Privilege_ResourceID = tools.CheckInt(Request.QueryString["RBAC_Privilege_ResourceID"]); string keyword = tools.CheckStr(Request["keyword"]); QueryInfo Query = new QueryInfo(); Query.PageSize = tools.CheckInt(Request["rows"]); Query.CurrentPage = tools.CheckInt(Request["page"]); Query.ParamInfos.Add(new ParamInfo("AND", "int", "RBACPrivilegeInfo.RBAC_Privilege_IsActive", "=", "1")); Query.OrderInfos.Add(new OrderInfo(tools.CheckStr(Request["sidx"]), tools.CheckStr(Request["sord"]))); if (RBAC_Privilege_ResourceID > 0) { Query.ParamInfos.Add(new ParamInfo("AND", "int", "RBACPrivilegeInfo.RBAC_Privilege_ResourceID", "=", RBAC_Privilege_ResourceID.ToString())); } if (keyword != "") { Query.ParamInfos.Add(new ParamInfo("AND(", "str", "RBACPrivilegeInfo.RBAC_Privilege_ID", "like", keyword)); Query.ParamInfos.Add(new ParamInfo("OR)", "str", "RBACPrivilegeInfo.RBAC_Privilege_Name", "like", keyword)); } PageInfo pageinfo = MyBLL.GetPageInfo(Query, Public.GetUserPrivilege()); RBACResourceInfo ResInfo; IList <RBACPrivilegeInfo> entitys = MyBLL.GetRBACPrivileges(Query, Public.GetUserPrivilege()); if (entitys != null) { StringBuilder jsonBuilder = new StringBuilder(); jsonBuilder.Append("{\"page\":" + pageinfo.CurrentPage + ",\"total\":" + pageinfo.PageCount + ",\"records\":" + pageinfo.RecordCount + ",\"rows\""); jsonBuilder.Append(":["); foreach (RBACPrivilegeInfo entity in entitys) { ResInfo = MyResBLL.GetRBACResourceByID(entity.RBAC_Privilege_ResourceID, Public.GetUserPrivilege()); jsonBuilder.Append("{\"RBACPrivilegeInfo.RBAC_Privilege_ID\":\"" + entity.RBAC_Privilege_ID + "\",\"cell\":["); //各字段 jsonBuilder.Append("\""); jsonBuilder.Append(entity.RBAC_Privilege_ID); jsonBuilder.Append("\","); jsonBuilder.Append("\""); jsonBuilder.Append(entity.RBAC_Privilege_Name); jsonBuilder.Append("\","); jsonBuilder.Append("\""); if (ResInfo != null) { jsonBuilder.Append(ResInfo.RBAC_Resource_Name); } else { jsonBuilder.Append(entity.RBAC_Privilege_ResourceID); } jsonBuilder.Append("\","); jsonBuilder.Append("\""); jsonBuilder.Append(entity.RBAC_Privilege_Addtime); jsonBuilder.Append("\","); jsonBuilder.Append("\""); if (Public.CheckPrivilege("51be7b46-e0f7-46dd-b0b2-a462fcb907ae")) { jsonBuilder.Append("<img src=\\\"/images/icon_edit.gif\\\" alt=\\\"修改\\\"> <a href=\\\"privilege_list.aspx?action=renew&rbac_privilege_id=" + entity.RBAC_Privilege_ID + "\\\" title=\\\"修改\\\">修改</a>"); } if (Public.CheckPrivilege("1030465e-7113-4db6-9b3c-da21aca07748")) { jsonBuilder.Append(" <img src=\\\"/images/icon_del.gif\\\" alt=\\\"删除\\\"> <a href=\\\"javascript:void(0);\\\" onclick=\\\"confirmdelete('privilege_do.aspx?action=move&rbac_privilege_id=" + entity.RBAC_Privilege_ID + "')\\\" title=\\\"删除\\\">删除</a>"); } jsonBuilder.Append("\","); jsonBuilder.Remove(jsonBuilder.Length - 1, 1); jsonBuilder.Append("]},"); } jsonBuilder.Remove(jsonBuilder.Length - 1, 1); jsonBuilder.Append("]"); jsonBuilder.Append("}"); return(jsonBuilder.ToString()); } else { return(null); } }