Пример #1
0
        /// <summary>
        /// Loads a collection of StaffPreference objects from the database.
        /// </summary>
        /// <returns>A collection containing all of the StaffPreference objects in the database.</returns>
        public static StaffPreferenceCollection LoadCollection(string spName, SqlParameter[] parms)
        {
            StaffPreferenceCollection result = new StaffPreferenceCollection();

            using (SqlDataReader reader = SqlHelper.Default.ExecuteReader(spName, parms))
            {
                while (reader.Read())
                {
                    StaffPreference tmp = new StaffPreference();
                    tmp.LoadFromReader(reader);
                    result.Add(tmp);
                }
            }
            return(result);
        }
Пример #2
0
 /// <summary>
 /// Loads a StaffPreference object from the database using the given where clause
 /// </summary>
 /// <param name="whereClause">The filter expression for the query</param>
 /// <returns>A StaffPreference object</returns>
 public static StaffPreference LoadWhere(string whereClause)
 {
     SqlParameter[] parameterValues = new SqlParameter[] { new SqlParameter("@WhereClause", whereClause) };
     using (SqlDataReader reader = SqlHelper.Default.ExecuteReader("spStaffPreference_SelAll", parameterValues))
     {
         if (reader.Read())
         {
             StaffPreference result = new StaffPreference();
             result.LoadFromReader(reader);
             return(result);
         }
         else
         {
             return(null);
         }
     }
 }
Пример #3
0
 /// <summary>
 /// Loads a StaffPreference object from the database using the given PreferenceId
 /// </summary>
 /// <param name="preferenceId">The primary key value</param>
 /// <returns>A StaffPreference object</returns>
 public static StaffPreference Load(Guid preferenceId)
 {
     SqlParameter[] parameterValues = new SqlParameter[] { new SqlParameter("@PreferenceId", preferenceId) };
     using (SqlDataReader reader = SqlHelper.Default.ExecuteReader("spStaffPreference_SelRec", parameterValues))
     {
         if (reader.Read())
         {
             StaffPreference result = new StaffPreference();
             result.LoadFromReader(reader);
             return(result);
         }
         else
         {
             return(null);
         }
     }
 }