Esempio n. 1
0
        void ICandidatesCommand.UpdateCandidate(Candidate candidate)
        {
            // Keep track of changes.

            var originalCandidate = _repository.GetCandidate(candidate.Id);

            // Change and save.

            PrepareUpdate(candidate);
            candidate.Validate();
            _repository.UpdateCandidate(candidate);

            // Fire events.

            Fire(candidate, originalCandidate);
        }
Esempio n. 2
0
        private Member CreateMember(int index)
        {
            var member = CreateMember(index, null);

            // Update all the times.

            var date = DateTime.Now.AddDays(-1 * index);

            member.CreatedTime     = date;
            member.LastUpdatedTime = date;
            _membersRepository.UpdateMember(member);

            var candidate = _candidatesRepository.GetCandidate(member.Id);

            candidate.LastUpdatedTime = date;
            _candidatesRepository.UpdateCandidate(candidate);

            var resume = _resumesRepository.GetResume(candidate.ResumeId.Value);

            resume.CreatedTime     = date;
            resume.LastUpdatedTime = date;
            _resumesRepository.UpdateResume(resume);

            _memberSearchService.UpdateMember(member.Id);
            return(member);
        }
Esempio n. 3
0
        private Member CreateMember(int index, DateTime lastUpdatedTime, DateTime?modifiedTime)
        {
            var member = _memberAccountsCommand.CreateTestMember(index);

            member.CreatedTime     = lastUpdatedTime;
            member.LastUpdatedTime = lastUpdatedTime;
            _membersRepository.UpdateMember(member);

            var candidate = _candidatesRepository.GetCandidate(member.Id);

            candidate.LastUpdatedTime = lastUpdatedTime;
            _candidatesRepository.UpdateCandidate(candidate);

            // Delete what is already there.

            using (var dc = new MaintenanceDataContext(_connectionFactory.CreateConnection()))
            {
                var entity = (from i in dc.MemberIndexingEntities where i.memberId == member.Id select i).SingleOrDefault();
                if (entity != null)
                {
                    dc.MemberIndexingEntities.DeleteOnSubmit(entity);
                    dc.SubmitChanges();
                }
            }

            if (modifiedTime != null)
            {
                using (var dc = new MaintenanceDataContext(_connectionFactory.CreateConnection()))
                {
                    dc.MemberIndexingEntities.InsertOnSubmit(new MemberIndexingEntity {
                        memberId = member.Id, modifiedTime = modifiedTime.Value
                    });
                    dc.SubmitChanges();
                }
            }

            return(member);
        }
        // GET: api/Candidates/5
        public ResponseModel Get(int id)
        {
            try
            {
                CandidateModel Candidate = _ICandidatesRepository.GetCandidate(id);

                if (Candidate != null && Candidate.IdCandidate != 0)
                {
                    ResponseModel SuccessResponse = Helpers.ResponseFactory.Create(true);
                    SuccessResponse.Object = Candidate;
                    return(SuccessResponse);
                }

                ResponseModel ErrorResponse = Helpers.ResponseFactory.Create(false);
                ErrorResponse.Message = "No se encontraron resultados.";
                return(ErrorResponse);
            }
            catch (Exception ex)
            {
                Helpers.Utils.RegisterException("Candidates: Get", ex.Message);
                return(Helpers.ResponseFactory.Create(false));
            }
        }
Esempio n. 5
0
 public async Task <Candidate> GetCandidate(int id)
 {
     return(await repository.GetCandidate(id));
 }
Esempio n. 6
0
 Candidate ICandidatesQuery.GetCandidate(Guid id)
 {
     return(_repository.GetCandidate(id));
 }