protected void Page_Load(object sender, EventArgs e) { _PoliticianInfo = Politicians.GetPoliticianIntroReportData(_PoliticianKey); if (_PoliticianInfo == null) { InnerContent.Controls.Clear(); var p = new HtmlP().AddTo(InnerContent, "not-found-error"); new LiteralControl($"Could not find Id {_PoliticianKey}").AddTo(p); return; } _PoliticianName = Politicians.FormatName(_PoliticianInfo); _OfficeAndStatus = Politicians.FormatOfficeAndStatus(_PoliticianInfo); Title = Format(TitleTag, GetCandidateInfo(" | "), PublicMasterPage.SiteName); MetaDescription = Format(MetaDescriptionTag, GetCandidateInfo(", "), PublicMasterPage.SiteName); //MetaKeywords = _PoliticianName; PageHeading.MainHeadingText = Format(PageHeading.MainHeadingText, _PoliticianName); PoliticianInfoResponsive.GetReport(_PoliticianInfo).AddTo(InfoPlaceHolder); IntroIssuesReport.GetReport(_PoliticianInfo).AddTo(ReportPlaceHolder); }
private HtmlTable CreateTitleTable() { var htmlTable = new HtmlTable { CellSpacing = 0, CellPadding = 0, Border = 0 }; var tr = new HtmlTableRow().AddTo(htmlTable, "trPoliticianInfoPoliticianTitle"); new HtmlTableCell { ColSpan = 2, InnerHtml = Politicians.FormatOfficeAndStatus(_PoliticianInfo) }.AddTo(tr, "tdPoliticianInfoPoliticianTitle tdOfficeName"); tr = new HtmlTableRow().AddTo(htmlTable, "trPoliticianInfoPoliticianTitle"); new HtmlTableCell { ColSpan = 2, InnerHtml = GetFutureElectionDescription() } .AddTo(tr, "tdPoliticianInfoPoliticianTitle tdElectionName"); return(htmlTable); }
private Control GenerateReport(DataRow politician) { var imageContainer = new HtmlDiv().AddTo(ReportContainer, "candidate-image"); CreatePoliticianImageTag(politician.PoliticianKey(), ImageSize300, false, Empty) .AddTo(imageContainer); var infoContainer = new HtmlDiv().AddTo(ReportContainer, "candidate-info"); new HtmlH1 { InnerText = Politicians.FormatOfficeAndStatus(politician) } .AddTo(infoContainer, "candidate-status"); if (politician.LiveOfficeStatus() == "InFutureViewableElection") { var h2 = new HtmlH2(); h2.AddTo(infoContainer, "candidate-election"); // Link removed per Mantis 840 //new HtmlAnchor //{ // HRef = UrlManager.GetElectionPageUri(politician.LiveElectionKey()).ToString(), // InnerText = politician.ElectionDescription() //}.AddTo(h2); h2.InnerText = politician.ElectionDescription(); CreateCompareTheCandidatesAnchor(politician.LiveElectionKey(), politician.LiveOfficeKey()) .AddTo(infoContainer); } Control party; if (politician.PartyKey() != null) { if (IsNullOrWhiteSpace(politician.PartyUrl())) { party = new LiteralControl(politician.PartyName()); } else { party = new HtmlAnchor { HRef = VotePage.NormalizeUrl(politician.PartyUrl()), Title = politician.PartyName() + " Website", Target = "_blank", InnerHtml = politician.PartyName() }; ((HtmlAnchor)party).Attributes["rel"] = "nofollow"; } } else { party = new LiteralControl("no party affiliation"); } if (party is LiteralControl) { var span = new HtmlSpan(); party.AddTo(span); party = span; } party.AddTo(infoContainer, "candidate-party"); FormatWebAddress(infoContainer, politician); FormatSocialMedia(infoContainer, politician); FormatPostalAddress(infoContainer, politician); FormatPhone(infoContainer, politician); FormatAge(infoContainer, politician); return(ReportContainer.AddCssClasses("intro-report clearfix")); }