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