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

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