public static string FindStateCode() { // reworked to eliminate ViewState references var stateCode = QueryState; if (IsNullOrWhiteSpace(stateCode)) { if (IsPublicPage) { stateCode = UrlManager.CurrentDomainDataCode; } else if (IsMasterUser || IsAdminUser) { stateCode = UserStateCode; if (IsNullOrWhiteSpace(stateCode)) { stateCode = Elections.GetStateCodeFromKey(QueryElection); } if (IsNullOrWhiteSpace(stateCode)) { stateCode = Offices.GetStateCodeFromKey(QueryOffice); } if (IsNullOrWhiteSpace(stateCode)) { stateCode = Politicians.GetStateCodeFromKey(QueryId); } if (IsNullOrWhiteSpace(stateCode)) { stateCode = Issues.GetStateCodeFromKey(QueryIssue); } if (IsNullOrWhiteSpace(stateCode)) { stateCode = Referendums.GetStateCodeFromKey(QueryReferendum); } } else if (IsPoliticianUser) { stateCode = Politicians.GetStateCodeFromKey(UserPoliticianKey); } else if (IsPartyUser) { stateCode = Parties.GetStateCodeFromKey(UserPartyKey); } } return(!IsNullOrWhiteSpace(stateCode) && (StateCache.IsValidStateOrFederalCode(stateCode) || GetPage <SecureAdminPage>()?.NonStateCodesAllowed.Contains(stateCode) == true) ? stateCode : Empty); }
private void CreateReport() { ReferendumTitle.InnerHtml = _Referendum.ReferendumTitle.ReplaceNewLinesWithParagraphs(); ReferendumSubTitle.InnerHtml = StateCache.GetStateName(Referendums.GetStateCodeFromKey(_ReferendumKey)) + " Ballot Measure / Referendum"; ReferendumSubTitle.Visible = false; // Link removed per Mantis 840 //new HtmlAnchor //{ // HRef = UrlManager.GetElectionPageUri(_ElectionKey).ToString(), // InnerText = _ElectionDescription //}.AddTo(ReferendumElection); ReferendumElection.InnerText = _ElectionDescription; var referendumDescription = _Referendum.ReferendumDescription; if (IsNullOrWhiteSpace(referendumDescription)) { ReferendumDescriptionLabel.Visible = false; ReferendumDescription.Visible = false; } else { ReferendumDescriptionLabel.InnerHtml = "Description:"; ReferendumDescription.InnerHtml = referendumDescription.ReplaceNewLinesWithParagraphs(); } var detail = _Referendum.ReferendumDetail; var detailUrl = _Referendum.ReferendumDetailUrl; if (IsNullOrWhiteSpace(detailUrl) && IsNullOrWhiteSpace(detail)) { ReferendumDetailLabel.Visible = false; ReferendumDetail.Visible = false; } else if (IsNullOrWhiteSpace(detail)) { ReferendumDetailLabel.InnerHtml = CreateAnchor(detailUrl, "Link to Detail", "no-print") .RenderToString(); ReferendumDetail.Visible = false; } else { ReferendumDetailLabel.InnerHtml = $"Detail {CreateAnchor(detailUrl, "(link to detail)", "parenthetical no-print").RenderToString()}"; ReferendumDetail.InnerHtml = detail.ReplaceNewLinesWithParagraphs(); } var fullText = _Referendum.ReferendumFullText; var fullTextUrl = _Referendum.ReferendumFullTextUrl; if (IsNullOrWhiteSpace(fullTextUrl) && IsNullOrWhiteSpace(fullText)) { ReferendumFullTextLabel.Visible = false; ReferendumFullText.Visible = false; } else if (IsNullOrWhiteSpace(fullText)) { ReferendumFullTextLabel.InnerHtml = CreateAnchor(fullTextUrl, "Link to Full Text", "no-print") .RenderToString(); ReferendumFullText.Visible = false; } else { ReferendumFullTextLabel.InnerHtml = $"Full Text {CreateAnchor(fullTextUrl, "(link to full text)").RenderToString()}"; ReferendumFullText.InnerHtml = fullText.ReplaceNewLinesWithParagraphs(); } }