public List <SYS_OrganizationPositionRole> SelectByOP(int organization, int position) { DbConnection conn = _DbHelper.CreateConnection(Common.ConnectionString); conn.Open(); List <SYS_OrganizationPositionRole> sys_organizationpositionrole = new List <SYS_OrganizationPositionRole>(); DbDataReader reader = null; try { List <DbParameter> para = new List <DbParameter>(); para.Add(_DbHelper.CreateParameter(FIELD_ORGANIZATIONID, organization, false)); para.Add(_DbHelper.CreateParameter(FIELD_POSITIONID, position, false)); reader = _DbHelper.ExecuteReader(conn, Common.DatabaseSchema + "[SYS_OrganizationPositionRole_SelectByOP]", (DbParameter[])para.ToArray()); if (reader.HasRows) { SYS_OrganizationPositionRoleDataAccess.SetListSYS_OrganizationPositionRoleInfo(ref reader, ref sys_organizationpositionrole); } return(sys_organizationpositionrole); } catch (Exception ex) { throw new Exception(String.Format(" SYS_OrganizationPositionRoleDataAccess.SelectAll: {0}", ex.Message)); } finally { if (reader != null) { reader.Close(); } conn.Close(); } }
public List <SYS_OrganizationPositionRole> SelectAllSYS_OrganizationPositionRole() { DbConnection conn = _DbHelper.CreateConnection(Common.ConnectionString); conn.Open(); List <SYS_OrganizationPositionRole> sys_organizationpositionrole = new List <SYS_OrganizationPositionRole>(); DbDataReader reader = null; try { reader = _DbHelper.ExecuteReader(conn, Common.DatabaseSchema + "[SYS_OrganizationPositionRole_SelectAll]", (DbParameter[])null); if (reader.HasRows) { SYS_OrganizationPositionRoleDataAccess.SetListSYS_OrganizationPositionRoleInfo(ref reader, ref sys_organizationpositionrole); } return(sys_organizationpositionrole); } catch (Exception ex) { throw new Exception(String.Format(" SYS_OrganizationPositionRoleDataAccess.SelectAll: {0}", ex.Message)); } finally { if (reader != null) { reader.Close(); } conn.Close(); } }
public SYS_OrganizationPositionRole SelectSYS_OrganizationPositionRole(int ID) { DbConnection conn = _DbHelper.CreateConnection(Common.ConnectionString); conn.Open(); SYS_OrganizationPositionRole sys_organizationpositionrole = new SYS_OrganizationPositionRole(); DbDataReader reader = null; try { List <DbParameter> para = new List <DbParameter>(); para.Add(_DbHelper.CreateParameter(FIELD_ID, ID, false)); reader = _DbHelper.ExecuteReader(conn, Common.DatabaseSchema + "[SYS_OrganizationPositionRole_SelectById]", para.ToArray()); if (reader.HasRows && reader.Read()) { SYS_OrganizationPositionRoleDataAccess.SetSYS_OrganizationPositionRoleInfo(reader, ref sys_organizationpositionrole); } return(sys_organizationpositionrole); } catch (Exception ex) { throw new Exception(String.Format("SYS_OrganizationPositionRoleDataAccess.SelectById: {0}", ex.Message)); } finally { if (reader != null) { reader.Close(); } conn.Close(); } }
private static void SetListSYS_OrganizationPositionRoleInfo(ref DbDataReader reader, ref List <SYS_OrganizationPositionRole> sys_organizationpositionroles) { SYS_OrganizationPositionRole sys_organizationpositionrole = null; while (reader.Read()) { sys_organizationpositionrole = new SYS_OrganizationPositionRole(); SYS_OrganizationPositionRoleDataAccess.SetSYS_OrganizationPositionRoleInfo(reader, ref sys_organizationpositionrole); sys_organizationpositionroles.Add(sys_organizationpositionrole); } }