private void HandleOfficialsPage() { var reportCode = string.Empty; if (StateCache.IsValidStateOrFederalCode(GetQueryParm("Report"), false)) { reportCode = GetQueryParm("Report") .ToUpper(); } else { var stateCode = UrlManager.FindStateCode(); if (StateCache.IsValidStateCode(stateCode) || StateCache.IsValidFederalCode(stateCode, false)) { reportCode = stateCode; } } if (!string.IsNullOrEmpty(reportCode)) { NormalizedUri = UrlManager.GetOfficialsPageUri(reportCode, GetQueryParm("County"), GetQueryParm("Local")); _IsCanonicalUsa = !StateCache.IsValidStateCode(reportCode); } else { ErrorMessage = "The Report code could not be identified."; } }
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); }
public static string State_Code() { //**Test var stateCode = SecurePage.GetViewStateStateCode(); if (stateCode != null) { return(stateCode); } if (VotePage.IsPublicPage) { return(StateCode_Domain_This()); } if (SecurePage.IsMasterUser) { if (!string.IsNullOrEmpty(VotePage.QueryState)) { Session_Put("UserCountyCode", string.Empty); Session_Put("UserLocalCode", string.Empty); Session_Put("UserStateCode", VotePage.QueryState); return(VotePage.QueryState); } return(!string.IsNullOrEmpty(User_StateCode()) ? User_StateCode() : string.Empty); } if (!SecurePage.IsStateAdminUser) { return(string.Empty); } if (StateCache.IsValidStateOrFederalCode(User_StateCode(), false)) { return(User_StateCode()); } return(StateCache.IsValidStateOrFederalCode(Domain_StateCode_This(), false) ? Domain_StateCode_This() : string.Empty); }