private void AssertCandidate(CandidateModel model, EmployerMemberView view) { Assert.AreEqual(view.Id, model.Id); Assert.AreEqual(view.GetCandidateTitle(), model.FullName); Assert.AreEqual(view.Status, model.Status); Assert.AreEqual(_memberStatusQuery.GetLastUpdatedTime(view, view, view.Resume).ToUniversalTime(), model.LastUpdatedTime); Assert.AreEqual(view.Address.Location.ToString(), model.Location); var salary = view.DesiredSalary == null ? null : view.DesiredSalary.ToRate(SalaryRate.Year); Assert.AreEqual(salary == null ? null : salary.LowerBound, model.DesiredSalary == null ? null : model.DesiredSalary.LowerBound); Assert.AreEqual(salary == null ? null : salary.UpperBound, model.DesiredSalary == null ? null : model.DesiredSalary.UpperBound); Assert.AreEqual(view.DesiredJobTitle, model.DesiredJobTitle); Assert.AreEqual(view.DesiredJobTypes, model.DesiredJobTypes); Assert.AreEqual(view.Resume == null ? null : view.Resume.Summary, model.Summary); if (view.Resume == null || view.Resume.Jobs == null || view.Resume.Jobs.Count == 0) { Assert.IsNull(model.Jobs); } else { for (var index = 0; index < view.Resume.Jobs.Count; ++index) { AssertJob(view.Resume.Jobs[index], model.Jobs[index]); } } }
private IDictionary <Guid, DateTime> GetLastUpdatedTimes(EmployerMemberView view) { return(new Dictionary <Guid, DateTime> { { view.Id, _memberStatusQuery.GetLastUpdatedTime(view, view, view.Resume) }, }); }
private void AssertResponse(string response, EmployerMemberView view) { var sb = new StringBuilder(); sb.Append("{\"Candidate\":{") .Append("\"Id\":\"").Append(view.Id.ToString()).Append("\"") .Append(",\"CanContact\":\"").Append(view.CanContact()).Append("\"") .Append(",\"CanContactByPhone\":\"").Append(view.CanContactByPhone()).Append("\"") .Append(",\"HasBeenViewed\":").Append(view.HasBeenViewed ? "true" : "false") .Append(",\"HasBeenAccessed\":").Append(view.HasBeenAccessed ? "true" : "false") .Append(",\"IsInMobileFolder\":").Append(view.IsInMobileFolder ? "true" : "false") .Append(",\"FullName\":").Append(view.GetCandidateTitle() == null ? "null" : "\"" + view.GetCandidateTitle() + "\"") .Append(",\"PhoneNumbers\":").Append(view.PhoneNumbers == null || view.PhoneNumbers.All(p => string.IsNullOrEmpty(p.Number)) ? "null" : "\"" + view.PhoneNumbers + "\"") .Append(",\"Status\":\"").Append(view.Status).Append("\"") .Append(",\"LastUpdatedTime\":\"").Append(_memberStatusQuery.GetLastUpdatedTime(view, view, view.Resume).ToUniversalTime().ToString("o")).Append("\"") .Append(",\"Location\":").Append(view.Address.Location.ToString() == null ? "null" : "\"" + view.Address.Location + "\"") .Append(",\"DesiredJobTitle\":").Append(view.DesiredJobTitle == null ? "null" : "\"" + view.DesiredJobTitle + "\""); if (view.DesiredJobTypes.IsFlagSet(JobTypes.FullTime)) { sb.Append(",\"FullTime\":true"); } if (view.DesiredJobTypes.IsFlagSet(JobTypes.PartTime)) { sb.Append(",\"PartTime\":true"); } if (view.DesiredJobTypes.IsFlagSet(JobTypes.Contract)) { sb.Append(",\"Contract\":true"); } if (view.DesiredJobTypes.IsFlagSet(JobTypes.JobShare)) { sb.Append(",\"JobShare\":true"); } if (view.DesiredJobTypes.IsFlagSet(JobTypes.Temp)) { sb.Append(",\"Temp\":true"); } sb.Append(",\"Summary\":").Append(view.Resume.Summary == null ? "null" : "\"" + view.Resume.Summary.Replace("\r\n", "\\r\\n").Replace("\t", "\\t").Replace("'", "\\u0027") + "\"") .Append(",\"Jobs\":["); for (var index = 0; index < view.Resume.Jobs.Count; ++index) { var job = view.Resume.Jobs[index]; if (index != 0) { sb.Append(","); } sb.Append("{\"Title\":").Append(job.Title == null ? "null" : "\"" + job.Title + "\"") .Append(",\"IsCurrent\":").Append(job.IsCurrent ? "true" : "false") .Append(",\"StartDate\":").Append(job.Dates == null || job.Dates.Start == null ? "null" : string.Format("\"{0:D4}-{1:D2}\"", job.Dates.Start.Value.Year, job.Dates.Start.Value.Month)) .Append(",\"EndDate\":").Append(job.Dates == null || job.Dates.End == null ? "null" : string.Format("\"{0:D4}-{1:D2}\"", job.Dates.End.Value.Year, job.Dates.End.Value.Month)) .Append(",\"Company\":").Append(job.Company == null ? "null" : "\"" + job.Company + "\"") .Append("}"); } sb.Append("]").Append(",\"DesiredSalary\":").Append(view.DesiredSalary == null ? "null" : "\"" + view.DesiredSalary + "\""); sb.Append("},\"Success\":true,\"Errors\":null}"); Assert.AreEqual(sb.ToString(), response); }
DocFile IJobAdApplicationsManager.GetResume(Member member) { var candidate = _candidatesQuery.GetCandidate(member.Id); var resume = candidate.ResumeId == null ? null : _resumesQuery.GetResume(candidate.ResumeId.Value); var view = new EmployerMemberView(member, candidate, resume, null, ProfessionalContactDegree.Applicant, false, false); return(_employerResumeFilesQuery.GetResumeFile(view)); }
DocFile IEmployerResumeFilesQuery.GetResumeFile(EmployerMemberView view) { // Need to figure out why there is a separate call to get the resume here and why not just use the one from the view ... var resume = _resumesQuery.GetResume(view.Resume.Id); var resumeFile = _resumeFilesQuery.GetResumeFile(view, resume); return(new DocFile(resumeFile.FileName, resumeFile.Contents)); }
private static RouteValueDictionary GetRouteValues(EmployerMemberView view) { return(new RouteValueDictionary { { LocationKey, (view.Address == null ? null : view.Address.Location).GetUrlSegment(null) }, { SalaryKey, view.DesiredSalary.GetUrlSegment(null) }, { TitleKey, view.DesiredJobTitle.GetTitleUrlSegment(null) }, { CandidateIdKey, view.Id.ToString() }, }); }
protected void AssertJobG8Request(Member member, JobAd jobAd, InternalApplication application) { var candidate = _candidatesQuery.GetCandidate(member.Id); var resume = application.ResumeId == null || candidate.ResumeId == null ? null : _resumesQuery.GetResume(candidate.ResumeId.Value); var view = new EmployerMemberView(member, candidate, resume, null, ProfessionalContactDegree.Applicant, false, false); var resumeFile = _resumeFilesQuery.GetResumeFile(view, resume); AssertJobG8Request(member, jobAd, application, resumeFile.FileName, GetResumeValue(resumeFile)); }
public void TestSuccess() { var member = _memberAccountsCommand.CreateTestMember(0); var candidate = _candidatesQuery.GetCandidate(member.Id); var resume = _candidateResumesCommand.AddTestResume(candidate); var view = new EmployerMemberView(member, candidate, resume, null, ProfessionalContactDegree.Applicant, false, false); var resumeFile = _resumeFilesQuery.GetResumeFile(view, resume); var integratorUser = _integrationCommand.CreateTestIntegratorUser(); Assert.AreEqual(resumeFile.Contents, Get(GetResumeUrl(candidate.Id), integratorUser, Password, true)); }
string IResumeHighlighter.SummarizeContent(EmployerMemberView view) { if (view.Resume == null || _contentQuery == null) { return(string.Empty); } var resumeView = new ResumeViewText(view); var resumeText = resumeView.RenderForSummarizing(); return(Summarize(_contentQuery, resumeText, true)); }
private ContentAttachment GetResumeFile(EmployerMemberView view) { var resumeFile = _employerResumeFilesQuery.GetResumeFile(view); // Save the contents into a stream. var stream = new MemoryStream(); stream.Write(resumeFile.Contents, 0, resumeFile.Contents.Length); stream.Position = 0; return(new ContentAttachment(stream, resumeFile.Name, MediaType.GetMediaTypeFromExtension(Path.GetExtension(resumeFile.Name), MediaType.Text))); }
public ResumeViewText(EmployerMemberView view) { if (view.Resume == null) { return; } Objective = view.Resume.Objective; SelfSummary = view.Resume.Summary; Skills = view.Resume.Skills; EmploymentDetails = RenderEmploymentDetails(view.Resume); EducationDetails = RenderEducationDetails(view.Resume); ProfessionalDetails = RenderProfessionalDetails(view.Resume); PersonalDetails = RenderPersonalDetails(view.Resume); }
private void SetView(IEmployer employer, Guid memberId, EmployerMemberView view) { var candidate = _candidatesQuery.GetCandidate(memberId); var resume = candidate.ResumeId == null ? null : _resumesQuery.GetResume(candidate.ResumeId.Value); view.Set( candidate, resume, HasViewedMember(employer, memberId), _candidateFlagListsQuery.IsFlagged(employer, memberId), _candidateFoldersQuery.IsInMobileFolder(employer, memberId), _candidateFoldersQuery.GetFolderCount(employer, memberId), _candidateNotesQuery.GetNoteCount(employer, memberId)); }
private void SendResume(InternalApplication application, Member member, JobAdEntry jobAd, IEnumerable <ApplicationAnswer> answers) { // Generate the resume file and send it. var candidate = _candidatesQuery.GetCandidate(member.Id); var resume = application.ResumeId == null || candidate.ResumeId == null ? null : _resumesQuery.GetResume(candidate.ResumeId.Value); var view = new EmployerMemberView(member, candidate, resume, null, ProfessionalContactDegree.Applicant, false, false); var resumeFile = _resumeFilesQuery.GetResumeFile(view, resume); using (var stream = new MemoryStream()) { var buffer = Encoding.ASCII.GetBytes(resumeFile.Contents); stream.Write(buffer, 0, buffer.Length); stream.Position = 0; _sendJobG8Command.SendApplication(member, jobAd, resumeFile.FileName, new StreamFileContents(stream), application, answers); } }
protected static EmployerMemberEmailView GetEmailView(EmployerMemberView view) { var result = new EmployerMemberEmailView { CandidateId = view.Id, IsNew = view.CreatedTime.Date > DateTime.Today - SearchResultFreshDays, }; // Only set everything else if there is a current job. if (view.Resume != null && !view.Resume.Jobs.IsNullOrEmpty()) { // Add the location if it is set. var location = view.Address.Location.ToString(); if (!string.IsNullOrEmpty(location)) { result.Location = location; } // Current job. var currentJob = view.Resume.Jobs[0]; result.CurrentJobTitle = currentJob.Title; result.CurrentEmployer = currentJob.Company ?? EmployerHidden; // Previous job. if (view.Resume.Jobs.Count > 1) { var previousJob = view.Resume.Jobs[1]; result.PreviousJobTitle = previousJob.Title; result.PreviousEmployer = previousJob.Company ?? EmployerHidden; } // Salary. if (view.DesiredSalary != null) { result.IdealSalary = view.DesiredSalary.GetDisplayText(); } } return(result); }
private ViewCandidateModel GetCurrentCandidate(Guid?currentCandidateId, EmployerMemberView view) { var currentCandidate = new ViewCandidateModel { View = view, LastLoginTime = currentCandidateId == null ? null : _userSessionsQuery.GetLastLoginTime(currentCandidateId.Value), CurrentSearch = EmployerContext.CurrentSearch, }; if (currentCandidateId.HasValue && EmployerContext.CurrentCandidates is ManageCandidatesNavigation) { var jobAdId = ((ManageCandidatesNavigation)EmployerContext.CurrentCandidates).JobAdId; currentCandidate.CurrentApplication = _jobAdApplicantsQuery.GetApplication(currentCandidateId.Value, jobAdId); currentCandidate.ApplicantStatus = currentCandidate.CurrentApplication == null ? (ApplicantStatus?)null : _jobAdApplicantsQuery.GetApplicantStatus(currentCandidate.CurrentApplication.Id); } return(currentCandidate); }
public static string GetCandidateTitle(this EmployerMemberView view) { if (!string.IsNullOrEmpty(view.FullName)) { return(view.FullName); } var currentJobTitles = view.Resume == null ? null : view.Resume.GetCurrentJobTitles(); if (currentJobTitles != null && currentJobTitles.Length > 0) { return(string.Join(", ", currentJobTitles)); } if (!view.DesiredJobTitle.IsNullOrEmpty()) { return(view.DesiredJobTitle); } return("<Name hidden>"); }
public static string GetPageTitle(this EmployerMemberView view) { var jobTitle = string.IsNullOrEmpty(view.DesiredJobTitle) ? string.Empty : view.DesiredJobTitle; if (jobTitle.Length >= 40) { // Truncate at the first space before 40 chars var lastSpace = jobTitle.Substring(0, 37).LastIndexOf(' '); jobTitle = string.Format("{0}...", jobTitle.Substring(0, lastSpace < 1 ? 37 : lastSpace)); } var location = string.Empty; if (view.Address != null && view.Address.Location != null) { location = view.Address.Location.IsCountry ? view.Address.Location.Country.ToString() : view.Address.Location.ToString(); } var availability = view.Status == CandidateStatus.AvailableNow || view.Status == CandidateStatus.ActivelyLooking ? "available now" : string.Empty; return(string.Format("{0} {1} {2}|Candidates Available on LinkMe", jobTitle, location, availability)); }
ResumeFile IResumeFilesQuery.GetResumeFile(RegisteredUser recipient, Member member, Candidate candidate, Resume resume) { if (candidate == null) { throw new ArgumentNullException("candidate"); } if (recipient == null) { throw new ArgumentNullException("recipient"); } EmployerMemberView view; var employer = recipient as Employer; if (employer != null) { view = _employerMemberViewsQuery.GetEmployerMemberView(employer, member); } else if (recipient is Member) { if (recipient.Id != member.Id) { throw new ApplicationException("Downloading the resume of another member is not supported."); } view = new EmployerMemberView(member, candidate, resume, null, ProfessionalContactDegree.Self, false, false); } else if (recipient is Administrator) { view = new EmployerMemberView(member, candidate, resume, null, ProfessionalContactDegree.Self, false, false); } else { throw new ApplicationException("Unexpected type of recipient: " + recipient.GetType().FullName); } return(ConvertResume(view, resume)); }
private static void AssertResume(bool canAccess, EmployerMemberView view) { // Check resume. if (canAccess) { Assert.AreEqual(Skills, view.Resume.Skills); Assert.AreEqual(Objective, view.Resume.Objective); Assert.AreEqual(Summary, view.Resume.Summary); Assert.AreEqual(Other, view.Resume.Other); Assert.AreEqual(Citizenship, view.Resume.Citizenship); Assert.AreEqual(Affiliations, view.Resume.Affiliations); Assert.AreEqual(Professional, view.Resume.Professional); Assert.AreEqual(Interests, view.Resume.Interests); Assert.IsTrue(Awards.SequenceEqual(view.Resume.Awards)); Assert.IsTrue(Courses.SequenceEqual(view.Resume.Courses)); var schools = view.Resume.Schools; Assert.AreEqual(Schools.Count, schools.Count); for (var index = 0; index < schools.Count; ++index) { Assert.AreEqual(Schools[index].City, schools[index].City); Assert.AreEqual(Schools[index].CompletionDate.End, schools[index].CompletionDate.End); Assert.AreEqual(Schools[index].Country, schools[index].Country); Assert.AreEqual(Schools[index].Degree, schools[index].Degree); Assert.AreEqual(Schools[index].Description, schools[index].Description); Assert.AreEqual(Schools[index].Institution, schools[index].Institution); Assert.AreEqual(Schools[index].Major, schools[index].Major); } } else { Assert.IsNull(view.Resume); } }
IEnumerable <KeyValuePair <string, string> > IResumeHighlighter.SummarizeSections(EmployerMemberView view) { var resumeView = new ResumeViewText(view); var summaries = new List <KeyValuePair <string, string> >(); AddSection(summaries, _contentQuery, "Objective", resumeView.Objective); AddSection(summaries, _contentQuery, "Summary", resumeView.SelfSummary); AddSection(summaries, _contentQuery, "Skills", resumeView.Skills); AddSection(summaries, _educationQuery, "Education", resumeView.EducationDetails); AddSection(summaries, _contentQuery, "Professional", resumeView.ProfessionalDetails); AddSection(summaries, _contentQuery, "Personal", resumeView.PersonalDetails); AddSection(summaries, _contentQuery, "Employment", resumeView.EmploymentDetails); return(summaries); }
protected IEnumerable <KeyValuePair <string, string> > SummarizeSections(EmployerMemberView view) { return(_resumeHighlighter.SummarizeSections(view)); }
public static ReadOnlyUrl GenerateCandidateUrl(this EmployerMemberView view) { return(CandidatesRoutes.Candidate.GenerateUrl(GetRouteValues(view))); }
public CandidateResumeEmail(ICommunicationUser to, EmployerMemberView view) : base(to) { _view = view; }
protected void AssertCandidate(CandidateResponseModel model, EmployerMemberView member) { AssertJsonSuccess(model); AssertCandidate(model.Candidate, member); }
private static void AppendResult(ICollection <Guid> newResults, ICollection <Guid> updatedResults, EmployerMemberView view, IDictionary <Guid, EmployerMemberEmailView> emailViews) { var emailView = GetEmailView(view); emailViews[view.Id] = emailView; if (emailView.IsNew) { newResults.Add(emailView.CandidateId); } else { updatedResults.Add(emailView.CandidateId); } }
private static void AssertJobs(bool canAccessResume, bool canAccessRecentEmployers, EmployerMemberView view) { // Check resume. if (canAccessResume) { // Reference equals not good enough for this one, check the jobs explicitly. var jobs = view.Resume.Jobs; Assert.AreEqual(Jobs.Count, jobs.Count); for (var index = 0; index < jobs.Count; ++index) { Assert.AreEqual(Jobs[index].Dates.Start, jobs[index].Dates.Start); Assert.AreEqual(Jobs[index].Dates.End, jobs[index].Dates.End); Assert.AreEqual(Jobs[index].Description, jobs[index].Description); Assert.AreEqual(Jobs[index].Title, jobs[index].Title); } // The company names are subject to settings, but only the current and previous job. // In this test case that means the first two jobs. if (canAccessRecentEmployers) { Assert.AreEqual(Jobs[0].Company, jobs[0].Company); Assert.AreEqual(Jobs[1].Company, jobs[1].Company); Assert.AreEqual(Jobs[2].Company, jobs[2].Company); } else { Assert.IsNull(jobs[0].Company); Assert.IsNull(jobs[1].Company); Assert.AreEqual(Jobs[2].Company, jobs[2].Company); } } else { Assert.IsFalse(canAccessRecentEmployers); Assert.IsNull(view.Resume); } }
public static string GetDisplayText(this EmployerMemberView view, bool nameOnly) { return(view.GetDisplayText(view, view.Resume, nameOnly)); }
ResumeFile IResumeFilesQuery.GetResumeFile(EmployerMemberView view, Resume resume) { return(ConvertResume(view, resume)); }
private static void AssertReferees(bool canAccessResume, bool canAccessReferees, EmployerMemberView view) { // Check resume. if (canAccessResume) { if (canAccessReferees) { Assert.AreEqual(Referees, view.Resume.Referees); } else { Assert.IsNull(view.Resume.Referees); } } else { Assert.IsNull(view.Resume); } }
private static ResumeFile ConvertResume(EmployerMemberView view, Resume resume) { // Use an empty resume if none provided. if (resume == null) { resume = new Resume(); } var resumeXml = Serialize(resume); var xsltArgumentList = new XsltArgumentList(); xsltArgumentList.AddParam("headerLogo", "", HeaderLogo); xsltArgumentList.AddParam("shortLine", "", ShortLine); xsltArgumentList.AddParam("longLine", "", LongLine); xsltArgumentList.AddParam("dateTimeNow", "", DateTime.Now.ToShortDateString()); if (!string.IsNullOrEmpty(view.FullName)) { xsltArgumentList.AddParam("networkerName", "", view.FullName); } // Use the first current job. var currentJobTitles = resume.GetCurrentJobTitles(); var currentJobTitle = currentJobTitles == null || currentJobTitles.Length == 0 ? string.Empty : currentJobTitles[0]; if (!string.IsNullOrEmpty(currentJobTitle)) { xsltArgumentList.AddParam("currentJobTitle", "", currentJobTitle); } var currentIndustry = view.GetIndustriesDisplayText(", "); if (!string.IsNullOrEmpty(currentIndustry)) { xsltArgumentList.AddParam("currentIndustry", "", currentIndustry); } xsltArgumentList.AddParam("updatedDate", "", resume.LastUpdatedTime.ToString("d MMMM yyyy")); var industries = view.GetIndustriesDisplayText(RtfLinebreak); if (!string.IsNullOrEmpty(industries)) { xsltArgumentList.AddParam("industries", "", industries); } var location = view.Address.Location.ToString(); if (!string.IsNullOrEmpty(location)) { xsltArgumentList.AddParam("location", "", location); } var state = view.Address.Location.CountrySubdivision; if (state != null) { if (state.ShortName != null) { xsltArgumentList.AddParam("state", "", state.ShortName); } xsltArgumentList.AddParam("country", "", state.Country.Name); } var phoneNumber = GetPhoneNumber(view, PhoneNumberType.Mobile); if (phoneNumber != null) { xsltArgumentList.AddParam("mobilePhoneNumber", "", phoneNumber.Number); } phoneNumber = GetPhoneNumber(view, PhoneNumberType.Work); if (phoneNumber != null) { xsltArgumentList.AddParam("workPhoneNumber", "", phoneNumber.Number); } phoneNumber = GetPhoneNumber(view, PhoneNumberType.Home); if (phoneNumber != null) { xsltArgumentList.AddParam("homePhoneNumber", "", phoneNumber.Number); } if (!string.IsNullOrEmpty(view.DesiredJobTitle)) { xsltArgumentList.AddParam("desiredJobTitle", "", view.DesiredJobTitle); } xsltArgumentList.AddParam("desiredJobTypes", "", view.DesiredJobTypes.GetDesiredClauseDisplayText()); if (view.DesiredSalary != null) { xsltArgumentList.AddParam("desiredSalary", "", view.DesiredSalary.GetDisplayText()); } var showRealName = !string.IsNullOrEmpty(view.FullName); xsltArgumentList.AddParam("showRealName", "", showRealName); xsltArgumentList.AddParam("showPhoneNumbers", "", view.PhoneNumbers != null && view.PhoneNumbers.Count > 0 && view.PhoneNumbers.All(p => !string.IsNullOrEmpty(p.Number))); xsltArgumentList.AddParam("showProfilePhoto", "", view.PhotoId != null); xsltArgumentList.AddParam("showRecentEmployers", "", true); xsltArgumentList.AddParam("showCommunities", "", view.AffiliateId != null); return(new ResumeFile { Contents = Transform(resumeXml, xsltArgumentList), FileName = FileSystem.GetValidFileName(view.GetDisplayText(view, view.Resume, true)) + FileExtension }); }