private static string FormatPoliticianName(PoliticiansAdminReportViewRow row, bool breakAfterPosition = false, bool includeAddOn = false) { const int maxNameLineLength = 30; return(Politicians.FormatName(row.FirstName, row.MiddleName, row.Nickname, row.LastName, row.Suffix, includeAddOn ? row.AddOn : null, row.StateCode, breakAfterPosition ? maxNameLineLength : 0)); }
private static HtmlAnchor CreateAdminPoliticianAnchor( PoliticiansAdminReportViewRow row, string anchorText, string target) { var a = new HtmlAnchor { HRef = SecurePoliticianPage.GetUpdateIntroPageUrl(row.PoliticianKey), Title = "Edit Links, Picture, Bio & Reasons", InnerHtml = anchorText, Target = IsNullOrWhiteSpace(target) ? "politician" : target }; return(a); }
//private static HtmlAnchor CreateAdminOfficeAnchor(string officeKey, // string anchorText, string target) //{ // var a = new HtmlAnchor // { // HRef = SecureAdminPage.GetOfficePageEditUrl(officeKey), // Target = string.IsNullOrWhiteSpace(target) ? "office" : target, // InnerHtml = anchorText // }; // return a; //} private static HtmlAnchor CreateAdminPoliticianAnchor( PoliticiansAdminReportViewRow row, string anchorText, string target) { var a = new HtmlAnchor { HRef = SecureAdminPage.GetPoliticianPageUrl(row.PoliticianKey), Title = FormatPoliticianName(row) + " administration data edit form", InnerHtml = anchorText, Target = string.IsNullOrWhiteSpace(target) ? "politician" : target }; return(a); }
private PlaceHolder CreatePoliticianNameAndKeyAnchor( PoliticiansAdminReportViewRow row) { var container = new PlaceHolder(); var literalText = row.LastName + " .. "; if (row.OfficeStatus.ToPoliticianStatus() == PoliticianStatus.Incumbent) { literalText += "*"; } new Literal { Text = literalText }.AddTo(container); Control imageTag; if (_AsMaster) { imageTag = CreatePoliticianImageAnchor( SecurePoliticianPage.GetUpdateIntroPageUrl(row.PoliticianKey), row.PoliticianKey, imageWidth: 15, title: FormatPoliticianName(row) + " Intro Page Data Entry", target: "intro"); } else { imageTag = CreatePoliticianImageTag(row.PoliticianKey, 15); } imageTag.AddTo(container); new Literal { Text = " " }.AddTo(container); CreateAdminPoliticianAnchor(row, FormatPoliticianName(row, true, true), Empty) .AddTo(container); literalText = Empty; if (row.PartyKey != Empty) { literalText += " (" + row.PartyCode.SafeString() + ")"; } literalText += " .. " + row.PoliticianKey; new Literal { Text = literalText }.AddTo(container); return(container); }
private HtmlTableRow CreateOneOutputRow(PoliticiansAdminReportViewRow row) { var tr = new HtmlTableRow().AddCssClasses("trReportDetail"); // Left Column - Politician Name var td = new HtmlTableCell().AddTo(tr, "tdReportDetail"); CreatePoliticianNameAndKeyAnchor(row) .AddTo(td); // Right Column - Office Title td = new HtmlTableCell().AddTo(tr, "tdReportDetail"); CreateOfficeNameAndKey(row) .AddTo(td); return(tr); }
private Control CreateOfficeNameAndKey(PoliticiansAdminReportViewRow row) { var officeClass = row.OfficeLevel.ToOfficeClass(); var countyName = row.County.SafeString(); Control control; string literalText; if (officeClass.IsCounty()) { literalText = FormatOfficeName(row) + ", " + countyName; } else if (officeClass.IsLocal()) { countyName = CountyCache.GetCountyName(_Options.StateCode, _Options.CountyCode); var localName = VotePage.GetPageCache() .LocalDistricts.GetLocalDistrict(_Options.StateCode, _Options.LocalKey); literalText = FormatOfficeName(row) + ", " + localName + ", " + countyName; } else { literalText = FormatOfficeName(row); } if (officeClass != OfficeClass.USPresident) { control = CreateAdminOfficeAnchor(row.OfficeKey, literalText, Empty); } else { control = new Literal { Text = literalText } }; return(control); }
private static string FormatOfficeName(PoliticiansAdminReportViewRow row) { return(Offices.FormatOfficeName(row.OfficeLine1, row.OfficeLine2, row.OfficeKey)); }