/// <summary> /// 根据角色获取树形结构的功能列表 /// </summary> public List <FunctionNodeInfo> GetTreeWithRole(string systemType, List <int> roleList) { List <FunctionNodeInfo> list = new List <FunctionNodeInfo>(); if (roleList.Count > 0) { string roleString = string.Join(",", roleList); string sql = string.Format(@"SELECT * FROM {0} Where ID in( SELECT distinct F.ID FROM {0} AS F INNER JOIN T_ACL_Role_Function AS RF ON F.ID = RF.Function_ID WHERE RF.Role_ID IN ({1}) AND F.SystemType_ID = '{2}' ) Order By PID, Name ", tableName, roleString, systemType); DataTable dt = base.SqlTable(sql); string sortCode = string.Format("{0} {1}", GetSafeFileName(SortField), IsDescending ? "DESC" : "ASC"); DataRow[] dataRows = dt.Select(string.Format(" PID = '{0}' ", -1), sortCode); for (int i = 0; i < dataRows.Length; i++) { string id = dataRows[i]["ID"].ToString(); FunctionNodeInfo menuNodeInfo = GetNode(id, dt); list.Add(menuNodeInfo); } } return(list); }
public List <FunctionNodeInfo> GetFunctionNodes(string roleIDs, string typeID) { string sql = string.Format(@"SELECT * FROM {0} Where ID in( SELECT distinct ID FROM {0} INNER JOIN T_ACL_Role_Function On {0}.ID=T_ACL_Role_Function.Function_ID WHERE Role_ID IN ({1}) )", tableName, roleIDs); if (typeID.Length > 0) { sql = sql + string.Format(" AND SystemType_ID='{0}' ", typeID); } List <FunctionNodeInfo> arrReturn = new List <FunctionNodeInfo>(); DataTable dt = base.SqlTable(sql); string sortCode = string.Format("{0} {1}", GetSafeFileName(SortField), IsDescending ? "DESC" : "ASC"); DataRow[] dataRows = dt.Select(string.Format(" PID = '{0}' ", -1), sortCode); for (int i = 0; i < dataRows.Length; i++) { string id = dataRows[i]["ID"].ToString(); FunctionNodeInfo menuNodeInfo = GetNode(id, dt); arrReturn.Add(menuNodeInfo); } return(arrReturn); }
public List <FunctionNodeInfo> GetFunctionNodes(string roleIds, string typeId) { string sql = string.Format(@"SELECT distinct a.Gid, a.Pgid, a.Name, a.DllPath, a.SystemtypeId, a.Seq FROM {0}Function a INNER JOIN {0}Role_Function b On a.Gid=b.FunctionGid WHERE b.RoleId IN ({1})", SQLServerPortal.gc._securityTablePre, roleIds); if (typeId.Length > 0) { sql = sql + string.Format(" AND SystemtypeId='{0}' ", typeId); } List <FunctionNodeInfo> arrReturn = new List <FunctionNodeInfo>(); DataTable dt = base.SqlTable(sql); string seq = string.Format("{0} {1}", GetSafeFileName(sortField), isDescending ? "DESC" : "ASC"); DataRow[] dataRows = dt.Select(string.Format(" Pgid = '{0}' ", -1), seq); for (int i = 0; i < dataRows.Length; i++) { string id = dataRows[i]["Gid"].ToString(); FunctionNodeInfo menuNodeInfo = GetNode(id, dt); arrReturn.Add(menuNodeInfo); } return(arrReturn); }
private FunctionNodeInfo GetNodeInfo(string string_0, DataTable dataTable_0) { FunctionNodeInfo info2 = new FunctionNodeInfo(this.FindByID(string_0)); DataRow[] rowArray = dataTable_0.Select(string.Format(" PID='{0}'", string_0)); for (int i = 0; i < rowArray.Length; i++) { string str = rowArray[i]["ID"].ToString(); FunctionNodeInfo item = this.GetNodeInfo(str, dataTable_0); info2.Children.Add(item); } return(info2); }
public List <FunctionNodeInfo> GetTreeByID(string mainID) { List <FunctionNodeInfo> list = new List <FunctionNodeInfo>(); string sql = string.Format("Select * From {0} Order By PID, Name ", base.tableName); DataTable table = this.SqlTable(sql); DataRow[] rowArray = table.Select(string.Format(" PID = '{0}'", mainID)); for (int i = 0; i < rowArray.Length; i++) { string str2 = rowArray[i]["ID"].ToString(); FunctionNodeInfo item = this.GetNodeInfo(str2, table); list.Add(item); } return(list); }
public List <FunctionNodeInfo> GetTree(string systemType) { string str = !string.IsNullOrEmpty(systemType) ? string.Format("Where SystemType_ID='{0}'", systemType) : ""; List <FunctionNodeInfo> list = new List <FunctionNodeInfo>(); string sql = string.Format("Select * From {0} {1} Order By PID, Name ", base.tableName, str); DataTable table = base.SqlTable(sql); DataRow[] rowArray = table.Select(string.Format(" PID = '{0}' ", -1)); for (int i = 0; i < rowArray.Length; i++) { string str3 = rowArray[i]["ID"].ToString(); FunctionNodeInfo item = this.GetNodeInfo(str3, table); list.Add(item); } return(list); }
private FunctionNodeInfo GetNode(string id, DataTable dt) { FunctionInfo menuInfo = this.FindByID(id); FunctionNodeInfo menuNodeInfo = new FunctionNodeInfo(menuInfo); string sort = string.Format("{0} {1}", GetSafeFileName(sortField), isDescending ? "DESC" : "ASC"); DataRow[] dChildRows = dt.Select(string.Format(" PID='{0}'", id), sort); for (int i = 0; i < dChildRows.Length; i++) { string childId = dChildRows[i]["ID"].ToString(); FunctionNodeInfo childNodeInfo = GetNode(childId, dt); menuNodeInfo.Children.Add(childNodeInfo); } return(menuNodeInfo); }
/// <summary> /// 获取指定功能下面的树形列表 /// </summary> /// <param name="id">指定功能ID</param> public List <FunctionNodeInfo> GetTreeByID(string mainID) { List <FunctionNodeInfo> arrReturn = new List <FunctionNodeInfo>(); string sql = string.Format("Select * From {0} Order By PID, Name ", tableName); DataTable dt = SqlTable(sql); string sort = string.Format("{0} {1}", GetSafeFileName(sortField), isDescending ? "DESC" : "ASC"); DataRow[] dataRows = dt.Select(string.Format(" PID = '{0}'", mainID), sort); for (int i = 0; i < dataRows.Length; i++) { string id = dataRows[i]["ID"].ToString(); FunctionNodeInfo menuNodeInfo = GetNode(id, dt); arrReturn.Add(menuNodeInfo); } return(arrReturn); }
/// <summary> /// 获取树形结构的功能列表 /// </summary> public List <FunctionNodeInfo> GetTree(string systemType) { string condition = !string.IsNullOrEmpty(systemType) ? string.Format("Where SystemType_ID='{0}'", systemType) : ""; List <FunctionNodeInfo> arrReturn = new List <FunctionNodeInfo>(); string sql = string.Format("Select * From {0} {1} Order By PID, Name ", tableName, condition); DataTable dt = base.SqlTable(sql); string sort = string.Format("{0} {1}", GetSafeFileName(sortField), isDescending ? "DESC" : "ASC"); DataRow[] dataRows = dt.Select(string.Format(" PID = '{0}' ", -1), sort); for (int i = 0; i < dataRows.Length; i++) { string id = dataRows[i]["ID"].ToString(); FunctionNodeInfo menuNodeInfo = GetNode(id, dt); arrReturn.Add(menuNodeInfo); } return(arrReturn); }
public List <FunctionNodeInfo> GetFunctionNodes(string roleIDs, string typeID) { string str = "SELECT * FROM T_ACL_Function INNER JOIN T_ACL_Role_Function On T_ACL_Function.ID=T_ACL_Role_Function.Function_ID WHERE Role_ID IN (" + roleIDs + ")"; if (typeID.Length > 0) { str = str + string.Format(" AND SystemType_ID='{0}' ", typeID); } List <FunctionNodeInfo> list = new List <FunctionNodeInfo>(); DataTable table = base.SqlTable(str, null); string sort = string.Format("{0} {1}", base.GetSafeFileName(base.sortField), base.isDescending ? "DESC" : "ASC"); DataRow[] rowArray = table.Select(string.Format(" PID = '{0}' ", -1), sort); for (int i = 0; i < rowArray.Length; i++) { string str3 = rowArray[i]["ID"].ToString(); FunctionNodeInfo item = this.GetNodeInfo(str3, table); list.Add(item); } return(list); }
public List <FunctionNodeInfo> GetFunctionNodes(string roleIDs, string typeID) { string sql = string.Format(@"SELECT * FROM {0}Function INNER JOIN {0}Role_Function On {0}Function.ID={0}Role_Function.Function_ID WHERE Role_ID IN ({1})", MySqlPortal.gc._securityTablePre, roleIDs); if (typeID.Length > 0) { sql = sql + string.Format(" AND SystemType_ID='{0}' ", typeID); } List <FunctionNodeInfo> arrReturn = new List <FunctionNodeInfo>(); DataTable dt = base.SqlTable(sql); string seq = string.Format("{0} {1}", GetSafeFileName(sortField), isDescending ? "DESC" : "ASC"); DataRow[] dataRows = dt.Select(string.Format(" PID = '{0}' ", -1), seq); for (int i = 0; i < dataRows.Length; i++) { string id = dataRows[i]["ID"].ToString(); FunctionNodeInfo menuNodeInfo = GetNode(id, dt); arrReturn.Add(menuNodeInfo); } return(arrReturn); }
/// <summary> /// 根据角色获取树形结构的功能列表 /// </summary> public List <FunctionNodeInfo> GetTreeWithRole(string systemtypeId, List <Int32> roleList) { List <FunctionNodeInfo> list = new List <FunctionNodeInfo>(); if (roleList.Count > 0) { string roleString = string.Join(",", roleList); string sql = string.Format(@"SELECT distinct F.* FROM {0}Function AS F INNER JOIN {0}Role_Function AS RF ON F.Gid = RF.FunctionGid WHERE RF.RoleId IN ({1}) AND F.SystemtypeId = '{2}' Order By Pgid, Name ", SQLServerPortal.gc._securityTablePre, roleString, systemtypeId); DataTable dt = base.SqlTable(sql); string seq = string.Format("{0} {1}", GetSafeFileName(sortField), isDescending ? "DESC" : "ASC"); DataRow[] dataRows = dt.Select(string.Format(" Pgid = '{0}' ", -1), seq); for (int i = 0; i < dataRows.Length; i++) { string id = dataRows[i]["Gid"].ToString(); FunctionNodeInfo menuNodeInfo = GetNode(id, dt); list.Add(menuNodeInfo); } } return(list); }