private static void CreateNewVacanciesProgress(Vacancy destination, VacancyDTO source) { source.CandidatesProgress.Where(x => x.IsNew()).ToList().ForEach(newVacancyStageInfo => { var toDomain = new VacancyStageInfo(); toDomain.Update(destination, newVacancyStageInfo); destination.CandidatesProgress.Add(toDomain); }); }
private static void CreateNewVacanciesProgress(Candidate destination, CandidateDTO source, IRepository <Vacancy> vacancyRepo) { source.VacanciesProgress.Where(x => x.IsNew()).ToList().ForEach(newVacancyStageInfo => { var toDomain = new VacancyStageInfo(); toDomain.Update(vacancyRepo.GetByID(newVacancyStageInfo.VacancyId.Value), newVacancyStageInfo); destination.VacanciesProgress.Add(toDomain); }); }
public static void Update(this VacancyStageInfo vacancyStageInfoDomain, Vacancy destination, VacancyStageInfoDTO vacancyStageInfoSource) { vacancyStageInfoDomain.CandidateId = vacancyStageInfoSource.CandidateId; if (vacancyStageInfoSource.VacancyId.HasValue) { vacancyStageInfoDomain.VacancyId = vacancyStageInfoSource.VacancyId.Value; } else { vacancyStageInfoDomain.Vacancy = destination; } vacancyStageInfoDomain.DateOfPass = vacancyStageInfoSource.DateOfPass; vacancyStageInfoDomain.StageState = vacancyStageInfoSource.StageState; vacancyStageInfoDomain.StageId = vacancyStageInfoSource.StageId; var extendedStage = destination.StageFlow.FirstOrDefault(x => x.StageId == vacancyStageInfoSource.StageId); if (vacancyStageInfoSource.IsNew()) { if (extendedStage.Stage.IsCommentRequired) { if (vacancyStageInfoSource.Comment == null) { if (vacancyStageInfoDomain.StageState == Domain.Entities.Enum.StageState.Passed) { throw new Exception("Comment is needed"); } } else { vacancyStageInfoDomain.Comment = new Comment(); vacancyStageInfoDomain.Comment.Update(vacancyStageInfoSource.Comment); } } } else if (extendedStage.Stage.IsCommentRequired && vacancyStageInfoSource.Comment != null) { vacancyStageInfoDomain.Comment = new Comment(); vacancyStageInfoDomain.Comment.Update(vacancyStageInfoSource.Comment); } }
public DummyBotContext() { #region Candidate Comment candidateComment = new Comment() { CommentType = CommentType.Candidate, Message = "msg", RelativeId = 0, }; File candidateFile = new File() { Description = "description", FilePath = "path", }; CandidateSource candidateSource = new CandidateSource() { Path = "Path", Source = Source.HeadHunter, }; LanguageSkill languageSkill = new LanguageSkill() { Language = _languages[0], LanguageLevel = LanguageLevel.Fluent, }; Photo photo = new Photo() { Description = "descr", ImagePath = "path" }; SocialNetwork socialNetwork = new SocialNetwork() { Id = 1, ImagePath = "path", Title = "Path" }; _socialNetworks.Add(socialNetwork); CandidateSocial candidateSocial = new CandidateSocial() { Path = "path", SocialNetwork = socialNetwork, }; Candidate candidate = new Candidate() { Id = 1, Skype = "skype", BirthDate = DateTime.Now, Comments = new List <Comment>() { candidateComment }, Description = "descrpition", Education = "High", Email = "email", Industry = industries[0], StartExperience = DateTime.Now, Tags = new List <Tag>() { _tags[0] }, Files = new List <File>() { candidateFile }, Sources = new List <CandidateSource>() { candidateSource }, FirstName = "TESTNAME", IsMale = true, LanguageSkills = new List <LanguageSkill>() { languageSkill }, LastName = "lname", Location = _locations[0], MiddleName = "mname", PhoneNumbers = new List <PhoneNumber>() { new PhoneNumber() { Id = 1, Number = "+380978762352" } }, Photo = photo, PositionDesired = "architecht", Practice = "best", RelocationAgreement = true, SalaryDesired = 10500, Skills = new List <Skill>() { _skills[0] }, SocialNetworks = new List <CandidateSocial>() { candidateSocial }, TypeOfEmployment = TypeOfEmployment.FullTime, VacanciesProgress = new List <VacancyStageInfo>() { } }; #endregion Comment vacancyComment = new Comment() { CommentType = CommentType.Vacancy, Message = "msg", RelativeId = 0, }; File vacancyFile = new File() { Description = "file", FilePath = "path", }; Permission permission = new Permission() { Id = 1, AccessRights = AccessRights.AddCandidateToVacancy, Description = "Permis", }; Role role = new Role() { Id = 1, Title = "adm", Permissions = new List <Permission>() { permission }, }; User user = new User() { Id = 1, BirthDate = DateTime.Now, Email = "mail", FirstName = "fname", isMale = true, LastName = "lastname", Location = _locations[0], Login = "******", Password = "******", MiddleName = "mname", PhoneNumbers = new List <PhoneNumber>() { new PhoneNumber() { Number = "+3565234662" } }, Photo = photo, Role = role, Skype = "skype", }; Vacancy vacancy = new Vacancy() { Id = 1, TypeOfEmployment = TypeOfEmployment.FullTime, Title = "Architecht", Comments = new List <Comment>() { vacancyComment }, DeadlineDate = DateTime.Now, Description = "descr", EndDate = DateTime.Now, Files = new List <File>() { vacancyFile }, LanguageSkill = languageSkill, Level = new List <Level>() { Level.Senior }, Locations = new List <Location>() { _locations[0] }, ParentVacancy = null, RequiredSkills = new List <Skill>() { _skills[0] }, Responsible = user, SalaryMax = 100500, SalaryMin = 15, StartDate = DateTime.Now, Department = _departments[0], CandidatesProgress = new List <VacancyStageInfo>() }; Comment vsicomment = new Comment() { CommentType = CommentType.StageInfo, Message = "msg", RelativeId = 0, }; VacancyStage vs = new VacancyStage() { IsCommentRequired = true, Order = 1, Stage = _stages[0], Vacacny = vacancy }; VacancyStageInfo vsi = new VacancyStageInfo() { Candidate = candidate, Comment = vsicomment, VacancyStage = vs }; candidate.VacanciesProgress.Add(vsi); vacancy.CandidatesProgress.Add(vsi); _vacancies.Add(vacancy); _candidates.Add(candidate); }