private static List <LinkInfo> GetRecentSampleBallotLinks(LocationCookies cookies) { var linkList = new List <LinkInfo>(); if (StateCache.IsValidStateCode(cookies.State)) { var table = Elections.GetViewableDisplayDataByStateCode(cookies.State); foreach (var row in table) { var linkInfo = new LinkInfo(row) { HRef = UrlManager.GetBallotPageUri(row.ElectionKey, cookies.Congress, cookies.StateSenate, cookies.StateHouse, cookies.County, cookies.District, cookies.Place, cookies.Elementary, cookies.Secondary, cookies.Unified, cookies.CityCouncil, cookies.CountySupervisors, cookies.SchoolDistrictDistrict, null) }; linkList.Add(linkInfo); // go back to most recent general or offyear election if (row.ElectionType == "G" || row.ElectionType == "O") { break; } } } return(linkList); }
private void HandleBallotPage() { var electionKey = MemCache.IsValidElection(GetQueryParm("Election")) ? GetQueryParm("Election") : FixElectionKeyFromQueryString(); var stateCode = Elections.GetStateCodeFromKey(electionKey); if (StateCache.IsValidStateCode(stateCode) && !string.IsNullOrEmpty(electionKey)) { NormalizedUri = UrlManager.GetBallotPageUri(stateCode, electionKey, GetQueryParm("Congress"), GetQueryParm("StateSenate"), GetQueryParm("StateHouse"), GetQueryParm("County")); } else { ErrorMessage = "Invalid_ElectionKey|State|Congress|StateSenate|StateHouse|County"; } }