Created
October 27, 2017 10:05
-
-
Save ps-team/4be78074cb054d82568daa1efb46dbe0 to your computer and use it in GitHub Desktop.
A-Z listing (c#) - will need a bit of work, but the basics are in there
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@using Contensis.Framework.Web | |
@using Contensis.Framework.Web.Search | |
@{ | |
var jobItemsQuery = Query.Where("SC_T_ID").IsEqualTo("-2356380").OrderBy("Property_Title").Ascending; /* Template and ordering */ | |
var jobItems = new NodeFinder().Find(jobItemsQuery); | |
var utils = new CMS_API.Common.BaseUtilities(); | |
string alphabet = "abcdefghijklmnopqrstuvwxyz"; /* alphabet! - there are better ways to do this, however it seems overcomplicated and this is just simple. */ | |
string letter = Request.QueryString["letter"]; | |
if (String.IsNullOrEmpty(letter)) | |
{ | |
letter = "A"; | |
} | |
} | |
<div class="sys_AtoZIndex"> | |
@foreach(char c in alphabet.ToUpper()) | |
{ | |
var test = from i in jobItems where i.Data.Title.ToString().StartsWith(c.ToString()) select i; | |
if (test.Count() > 0) | |
{ | |
<a href="/careers/careers-home.aspx?letter=@c">@c</a> | |
} | |
else | |
{ | |
<span class="sys_AtoZEmpty">@c</span> | |
} | |
} | |
</div> | |
<div class="sys_AtoZTable"> | |
<div class="sys_AtoZTableHeader"> | |
<div class="sys_AtoZCell"> | |
Job | |
</div> | |
<div class="sys_AtoZCell sys_industryAZ"> | |
Industry | |
</div> | |
<div class="sys_AtoZCell"> | |
Sector | |
</div> | |
</div> | |
@foreach(var jobItem in jobItems) | |
{ | |
string titles = jobItem.Data.Title.ToString(); | |
if (titles.StartsWith(letter.ToUpper())) | |
{ | |
var sectorFolderQuery = Query.Where("Property_TopFolderId").IsEqualTo("165948").And("SC_T_ID").IsEqualTo("-2002576").And("Property_Title").StartsWith(jobItem.Data.CareerIndustries.ToString().ToLower().Substring(0,5)); | |
var sectorFolders = new NodeFinder().Find(sectorFolderQuery); | |
var sectorFolder = sectorFolders[0]; | |
<div class="sys_AtoZTableRow"> | |
<div class="sys_AtoZCell"> | |
@jobItem.Data.Title | |
</div> | |
<div class="sys_AtoZCell sys_industryAZ"> | |
<a href="@sectorFolder.Parent.Path">@if (jobItem.Data.CareerIndustries.length>-1){ @jobItem.Data.CareerIndustries }</a> | |
</div> | |
<div class="sys_AtoZCell"> | |
<a href="@sectorFolder.Parent.Parent.Path">@sectorFolder.Parent.Parent.MenuName</a> | |
</div> | |
</div> | |
} else { | |
} | |
} | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment