private static RouteValueDictionary GetRouteValues(IUrlNamedLocation location) { return(new RouteValueDictionary { { LocationKey, location.GetUrlSegment(JobAdsRoutes.SegmentSuffix) } }); }
private static RouteValueDictionary GetRouteValues(IUrlNamedLocation location, Salary salary) { return(new RouteValueDictionary { { SalaryKey, salary.GetUrlSegment(CandidatesRoutes.SegmentSuffix) }, { LocationKey, location.GetUrlSegment(CandidatesRoutes.SegmentSuffix) } }); }
private static RouteValueDictionary GetRouteValues(Industry industry, IUrlNamedLocation location, int page) { return(new RouteValueDictionary { { IndustryKey, industry.GetUrlSegment(JobAdsRoutes.SegmentSuffix) }, { LocationKey, location.GetUrlSegment(JobAdsRoutes.SegmentSuffix) }, { PageKey, page } }); }
public static ReadOnlyUrl GenerateJobAdsUrl(this IUrlNamedLocation location) { return(JobAdsRoutes.LocationJobAds.GenerateUrl(GetRouteValues(location))); }
public static MvcHtmlString JobAdsRouteLink(this HtmlHelper html, string linkText, IUrlNamedLocation location, Industry industry, object htmlAttributes) { return(html.RouteRefLink(linkText, JobAdsRoutes.LocationIndustryJobAds, GetRouteValues(industry, location), htmlAttributes)); }
private ReadOnlyUrl GetBrowseUrl(IUrlNamedLocation location) { return(new ReadOnlyApplicationUrl(_browseBaseUrl, location.UrlName + "-candidates")); }
private ReadOnlyUrl GetBrowseUrl(IUrlNamedLocation location, Salary salary) { return(new ReadOnlyApplicationUrl(true, _browseBaseUrl, location.UrlName + "-candidates/" + GetUrlSegment(salary))); }
public BrowseCandidatesNavigation(IUrlNamedLocation location, Salary salaryBand, CandidatesPresentationModel presentation) : base(presentation) { Location = location; SalaryBand = salaryBand; }
public static ReadOnlyUrl GenerateCandidatesUrl(this IUrlNamedLocation location, Salary salary, int?page) { return(page == null || page.Value <= 1 ? CandidatesRoutes.LocationSalaryBandCandidates.GenerateUrl(GetRouteValues(location, salary)) : CandidatesRoutes.PagedLocationSalaryBandCandidates.GenerateUrl(GetRouteValues(location, salary, page.Value))); }
public static ReadOnlyUrl GenerateCandidatesUrl(this IUrlNamedLocation location) { return(CandidatesRoutes.LocationCandidates.GenerateUrl(GetRouteValues(location))); }
public static MvcHtmlString CandidatesRouteLink(this HtmlHelper html, string linkText, IUrlNamedLocation location, Salary salary, int?page, object htmlAttributes) { if (!page.HasValue || page.Value <= 1) { return(html.RouteRefLink(linkText, CandidatesRoutes.LocationSalaryBandCandidates, GetRouteValues(location, salary), htmlAttributes)); } return(html.RouteRefLink(linkText, CandidatesRoutes.PagedLocationSalaryBandCandidates, GetRouteValues(location, salary, page.Value), htmlAttributes)); }
public static MvcHtmlString CandidatesRouteLink(this HtmlHelper html, string linkText, IUrlNamedLocation location, object htmlAttributes) { return(html.RouteRefLink(linkText, CandidatesRoutes.LocationCandidates, GetRouteValues(location), htmlAttributes)); }
public static string GetUrlSegment(this IUrlNamedLocation location, string suffix) { return(location.UrlName + GetSuffix(suffix)); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); Total = Model.Results.TotalCandidates; // Determine start and end. var items = Model.Presentation.Pagination.Items ?? Model.Results.CandidateIds.Count; CurrentPage = Model.Presentation.Pagination.Page ?? 1; TotalPages = (int)Math.Ceiling((double)Total / items); // Only show a maximum number of page links. if (TotalPages <= MaxPages) { FirstPage = 1; LastPage = TotalPages; } else { if (CurrentPage < MaxPages / 2 + 1) { // If at left end ... FirstPage = 1; LastPage = MaxPages; } else if (CurrentPage > TotalPages - MaxPages / 2) { // If at right end ... FirstPage = TotalPages - MaxPages + 1; LastPage = TotalPages; } else { // If in the middle ... FirstPage = CurrentPage < MaxPages / 2 + 1 ? 1 : CurrentPage - MaxPages / 2; LastPage = CurrentPage > TotalPages - MaxPages / 2 ? TotalPages : CurrentPage + MaxPages / 2; } } Start = ((CurrentPage - 1) * items) + 1; End = Start + Model.Results.CandidateIds.Count - 1; // Set up browse parameters. if (Model is BrowseListModel) { // Extract the location and industry from the criteria. var location = Model.Criteria.Location; if (location.IsFullyResolved) { _location = location.NamedLocation as IUrlNamedLocation; } _salary = Model.Criteria.Salary; } }
public static ReadOnlyUrl GenerateJobAdsUrl(this IUrlNamedLocation location, Industry industry, int?page) { return(page == null || page.Value <= 1 ? JobAdsRoutes.LocationIndustryJobAds.GenerateUrl(GetRouteValues(industry, location)) : JobAdsRoutes.PagedLocationIndustryJobAds.GenerateUrl(GetRouteValues(industry, location, page.Value))); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); Total = Model.Results.TotalJobAds; // Determine start and end. ItemsPerPage = Model.Presentation.Pagination.Items ?? Reference.DefaultItemsPerPage; CurrentPage = Model.Presentation.Pagination.Page ?? 1; TotalPages = (int)Math.Ceiling((double)Total / ItemsPerPage); // Only show a maximum number of page links. if (TotalPages <= MaxPages) { FirstPage = 1; LastPage = TotalPages; } else { if (CurrentPage < MaxPages / 2 + 1) { // If at left end ... FirstPage = 1; LastPage = MaxPages; } else if (CurrentPage > TotalPages - MaxPages / 2) { // If at right end ... FirstPage = TotalPages - MaxPages + 1; LastPage = TotalPages; } else { // If in the middle ... FirstPage = CurrentPage < MaxPages / 2 + 1 ? 1 : CurrentPage - MaxPages / 2; LastPage = CurrentPage > TotalPages - MaxPages / 2 ? TotalPages : CurrentPage + MaxPages / 2; } } Start = ((CurrentPage - 1) * ItemsPerPage) + 1; End = Start + ItemsPerPage - 1; if (End > Total) { End = Total; } // Set up browse parameters. if (Model.ListType == JobAdListType.BrowseResult) { // Extract the location and industry from the criteria. var criteria = ((JobAdSearchListModel)Model).Criteria; var location = criteria.Location; if (location.IsFullyResolved) { _location = location.NamedLocation as IUrlNamedLocation; } if (!criteria.IndustryIds.IsNullOrEmpty() && criteria.IndustryIds.Count == 1) { _industry = (from i in Model.Industries where i.Id == criteria.IndustryIds[0] select i).SingleOrDefault(); } } }
private ReadOnlyUrl GetBrowseUrl(IUrlNamedLocation location, Industry industry) { return(new ReadOnlyApplicationUrl(_browseBaseUrl, location.UrlName + "-jobs/" + industry.UrlName + "-jobs")); }