public List <SYS_Region_Organization> SelectAllSYS_Region_Organization() { List <SYS_Region_Organization> sys_region_organization = new List <SYS_Region_Organization>(); DbDataReader reader = null; DbConnection conn = _DbHelper.CreateConnection(Common.ConnectionString); conn.Open(); try { reader = _DbHelper.ExecuteReader(conn, Common.DatabaseSchema + "[SYS_Region_Organization_SelectAll]", (DbParameter[])null); if (reader.HasRows) { SYS_Region_OrganizationDataAccess.SetListSYS_Region_OrganizationInfo(ref reader, ref sys_region_organization); } return(sys_region_organization); } catch (Exception ex) { throw new Exception(String.Format(" SYS_Region_OrganizationDataAccess.SelectAll: {0}", ex.Message)); } finally { if (reader != null) { reader.Close(); } conn.Close(); } }
public SYS_Region_Organization SelectSYS_Region_Organization(int ID) { SYS_Region_Organization sys_region_organization = new SYS_Region_Organization(); DbDataReader reader = null; DbConnection conn = _DbHelper.CreateConnection(Common.ConnectionString); conn.Open(); try { List <DbParameter> para = new List <DbParameter>(); para.Add(_DbHelper.CreateParameter(FIELD_ID, ID, false)); reader = _DbHelper.ExecuteReader(conn, Common.DatabaseSchema + "[SYS_Region_Organization_SelectById]", para.ToArray()); if (reader.HasRows && reader.Read()) { SYS_Region_OrganizationDataAccess.SetSYS_Region_OrganizationInfo(reader, ref sys_region_organization); } return(sys_region_organization); } catch (Exception ex) { throw new Exception(String.Format("SYS_Region_OrganizationDataAccess.SelectById: {0}", ex.Message)); } finally { if (reader != null) { reader.Close(); } conn.Close(); } }
private static void SetListSYS_Region_OrganizationInfo(ref DbDataReader reader, ref List <SYS_Region_Organization> sys_region_organizations) { SYS_Region_Organization sys_region_organization = null; while (reader.Read()) { sys_region_organization = new SYS_Region_Organization(); SYS_Region_OrganizationDataAccess.SetSYS_Region_OrganizationInfo(reader, ref sys_region_organization); sys_region_organizations.Add(sys_region_organization); } }