public RoleInfo_QueryCollection QueryRoleCollection() { Session.Clear(); string strSql = "select isnull(RoleId,'')as roleId,isnull(RoleName,'')as roleName,RoleType from C_Auth_Roles"; var result = Session.CreateSQLQuery(strSql).List(); RoleInfo_QueryCollection collection = new RoleInfo_QueryCollection(); if (result != null && result.Count > 0) { foreach (var item in result) { var array = item as object[]; RoleInfo_Query info = new RoleInfo_Query(); info.RoleId = Convert.ToString(array[0]); info.RoleName = Convert.ToString(array[1]); info.RoleType = (RoleType)Convert.ToInt32(array[2]); collection.Add(info); } } return(collection); }
public RoleInfo_Query GetSystemRoleById(string roleId) { using (var roleManager = new RoleManager()) { var role = roleManager.GetRoleById(roleId); var info = new RoleInfo_Query(); ObjectConvert.ConverEntityToInfo <SystemRole, RoleInfo_Query>(role, ref info); foreach (var function in role.FunctionList) { if (function.Status == EnableStatus.Enable) { var item = new RoleFunctionInfo { FunctionId = function.FunctionId, Mode = function.Mode, }; info.FunctionList.Add(item); } } return(info); } }