예제 #1
0
 public int GetRefusedCount()
 {
     using (var context = new CandidatesDataContext(_connectionString))
     {
         return(context.Candidates.Count(c => c.Status == Status.Refused));
     }
 }
예제 #2
0
 public Candidate ViewDetails(int candidateId)
 {
     using (var context = new CandidatesDataContext(_connectionString))
     {
         return(context.Candidates.FirstOrDefault(c => c.Id == candidateId));
     }
 }
예제 #3
0
 public void Refuse(int candidateId)
 {
     using (var context = new CandidatesDataContext(_connectionString))
     {
         context.ExecuteCommand("UPDATE Candidates SET Status = 2 WHERE Id = {0}", candidateId);
     }
 }
예제 #4
0
 public IEnumerable <Candidate> GetRefused()
 {
     using (var context = new CandidatesDataContext(_connectionString))
     {
         return(context.Candidates.Where(c => c.Status == Models.Status.Refused).ToList());
     }
 }
예제 #5
0
 public void AddCandidate(Candidate candidate)
 {
     using (var context = new CandidatesDataContext(_connectionString))
     {
         context.Candidates.InsertOnSubmit(candidate);
         context.SubmitChanges();
     }
 }
예제 #6
0
        private IList <Candidate> GetCandidates(CandidatesDataContext dc, IEnumerable <Guid> ids)
        {
            var candidateIds = new SplitList <Guid>(ids).ToString();
            var candidates   = GetCandidatesQuery(dc, candidateIds, _industriesQuery).ToList();

            GetRelocationLocations(dc, candidateIds, candidates);
            GetIndustries(dc, candidateIds, candidates);
            return(candidates);
        }
예제 #7
0
        private Candidate GetCandidate(CandidatesDataContext dc, Guid id)
        {
            var candidate = GetCandidateQuery(dc, id, _industriesQuery);

            if (candidate == null)
            {
                return(null);
            }
            candidate.RelocationLocations = GetList(GetRelocationLocationsQuery(dc, id, _locationQuery).ToList());
            candidate.Industries          = GetList(GetIndustriesQuery(dc, id, _industriesQuery).ToList());
            return(candidate);
        }
예제 #8
0
        private void GetIndustries(CandidatesDataContext dc, string candidateIds, IEnumerable <Candidate> candidates)
        {
            var allIndustries = (from e in GetAllIndustriesQuery(dc, candidateIds, _industriesQuery)
                                 group e by e.Item1).ToDictionary(g => g.Key, g => (from e in g select e.Item2).ToList());

            foreach (var candidate in candidates)
            {
                List <Industry> industries;
                if (allIndustries.TryGetValue(candidate.Id, out industries))
                {
                    candidate.Industries = GetList(industries);
                }
            }
        }
예제 #9
0
        private void GetRelocationLocations(CandidatesDataContext dc, string candidateIds, IEnumerable <Candidate> candidates)
        {
            var allLocations = (from l in GetAllRelocationLocationsQuery(dc, candidateIds, _locationQuery)
                                group l by l.Item1).ToDictionary(g => g.Key, g => (from l in g select l.Item2).ToList());

            foreach (var candidate in candidates)
            {
                List <LocationReference> locations;
                if (allLocations.TryGetValue(candidate.Id, out locations))
                {
                    candidate.RelocationLocations = GetList(locations);
                }
            }
        }
예제 #10
0
 private static CandidateEntity GetCandidateEntity(CandidatesDataContext dc, Guid id)
 {
     return(GetCandidateEntityQuery(dc, id));
 }