Beispiel #1
0
        public void Add(CandidateDto dto, string name)
        {
            var candidate = new Candidate();
            dto.ToCandidateModel(candidate);

            var user = _userProfileRepository.Get(name);
            if (user != null)
            {
                candidate.AddedByProfileId = user.Id;
            }

            foreach (var item in dto.PoolNames)
            {
                var pool = _poolRepository.Get(x => x.Name == item);
                if (pool != null)
                {
                    candidate.Pool.Add(pool);
                }
            }
            try
            {
                candidate.AddDate = DateTime.Now;
                _candidateRepository.UpdateAndCommit(candidate);
                _activityHelperService.CreateAddedCandidateActivity(candidate);
            }
            catch (Exception ex)
            {
                _logger.Log(ex);
                throw new Exception("Database save error!");
            }
        }
Beispiel #2
0
 public void CreateAddedCandidateActivity(Candidate candidate)
 {
     try
     {
         string message = string.Format("A new candidate has been added : {0} {1}", candidate.FirstName,
             candidate.LastName);
         ActivityType type = ActivityType.Candidate;
         Uri url = new Uri("#/candidate/"+candidate.Id, UriKind.Relative);
         _activityPostService.Post(message, type, url);
     }
     catch (Exception e)
     {
         _logger.Log("Creating activity exception : " + e.Message);
     }
 }
Beispiel #3
0
 public void Delete(Candidate candidate)
 {
     try
     {
         _candidateRepository.DeleteAndCommit(candidate);
     }
     catch (Exception ex)
     {
         _logger.Log(ex);
     }
 }
Beispiel #4
0
 public void SavePhoto(Candidate candidate, byte[] sourceBytes)
 {
     candidate.Photo = sourceBytes;
     _candidateService.Update(candidate.ToCandidateDto());
     _activityHelperService.CreateUploadedPhotoActivity(candidate);
 }
Beispiel #5
0
 public void CreateUpdateCandidateResolution(Candidate candidate, Resolution oldResolution)
 {
     try
     {
         string message = string.Format("Resolution for {0} {1} has been changed from '{2}' to '{3}'",
             candidate.FirstName, candidate.LastName, oldResolution.GetCustomDescription(), ((Resolution)candidate.Resolution).GetCustomDescription());
         ActivityType type = ActivityType.Candidate;
         Uri url = new Uri("#/candidate/"+candidate.Id, UriKind.Relative);
         _activityPostService.Post(message, type, url);
     }
     catch (Exception e)
     {
         _logger.Log("Creating activity exception : " + e.Message);
     }
 }