/// <summary> /// 取得角色對應檔資料 /// </summary> /// <returns> 取得角色對應檔資料</returns> public List <VO.RoleUserMappingVO> SelectRoleUserMapping() { StringBuilder sb = new StringBuilder(); sb.AppendLine("SELECT A.*,B.role_name,C.name as unit_name,D.C_DEPT_NAME,D.C_DEPT_ABBR,D.WORK_ID,D.NATIVE_NAME "); sb.AppendLine("FROM RoleUserMapping A "); sb.AppendLine("left join RoleList B on A.role_id=B.id "); sb.AppendLine("left join Unit C on A.unit_id=C.id "); sb.AppendLine("left join V_ACSM_USER2 D on A.emp_id=D.ID "); sb.AppendLine("order by C.name,B.id "); SqlConnection aconn = MyConn(); IDataReader myIDataReader = SqlHelper.ExecuteReader(aconn, CommandType.Text, sb.ToString(), null); List <VO.RoleUserMappingVO> myRoleUserMappingVOList = new List <ACMS.VO.RoleUserMappingVO>(); while (myIDataReader.Read()) { VO.RoleUserMappingVO myRoleUserMappingVO = new ACMS.VO.RoleUserMappingVO(); myRoleUserMappingVO.id = (int)myIDataReader["id"]; myRoleUserMappingVO.role_name = (string)myIDataReader["role_name"]; myRoleUserMappingVO.unit_name = clsMyObj.GetStringObject(myIDataReader["unit_name"]); myRoleUserMappingVO.emp_id = (string)myIDataReader["emp_id"]; myRoleUserMappingVO.C_DEPT_ABBR = clsMyObj.GetStringObject(myIDataReader["C_DEPT_ABBR"]); myRoleUserMappingVO.WORK_ID = clsMyObj.GetStringObject(myIDataReader["WORK_ID"]); myRoleUserMappingVO.NATIVE_NAME = clsMyObj.GetStringObject(myIDataReader["NATIVE_NAME"]); myRoleUserMappingVOList.Add(myRoleUserMappingVO); } myIDataReader.Close(); aconn.Close(); if (myIDataReader != null) { myIDataReader.Dispose(); } if (aconn != null) { aconn.Dispose(); } return(myRoleUserMappingVOList); }
/// <summary> /// 取得角色對應檔資料 /// </summary> /// <returns> 取得角色對應檔資料</returns> public List<VO.RoleUserMappingVO> SelectRoleUserMapping() { StringBuilder sb = new StringBuilder(); sb.AppendLine("SELECT A.*,B.role_name,C.name as unit_name,D.C_DEPT_NAME,D.C_DEPT_ABBR,D.WORK_ID,D.NATIVE_NAME "); sb.AppendLine("FROM RoleUserMapping A "); sb.AppendLine("left join RoleList B on A.role_id=B.id "); sb.AppendLine("left join Unit C on A.unit_id=C.id "); sb.AppendLine("left join V_ACSM_USER2 D on A.emp_id=D.ID "); sb.AppendLine("order by C.name,B.id "); SqlConnection aconn = MyConn(); IDataReader myIDataReader = SqlHelper.ExecuteReader(aconn, CommandType.Text, sb.ToString(), null); List<VO.RoleUserMappingVO> myRoleUserMappingVOList = new List<ACMS.VO.RoleUserMappingVO>(); while (myIDataReader.Read()) { VO.RoleUserMappingVO myRoleUserMappingVO = new ACMS.VO.RoleUserMappingVO(); myRoleUserMappingVO.id = (int)myIDataReader["id"]; myRoleUserMappingVO.role_name = (string)myIDataReader["role_name"] ; myRoleUserMappingVO.unit_name = clsMyObj.GetStringObject(myIDataReader["unit_name"]); myRoleUserMappingVO.emp_id = (string)myIDataReader["emp_id"]; myRoleUserMappingVO.C_DEPT_ABBR = clsMyObj.GetStringObject(myIDataReader["C_DEPT_ABBR"]); myRoleUserMappingVO.WORK_ID = clsMyObj.GetStringObject(myIDataReader["WORK_ID"]); myRoleUserMappingVO.NATIVE_NAME =clsMyObj.GetStringObject(myIDataReader["NATIVE_NAME"]); myRoleUserMappingVOList.Add(myRoleUserMappingVO); } myIDataReader.Close(); aconn.Close(); if (myIDataReader != null) myIDataReader.Dispose(); if (aconn != null) aconn.Dispose(); return myRoleUserMappingVOList; }