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