public static string LookupChannelId(string url, int retries = 0) { // There's gotta be a better way... // Accepts a "friendly" channel url like: // [www.]youtube.com/c/{name}[?...] // [www.]youtube.com/cuser/{name}[?...] // [www.]youtube.com/{name}[?...] //Fetches the page and looks for either // 1. data-channel-external-id="{channelId" // 2. <link rel="canonical" href="https://www.youtube.com/channel/{channelId}"> try { var page = new WebClient().DownloadString(VotePage.NormalizeUrl(url)); var match = ChannelIdRegex1.Match(page); if (match.Success) { return(match.Groups["id"].Captures[0].Value); } match = ChannelIdRegex2.Match(page); if (match.Success) { return(match.Groups["id"].Captures[0].Value); } return(null); } catch { if (retries <= 0) { return(null); } } return(LookupChannelId(url, retries - 1)); }
public static int UpdateSitemapVirtualPage() { string message; var pages = 0; try { VotePage.LogInfo("UpdateSitemapVirtualPage", "Started"); //var table = Sitemap.GetAllKeyData(0); //foreach (var row in table) // new SitemapManager().UpdateVirtualPage(row.DomainDataCode); pages = new SitemapManager().UpdateVirtualPage(); message = "Completed"; } catch (Exception ex) { VotePage.LogException("UpdateSitemapVirtualPage", ex); message = $"Exception: {ex.Message} [see exception log for details]"; } VotePage.LogInfo("UpdateSitemapVirtualPage", message); return(pages); }
public static void Update() { string message; try { VotePage.LogInfo("UpdateOfficesAlternateOfficeLevel", "Started"); var alternateOfficeLevelsUpdated = 0; foreach (var row in Offices.GetAllAlternateOfficeLevelUpdateData()) { var newAlternateOfficeLevel = ComputeAlternateOfficeClass(row) .ToInt(); if (newAlternateOfficeLevel == row.AlternateOfficeLevel) { continue; } Offices.UpdateAlternateOfficeLevel(newAlternateOfficeLevel, row.OfficeKey); alternateOfficeLevelsUpdated++; } message = $"{alternateOfficeLevelsUpdated} AlternateOfficeLevels updated"; } catch (Exception ex) { VotePage.LogException("UpdateOfficesAlternateOfficeLevel", ex); message = $"Exception: {ex.Message} [see exception log for details]"; } VotePage.LogInfo("UpdateOfficesAlternateOfficeLevel", message); }
//private IEnumerable<ElectionsFutureRow> GetFutureElections(string stateCode) //{ // var key = stateCode + "|ElectionsFutureByState"; // var data = GetDataCache(key); // if (data == null) // { // data = ElectionsFuture.GetIdData(stateCode, string.Empty, string.Empty); // PutDataCache(key, data); // } // return data as ElectionsFutureTable; //} private string GetLocalizedOfficeName(string officeKey) { var officeTitle = string.Empty; if (!Offices.IsStateOrFederalOffice(officeKey)) { if (Offices.IsCountyOffice(officeKey)) { officeTitle += CountyCache.GetCountyName(Offices.GetStateCodeFromKey(officeKey), Offices.GetCountyCodeFromKey(officeKey)); } else { officeTitle += VotePage.GetPageCache() .LocalDistricts.GetLocalDistrict( Offices.GetStateCodeFromKey(officeKey), Offices.GetCountyCodeFromKey(officeKey), Offices.GetLocalCodeFromKey(officeKey)); } officeTitle += " "; } officeTitle += Offices.FormatOfficeName(PageCache.Offices.GetOfficeLine1(officeKey), PageCache.Offices.GetOfficeLine2(officeKey), officeKey); return(officeTitle); }
// This method is only used by the CommonCacheCleanup which is run via the // Windows task scheduler public static void CleanUpCacheInvalidation() { string message; try { VotePage.LogInfo("CleanUpCacheInvalidation", "Started"); // Get the number of days to retain, default to 7 var daysString = ConfigurationManager.AppSettings["VoteCommonCacheInvalidationRetentionDays"]; if (!int.TryParse(daysString, out var days)) { days = 7; } // Convert to a past DateTime var expiration = DateTime.UtcNow - new TimeSpan(days, 0, 0, 0); // Do it var deleted = CacheInvalidation.DeleteExpiredTransactions(expiration); message = $"{deleted} CacheInvalidation rows deleted"; } catch (Exception ex) { VotePage.LogException("CleanUpCacheInvalidation", ex); message = $"Exception: {ex.Message} [see exception log for details]"; } VotePage.LogInfo("CleanUpCacheInvalidation", message); }
private static string CreateImageAnchor(string href, string src, string title = "", string target = "") { if (string.IsNullOrWhiteSpace(href)) { return(string.Empty); } if (string.IsNullOrWhiteSpace(src)) { return(string.Empty); } href = VotePage.NormalizeUrl(href); src = VotePage.NormalizeUrl(src); var a = new HtmlAnchor { HRef = href, Title = title, Target = target }; new HtmlImage { Src = src }.AddTo(a); return(a.RenderToString()); }
private void SetHyperlinkLabel(string value) { if (Label != null) { Label.Controls.Clear(); Control label; if (string.IsNullOrWhiteSpace(value)) { label = new LiteralControl(Description); } else { var tooltip = (HyperlinkToolTip ?? "Visit {link}").Replace("{link}", value); label = new HyperLink { Text = Description, NavigateUrl = VotePage.NormalizeUrl(value), Target = "view", ToolTip = tooltip }.AddCssClasses("tiptip"); } label.AddTo(Label); } }
protected static FeedbackContainerControl LoadFeedbackContainerControl() { var page = VotePage.GetPage <Page>(); return (page.LoadControl("/controls/feedbackcontainer.ascx") as FeedbackContainerControl); }
//private static string RenderBannerAd(string adType, string stateCode, string electionKey, // string officeKey, bool show) //{ // //if (UrlManager.IsLive /*&& adType != "H"*/) return Empty; // var adTable = BannerAds.GetRenderInfoData(adType, stateCode, electionKey, officeKey); // if (adTable.Count == 0) return Empty; // var ad = adTable[0]; // if (!ad.AdEnabled && !show) return Empty; // return $"<div class=\"banner-ad-outer\"><a href=\"{VotePage.NormalizeUrl(ad.AdUrl)}\"" + // $" target=\"ad\"><img src=\"/banneradimage?{adType}.{stateCode}.{electionKey}.{officeKey}.{DateTime.UtcNow.Ticks}\"" + // " alt=\"Ad Image\"/></a><p class=\"paid-advertisement-notice\">Paid Advertisement</p>" + // "<hr /></div>"; //} //public static string RenderBannerAd(string adType, string stateCode, string electionKey, // string officeKey, bool show, int orgId, bool forAdmin = false) //{ // //if (UrlManager.IsLive /*&& adType != "H"*/) return Empty; // // If orgID is non zero, the organzation ad will be shown. If the org has no ad, no ad will be shown. // if (orgId == 0) // return RenderBannerAd(adType, stateCode, electionKey, officeKey, show); // var adTable = Organizations.GetAdData(orgId); // if (adTable.Count == 0) return Empty; // var ad = adTable[0]; // if (IsNullOrWhiteSpace(ad.AdImageName)) return Empty; // var src = forAdmin // ? GetAdjustedSiteUri("orgadimage", $"{orgId}.{DateTime.UtcNow.Ticks}") // : $"/orgadimage?{orgId}.{DateTime.UtcNow.Ticks}"; // var onClick = IsNullOrWhiteSpace(ad.AdUrl) // ? "onclick=\"return false;\"" // : Empty; // return $"<div class=\"banner-ad-outer\"><a href=\"{VotePage.NormalizeUrl(ad.AdUrl)}\"" + // $" {onClick} target=\"ad\"><img src=\"{src}\"" + // " alt=\"Ad Image\"/></a><p class=\"paid-advertisement-notice\">Paid Advertisement</p>" + // "<hr /></div>"; //} public static string RenderBannerAd2(string adType, string stateCode, string electionKey, string officeKey, bool show) { var adTable = BannerAds.GetRenderInfo2Data(adType, stateCode, electionKey, officeKey); if (adTable.Count == 0) { return(Empty); } var ad = adTable[0]; if (!ad.AdEnabled && !show) { return(Empty); } var descriptionLines = new List <string>(); if (!IsNullOrWhiteSpace(ad.AdDescription1)) { descriptionLines.Add($"<div class=\"ad3-description\"><p>{ad.AdDescription1}</p>"); if (!IsNullOrWhiteSpace(ad.AdDescription2)) { descriptionLines.Add($"<p>{ad.AdDescription2}</p>"); } if (!IsNullOrWhiteSpace(ad.AdDescriptionUrl)) { descriptionLines.Insert(0, $"<a href=\"{VotePage.NormalizeUrl(ad.AdDescriptionUrl)}\" target=\"_blank\">"); descriptionLines.Add("</a>"); } descriptionLines.Add("</div>"); } var thumbnailId = ad.AdYouTubeUrl.GetYouTubeVideoId(); var paidAdvertisement = ad.AdIsPaid ? "<p class=\"ad3-paid-advertisement-notice\">Paid Advertisement</p>" : Empty; var imgSource = IsNullOrWhiteSpace(ad.AdImageName) ? $"http://i.ytimg.com/vi/{thumbnailId}/hqdefault.jpg" : $"{GetAdjustedSiteUri("banneradimage", $"{ adType}.{ stateCode}.{ electionKey}.{ officeKey}.{ DateTime.UtcNow.Ticks}")}"; return(ad.AdMediaType == "Y" ? "<div class=\"ad3-outer ad3-yt\"><div class=\"ad3-inner\"><div class=\"ad3-copy\">" + $"{Join(Empty, descriptionLines)}</div>" + $"<div class=\"ad3-right-wrapper\"><a class=\"ad3-video-wrapper-outer\" target=\"youtube\" href=\"{VotePage.NormalizeUrl(ad.AdYouTubeUrl)}\">" + "<div class=\"ad3-video-container\"><div class=\"ad3-video-player\"><div>" + //$"<img class=\"video-thumb\" src=\"http://i.ytimg.com/vi/{thumbnailId}/hqdefault.jpg\"/>" + $"<img class=\"ad3-video-thumb\" src=\"{imgSource}\"/>" + "<div class=\"video-play-button yt-play-button\"></div></div></div></div></a></div>" + $"</div>{paidAdvertisement}</div>" : "<div class=\"ad3-outer ad3-img\"><div class=\"ad3-inner\"><div class=\"ad3-copy\">" + $"{Join(Empty, descriptionLines)}</div>" + $"<div class=\"ad3-right-wrapper\"><div class=\"ad3-image-wrapper\"><a class=\"ad3-image-link\" target=\"ext\" href=\"{VotePage.NormalizeUrl(ad.AdUrl)}\">" + //$"<img class=\"ad-image\" src=\"{GetAdjustedSiteUri("banneradimage", $"{adType}.{stateCode}.{electionKey}.{officeKey}.{DateTime.UtcNow.Ticks}")}\" /></a></div></div>" + $"<img class=\"ad3-image\" src=\"{imgSource}\" /></a></div></div>" + $"</div>{paidAdvertisement}</div>"); }
private static void InvalidatePageCacheAll() { var count = CachePagesLocal.CountTable(0); VotePage.LogInfo("LocalCacheInvalidation", "Begin InvalidatePageCacheAll:" + count); CachePagesLocal.TruncateTable(); VotePage.LogInfo("LocalCacheInvalidation", "End InvalidatePageCacheAll:" + count); }
private static string Domain_DataCode_This() { var queryData = VotePage.GetQueryString("Data").ToUpperInvariant(); if (!string.IsNullOrEmpty(queryData)) { return(queryData); } var queryState = VotePage.QueryState; return(!string.IsNullOrEmpty(queryState) ? queryState : UrlManager.CurrentDomainDataCode); }
public static string RenderOneAd(string electionKey, string officeKey, string adType, string politicianKey, string politicianName, string videoUrl, string thumbnailId, string sponsor, string sponsorUrl, bool isCandidateSponsored) { string paidMessage; if (isCandidateSponsored) { var url = IsNullOrWhiteSpace(sponsorUrl) ? UrlManager.GetIntroPageUri(politicianKey).ToString() : VotePage.NormalizeUrl(sponsorUrl); paidMessage = "Paid advertisement by<br/><a target=\"_blank\"" + $" href=\"{url}\">candidate’s campaign</a>"; } else if (!IsNullOrWhiteSpace(sponsor)) { paidMessage = IsNullOrWhiteSpace(sponsorUrl) ? $"Paid advertisement by<br/>{sponsor}" : $"Paid advertisement by<br/><a target=\"_blank\" href=\"{VotePage.NormalizeUrl(sponsorUrl)}\">" + $"{sponsor}</a>"; } else { paidMessage = "Paid advertisement"; } var website = adType == "I" ? VotePage.NormalizeUrl(Politicians.GetPublicWebAddress(politicianKey)) : Empty; return(adType == "Y" ? "<div class=\"ad-outer flex\"><div class=\"ad-inner\"><div class=\"ad-copy\">" + $"<p class=\"ad-name\">{politicianName}</p>" + $"<p class=\"paid-ad\">{paidMessage}</p></div><div class=\"right-wrapper\">" + $"<img class=\"ad-profile\" src=\"/Image.aspx?Id={politicianKey}&Col=Headshot100\"/>" + $"<a class=\"video-wrapper-outer\" target=\"youtube\" href=\"{VotePage.NormalizeUrl(videoUrl)}\">" + "<div class=\"video-container\"><div class=\"video-player\"><div>" + $"<img class=\"video-thumb\" src=\"http://i.ytimg.com/vi/{thumbnailId}/hqdefault.jpg\"/>" + "<div class=\"video-play-button\"></div></div></div></div></a>" + "<div style=\"clear:both\"></div></div></div></div>" : "<div class=\"ad-outer flex\"><div class=\"ad-inner\"><div class=\"ad-copy\">" + $"<p class=\"ad-name\">{politicianName}</p>" + $"<p class=\"paid-ad\">{paidMessage}</p></div><div class=\"right-wrapper\">" + $"<img class=\"ad-profile\" src=\"/Image.aspx?Id={politicianKey}&Col=Headshot100\"/>" + $"<div class=\"image-wrapper\"><a class=\"image-link\" target=\"ext\" href=\"{website}\">" + $"<img class=\"ad-image\" src=\"/adimage?{electionKey}.{officeKey}.{politicianKey}\" /></a></div>" + "</div></div></div></div>"); }
private static void CreateOneMediumAnchor(Control ul, string webAddress, SocialMedium medium, string politicianName, bool useLargeIcons = false) { var li = new HtmlLi().AddTo(ul); var a = new HyperLink { NavigateUrl = VotePage.NormalizeUrl(webAddress), Target = medium.Name.ToLowerInvariant(), ToolTip = medium.GetTooltip(politicianName) }.AddTo(li); new Image { ImageUrl = useLargeIcons ? medium.LargeImageUrl : medium.ImageUrl }.AddTo(a); }
//protected void Page_Load(object sender, EventArgs e) protected void Page_PreRender(object sender, EventArgs e) { //Moved from Page_Load because if design is changes Page_Load is performed before //the database is updated with the new design. Page_PreRender is performed after //the database is updated. try { //if (!IsPostBack) //{ #region Is Support Us Visible ? All.Visible = false; if (VotePage.IsPublicPage) { if (db.Is_Include_Donate_This()) { All.Visible = true; } } else { All.Visible = true;//MASTER and DESIGN Pages } #endregion Is Support Us Visible ? if (All.Visible) { if (VotePage.IsPublicPage) { All.Attributes["class"] = "tablePage"; } else { All.Attributes["class"] = "tableAdmin"; } } } //} catch (Exception ex) { db.Log_Page_Not_Found_404("SupportUs.aspx:ex.Message" + ex.Message); if (!VotePage.IsDebugging) { VotePage.SafeTransferToError500(); } } }
public static void Update() { string message; try { VotePage.LogInfo("UpdatePoliticianSearchKeys", "Started"); var alphaNamesUpdated = 0; var vowelStrippedNamesUpdated = 0; var table = Politicians.GetAllSearchKeyUpdateData(0); foreach (var row in table) { var newAlphaName = row.LastName.StripAccents(); if (newAlphaName != row.AlphaName) { row.AlphaName = newAlphaName; alphaNamesUpdated++; } var newVowelStrippedName = row.LastName.StripVowels(); if (newVowelStrippedName != row.VowelStrippedName) { row.VowelStrippedName = newVowelStrippedName; vowelStrippedNamesUpdated++; } } Politicians.UpdateTable(table, PoliticiansTable.ColumnSet.SearchKeyUpdate, 0); message = $"{alphaNamesUpdated} AlphaNames updated, {vowelStrippedNamesUpdated} VowelStrippedNames updated"; } catch (Exception ex) { VotePage.LogException("UpdatePoliticianSearchKeys", ex); message = $"Exception: {ex.Message} [see exception log for details]"; } VotePage.LogInfo("UpdatePoliticianSearchKeys", message); }
public IList <IGrouping <string, AnswersViewRow> > GetDataTable() { if (_DataTable == null) { AnswersViewTable table = null; if (_Usage == Usage.ForIssues) { var page = VotePage.GetPage <SecurePoliticianPage>(); var officeKey = page.PageCache.Politicians.GetOfficeKey(page.PoliticianKey); var officeClass = page.PageCache.Offices.GetOfficeClass(officeKey); if (officeClass.IsFederal()) { table = AnswersView.GetAllDataByIssueLevelStateCodePoliticianKey("B", "US", page.PoliticianKey); } else { table = AnswersView.GetAllDataByIssueLevelStateCodePoliticianKey("C", Politicians.GetStateCodeFromKey(page.PoliticianKey), page.PoliticianKey); } } else if (_Usage == Usage.ForIntroBio) { table = AnswersView.GetAllDataByIssueKeyPoliticianKey("ALLBio", VotePage.GetPage <SecurePoliticianPage>().PoliticianKey); } else if (_Usage == Usage.ForIntroReasons) { table = AnswersView.GetAllDataByIssueKeyPoliticianKey("ALLPersonal", VotePage.GetPage <SecurePoliticianPage>().PoliticianKey); } Debug.Assert(table != null, "table != null"); _DataTable = table .GroupBy(r => r.QuestionKey) //.Select(g => g.First()) .ToList(); } return(_DataTable); }
public static void Update() { string message; try { VotePage.LogInfo("UpdateSingleCandidateContestWinners", "Started"); message = $"{ElectionsPoliticians.MarkWinnersForSingleCandidatePastContests(0)} winners updated"; } catch (Exception ex) { VotePage.LogException("UpdateSingleCandidateContestWinners", ex); message = $"Exception: {ex.Message} [see exception log for details]"; } VotePage.LogInfo("UpdateSingleCandidateContestWinners", message); }
public static void ServeImagePage(VotePage votePage) { var politicianKey = VotePage.QueryId; var column = VotePage.GetQueryString("Col"); if (IsNullOrWhiteSpace(column)) { column = "Profile300"; } // Set &Def=ColumnName to show the NoPhoto if requested image is missing // and to use the ColumnName for the size. If Def= is present but the // column name is invalid, the columnName from Col= will be used var defaultColumn = VotePage.GetQueryString("Def"); // Include <NoCacheParameter>=1 (meaning nocache=true) to force the image to be be served // from the common server to avoid cache invalidation latency. This should // ONLY be used on master and admin maintenance forms. // Use the NoCacheParameter property so we can change the value if need be. var noCacheParameter = VotePage.GetQueryString(VotePage.NoCacheParameter); int.TryParse(noCacheParameter, out var noCacheValue); var noCache = noCacheValue == 1 || votePage.NoCacheViaCookie; // Added 09/10/2012 to prevent serving an empty image if (IsNullOrWhiteSpace(defaultColumn)) { defaultColumn = column; } // Added 09/10/2012 -- we no longer serve Profile500 & Profile400 if (column == "Profile500" || column == "Profile400") { column = "Profile300"; } if (defaultColumn == "Profile500" || defaultColumn == "Profile400") { defaultColumn = "Profile300"; } ServePoliticianImage( politicianKey, column, defaultColumn, noCache); }
// This method is only used by the CommonCacheInvalidation which is run via the // Windows task scheduler public static void ProcessPendingTransactions() { string message; try { VotePage.LogInfo("CommonCacheInvalidation", "Started"); var table = CacheInvalidation.GetUnprocessedData(); var count = table.Sum(ProcessTransaction); message = $"{table.Count()} CacheInvalidation rows processed, {count} Page rows deleted"; } catch (Exception ex) { VotePage.LogException("CommonCacheInvalidation", ex); message = $"Exception: {ex.Message} [see exception log for details]"; } VotePage.LogInfo("CommonCacheInvalidation", message); }
public static string CreateWebAnchor(string href, string anchorText = "", string title = "", string target = "") { if (string.IsNullOrWhiteSpace(href)) { return(string.Empty); } if (string.IsNullOrWhiteSpace(anchorText)) { anchorText = href; } href = VotePage.NormalizeUrl(href); var a = new HtmlAnchor { HRef = href, InnerHtml = anchorText, Title = title, Target = target }; return(a.RenderToString()); }
//public static string RenderAds(string electionKey, string officeKey, string adKey = null) //{ // var table = ElectionsPoliticians.GetAds(electionKey, officeKey, adKey); // if (table.Rows.Count == 0) return Empty; // var ads = new List<string>(); // var cache = VotePage.GetPageCache().Politicians; // foreach (var ad in table.Rows.OfType<DataRow>()) // { // var thumbnailId = IsNullOrWhiteSpace(ad.AdThumbnailUrl()) // ? ad.AdUrl().GetYouTubeVideoId() // : ad.AdThumbnailUrl().GetYouTubeVideoId(); // ads.Add(RenderOneAd(ad.PoliticianKey(), cache.GetPoliticianName(ad.PoliticianKey()), // ad.AdUrl(), thumbnailId, ad.AdSponsor(), ad.AdSponsorUrl(), ad.AdIsCandidateSponsored())); // } // return $"<div class=\"ads-outer\">{Join(Empty, ads)}</div>"; //} //public static string RenderOneAd(string politicianKey, string politicianName, // string videoUrl, string thumbnailId, string sponsor, string sponsorUrl, bool isCandidateSponsored) //{ // string paidMessage; // if (isCandidateSponsored) // paidMessage = // "Paid advertisement by <a target=\"_blank\"" + // $" href=\"{UrlManager.GetIntroPageUri(politicianKey)}\">candidate’s campaign</a>"; // else if (!IsNullOrWhiteSpace(sponsor)) // paidMessage = IsNullOrWhiteSpace(sponsorUrl) // ? $"Paid advertisement by {sponsor}" // : $"Paid advertisement by <a target=\"_blank\" href=\"{VotePage.NormalizeUrl(sponsorUrl)}\">" + // $"{sponsor}</a>"; // else // paidMessage = "Paid advertisement"; // return "<div class=\"ad-outer\"><div class=\"ad-inner\"><div class=\"ad-copy\">" + // $"<p class=\"ad-name\">{politicianName}</p>" + // $"<p class=\"paid-ad\">{paidMessage}</p></div>" + // $"<a class=\"video-wrapper-outer\" target=\"youtube\" href=\"{VotePage.NormalizeUrl(videoUrl)}\">" + // "<div class=\"video-container\"><div class=\"video-player\"><div>" + // $"<img class=\"video-thumb\" src=\"http://i.ytimg.com/vi/{thumbnailId}/hqdefault.jpg\"/>" + // "<div class=\"video-play-button\"></div></div></div></div></a>" + // $"<img class=\"ad-profile\" src=\"/Image.aspx?Id={politicianKey}&Col=Headshot100\"/>" + // "<div style=\"clear:both\"></div></div></div>"; //} public static string RenderAds(string electionKey, string officeKey, string adKey = null) { var table = ElectionsPoliticians.GetAds(electionKey, officeKey, adKey); if (table.Rows.Count == 0) { return(Empty); } var ads = new List <string>(); var cache = VotePage.GetPageCache().Politicians; foreach (var ad in table.Rows.OfType <DataRow>()) { var thumbnailId = IsNullOrWhiteSpace(ad.AdThumbnailUrl()) ? ad.AdUrl().GetYouTubeVideoId() : ad.AdThumbnailUrl().GetYouTubeVideoId(); ads.Add(RenderOneAd(electionKey, officeKey, ad.AdType(), ad.PoliticianKey(), cache.GetPoliticianName(ad.PoliticianKey()), ad.AdUrl(), thumbnailId, ad.AdSponsor(), ad.AdSponsorUrl(), ad.AdIsCandidateSponsored())); } return($"<div class=\"ads-outer\">{Join(Empty, ads)}</div>"); }
public static string RenderBannerAd(string adType, string stateCode, string electionKey, string officeKey, bool show, int orgId, bool forAdmin = false) { if (UrlManager.IsLive && adType == "H" && orgId == 0) { return(Empty); // disable home ads for now } // If orgID is non zero, the organzation ad will be shown. If the org has no ad, no ad will be shown. if (orgId == 0) { return(RenderBannerAd2(adType, stateCode, electionKey, officeKey, show)); } var adTable = Organizations.GetAdData(orgId); if (adTable.Count == 0) { return(Empty); } var ad = adTable[0]; if (IsNullOrWhiteSpace(ad.AdImageName)) { return(Empty); } var src = forAdmin ? GetAdjustedSiteUri("orgadimage", $"{orgId}.{DateTime.UtcNow.Ticks}") : $"/orgadimage?{orgId}.{DateTime.UtcNow.Ticks}"; var onClick = IsNullOrWhiteSpace(ad.AdUrl) ? "onclick=\"return false;\"" : Empty; return($"<div class=\"banner-ad-outer\"><a href=\"{VotePage.NormalizeUrl(ad.AdUrl)}\"" + $" {onClick} target=\"ad\"><img src=\"{src}\"" + " alt=\"Ad Image\"/></a><p class=\"paid-advertisement-notice\">Paid Advertisement</p>" + "<hr /></div>"); }
public static void UpdateAllSitemapVirtualPages() { string message; try { VotePage.LogInfo("UpdateAllSitemapVirtualPages", "Started"); var table = Sitemap.GetAllKeyData(0); foreach (var row in table) { new SitemapManager().UpdateVirtualPage(row.DomainDataCode); } message = "Completed"; } catch (Exception ex) { VotePage.LogException("UpdateAllSitemapVirtualPages", ex); message = $"Exception: {ex.Message} [see exception log for details]"; } VotePage.LogInfo("UpdateAllSitemapVirtualPages", message); }
private void SetMailToLabel(string value) { if (Label != null) { Label.Controls.Clear(); Control label; if (IsNullOrWhiteSpace(value)) { label = new LiteralControl(Description); } else { var tooltip = (HyperlinkToolTip ?? "Send mail to {email}").Replace("{email}", value); label = new HyperLink { Text = Description, NavigateUrl = VotePage.NormalizeEmailHRef(value), ToolTip = tooltip }.AddCssClasses("tiptip"); } label.AddTo(Label); } }
protected void Page_PreRender(object sender, EventArgs e) { //Moved from Page_Load because if design is changes Page_Load is performed before //the database is updated with the new design. Page_PreRender is performed after //the database is updated. try { All.Visible = true; //MASTER and DESIGN Pages footer always shows. if (VotePage.IsPublicPage) { if ( (!db.Is_Include_Email_Us_This()) && (!db.Is_Include_Powered_By_This()) ) { All.Visible = false; } //else if (!db.Is_StateCode_Identified()) //{ // //There is no StateCode identified so if State substitutions exist don't show // if (db.Is_Substitutions_Has_StateCode( // db.Design_Substitutions_This("EmailUsLineAllPages")) // ) // All.Visible = false; //} All.Attributes["Class"] = "tablePage"; } else { All.Attributes["Class"] = "tableAdmin"; } if (All.Visible) { #region Email Us if (VotePage.IsPublicPage) { var emailAddress = DomainDesigns.GetDesignStringWithSubstitutions( DomainDesigns.Column.EmailUsAddressAllPages); if (!db.Is_Include_Email_Us_This() || string.IsNullOrWhiteSpace(emailAddress)) { EmailUs.Visible = false; } else { EmailUs.Visible = true; LabelEmailUs.Text = DomainDesigns.GetDesignStringWithSubstitutions( DomainDesigns.Column.EmailUsLineAllPages); if (string.IsNullOrWhiteSpace(LabelEmailUs.Text)) { LabelEmailUs.Text = "Email Us:"; } HyperLinkEMailUs.Text = db.Anchor_Mailto_Email(emailAddress); } } else { EmailUs.Visible = true; if (SecurePage.IsMasterPage) { LabelEmailUs.Text = MasterDesign.GetDesignStringWithSubstitutions( MasterDesign.Column.EmailUsLineAllPages); HyperLinkEMailUs.Text = db.Anchor_Mailto_Email( MasterDesign.GetDesignStringWithSubstitutions( MasterDesign.Column.EmailUsAddressAllPages)); } else if (SecurePage.IsDesignPage) { LabelEmailUs.Text = DomainDesigns.GetDesignStringWithSubstitutions( DomainDesigns.Column.EmailUsLineAllPages); HyperLinkEMailUs.Text = db.Anchor_Mailto_Email( DomainDesigns.GetDesignStringWithSubstitutions( DomainDesigns.Column.EmailUsAddressAllPages)); } } #endregion Email Us #region Powered By if (VotePage.IsPublicPage && !db.Is_Include_Powered_By_This())//Always show MASTER and DESIGN pages { PoweredBy.Visible = false; } else { PoweredBy.Visible = true; HyperLinkVoteUSAImageButton.Visible = true; HyperLinkVoteUSAImageButton.ImageUrl = "/images/poweredby.gif"; //if (db.Is_Localhost) // HyperLinkVoteUSAImageButton.NavigateUrl = "http://localhost" + db.ServerPort; //else // HyperLinkVoteUSAImageButton.NavigateUrl = "http://Vote-USA.org"; HyperLinkVoteUSAImageButton.NavigateUrl = UrlManager.SiteUri.ToString(); } #endregion Powered By } } catch (Exception ex) { db.Log_Page_Not_Found_404("EmailPowered.aspx:ex.Message" + ex.Message); if (!VotePage.IsDebugging) { VotePage.SafeTransferToError500(); } } }
public static string Linkify(this string self, string target = "_blank", bool nofollow = true) { return(LinkifyRegex2.Replace(self, m => $"<a href=\"{VotePage.NormalizeUrl(m.ToString())}" + $"\"{(IsNullOrWhiteSpace(target) ? Empty : $" target=\"{target}\"")}" +
//protected void Page_Load(object sender, EventArgs e) protected void Page_PreRender(object sender, EventArgs e) { //Moved from Page_Load because if design is changes Page_Load is performed before //the database is updated with the new design. Page_PreRender is performed after //the database is updated. try { //if (!IsPostBack) //{ //if (All.Visible) if (db.Is_Include_First_Footer_This()) { #region Visible All.Visible = true; #region HTML Table Attributes HtmlTable FooterFirstHTMLTable = new System.Web.UI.HtmlControls.HtmlTable(); FooterFirstHTMLTable.Attributes["cellSpacing"] = "0"; FooterFirstHTMLTable.Attributes["padding"] = "0"; FooterFirstHTMLTable.Attributes["border"] = "0"; FooterFirstHTMLTable.Attributes["id"] = "FooterFirst"; if (VotePage.IsPublicPage) { FooterFirstHTMLTable.Attributes["class"] = "tablePage"; } else { FooterFirstHTMLTable.Attributes["class"] = "tableAdmin"; } #endregion HTML Table Attributes //<tr> //HtmlTableRow FooterFirstHTMLTr = db.AddNavbarRow2Table(FooterFirstHTMLTable); HtmlTableRow FooterFirstHTMLTr = db.Add_Tr_To_Table_Return_Tr( FooterFirstHTMLTable , "trFooterFirst" ); string Content = string.Empty; if (SecurePage.IsMasterPage) { Content = MasterDesign.GetDesignStringWithSubstitutions( MasterDesign.Column.FirstFooterAllPages, MasterDesign.Column.IsTextFirstFooterAllPages); } else { Content = DomainDesigns.GetDesignStringWithSubstitutions( DomainDesigns.Column.FirstFooterAllPages, DomainDesigns.Column.IsTextFirstFooterAllPages); } db.Add_Td_To_Tr( FooterFirstHTMLTr , Content , "tdFooterFirst"); All.Text = db.RenderToString(FooterFirstHTMLTable); #endregion Visible } else //if (db.Is_Page_Element_Visible( // db.DomainDesigns_Bool_This( // "IsIncludedFirstFooterAllPages") // , "IsTextFirstFooterAllPages" // , "FirstFooterAllPages" // )) { All.Visible = false; } } //} catch (Exception ex) { db.Log_Page_Not_Found_404("FooterFirst.aspx:ex.Message" + ex.Message); if (!VotePage.IsDebugging) { VotePage.SafeTransferToError500(); } } }
public static void Update() { string message; try { VotePage.LogInfo("UpdatePoliticiansLiveOfficeKey", "Started"); var officeKeysUpdated = 0; var officeStatusesUpdated = 0; var electionKeysUpdated = 0; var dictionary = PoliticiansLiveOfficeKeyView.GetAllData(commandTimeout: 3600) .ToDictionary(row => row.PoliticianKey, row => row); var politiciansTable = Politicians.GetAllLiveOfficeData(); foreach (var politiciansRow in politiciansTable) { if (!dictionary.TryGetValue(politiciansRow.PoliticianKey, out var viewRow)) { continue; } var keyAndStatus = PoliticianOfficeStatus.FromLiveOfficeKeyAndStatus( viewRow.LiveOfficeKeyAndStatus); if (keyAndStatus.OfficeKey != politiciansRow.LiveOfficeKey) { Politicians.UpdateLiveOfficeKey(keyAndStatus.OfficeKey, politiciansRow.PoliticianKey); officeKeysUpdated++; } if (keyAndStatus.PoliticianStatus.ToString() != politiciansRow.LiveOfficeStatus) { Politicians.UpdateLiveOfficeStatus( keyAndStatus.PoliticianStatus.ToString(), politiciansRow.PoliticianKey); officeStatusesUpdated++; } // ReSharper disable InvertIf if (keyAndStatus.ElectionKey != politiciansRow.LiveElectionKey) // ReSharper restore InvertIf { Politicians.UpdateLiveElectionKey( keyAndStatus.ElectionKey, politiciansRow.PoliticianKey); electionKeysUpdated++; } } message = $"{officeKeysUpdated} LiveOfficeKeys updated," + $" {officeStatusesUpdated} LiveOfficeStatuses updated," + $" {electionKeysUpdated} LiveElectionKeys updated"; } catch (Exception ex) { VotePage.LogException("UpdatePoliticiansLiveOfficeKey", ex); message = $"Exception: {ex.Message} [see exception log for details]"; } VotePage.LogInfo("UpdatePoliticiansLiveOfficeKey", message); }
private SecurePage.UpdateStatus DoAnswerUpdate(IList <IGrouping <string, AnswersViewRow> > table, string questionKey, bool reportUnchanged, ref int updateCount) { var page = VotePage.GetPage <SecurePoliticianPage>(); var updateStatus = SecurePage.UpdateStatus.Failure; // default var description = string.Empty; var feedback = page.Master.FindMainContentControl("Feedback" + questionKey) as FeedbackContainerControl; var updatePanel = page.Master.FindMainContentControl("UpdatePanel" + questionKey) as UpdatePanel; var textAnswerBox = page.Master.FindMainContentControl("TextBox" + questionKey) as TextBox; var textSourceBox = page.Master.FindMainContentControl("Source" + questionKey) as TextBox; var textDateBox = page.Master.FindMainContentControl("Date" + questionKey) as TextBox; var youTubeUrlBox = page.Master.FindMainContentControl("YouTubeUrl" + questionKey) as TextBox; var youTubeSourceBox = page.Master.FindMainContentControl("YouTubeSource" + questionKey) as TextBox; var youTubeSourceUrlBox = page.Master.FindMainContentControl("YouTubeSourceUrl" + questionKey) as TextBox; var youTubeDateBox = page.Master.FindMainContentControl("YouTubeDate" + questionKey) as TextBox; var youTubeDescriptionBox = page.Master.FindMainContentControl("YouTubeDescription" + questionKey) as TextBox; var youTubeRunningTimeBox = page.Master.FindMainContentControl("YouTubeRunningTime" + questionKey) as TextBox; var youTubeFromCandidate = page.Master.FindMainContentControl("YouTubeFromCandidate" + questionKey) as HtmlInputCheckBox; var youTubeFromVoteUsa = page.Master.FindMainContentControl("YouTubeFromVoteUSA" + questionKey) as HtmlInputCheckBox; var sequenceHidden = page.Master.FindMainContentControl("Sequence" + questionKey) as HtmlInputHidden; var hasValue = page.Master.FindMainContentControl("HasValue" + questionKey) as HtmlInputHidden; var textIsFromCandidate = SecurePage.IsPoliticianUser; var youTubeIsFromCandidate = SecurePage.IsPoliticianUser || youTubeFromCandidate.Checked || youTubeSourceBox.Text.Trim() == YouTubeInfo.VideoUploadedByCandidateMessage; try { textAnswerBox.AddCssClasses("badupdate"); FeedbackContainerControl.ClearValidationErrors(textAnswerBox, textSourceBox, textDateBox, youTubeUrlBox, youTubeDateBox); var sequence = sequenceHidden.Value == "?" ? Answers.GetNextSequence(page.PoliticianKey, questionKey) : int.Parse(sequenceHidden.Value); var newTextAnswer = textAnswerBox.GetValue(); string newTextSource; DateTime newTextDate; var newYouTubeSource = string.Empty; var newYouTubeSourceUrl = string.Empty; var newYouTubeDate = VotePage.DefaultDbDate; bool success; var textDateWasEmpty = true; var youTubeDateWasEmpty = true; youTubeDescriptionBox.Text = string.Empty; youTubeRunningTimeBox.Text = string.Empty; newTextAnswer = feedback.StripHtml(newTextAnswer); newTextAnswer = newTextAnswer.StripRedundantSpaces(); var oldResponses = table.Where(g => g.Key.IsEqIgnoreCase(questionKey)) .SelectMany(g => g); var question = oldResponses.First(); var oldRow = table.Where(g => g.Key.IsEqIgnoreCase(questionKey)) .SelectMany(g => g) .FirstOrDefault(r => r.Sequence == sequence); description = '"' + question.Question + '"'; var isAnswerChanged = oldRow == null || /*newTextAnswer*/ textAnswerBox.GetValue().Trim() != oldRow.Answer.Trim(); if (string.IsNullOrWhiteSpace(newTextAnswer)) { newTextSource = string.Empty; newTextDate = VotePage.DefaultDbDate; } else if (textIsFromCandidate) { newTextSource = page.PageCache.Politicians.GetLastName(page.PoliticianKey); newTextDate = DateTime.UtcNow.Date; } else { newTextSource = textSourceBox.Text; newTextSource = feedback.StripHtml(newTextSource); newTextSource = newTextSource.StripRedundantSpaces(); textDateWasEmpty = string.IsNullOrWhiteSpace(textDateBox.Text); newTextDate = feedback.ValidateDateOptional(textDateBox, out success, "Text Date", isAnswerChanged ? DateTime.UtcNow.Date : VotePage.DefaultDbDate) .Date; } var newYouTubeUrl = youTubeUrlBox.GetValue(); newYouTubeUrl = feedback.StripHtml(newYouTubeUrl); newYouTubeUrl = newYouTubeUrl.StripRedundantSpaces(); YouTubeInfo youTubeInfo = null; if (!string.IsNullOrWhiteSpace(newYouTubeUrl)) { var youTubeId = newYouTubeUrl.GetYouTubeVideoId(); if (youTubeFromCandidate != null && !youTubeFromCandidate.Checked && youTubeFromVoteUsa != null && !youTubeFromVoteUsa.Checked) { feedback.PostValidationError(new[] { youTubeFromCandidate, youTubeFromVoteUsa }, "Please select a type of video"); } if (string.IsNullOrWhiteSpace(youTubeId)) { feedback.PostValidationError(youTubeUrlBox, YouTubeInfo.InvalidVideoUrlMessage); } else { youTubeInfo = YouTubeUtility.GetVideoInfo(youTubeId, true, 1); if (!youTubeInfo.IsValid) { feedback.PostValidationError(youTubeUrlBox, YouTubeInfo.VideoIdNotFoundMessage); } else if (!youTubeInfo.IsPublic) { feedback.PostValidationError(youTubeUrlBox, YouTubeInfo.VideoNotPublicMessage); } else { youTubeDateWasEmpty = string.IsNullOrWhiteSpace(youTubeDateBox?.Text); if (youTubeIsFromCandidate) { newYouTubeSource = YouTubeInfo.VideoUploadedByCandidateMessage; newYouTubeSourceUrl = string.Empty; newYouTubeDate = youTubeInfo.PublishedAt; } else { newYouTubeSource = youTubeSourceBox.Text; newYouTubeSource = feedback.StripHtml(newYouTubeSource); newYouTubeSource = newYouTubeSource.StripRedundantSpaces(); newYouTubeSourceUrl = youTubeSourceUrlBox == null ? string.Empty : youTubeSourceUrlBox.Text; newYouTubeSourceUrl = feedback.StripHtml(newYouTubeSourceUrl); newYouTubeSourceUrl = Validation.StripWebProtocol(newYouTubeSourceUrl); newYouTubeDate = youTubeDateWasEmpty ? youTubeInfo.PublishedAt : feedback.ValidateDate(youTubeDateBox, out success, "YouTube Date", new DateTime(2004, 1, 1), DateTime.UtcNow).Date; } } } } if (feedback.ValidationErrorCount == 0) { var oldTextAnswer = string.Empty; var oldTextSource = string.Empty; var oldTextDate = VotePage.DefaultDbDate; var oldYouTubeUrl = string.Empty; var oldYouTubeSource = string.Empty; var oldYouTubeSourceUrl = string.Empty; var oldYouTubeDate = VotePage.DefaultDbDate; if (oldRow != null) { oldTextAnswer = oldRow.Answer.SafeString(); oldTextSource = oldRow.Source.SafeString(); oldTextDate = oldRow.DateStamp.SafeDbDate(); oldYouTubeUrl = oldRow.YouTubeUrl.SafeString(); oldYouTubeSource = oldRow.YouTubeSource(); oldYouTubeSourceUrl = oldRow.YouTubeSourceUrl().SafeString(); oldYouTubeDate = oldRow.YouTubeDate.SafeDbDate() .Date; } var unchanged = oldTextAnswer == newTextAnswer && oldYouTubeUrl == newYouTubeUrl && oldYouTubeSource == newYouTubeSource && oldYouTubeSourceUrl == newYouTubeSourceUrl && (oldYouTubeDate == newYouTubeDate || youTubeDateWasEmpty); if (unchanged && !textIsFromCandidate) { unchanged = oldTextSource == newTextSource && (oldTextDate == newTextDate || textDateWasEmpty); } if (unchanged) { if (reportUnchanged) { feedback.AddInfo("Your " + description + " entry was unchanged."); updatePanel.Update(); } updateStatus = SecurePage.UpdateStatus.Unchanged; } else { if (!textIsFromCandidate && !question.IsTextSourceOptional.GetValueOrDefault() && !string.IsNullOrWhiteSpace(newTextAnswer) && (isAnswerChanged || !string.IsNullOrWhiteSpace(oldTextSource))) { feedback.ValidateLength(textSourceBox, "Text Source", 1, 255, out success); } if (!string.IsNullOrWhiteSpace(newYouTubeUrl)) { if (!youTubeIsFromCandidate) { feedback.ValidateRequired(youTubeSourceBox, "YouTube Source", out success); } } if (feedback.ValidationErrorCount == 0) { string videoDescription = null; var videoRunningTime = default(TimeSpan); if (youTubeInfo != null) { videoDescription = youTubeInfo.ShortDescription; videoRunningTime = youTubeInfo.Duration; youTubeDescriptionBox.Text = videoDescription; youTubeRunningTimeBox.Text = videoRunningTime.FormatRunningTime(); } if (youTubeSourceBox != null) { youTubeSourceBox.Text = newYouTubeSource; } if (youTubeSourceUrlBox != null) { youTubeSourceUrlBox.Text = newYouTubeSourceUrl; } if (youTubeDateBox != null) { youTubeDateBox.Text = newYouTubeDate.DbDateToShortDate(); } if (youTubeFromCandidate != null) { youTubeFromCandidate.Checked = youTubeIsFromCandidate; } if (youTubeFromVoteUsa != null) { youTubeFromVoteUsa.Checked = !youTubeIsFromCandidate; } hasValue.Value = string.IsNullOrWhiteSpace(newTextAnswer) && string.IsNullOrWhiteSpace(newYouTubeUrl) ? string.Empty : "Y"; page.LogPoliticianAnswerChange(questionKey, sequence, oldTextAnswer, newTextAnswer, newTextSource); page.UpdatePoliticianAnswer(questionKey, sequence, question.IssueKey, newTextAnswer, newTextSource, newTextDate, newYouTubeUrl, videoDescription, videoRunningTime, newYouTubeSource, newYouTubeSourceUrl, newYouTubeDate); UpdateQuestion(questionKey, sequence); feedback.AddInfo("Your " + description + " entry was updated."); updateStatus = SecurePage.UpdateStatus.Success; updateCount++; } updatePanel.Update(); } } if (updateStatus != SecurePage.UpdateStatus.Failure) { if (newTextAnswer != textAnswerBox.Text) { updatePanel.Update(); } textAnswerBox.SetValue(newTextAnswer); if (!textIsFromCandidate) { if (string.IsNullOrWhiteSpace(newTextAnswer)) { newTextSource = string.Empty; newTextDate = VotePage.DefaultDbDate; } var newDateText = newTextDate.DbDateToShortDate(); Debug.Assert(textSourceBox != null, "sourceBox != null"); Debug.Assert(textDateBox != null, "dateBox != null"); if (newTextSource != textSourceBox.Text || newDateText != textDateBox.Text) { updatePanel.Update(); } textSourceBox.SetValue(newTextSource); textDateBox.SetValue(newDateText); } if (!youTubeIsFromCandidate) { var newYouTubeDateText = newYouTubeDate == VotePage.DefaultDbDate ? string.Empty : newYouTubeDate.DbDateToShortDate(); if (newYouTubeDateText != youTubeDateBox.Text) { updatePanel.Update(); } youTubeDateBox.SetValue(newYouTubeDateText); } } textAnswerBox.RemoveCssClass("badupdate"); } catch (Exception ex) { if (description == string.Empty) { description = "your response"; } feedback.AddError("There was an unexpected error updating " + description); feedback.HandleException(ex); updatePanel.Update(); } return(updateStatus); }
private static void ProcessTransaction(CacheInvalidationRow row) { switch (row.TransactionType.ToLowerInvariant()) { case "all": VotePage.LogInfo("LocalCacheInvalidation", "Begin InvalidateAll"); InvalidateAll(); break; //case "ballotall": // InvalidateBallotAll(); // break; //case "ballotbydomaindesigncodeelectionkey": // { // var keys = row.CacheKey.Split('|'); // if (keys.Length == 2) // InvalidateBallotByDomainDesignCodeElectionKey(keys[0], keys[1]); // } // break; //case "ballotbyelectionkey": // InvalidateBallotByElectionKey(row.CacheKey); // break; //case "electedall": // InvalidateElectedAll(); // break; //case "electedbystatecode": // InvalidateElectedByStateCode(row.CacheKey); // break; //case "electionall": // InvalidateElectionAll(); // break; //case "electionbyelectionkey": // InvalidateElectionByElectionKey(row.CacheKey); // break; //case "introall": // InvalidateIntroAll(); // break; //case "introbypoliticiankey": // InvalidateIntroByPoliticianKey(row.CacheKey); // break; //case "issueall": // InvalidateIssueAll(); // break; //case "issuebyissuekey": // InvalidateIssueByIssueKey(row.CacheKey); // break; //case "issuebyofficekey": // InvalidateIssueByOfficeKey(row.CacheKey); // break; //case "issuebyelectionkeyofficekey": // { // var keys = row.CacheKey.Split('|'); // if (keys.Length == 2) // InvalidateIssueByElectionKeyOfficeKey(keys[0], keys[1]); // } // break; //case "issuebyofficekeyissuekey": // { // var keys = row.CacheKey.Split('|'); // if (keys.Length == 2) // InvalidateIssueByOfficeKeyIssueKey(keys[0], keys[1]); // } // break; //case "issuebyelectionkeyofficekeyissuekey": // { // var keys = row.CacheKey.Split('|'); // if (keys.Length == 3) // InvalidateIssueByElectionKeyOfficeKeyIssueKey( // keys[0], keys[1], keys[2]); // } // break; case "nagsall": InvalidateNagsAll(); break; //case "officialsall": // InvalidateOfficialsAll(); // break; //case "officialsbystatecode": // InvalidateOfficialsByStateCode(row.CacheKey); // break; //case "officialsbystatecodecountycode": // { // var keys = row.CacheKey.Split('|'); // if (keys.Length == 2) // InvalidateOfficialsByStateCodeCountyCode(keys[0], keys[1]); // } // break; //case "officialsbystatecodecountycodelocalcode": // { // var keys = row.CacheKey.Split('|'); // if (keys.Length == 3) // InvalidateOfficialsByStateCodeCountyCodeLocalCode( // keys[0], keys[1], keys[2]); // } // break; case "politicianimage": InvalidatePoliticianImage(row.CacheKey); break; //case "politicianissueall": // InvalidatePoliticianIssueAll(); // break; //case "politicianissuebyissuekey": // InvalidatePoliticianIssueByIssuekey(row.CacheKey); // break; //case "politicianissuebypoliticiankey": // InvalidatePoliticianIssueByPoliticianKey(row.CacheKey); // break; //case "politicianissuebypoliticiankeyissuekey": // { // var keys = row.CacheKey.Split('|'); // if (keys.Length == 2) // InvalidatePoliticianIssueByPoliticianKeyIssueKey(keys[0], keys[1]); // } // break; //case "referendumall": // InvalidateReferendumAll(); // break; //case "referendumbyelectionkey": // InvalidateReferendumByElectionkey(row.CacheKey); // break; default: throw new VoteException( "Unidentified invalidation transaction type" + row.TransactionType); } }