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