Exemplo n.º 1
0
        private static bool IsValidIssue(string issueKey, string stateCode)
        {
            if (Is_Valid_Issue(issueKey))

            #region Check StateCode in IssueKey match StateCode for page

            {
                switch (Issues.GetIssueLevelFromKey(issueKey.ToUpper()))
                {
                case "A": //All Offices
                    return(Issues.GetStateCodeFromKey(issueKey) == "LL");

                case "B": //National issues
                    return(Issues.GetStateCodeFromKey(issueKey) == "US");

                case "C": //State Issues
                    return(Issues.GetStateCodeFromKey(issueKey) == stateCode);

                case "D": //County Issues
                    return(Issues.GetStateCodeFromKey(issueKey) == stateCode);

                case "E": //Local Issues
                    return(Issues.GetStateCodeFromKey(issueKey) == stateCode);

                default:
                    return(false);
                }
            }

            #endregion Check StateCode in IssueKey match StateCode for page

            return(false);
        }
        protected void ReportQuestion(DataRow row)
        {
            var tr = new HtmlTableRow().AddTo(CurrentHtmlTable, "trReportDetail");

            new HtmlTableCell {
                InnerText = row.QuestionOrder().ToString()
            }
            .AddTo(tr, "tdReportDetail");
            var td = new HtmlTableCell().AddTo(tr, "tdReportDetail");

            new HtmlAnchor
            {
                HRef = SecureAdminPage.GetIssuesPageUrl(Issues.GetStateCodeFromKey(row.IssueKey()),
                                                        row.IssueKey(), row.QuestionKey()),
                InnerHtml = $"<nobr>{row.Question()}</nobr>"
            }.AddTo(td);
            td = new HtmlTableCell().AddTo(tr, "tdReportDetail");
            new HtmlAnchor
            {
                HRef = SecureAdminPage.GetIssuesPageUrl(Issues.GetStateCodeFromKey(row.IssueKey()),
                                                        row.IssueKey(), row.QuestionKey(), !row.IsQuestionOmit()),
                InnerHtml = row.IsQuestionOmit() ? "<strong>OMIT</strong>" : "ok"
            }.AddTo(td);
            new HtmlTableCell {
                InnerText = row.QuestionKey()
            }
            .AddTo(tr, "tdReportDetail");
            new HtmlTableCell {
                InnerText = row.Count().ToString()
            }
            .AddTo(tr, "tdReportDetail");
        }
Exemplo n.º 3
0
        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);
        }