Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var substitutions = new Substitutions();

            if (DomainData.IsValidStateCode) // Single state
            {
                Title =
                    $"{PublicMasterPage.SiteName} | {substitutions.Substitute(TitleTagDefaultPageSingleStateDomain)}";
                MetaDescription = substitutions.Substitute(MetaDescriptionTagDefaultPageSingleStateDomain);
            }
            else // use the All states domain
            {
                Title =
                    $"{PublicMasterPage.SiteName} | {substitutions.Substitute(TitleTagDefaultPageAllStatesDomain)}";
                MetaDescription = substitutions.Substitute(MetaDescriptionTagDefaultPageAllStatesDomain);
            }

            // My Sample Ballot Buttons

            var             cookies   = LocationCookies.GetCookies();
            List <LinkInfo> links     = null;
            var             stateCode = DomainData.FromQueryStringOrDomain;

            if (cookies.IsValid)
            {
                links = GetRecentSampleBallotLinks(cookies);
            }
            ExplorerLinkBox.Visible = false;

            SetupHeading(cookies, links);

            if (DomainData.IsValidStateCode)
            {
                CreateUpcomingLinks(stateCode);
            }
            else
            {
                UpcomingLinkBox.Visible = false;
            }

            GetLinkBox(PresidentLinks, "US President and Vice-President",
                       ForResearchPage.GetPresidentLinks());
            GetLinkBox(SenateLinks, "US Senate",
                       ForResearchPage.GetSenateLinks());
            GetLinkBox(HouseLinks, "US House of Representatives",
                       ForResearchPage.GetHouseLinks());
            GetLinkBox(GovernorLinks,
                       "State Governors and Lieutenant Governors",
                       ForResearchPage.GetGovernorLinks());

            if (DomainData.IsValidStateCode)
            {
                ForResearchPage.AddStateLinksToDiv(ElectionResults, stateCode, false, false);
            }
            else
            {
                ElectionResultsLinkBox.Visible = false;
            }
        }
Esempio n. 2
0
        protected override string GetCacheKey()
        {
            var cookies = LocationCookies.GetCookies();
            var key     = UrlManager.GetStateCodeFromHostName();

            if (cookies.IsValid)
            {
                key =
                    $"{UrlManager.GetStateCodeFromHostName()}.{cookies.Congress}.{cookies.StateSenate}." +
                    $"{cookies.StateHouse}.{cookies.County}.{cookies.District}.{cookies.Place}." +
                    $"{cookies.Elementary}.{cookies.Secondary}.{cookies.Unified}.{cookies.CityCouncil}." +
                    $"{cookies.CountySupervisors}.{cookies.SchoolDistrictDistrict}";
            }

            return(key);
        }