public JobPosting SelectById(int id) { JobPosting jobPosting = new JobPosting(); List <JobTag> jtList = null; List <JobApplicationEmployer> jpaList = null; DataProvider.ExecuteCmd(GetConnection, "dbo.JobPosting_SelectById", inputParamMapper : delegate(SqlParameterCollection paramCollection) { paramCollection.AddWithValue("@Id", id); } , map : (Action <IDataReader, short>) delegate(IDataReader reader, short set) { switch (set) { case 0: jobPosting = MapJobPosting(reader); break; case 1: int jobPostingId = 0; JobTag jobTag = MapJobTagList(reader, out jobPostingId); if (jtList == null) { jtList = new List <JobTag>(); } jtList.Add(jobTag); break; case 2: JobApplicationEmployer jpa = new JobApplicationEmployer(); int ord = 0; jpa.Id = reader.GetSafeInt32(ord++); jpa.PersonId = reader.GetSafeInt32(ord++); jpa.FirstName = reader.GetSafeString(ord++); jpa.LastName = reader.GetSafeString(ord++); jpa.JobTitle = reader.GetSafeString(ord++); jpa.Resume = reader.GetSafeString(ord++); jpa.CoverLetter = reader.GetSafeString(ord++); jpa.ApplicationStatus = reader.GetSafeString(ord++); jpa.Notes = reader.GetSafeString(ord++); jpa.DateCreated = reader.GetSafeDateTime(ord++); if (jpaList == null) { jpaList = new List <JobApplicationEmployer>(); } jpaList.Add(jpa); break; } } ); jobPosting.JobTags = jtList; jobPosting.Applications = jpaList; return(jobPosting); }
public List <JobApplicationEmployer> SelectByStatusId(int jobPostingId, int statusId) { List <JobApplicationEmployer> jaList = null; DataProvider.ExecuteCmd(GetConnection, "dbo.JobApplication_SelectByStatusId", inputParamMapper : delegate(SqlParameterCollection paramCollection) { paramCollection.AddWithValue("@JobPostingId", jobPostingId); paramCollection.AddWithValue("@StatusId", statusId); } , map : delegate(IDataReader reader, short set) { switch (set) { case 0: JobApplicationEmployer jpa = new JobApplicationEmployer(); int ord = 0; jpa.Id = reader.GetSafeInt32(ord++); jpa.PersonId = reader.GetSafeInt32(ord++); jpa.FirstName = reader.GetSafeString(ord++); jpa.LastName = reader.GetSafeString(ord++); jpa.JobTitle = reader.GetSafeString(ord++); jpa.Resume = reader.GetSafeString(ord++); jpa.CoverLetter = reader.GetSafeString(ord++); jpa.ApplicationStatus = reader.GetSafeString(ord++); jpa.Notes = reader.GetSafeString(ord++); jpa.DateCreated = reader.GetSafeDateTime(ord++); if (jaList == null) { jaList = new List <JobApplicationEmployer>(); } jaList.Add(jpa); break; } } ); return(jaList); }