Ejemplo n.º 1
0
        private static SuggestedJobsEmailItem CreateEmailItem(JobAd jobAd, JobSearchHighlighter highlighter)
        {
            var emailItem = new SuggestedJobsEmailItem
            {
                JobAdId  = jobAd.Id.ToString("n"),
                Title    = highlighter.HighlightTitle(jobAd.Title),
                Location = jobAd.GetLocationDisplayText()
            };

            if (jobAd.Description.Salary != null)
            {
                emailItem.Salary = jobAd.Description.Salary.GetDisplayText();
            }

            emailItem.PostedAge  = GetAgeString(DateTime.Now - jobAd.CreatedTime);
            emailItem.PostedDate = jobAd.CreatedTime.ToShortDateString();

            emailItem.JobType = jobAd.Description.JobTypes.GetDisplayText(", ", false, false);

            if (jobAd.Description.Industries != null)
            {
                emailItem.Industry = jobAd.Description.Industries.GetCriteriaIndustriesDisplayText();
            }

            Summarize(jobAd, highlighter, out emailItem.Digest, out emailItem.Fragments);

            return(emailItem);
        }
Ejemplo n.º 2
0
        private static void AppendResult(ICollection <JobSearchAlertEmailResult> emailResults, JobAd jobAd, JobSearchHighlighter highlighter, bool haveKeywords)
        {
            var emailResult = new JobSearchAlertEmailResult
            {
                JobAdId  = jobAd.Id.ToString("n"),
                Title    = highlighter.HighlightTitle(jobAd.Title),
                Location = jobAd.GetLocationDisplayText()
            };

            if (jobAd.Description.Salary != null)
            {
                emailResult.Salary = jobAd.Description.Salary.GetJobAdDisplayText();
            }

            emailResult.PostedAge  = jobAd.GetPostedDisplayText();
            emailResult.PostedDate = jobAd.CreatedTime.ToShortDateString();
            emailResult.JobType    = jobAd.Description.JobTypes.GetDisplayText(", ", false, false);

            if (jobAd.Description.Industries != null)
            {
                emailResult.Industry = jobAd.Description.Industries.GetCriteriaIndustriesDisplayText();
            }

            Summarize(jobAd, highlighter, haveKeywords, out emailResult.Digest, out emailResult.Fragments);

            emailResults.Add(emailResult);
        }
Ejemplo n.º 3
0
 private static FeaturedItem CreateFeaturedJobAd(JobAd jobAd)
 {
     return(new FeaturedItem
     {
         Id = jobAd.Id,
         Title = jobAd.Title + " (" + jobAd.Description.Location + ")",
         Url = "~/jobs/" + jobAd.GetLocationDisplayText().ToLower().Replace(' ', '-') + "/" + jobAd.Description.Industries[0].UrlName + "/" + jobAd.Title.ToLower() + "/" + jobAd.Id
     });
 }
Ejemplo n.º 4
0
        public static string GetJobRelativePath(this JobAd jobAd)
        {
            var sb = new StringBuilder();

            // Location.

            var location = jobAd.GetLocationDisplayText();

            sb.Append(!string.IsNullOrEmpty(location)
                ? location.EncodeUrlSegment()
                : "-");

            // Industry. If there is only one industry then use it.  Do not concatenate more as this can easily lead to
            // urls being longer then url or segment lengths.

            var industrySb = new StringBuilder();

            var industries = jobAd.Description.Industries;

            if (industries != null && industries.Count == 1)
            {
                var industry = industries[0];
                industrySb.Append(industry.UrlName);
            }

            sb.Append("/");
            if (industrySb.Length == 0)
            {
                sb.Append("-");
            }
            else
            {
                sb.Append(industrySb);
            }

            // Job title.

            sb.Append("/");
            sb.Append(jobAd.Title.EncodeUrlSegment());

            // Id

            sb.Append("/");
            sb.Append(jobAd.Id.ToString());

            return(sb.ToString());
        }