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