public static ReadOnlyCollection<Job> LoadAll(int? jobGroupId, int portalId, string jobTitle, int? locationId, int pageIndex, int? pageSize, out int totalCount) { var jobs = new List<Job>(); using (IDataReader dr = DataProvider.Instance().GetJobs(jobGroupId, portalId, jobTitle, locationId, pageIndex, pageSize, out totalCount)) { while (dr.Read()) { jobs.Add(FillJob(dr)); } } return jobs.AsReadOnly(); }
public static ReadOnlyCollection<JobSearchQuery> LoadSearches(int userId, int? jobGroupId) { var queries = new List<JobSearchQuery>(); using (IDataReader dr = DataProvider.Instance().GetJobSearchQueries(userId, jobGroupId, PortalId)) { while (dr.Read()) { queries.Add(FillJobSearchQuery(dr)); } } return queries.AsReadOnly(); }
/// <summary> /// Loads a listing of jobs for the given criteria. Only retrieves jobs that have started and not ended. /// </summary> /// <param name="maximumNumberOfJobs">The maximum number of jobs to retrieve, or <c>null</c> for no limit.</param> /// <param name="limitRandomly"> /// if set to <c>true</c>, retrieves a random segment of the jobs. This only applies when /// <paramref name="maximumNumberOfJobs"/> is less than the number of jobs retrieved. /// </param> /// <param name="onlyHotJobs">if set to <c>true</c> only retrieves jobs marked as hot.</param> /// <param name="jobGroupId">The job group ID, or <c>null</c> not to restrict the results to a particular job group.</param> /// <param name="portalId">The portal ID.</param> /// <returns>A collection of the active jobs meeting the given criteria</returns> public static ReadOnlyCollection<Job> LoadActiveJobs(int? maximumNumberOfJobs, bool limitRandomly, bool onlyHotJobs, int? jobGroupId, int portalId) { var jobs = new List<Job>(); using (IDataReader dr = limitRandomly ? DataProvider.Instance().GetActiveJobs(onlyHotJobs, jobGroupId, portalId) : DataProvider.Instance().GetActiveJobs(onlyHotJobs, maximumNumberOfJobs, jobGroupId, portalId)) { while (dr.Read()) { jobs.Add(FillJob(dr)); } } if (maximumNumberOfJobs.HasValue && jobs.Count > maximumNumberOfJobs.Value) { if (limitRandomly) { Utility.GetRandomSelection(jobs, maximumNumberOfJobs.Value); } else { jobs.RemoveRange(maximumNumberOfJobs.Value, jobs.Count - maximumNumberOfJobs.Value); } } return jobs.AsReadOnly(); }