Ejemplo n.º 1
0
        private bool UnsubscribeDailyDigestViaEmail(Candidate candidate)
        {
            candidate.CommunicationPreferences.ApplicationStatusChangePreferences.EnableEmail = false;
            candidate.CommunicationPreferences.ExpiringApplicationPreferences.EnableEmail     = false;

            _saveCandidateStrategy.SaveCandidate(candidate);
            return(true);
        }
        public Candidate SaveCandidate(Candidate candidate)
        {
            Condition.Requires(candidate);

            _logger.Debug("Calling CandidateService to save a candidate.");

            return(_saveCandidateStrategy.SaveCandidate(candidate));
        }
        public void UpdateUsername(Guid userId, string verfiyCode, string password)
        {
            var user      = _userAccountService.GetUser(userId);
            var candidate = _candidateReadRepository.Get(userId);

            _userAccountService.UpdateUsername(userId, verfiyCode, password);

            var existingCandidates = _candidateReadRepository.Get(user.PendingUsername, false);

            foreach (var existingCandidate in existingCandidates)
            {
                //Any candidate now associated with a null user record must have been pending activation and can be deleted.
                var existingUser = _userReadRepository.Get(existingCandidate.EntityId);
                if (existingUser == null)
                {
                    _candidateWriteRepository.Delete(existingCandidate.EntityId);
                    _serviceBus.PublishMessage(new CandidateUserUpdate(user.EntityId, CandidateUserUpdateType.Delete));
                }
            }

            candidate.RegistrationDetails.EmailAddress = user.PendingUsername;
            _saveCandidateStrategy.SaveCandidate(candidate);
            _serviceBus.PublishMessage(new CandidateUserUpdate(user.EntityId, CandidateUserUpdateType.Update));
        }