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