public RoleInfo_QueryCollection GetSystemRoleCollection() { using (var roleManager = new RoleManager()) { var list = roleManager.QueryRoleList(); var collection = new RoleInfo_QueryCollection(); ObjectConvert.ConvertEntityListToInfoList <IList <SystemRole>, SystemRole, RoleInfo_QueryCollection, RoleInfo_Query>(list, ref collection, () => new RoleInfo_Query()); return(collection); } }
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); }