Beispiel #1
0
        private static IList <Resume> GetResumes(ResumesDataContext dc, IEnumerable <Guid> ids)
        {
            var resumeIds = new SplitList <Guid>(ids).ToString();
            var resumes   = GetAllResumesQuery(dc, resumeIds).ToList();
            var allJobs   = (from e in GetAllJobsQuery(dc, resumeIds)
                             group e by e.Item1).ToDictionary(g => g.Key, g => (from e in g select e.Item2).ToList());
            var allSchools = (from e in GetAllSchoolsQuery(dc, resumeIds)
                              group e by e.Item1).ToDictionary(g => g.Key, g => (from e in g select e.Item2).ToList());

            foreach (var resume in resumes)
            {
                List <Job> jobs;
                if (allJobs.TryGetValue(resume.Id, out jobs))
                {
                    resume.Jobs = jobs;
                }
                List <School> schools;
                if (allSchools.TryGetValue(resume.Id, out schools))
                {
                    resume.Schools = schools;
                }
            }

            return(resumes.ToList());
        }
Beispiel #2
0
        private static Resume GetResume(ResumesDataContext dc, Guid id)
        {
            var resume = GetResumeQuery(dc, id);

            if (resume != null)
            {
                resume.Jobs    = GetList(GetJobsQuery(dc, resume.Id).ToList());
                resume.Schools = GetList(GetSchoolsQuery(dc, resume.Id).ToList());
            }
            return(resume);
        }
Beispiel #3
0
        private static void DeleteJobsSchools(ResumesDataContext dc, ResumeEntity entity)
        {
            if (entity.ResumeJobEntities != null && entity.ResumeJobEntities.Count > 0)
            {
                dc.ResumeJobEntities.DeleteAllOnSubmit(entity.ResumeJobEntities);
                entity.ResumeJobEntities = null;
            }

            if (entity.ResumeSchoolEntities != null && entity.ResumeSchoolEntities.Count > 0)
            {
                dc.ResumeSchoolEntities.DeleteAllOnSubmit(entity.ResumeSchoolEntities);
                entity.ResumeSchoolEntities = null;
            }
        }
Beispiel #4
0
        private static ParsedResume GetParsedResume(ResumesDataContext dc, Guid id)
        {
            var parsedResumeEntity = GetParsedResumeEntity(dc, id);

            if (parsedResumeEntity == null)
            {
                return(null);
            }

            var parsedResume = parsedResumeEntity.Map();

            if (parsedResumeEntity.resumeId != null)
            {
                parsedResume.Resume = GetResumeQuery(dc, parsedResumeEntity.resumeId.Value);
                if (parsedResume.Resume != null)
                {
                    parsedResume.Resume.Jobs    = GetList(GetJobsQuery(dc, parsedResume.Resume.Id).ToList());
                    parsedResume.Resume.Schools = GetList(GetSchoolsQuery(dc, parsedResume.Resume.Id).ToList());
                }
            }

            return(parsedResume);
        }