public int GetRefusedCount() { using (var context = new CandidatesDataContext(_connectionString)) { return(context.Candidates.Count(c => c.Status == Status.Refused)); } }
public Candidate ViewDetails(int candidateId) { using (var context = new CandidatesDataContext(_connectionString)) { return(context.Candidates.FirstOrDefault(c => c.Id == candidateId)); } }
public void Refuse(int candidateId) { using (var context = new CandidatesDataContext(_connectionString)) { context.ExecuteCommand("UPDATE Candidates SET Status = 2 WHERE Id = {0}", candidateId); } }
public IEnumerable <Candidate> GetRefused() { using (var context = new CandidatesDataContext(_connectionString)) { return(context.Candidates.Where(c => c.Status == Models.Status.Refused).ToList()); } }
public void AddCandidate(Candidate candidate) { using (var context = new CandidatesDataContext(_connectionString)) { context.Candidates.InsertOnSubmit(candidate); context.SubmitChanges(); } }
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); }
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); }
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); } } }
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); } } }
private static CandidateEntity GetCandidateEntity(CandidatesDataContext dc, Guid id) { return(GetCandidateEntityQuery(dc, id)); }