/// <summary> /// Loads a collection of SupplierAddress objects from the database. /// </summary> /// <returns>A collection containing all of the SupplierAddress objects in the database.</returns> public static SupplierAddressCollection LoadCollection(string spName, SqlParameter[] parms) { SupplierAddressCollection result = new SupplierAddressCollection(); using (SqlDataReader reader = SqlHelper.Default.ExecuteReader(spName, parms)) { while (reader.Read()) { SupplierAddress tmp = new SupplierAddress(); tmp.LoadFromReader(reader); result.Add(tmp); } } return(result); }
/// <summary> /// Loads a SupplierAddress object from the database using the given AddressId /// </summary> /// <param name="addressId">The primary key value</param> /// <returns>A SupplierAddress object</returns> public static SupplierAddress Load(Guid addressId) { SqlParameter[] parameterValues = new SqlParameter[] { new SqlParameter("@AddressId", addressId) }; using (SqlDataReader reader = SqlHelper.Default.ExecuteReader("spSupplierAddress_SelRec", parameterValues)) { if (reader.Read()) { SupplierAddress result = new SupplierAddress(); result.LoadFromReader(reader); return(result); } else { return(null); } } }
/// <summary> /// Loads a SupplierAddress object from the database using the given where clause /// </summary> /// <param name="whereClause">The filter expression for the query</param> /// <returns>A SupplierAddress object</returns> public static SupplierAddress LoadWhere(string whereClause) { SqlParameter[] parameterValues = new SqlParameter[] { new SqlParameter("@WhereClause", whereClause) }; using (SqlDataReader reader = SqlHelper.Default.ExecuteReader("spSupplierAddress_SelAll", parameterValues)) { if (reader.Read()) { SupplierAddress result = new SupplierAddress(); result.LoadFromReader(reader); return(result); } else { return(null); } } }