Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            switch (GetQueryString("Content").ToUpperInvariant())
            {
            case "COMPARE":
                CompareCandidatesReportResponsive
                .GetOneAnswerContent(QueryElection, QueryOffice, QueryQuestion)
                .AddTo(PlaceHolder);
                break;

            case "COMPAREVIDEOS":
                CompareCandidatesReportResponsive
                .GetOneCandidateVideoContent(QueryElection, QueryOffice, QueryId)
                .AddTo(PlaceHolder);
                break;

            case "INTRO":
                IntroIssuesReport.GetOneAnswerContent(QueryId, QueryQuestion).AddTo(PlaceHolder);
                break;

            case "INTROVIDEOS":
                IntroIssuesReport.GetVideoContent(QueryId).AddTo(PlaceHolder);
                break;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.IncludeJs("~/js/ballot.js");

            _ElectionDescription = PageCache.Elections.GetElectionDesc(_ElectionKey);
            Title = Format(TitleTag, GetMetaTitle(), PublicMasterPage.SiteName);

            OgUrl.Attributes.Add("content", CanonicalUri.ToString());
            OgTitle.Attributes.Add("content", $"My choices for {_ElectionDescription}");
            OgDescription.Attributes.Add("content", "View the candidates I plan to vote for.");

            OgImage.Attributes.Add("content",
                                   UrlManager.GetSiteUri("/images/designs/Vote-USA/fbbanner2.png").ToString());
            OgImageWidth.Attributes.Add("content", "250");
            OgImageHeight.Attributes.Add("content", "250");

            try
            {
                var metaContent = GetMetaTitle();
                MetaDescription = metaContent;
                MetaKeywords    = metaContent;

                BallotReportResponsive.GetReport(QueryElection, QueryCongress, QueryStateSenate,
                                                 QueryStateHouse, QueryCounty, QueryDistrict, QueryPlace, QueryElementary,
                                                 QuerySecondary, QueryUnified, QueryCityCouncil, QueryCountySupervisors,
                                                 QuerySchoolDistrictDistrict, out var officeContests).AddTo(ReportPlaceHolder);
                var ballotMeasures = BallotReferendumReportResponsive.GetReport(QueryElection, QueryCounty,
                                                                                QueryDistrict, QueryPlace, QueryElementary, QuerySecondary, QueryUnified,
                                                                                QueryCityCouncil, QueryCountySupervisors, QuerySchoolDistrictDistrict)
                                     .AddTo(ReferendumReportPlaceHolder);
                ballotMeasures.AddTo(ReferendumReportPlaceHolder);
                CreateHeading(officeContests.Count, ballotMeasures.Controls.Count > 0);

                // tag body with key for persistent selections
                var body             = Master.FindControl("Body") as HtmlGenericControl;
                var stateElectionKey = Elections.GetStateElectionKeyFromKey(QueryElection)
                                       .ToUpperInvariant();
                // ReSharper disable once PossibleNullReferenceException
                body.Attributes.Add("data-election", stateElectionKey);
                var electionDate = DateTime.ParseExact(Elections.GetElectionDateStringFromKey(stateElectionKey), "yyyyMMdd",
                                                       CultureInfo.InvariantCulture);
                //var showAd = electionDate.AddDays(1) > DateTime.Today;
                var showAd = true;
                body.Attributes.Add("data-ad", showAd ? "Y" : "N");

                // for a single contest election we add a special class and also include the candidate comparison info
                if (officeContests.Count == 1 && ballotMeasures.Controls.Count == 0)
                {
                    body.AddCssClasses("single-contest");
                    body.Attributes.Add("data-adelection", QueryElection);
                    body.Attributes.Add("data-adoffice", officeContests[0]);
                    CompareCandidatesReportResponsive.GetReport(_ElectionKey, officeContests[0], true)
                    .AddTo(ReportPlaceHolder);
                }
            }
            catch (Exception /*ex*/)
            {
                // ignored
            }
        }
Exemple #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _ElectionDescription = PageCache.Elections.GetElectionDesc(_ElectionKey);
            _OfficeDescription   = Offices.GetLocalizedOfficeName(_OfficeKey);

            if (Elections.GetElectionTypeFromKey(_ElectionKey) ==
                Elections.ElectionTypeUSPresidentialPrimary ||
                Elections.GetStateCodeFromKey(_ElectionKey) == "US" &&
                Elections.GetElectionTypeFromKey(_ElectionKey) == "G")
            {
                _ElectionAndOfficeDescription = _ElectionDescription;
                ElectionTitle.InnerText       = _ElectionDescription;
                OfficeTitle.Visible           = false;
            }
            else
            {
                _ElectionAndOfficeDescription = $"{_ElectionDescription}, {_OfficeDescription}";
                // Link removed per Mantis 840
                //new HtmlAnchor
                //{
                //  HRef = UrlManager.GetElectionPageUri(_ElectionKey).ToString(),
                //  InnerText = _ElectionDescription
                //}.AddTo(ElectionTitle);
                ElectionTitle.InnerText = _ElectionDescription;
                OfficeTitle.InnerText   =
                    $"Candidates for {Offices.GetLocalizedOfficeNameWithElectoralClass(PageCache, _OfficeKey)}";
            }

            PopulateMetaTags();
            if (Master2.FindControl("Body") is HtmlGenericControl body)
            {
                body.Attributes.Add("data-election",
                                    Elections.GetStateElectionKeyFromKey(QueryElection).ToUpperInvariant());
                body.Attributes.Add("data-adelection", _ElectionKey);
                body.Attributes.Add("data-adoffice", _OfficeKey);
            }

            CompareCandidatesReportResponsive.GetReport(_ElectionKey, _OfficeKey)
            .AddTo(ReportPlaceHolder);
        }