public virtual PersonalInformationViewModel Prepare([NotNull] MandatorResponse mandatorResponse, [CanBeNull] ApplicantResponse applicantResponse) { AllowEmptyGender = mandatorResponse.PortalSettings.AllowEmptyGender; AvailableTitlesBeforeName = from x in mandatorResponse.TitlesBeforeName select new SelectListItem { Value = x.Name, Text = x.Name }; AvailableTitlesAfterName = from x in mandatorResponse.TitlesAfterName select new SelectListItem { Value = x.Name, Text = x.Name }; AvailableCountries = from x in mandatorResponse.Countries select new SelectListItem { Value = x, Text = x }; AvailableNationalities = from x in mandatorResponse.Countries select new SelectListItem { Value = x, Text = x }; if (applicantResponse != null) { AutoMapper.Mapper.DynamicMap(applicantResponse, this); } return(this); }
private IEnumerable<string> GetTitles(bool beforeName, ApiHttpClient apiClient) { _mandator = _mandator ?? new MandatorRequest().LoadResult(apiClient); if (beforeName) return _mandator.TitlesBeforeName.Select(x => x.Name); return _mandator.TitlesAfterName.Select(x => x.Name); }
public static string TlT(MandatorResponse mandatorResponse, string originalText) { var allTranslations = mandatorResponse.Translations; var matchingEntry = allTranslations.FirstOrDefault(x => x.Texts.Any(y => y.Text.Is(originalText))); if (matchingEntry != null) { var currentCulture = CultureInfo.CurrentCulture.Name; //check for identical culture var matchingTranslation = matchingEntry.Texts.FirstOrDefault(x => x.Culture.Is(currentCulture)); //check for similar culture matchingTranslation = matchingTranslation ?? matchingEntry.Texts.FirstOrDefault(x => x.Culture.Substring(0, 2).Is(currentCulture.Substring(0, 2))); //fallback to english matchingTranslation = matchingTranslation ?? matchingEntry.Texts.FirstOrDefault(x => x.Culture.Substring(0, 2).Is("en")); if (matchingTranslation != null) { return(matchingTranslation.Text); } } return(originalText); }
private bool IsDocumentTypeAvailable(ApiHttpClient apiClient) { if (SubType.IsNoE()) return false; _mandator = _mandator ?? new MandatorRequest().LoadResult(apiClient); return _mandator.ApplicantDocumentTypes.Any(x => x.Is(SubType)); }
private bool IsKnowledgeAvailable(ApiHttpClient apiClient) { if (SubType.IsNoE()) return false; _mandator = _mandator ?? new MandatorRequest().LoadResult(apiClient); return _mandator.Knowledges.Any(x => x.Is(SubType)); }
private bool IsKnowledgeLevelAvailable(string value, ApiHttpClient apiClient) { if (value.IsNoE()) return false; _mandator = _mandator ?? new MandatorRequest().LoadResult(apiClient); return _mandator.KnowledgeLevels.Any(x => x.Is(value)); }
private IEnumerable <string> GetTitles(bool beforeName, ApiHttpClient apiClient) { _mandator = _mandator ?? new MandatorRequest().LoadResult(apiClient); if (beforeName) { return(_mandator.TitlesBeforeName.Select(x => x.Name)); } return(_mandator.TitlesAfterName.Select(x => x.Name)); }
private bool IsKnowledgeAvailable(ApiHttpClient apiClient) { if (SubType.IsNoE()) { return(false); } _mandator = _mandator ?? new MandatorRequest().LoadResult(apiClient); return(_mandator.Knowledges.Any(x => x.Is(SubType))); }
private bool IsKnowledgeLevelAvailable(string value, ApiHttpClient apiClient) { if (value.IsNoE()) { return(false); } _mandator = _mandator ?? new MandatorRequest().LoadResult(apiClient); return(_mandator.KnowledgeLevels.Any(x => x.Is(value))); }
public IndexViewModel(MandatorResponse mandatorResponse, IEnumerable <ApplicantDocumentResponse> documents) { AvailableDocumentTypes = mandatorResponse.ApplicantDocumentTypes.Select(x => new SelectListItem { Value = x, Text = Translations.TlT(mandatorResponse, x) }); var documentsAsList = documents.ToList(); HasCv = documentsAsList.Any(x => x.Id == -1); HasPhoto = documentsAsList.Any(x => x.Id == -2); Documents = documentsAsList.Where(x => x.Id > 0).ToList(); }
public IndexViewModel Fill(MandatorResponse mandatorResponse, IEnumerable <string> jobProfiles) { JobProfiles = jobProfiles.OrderBy(x => x).ToList(); AvailableJobProfiles = (from x in mandatorResponse.JobProfiles where !JobProfiles.Any(y => y.Is(x)) orderby x select new SelectListItem { Text = x, Value = x }).ToList(); return(this); }
public RegisterViewModel Prepare(MandatorResponse mandatorResponse, JobResponse jobResponse) { if (jobResponse != null) { JobId = jobResponse.Id; } AvailableDocumentTypes = mandatorResponse.ApplicantDocumentTypes.Select(x => new SelectListItem { Text = x, Value = x }).ToList(); base.Prepare(mandatorResponse); return(this); }
public async Task <IndexViewModel> Build(MandatorResponse mandator, LoadJobsService loadJobsService, Uri requestUrl) { var publishedJobs = await loadJobsService.LoadJobsForCurrentPortal(requestUrl, mandator); foreach (var application in Applications) { if (publishedJobs.Jobs.Any(x => x.Id == application.JobId)) { application.Job = publishedJobs.Jobs.Single(x => x.Id == application.JobId).Title; application.JobIsPublished = true; } else { application.Job = (await loadJobsService.LoadSingleJob(application.JobId)).Title; application.JobIsPublished = false; } } return(this); }
private bool IsJobProfileAvailable(string value, ApiHttpClient apiClient) { _mandator = _mandator ?? new MandatorRequest().LoadResult(apiClient); return(_mandator.JobProfiles.Any(x => x.Is(value))); }
public virtual PersonalInformationViewModel Prepare(MandatorResponse mandatorResponse) { return(Prepare(mandatorResponse, null)); }
private bool IsNationalityAvailable(string value, ApiHttpClient apiClient) { _mandator = _mandator ?? new MandatorRequest().LoadResult(apiClient); return(_mandator.Countries.Any(x => x.Is(value))); }
private CustomFieldResponse GetCustomField(ApiHttpClient apiClient) { _mandator = _mandator ?? new MandatorRequest().LoadResult(apiClient); return(_mandator.CustomFields.FirstOrDefault(x => x.Name.Is(SubType) && (x.Target == CustomFieldResponse.CustomFieldTarget.Applicant || x.Target == CustomFieldResponse.CustomFieldTarget.ApplicantCompany || x.Target == CustomFieldResponse.CustomFieldTarget.JobApplicantCompany || x.Target == CustomFieldResponse.CustomFieldTarget.JobApplicant))); }
private bool IsClassificationAvailable(string value, ApiHttpClient apiClient) { _mandator = _mandator ?? new MandatorRequest().LoadResult(apiClient); return(_mandator.ClassificationTypes.Any(x => x.Is(value))); }
private bool IsRegionAvailable(string value, ApiHttpClient apiClient) { _mandator = _mandator ?? new MandatorRequest().LoadResult(apiClient); return(IsRegionAvailable(value, _mandator.Regions)); }
private bool IsReferrerAvailable(string value, ApiHttpClient apiClient) { _mandator = _mandator ?? new MandatorRequest().LoadResult(apiClient); return _mandator.Referrers.Any(x => x.Name.Is(value)); }
private bool IsRegionAvailable(string value, ApiHttpClient apiClient) { _mandator = _mandator ?? new MandatorRequest().LoadResult(apiClient); return IsRegionAvailable(value, _mandator.Regions); }
private bool IsClassificationAvailable(string value, ApiHttpClient apiClient) { _mandator = _mandator ?? new MandatorRequest().LoadResult(apiClient); return _mandator.ClassificationTypes.Any(x => x.Is(value)); }
public async Task <JobsResponse> LoadJobsForCurrentPortal(Uri requestUri, MandatorResponse mandatorResponse) { return(await new JobsRequest(string.Empty).LoadResult(_client)); }
public SyndicationService(MandatorResponse mandatorResponse, UrlBuilderService urlBuilder) { _urlBuilder = urlBuilder; _mandatorResponse = mandatorResponse; }
public FixJobAdUrlsService(MandatorResponse mandatorResponse) { _mandatorResponse = mandatorResponse; }
public async Task <ApplicantResponse> LinkProfileToApplicant([NotNull] ApiHttpClient apiClient, [NotNull] MandatorResponse mandatorResponse, [CanBeNull] ApplicantResponse loggedInApplicantResponse, [NotNull] IProfile profile, ThirdParty thirdParty) { if (profile == null) { throw new ArgumentNullException("profile"); } ApplicantResponse applicant; try { applicant = loggedInApplicantResponse ?? await new ApplicantGetRequest(profile.Id, thirdParty).LoadResult(apiClient); } catch { applicant = null; } //we don't have an applicant that is logged in or has a matching profile //so, lets create a new applicant if (applicant == null) { //this should never happen, because we catch this case earlier, before calling this method //this is just to make absolutely sure ;) if (await IsEmailAddressAlreadyInUse(apiClient, mandatorResponse, profile.Email)) { return(null); } bool?gender = null; if (profile.Gender == Gender.Female) { gender = false; } else if (profile.Gender == Gender.Male) { gender = true; } var parameter = new ApplicantParameter { Email = profile.Email, FirstName = profile.FirstName, LastName = profile.LastName, Gender = gender }; applicant = await new ApplicantPutRequest(parameter).LoadResult(apiClient); } //now link the profile var linkRequest = thirdParty == ThirdParty.Xing ? new LinkXingRequest(applicant.Id, profile.Id, profile.Url) : (HttpRequestMessage <ApplicantResponse>) new LinkLinkedInRequest(applicant.Id, profile.Id, profile.Url); applicant = await linkRequest.LoadResult(apiClient); return(applicant); }
private bool IsCareerlevelAvailable(string value, ApiHttpClient apiClient) { _mandator = _mandator ?? new MandatorRequest().LoadResult(apiClient); return(_mandator.CareerLevels.Any(x => x.Is(value))); }
private bool IsReferrerAvailable(string value, ApiHttpClient apiClient) { _mandator = _mandator ?? new MandatorRequest().LoadResult(apiClient); return(_mandator.Referrers.Any(x => x.Name.Is(value))); }
private CustomFieldResponse GetCustomField(ApiHttpClient apiClient) { _mandator = _mandator ?? new MandatorRequest().LoadResult(apiClient); return _mandator.CustomFields.FirstOrDefault(x => x.Name.Is(SubType) && (x.Target == CustomFieldResponse.CustomFieldTarget.Applicant || x.Target == CustomFieldResponse.CustomFieldTarget.ApplicantCompany || x.Target == CustomFieldResponse.CustomFieldTarget.JobApplicantCompany || x.Target == CustomFieldResponse.CustomFieldTarget.JobApplicant)); }
public async Task <ApplicantResponse> LinkProfileToApplicant([NotNull] ApiHttpClient apiClient, [NotNull] MandatorResponse mandatorResponse, [NotNull] IProfile profile, ThirdParty thirdParty) { return(await LinkProfileToApplicant(apiClient, mandatorResponse, null, profile, thirdParty)); }
public async Task <bool> IsEmailAddressAlreadyInUse([NotNull] ApiHttpClient apiClient, [NotNull] MandatorResponse mandatorResponse, string email) { //check if the email is not in use already if (!mandatorResponse.PortalSettings.AllowDuplicateEmail) { var applicantsWithThisEmail = await new ApplicantsRequest(email).LoadResult(apiClient); return(applicantsWithThisEmail.Any()); } return(false); }
private bool IsCountryAvailable(string value, ApiHttpClient apiClient) { _mandator = _mandator ?? new MandatorRequest().LoadResult(apiClient); return _mandator.Countries.Any(x => x.Is(value)); }
protected async Task <JobResponse> GetJob(MandatorResponse mandatorResponse, LoadJobsService jobsService, int jobId) { var jobsResponse = await jobsService.LoadJobsForCurrentPortal(Request.Url, mandatorResponse); return(jobsResponse.Jobs.FirstOrDefault(x => x.Id == jobId)); }