Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Page.Title   = "Setup Ballot Page Banner Ad";
                H1.InnerHtml = "Setup Ballot Page Banner Ad";
                _SetupAdDialogInfo.LoadControls();
                FeedbackSetupAd.AddInfo("Ad information loaded.");
                SetupSampleAd();
            }

            var body = Master.FindControl("body") as HtmlGenericControl;

            Debug.Assert(body != null, "body != null");
            body.Attributes.Add("data-state", StateCode);

            AdRate.InnerText =
                DB.Vote.Master.GetBallotAdRate(0)
                .ToString("C", CultureInfo.CreateSpecificCulture("en-US"));
            State.InnerText = StateCache.GetStateName(StateCode.SafeString());

            if (AdminPageLevel == AdminPageLevel.Unknown)
            {
                UpdateControls.Visible = false;
                NoJurisdiction.CreateStateLinks("/admin/SetupBallotPageBannerAd.aspx?state={StateCode}");
                NoJurisdiction.Visible = true;
            }
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            const string title = "Update Jurisdictions";

            Page.Title   = title;
            H1.InnerHtml = title;

            var body = Master.FindControl("body") as HtmlGenericControl;

            Debug.Assert(body != null, "body != null");
            body.Attributes.Add("data-state", StateCode);

            SetSubHeading();
            SetCredentialMessage();

            if (AdminPageLevel == AdminPageLevel.State)
            {
                SetupBallotAdButton.HRef  = GetAdminFolderPageUrl("SetupBallotPageBannerAd", "state", StateCode);
                SetupElectedAdButton.HRef = GetAdminFolderPageUrl("SetupElectedPageBannerAd", "state", StateCode);
            }
            else
            {
                SetupBallotAdButton.Visible  = false;
                SetupElectedAdButton.Visible = false;
            }

            if (AdminPageLevel == AdminPageLevel.Unknown)
            {
                UpdateControls.Visible = false;
                NoJurisdiction.CreateStateLinks("/admin/UpdateJurisdictions.aspx?state={StateCode}");
                NoJurisdiction.Visible = true;
            }
        }
Beispiel #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsSuperUser)
            {
                Column1.Visible = false;
                Column2.AddCssClasses("wide");
            }

            if (!IsPostBack)
            {
                const string title = "Master Administration";
                Page.Title   = title;
                H1.InnerHtml = title;

                NoJurisdiction.CreateStateLinks("/admin/?state={StateCode}");
                NoJurisdiction.SetHead("Links to State Administration Pages");

                if (IsSuperUser)
                {
                    var sampleBallotDialogEnabled = DB.Vote.Master.GetPresentGetFutureSampleBallotsDialog(false);
                    var nagsEnabled = DonationNagsControl.GetIsNaggingEnabled(false);
                    if (!sampleBallotDialogEnabled || !nagsEnabled)
                    {
                        if (!sampleBallotDialogEnabled)
                        {
                            new HtmlP {
                                InnerText = "Ballot Choices Dialogs are disabled"
                            }
                        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                const string title = "VoteSmart Import";
                Page.Title   = title;
                H1.InnerHtml = title;

                SetSubHeading();
                SetCredentialMessage();
                ClientStateCode.Value = StateCode;
                ClientStateName.Value = StateCache.GetStateName(StateCode);

                if (AdminPageLevel == AdminPageLevel.Unknown)
                {
                    UpdateControls.Visible = false;
                    NoJurisdiction.CreateStateLinks("/admin/VoteSmartImport.aspx?state={StateCode}");
                    NoJurisdiction.Visible = true;
                }

                RefreshElectionsButton.Disabled = true;
                if (StateCodeExists)
                {
                    RefreshElectionsButton.Value = $"Refresh VoteSmart Elections for {ClientStateName.Value}";
                }
            }
        }
        // ReSharper restore UnusedMember.Global
        // ReSharper restore VirtualMemberNeverOverriden.Global
        // ReSharper restore MemberCanBePrivate.Global

        #endregion ReSharper restore

        #endregion Protected

        #region Event handlers and overrides

        protected void Page_Load(object sender, EventArgs e)
        {
            _ManagePoliticiansPanel =
                Master.FindMainContentControl("ManagePoliticiansPanel") as ManagePoliticiansPanel;
            if (_ManagePoliticiansPanel != null)
            {
                _ManagePoliticiansPanel.Mode         = ManagePoliticiansPanel.DataMode.ManageIncumbents;
                _ManagePoliticiansPanel.GetOfficeKey = () => OfficeControl.OfficeKey;
                _ManagePoliticiansPanel.PageFeedback = FeedbackAddCandidates;
            }

            if (!IsPostBack)
            {
                const string title = "Update Offices";
                Page.Title   = title;
                H1.InnerHtml = title;

                SetSubHeading();
                SetCredentialMessage();
                LoadOfficeControl();
                PopulateAddOfficeSelectOfficeClass();

                Master.MasterForm.Attributes.Add("data-state-code", StateCode);
                Master.MasterForm.Attributes.Add("data-county-code", CountyCode);
                Master.MasterForm.Attributes.Add("data-local-key", LocalKey);

                TabChangeInfo.InnerHtml = IsMasterUser
          ? "Change/Delete<br />Office"
          : "Edit<br />Office";

                ChangeOfficeInfo.InnerHtml = IsMasterUser
          ? "Select an office, then click the Edit Office or Delete Office button"
          : "Select an office, then click the Edit Office button";

                if (!IsMasterUser)
                {
                    DeleteOfficeButton.Visible = false;
                }

                if (AdminPageLevel == AdminPageLevel.Unknown)
                {
                    UpdateControls.Visible = false;
                    NoJurisdiction.CreateStateLinks("/admin/UpdateOffices.aspx?state={StateCode}");
                    NoJurisdiction.Visible = true;
                }

                if (AdminPageLevel == AdminPageLevel.State)
                {
                    InitializeTabOfficeTemplate();
                }
                else
                {
                    TabAddOfficeTemplateItem.Visible = false;
                }
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (AdminPageLevel == AdminPageLevel.Unknown)
         {
             UpdateControls.Visible = false;
             NoJurisdiction.CreateStateLinks("/admin/UpdateParties.aspx?state={StateCode}");
             NoJurisdiction.ShowHeadOptional(false);
             NoJurisdiction.Visible = true;
         }
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsMasterUser)
            {
                HandleSecurityException();
            }

            _ManagePoliticiansPanel =
                Master.FindMainContentControl("ManagePoliticiansPanel") as ManagePoliticiansPanel;
            if (_ManagePoliticiansPanel != null)
            {
                _ManagePoliticiansPanel.Mode         = ManagePoliticiansPanel.DataMode.AddPoliticians;
                _ManagePoliticiansPanel.PageFeedback = FeedbackAddCandidates;
            }

            if (!IsPostBack)
            {
                const string title = "Update Politicians";
                Title        = title;
                H1.InnerHtml = title;

                SetSubHeading();

                if (AdminPageLevel != AdminPageLevel.State && AdminPageLevel != AdminPageLevel.President)
                {
                    UpdateControls.Visible = false;
                }

                if (AdminPageLevel == AdminPageLevel.Unknown)
                {
                    NoJurisdiction.CreateStateLinks("/admin/UpdatePoliticians.aspx?state={StateCode}");
                    NoJurisdiction.ShowHeadOptional(false);
                    NoJurisdiction.Visible = true;
                }
                else
                {
                    ChangeState.Items.Clear();
                    ChangeState.Items.Add(new ListItem {
                        Text = "All States", Value = "US"
                    });
                    foreach (var stateCode in StateCache.All51StateCodes)
                    {
                        ChangeState.Items.Add(new ListItem {
                            Text =
                                $"{stateCode} - {StateCache.GetStateName(stateCode)}", Value = stateCode
                        });
                    }
                    ChangeState.SetValue(QueryState);
                }
            }
        }
        // ReSharper restore UnusedMember.Global
        // ReSharper restore VirtualMemberNeverOverriden.Global
        // ReSharper restore MemberCanBePrivate.Global

        #endregion ReSharper restore

        #endregion Protected

        #region Event handlers and overrides

        protected void Page_Load(object sender, EventArgs e)
        {
            _ManagePoliticialsPanel =
                Master.FindMainContentControl("ManagePoliticiansPanel") as ManagePoliticiansPanel;
            if (_ManagePoliticialsPanel != null)
            {
                _ManagePoliticialsPanel.Mode           = ManagePoliticiansPanel.DataMode.ManageCandidates;
                _ManagePoliticialsPanel.GetElectionKey = GetElectionKey;
                _ManagePoliticialsPanel.GetOfficeKey   = () => OfficeControl.OfficeKey;
                _ManagePoliticialsPanel.PageFeedback   = FeedbackAddCandidates;
            }

            if (!IsPostBack)
            {
                const string title = "Update Elections";
                Page.Title   = title;
                H1.InnerHtml = title;

                SetSubHeading();
                SetCredentialMessage();
                ClientStateCode.Value = StateCode;

                OfficeControl.Message += "<br />The current number of candidates is in [square brackets].";

                if (AdminPageLevel == AdminPageLevel.Unknown)
                {
                    UpdateControls.Visible = false;
                    NoJurisdiction.CreateStateLinks("/admin/UpdateElections.aspx?state={StateCode}");
                    NoJurisdiction.Visible = true;
                }

                if (!ShowAddElections)
                {
                    SelectElectionControl.RemoveCssClass("disabled");
                    SelectedElectionKey.Value = _MostRecentElectionKey;
                    if (!string.IsNullOrEmpty(GetElectionKey())) // It's the default tab
                    {
                        _ChangeInfoTabInfo.LoadControls();
                        SetElectionHeading(HeadingChangeInfo);
                    }
                }

                ShowAddCandidates = StateCache.IsValidStateCode(StateCode) ||
                                    StateCache.IsPresidentialPrimary(StateCode);
                if (!ShowAddCandidates)
                {
                    TabAddCandidatesItem.Visible = false;
                }
            }
        }
        private void Page_Load(object sender, EventArgs e)
        {
            _IssueLevel = GetQueryString("IssueLevel");
            if (_IssueLevel == Empty || StateCode == Empty)
            {
                HandleFatalError("The IssueLevel and/or StateCode is missing");
            }

            if (!IsPostBack)
            {
                H1.InnerText = Page.Title = "Move Questions and Answers";

                if (IsNullOrWhiteSpace(StateCode))
                {
                    UpdateControls.Visible = false;
                    NoJurisdiction.CreateStateLinks(
                        "/admin/QuestionAnswers.aspx?issuelevel=C&state={StateCode}");
                    NoJurisdiction.ShowHeadOptional(false);
                    NoJurisdiction.Visible = true;
                    return;
                }

                #region note

                //Level A = StateCode LL - indicating all politicians
                //Level B = StateCode US - National Issues
                //Level C and higher = StateCode - State Issues

                #endregion note

                try
                {
                    PageTitle.Text = PageTitle_QuestionAnswers(StateCode, _IssueLevel);

                    HyperLinkReport.NavigateUrl = $"/Admin/IssuesReport.aspx?IssueLevel={_IssueLevel}&Group={StateCode}";
                }
                catch (Exception ex)
                {
                    Msg.Text = Fail(ex.Message);
                    LogAdminError(ex);
                }
            }
        }
Beispiel #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //The Session UserStateCode, UserCountyCode, UserLocalCode can be changed
                //by a higher administration level using query strings
                //This is done in db.State_Code(), db.County_Code(), db.Local_Code()
                //
                //Using ViewState variables insures these values won't
                //change on any postbacks or in different tab or browser Sessions.
                //
                //ViewState["StateCode"] can be a StateCode or U1, u2, u3 for FederalCode
                //db.QueryString("State") can't be used because Login Security does not pass
                //the State in a query string
                //
                //db.State_Code(),db.County_Code(),db.Local_Code() have to be called
                //in that order because db.State_Code() resets CountyCode and LocalCode empty

                Page.Title = "Home";

                if (string.IsNullOrWhiteSpace(StateCode))
                {
                    UpdateControls.Visible = false;
                    NoJurisdiction.CreateStateLinks("/admin/?state={StateCode}");
                    NoJurisdiction.ShowHeadOptional(false);
                    NoJurisdiction.Visible = true;
                    return;
                }

                ViewState["StateCode"]  = G.State_Code();
                ViewState["CountyCode"] = G.County_Code();
                ViewState["LocalCode"]  = G.Local_Code();

                try
                {
                    // All Tables Not Visible

                    //TableStateElection.Visible = false;
                    //TablePresidentialPrimary.Visible = false;
                    //TablePresidentialPrimaryTemplate.Visible = false;
                    //TableStateByStateElections.Visible = false;

                    //TableStateElectionMaint.Visible = false;

                    TableCountyLinks.Visible       = false;
                    TableElectionAuthority.Visible = false;
                    TableBallotDesign.Visible      = false;
                    //TableSendEmails.Visible = false;
                    TableLocalLinks.Visible     = false;
                    TableLocalLinksEdit.Visible = false;
                    //TableOffices_Identified.Visible = false;
                    //TableBulkCountyOfficeAdds.Visible = false;
                    TableMultiCountyJudicialDistricts.Visible = false;
                    TableMultiCountyOtherDistricts.Visible    = false;
                    TableMultiCountyPartyDistricts.Visible    = false;
                    TableNotes.Visible      = false;
                    TableMasterOnly.Visible = false;
                    TableMisc.Visible       = false;

                    // State vs Non-State Controls
                    // State
                    if (StateCache.IsValidStateCode(ViewState["StateCode"].ToString()))
                    {
                        //TableStateElection.Visible = true;
                        //TableStateElectionMaint.Visible = true;

                        PageTitle.Text  = string.Empty;
                        PageTitle.Text += Offices.GetElectoralClassDescription(
                            ViewState["StateCode"].ToString(),
                            ViewState["CountyCode"].ToString(), ViewState["LocalCode"].ToString());

                        PageTitle.Text += "<br>";
                        PageTitle.Text += "ADMINISTRATION";

                        //HyperLinkElections.Text = db.Name_Electoral_Plus_Text(" Elections");
                        //HyperLinkElections.NavigateUrl = GetUpdateElectionsPageUrl(StateCode,
                        //  CountyCode, LocalCode);

                        // Counties & Locals Links
                        switch (
                            Electoral_Class(ViewState["StateCode"].ToString(),
                                            ViewState["CountyCode"].ToString(), ViewState["LocalCode"].ToString())
                            )
                        {
                        case ElectoralClass.USPresident:
                            break;

                        case ElectoralClass.USSenate:
                            break;

                        case ElectoralClass.USHouse:
                            break;

                        case ElectoralClass.USGovernors:
                            break;

                        case ElectoralClass.State:
                            LoadCountyLinks();

                            // Bulk County Office Adds & Multi-County Districts
                            if (IsSuperUser)
                            {
                                //TableBulkCountyOfficeAdds.Visible = true;

                                TableMultiCountyJudicialDistricts.Visible = true;
                                TableMultiCountyOtherDistricts.Visible    = true;
                                TableMultiCountyPartyDistricts.Visible    = true;

                                // Bulk Addition of County Offices

                                var sql = string.Empty;
                                sql += " Offices";
                                sql += " WHERE StateCode = " +
                                       SqlLit(ViewState["StateCode"].ToString());
                                sql += " AND (";
                                sql += " (OfficeLevel = 8)";
                                sql += " OR (OfficeLevel = 9)";
                                sql += " OR (OfficeLevel = 10)";
                                sql += " OR (OfficeLevel = 11)";
                                sql += " OR (OfficeLevel = 18)";
                                sql += " OR (OfficeLevel = 22)";
                                sql += " )";
                                var countyOffices = G.Rows_Count_From(sql);
                                //Label_BulkCountyOfficeAdds.Text = countyOffices +
                                //  " County offices are defined in all counties.";

                                if (countyOffices > 0)
                                {
                                    //sql = string.Empty;
                                    //sql += " Offices";
                                    //sql += " WHERE StateCode = " +
                                    //  SqlLit(ViewState["StateCode"].ToString());
                                    //sql += " AND OfficeLevel = 8";
                                    //var countyExecutiveOffices = G.Rows_Count_From(sql);
                                    //Label_BulkCountyOfficeAdds.Text += " (" + countyExecutiveOffices +
                                    //  " Executive Offices)";

                                    //sql = string.Empty;
                                    //sql += " Offices";
                                    //sql += " WHERE StateCode = " +
                                    //  SqlLit(ViewState["StateCode"].ToString());
                                    //sql += " AND OfficeLevel = 9";
                                    //var countyLegislative = G.Rows_Count_From(sql);
                                    //Label_BulkCountyOfficeAdds.Text += " (" + countyLegislative +
                                    //  " Legislative Offices)";

                                    //sql = string.Empty;
                                    //sql += " Offices";
                                    //sql += " WHERE StateCode = " +
                                    //  SqlLit(ViewState["StateCode"].ToString());
                                    //sql += " AND OfficeLevel = 10";
                                    //var countySchoolBoard = G.Rows_Count_From(sql);
                                    //Label_BulkCountyOfficeAdds.Text += " (" + countySchoolBoard +
                                    //  " SchoolBoard Offices)";

                                    //sql = string.Empty;
                                    //sql += " Offices";
                                    //sql += " WHERE StateCode = " +
                                    //  SqlLit(ViewState["StateCode"].ToString());
                                    //sql += " AND OfficeLevel = 11";
                                    //var countyCommission = G.Rows_Count_From(sql);
                                    //Label_BulkCountyOfficeAdds.Text += " (" + countyCommission +
                                    //  " Commission Offices)";

                                    //sql = string.Empty;
                                    //sql += " Offices";
                                    //sql += " WHERE StateCode = " +
                                    //  SqlLit(ViewState["StateCode"].ToString());
                                    //sql += " AND OfficeLevel = 18";
                                    //var countyJudicial = G.Rows_Count_From(sql);
                                    //Label_BulkCountyOfficeAdds.Text += " (" + countyJudicial +
                                    //  " Judicial Offices)";

                                    //sql = string.Empty;
                                    //sql += " Offices";
                                    //sql += " WHERE StateCode = " +
                                    //  SqlLit(ViewState["StateCode"].ToString());
                                    //sql += " AND OfficeLevel = 22";
                                    //var countyParty = G.Rows_Count_From(sql);
                                    //Label_BulkCountyOfficeAdds.Text += " (" + countyParty +
                                    //  " Party Offices)";
                                }

                                //HyperLinkBulkCountyOfficeAdds.NavigateUrl =
                                //  "/Admin/Office.aspx?Electoral=4";

                                //HyperLinkBulkCountyOfficeAdds.Text =
                                //  StateCache.GetStateName(ViewState["StateCode"].ToString()) +
                                //    " Bulk Additions, Updates and Report of County Offices in EACH COUNTY";

                                sql = string.Empty;

                                // JUDICIAL Districts
                                sql += " Districts";
                                sql += " WHERE StateCode = " +
                                       SqlLit(ViewState["StateCode"].ToString());
                                sql += " AND OfficeLevel = 17";
                                var judicialDistricts = G.Rows_Count_From(sql);
                                Label_JudicialDistricts.Text = judicialDistricts +
                                                               " Multi-County JUDICIAL Districts are defined.";
                                HyperLinkJudicialDistricts.NavigateUrl =
                                    "/Admin/Districts.aspx?Level=17";

                                HyperLinkJudicialDistricts.Text =
                                    StateCache.GetStateName(ViewState["StateCode"].ToString()) +
                                    " Add or Edit JUDICIAL Multi-County Districts (Office Level 17)";

                                // OTHER Districts
                                sql  = string.Empty;
                                sql += " Districts";
                                sql += " WHERE StateCode = " +
                                       SqlLit(ViewState["StateCode"].ToString());
                                sql += " AND OfficeLevel = 7";
                                var otherDistricts = G.Rows_Count_From(sql);
                                Label_MultiCountyDistricts.Text = otherDistricts +
                                                                  " Multi-County OTHER Districts are defined.";
                                HyperLinkMultiCountyDistricts.NavigateUrl =
                                    "/Admin/Districts.aspx?Level=7";

                                HyperLinkMultiCountyDistricts.Text =
                                    StateCache.GetStateName(ViewState["StateCode"].ToString()) +
                                    " Add or Edit OTHER Multi-County Districts like Conservation Districts (Office Level 7)";

                                // PARTY Districts
                                sql  = string.Empty;
                                sql += " Districts";
                                sql += " WHERE StateCode = " +
                                       SqlLit(ViewState["StateCode"].ToString());
                                sql += " AND OfficeLevel = 21";
                                var partyDistricts = G.Rows_Count_From(sql);
                                Label_PartyDistricts.Text = partyDistricts +
                                                            " Multi-County PARTY Districts are defined.";
                                HyperLinkPartyDistricts.NavigateUrl =
                                    "/Admin/Districts.aspx?Level=21";

                                HyperLinkPartyDistricts.Text =
                                    StateCache.GetStateName(ViewState["StateCode"].ToString()) +
                                    " Add or Edit PARTY Multi-County Districts (Office Level 21)";
                            }

                            TableBallotDesign.Visible = true;

                            TableElectionAuthority.Visible = true;

                            break;

                        case ElectoralClass.County:

                            //County
                            LoadCountyLinks();
                            LoadLocalLinks();

                            // Local Districts
                            TableLocalLinksEdit.Visible         = true;
                            HyperLinkLocalDistricts.NavigateUrl =
                                Url_Admin_LocalDistricts(ViewState["StateCode"].ToString(),
                                                         ViewState["CountyCode"].ToString(), string.Empty);

                            HyperLinkLocalDistricts.Text = "ADD " +
                                                           Offices.GetElectoralClassDescription(ViewState["StateCode"].ToString(),
                                                                                                ViewState["CountyCode"].ToString()) +
                                                           " Local Districts, Towns and Cities";

                            TableElectionAuthority.Visible = true;

                            break;

                        case ElectoralClass.Local:

                            LoadCountyLinks();

                            LoadLocalLinks();

                            TableElectionAuthority.Visible = true;

                            break;
                        }

                        // Elected Officials
                        //HyperLinkOfficials.NavigateUrl = db.Url_Admin_Officials();
                        //HyperLinkOfficials.Text = //db.Name_Electoral_Plus_Text_Officials();
                        //  db.Name_Electoral_Plus_Text(" Currently Elected Officials (Incumbents)");

                        // Elected Offices
                        //if (Is_Electoral_Class_Federal(ViewState["StateCode"].ToString(),
                        //  ViewState["CountyCode"].ToString(), ViewState["LocalCode"].ToString()))
                        //{
                        //  //No link -> defined at state level
                        //}
                        //else if (Is_Electoral_Class_State(ViewState["StateCode"].ToString(),
                        //  ViewState["CountyCode"].ToString(), ViewState["LocalCode"].ToString()))

                        //  // State Admin
                        //  HyperLinkElectedOffices.NavigateUrl =
                        //    Url_Admin_Offices(ViewState["StateCode"].ToString());

                        //else if (Is_Electoral_Class_County(ViewState["StateCode"].ToString(),
                        //  ViewState["CountyCode"].ToString(),
                        //  ViewState["LocalCode"].ToString()))

                        //  // County Admin
                        //  HyperLinkElectedOffices.NavigateUrl =
                        //    Url_Admin_Offices(ViewState["StateCode"].ToString(),
                        //      ViewState["CountyCode"].ToString());

                        //else if (Is_Electoral_Class_Local(ViewState["StateCode"].ToString(),
                        //  ViewState["CountyCode"].ToString(),
                        //  ViewState["LocalCode"].ToString()))

                        //  // Local Admiin
                        //  HyperLinkElectedOffices.NavigateUrl =
                        //    Url_Admin_Offices(ViewState["StateCode"].ToString(),
                        //      ViewState["CountyCode"].ToString(),
                        //      ViewState["LocalCode"].ToString());

                        //HyperLinkElectedOffices.Text = ////db.Name_Electoral_Plus_Text_Offices();
                        //  Offices.GetElectoralClassDescription(ViewState["StateCode"].ToString(),
                        //    ViewState["CountyCode"].ToString(), ViewState["LocalCode"].ToString()) +
                        //    " Elected Offices";
                        //if (Is_Electoral_Class_Federal(ViewState["StateCode"].ToString(),
                        //  ViewState["CountyCode"].ToString(), ViewState["LocalCode"].ToString()))

                        //  // Federal
                        //  HyperLinkElectedOffices.Text +=
                        //    " are all defined, and can onlly be edited at the state level.";

                        // Politicians
                        // HyperLinkPoliticians.NavigateUrl
                        //if (Is_Electoral_Class_Federal(ViewState["StateCode"].ToString(),
                        //  ViewState["CountyCode"].ToString(), ViewState["LocalCode"].ToString()))
                        //{
                        //  // Federal - No link -> defined at state level
                        //}
                        //else
                        //  HyperLinkPoliticians.NavigateUrl =
                        //    Url_Admin_Politicians(OfficeClass.Undefined);

                        //HyperLinkPoliticians.Text = db.Name_Electoral_Plus_Text(" Politicians");
                        //if (Is_Electoral_Class_Federal(ViewState["StateCode"].ToString(),
                        //  ViewState["CountyCode"].ToString(), ViewState["LocalCode"].ToString()))

                        //  // Federal
                        //  HyperLinkPoliticians.Text += " are edited at the state level.";

                        if (
                            Is_Electoral_Class_State_County_Local(
                                ViewState["StateCode"].ToString(), ViewState["CountyCode"].ToString(),
                                ViewState["LocalCode"].ToString()))
                        {
                            // Election Authority
                            //if (TableElectionAuthority.Visible)
                            //{
                            //  HyperLinkElectionAuthority.NavigateUrl = Url_Admin_Authority();
                            //  //HyperLinkElectionAuthority.Text = db.Name_Electoral(
                            //  //  db.State_Code(), string.Empty, string.Empty, true)
                            //  //  + " Election Authority";
                            //  HyperLinkElectionAuthority.Text =
                            //    Name_Electoral_Plus_Text(" Election Authority");
                            //}

                            // Political Parties
                            HyperLinkPoliticalParties.NavigateUrl =
                                Url_Admin_Parties(ViewState["StateCode"].ToString());
                            HyperLinkPoliticalParties.Text =
                                Offices.GetElectoralClassDescription(G.State_Code(), string.Empty, string.Empty) +
                                " Political Parties";

                            // Counties
                            Label_Counties.Text = Name_Electoral_Plus_Text(" Counties");

                            // Emails
                            //Label_Emails_Date_Roster_Primary.Text = States_Date(
                            //  ViewState["StateCode"].ToString(), "EmailsDateElectionRosterPrimary")
                            //  .ToString(CultureInfo.InvariantCulture);
                            //Label_Emails_Sent_Roster_Primary.Text = States_Int(
                            //  ViewState["StateCode"].ToString(), "EmailsSentElectionRosterPrimary")
                            //  .ToString(CultureInfo.InvariantCulture);
                            //Label_Emails_Date_Roster_General.Text = States_Date(
                            //  ViewState["StateCode"].ToString(), "EmailsDateElectionRosterGeneral")
                            //  .ToString(CultureInfo.InvariantCulture);
                            //Label_Emails_Sent_Roster_General.Text = States_Int(
                            //  ViewState["StateCode"].ToString(), "EmailsSentElectionRosterGeneral")
                            //  .ToString(CultureInfo.InvariantCulture);

                            // Ballot Design
                            HyperLinkBallotDesign.NavigateUrl = /*Url_Admin_Ballot()*/ GetBallotPageUrl(StateCode);
                            HyperLinkBallotDesign.Text        = Name_Electoral_Plus_Text(" Ballot Design and Content");
                        }
                    }
                    else
                    {
                        switch (ViewState["StateCode"].ToString())
                        {
                        case "US":
                            //TablePresidentialPrimary.Visible = true;
                            PageTitle.Text  = Str_Election_Type_Description("A", "US");
                            PageTitle.Text += "<br>";
                            PageTitle.Text += "ADMINISTRATION";
                            //HyperLinkElectionsUS.Text = Str_Election_Type_Description("A",
                            //  "US");
                            //HyperLinkElectionsUS.NavigateUrl = db.Url_Admin_Elections("US");
                            break;

                        case "PP":
                            //TablePresidentialPrimaryTemplate.Visible = true;
                            PageTitle.Text  = Str_Election_Type_Description("A", "PP");
                            PageTitle.Text += "<br>";
                            PageTitle.Text += "ADMINISTRATION";
                            //HyperLinkElectionsPP.Text = Str_Election_Type_Description("A",
                            //  "PP");
                            //HyperLinkElectionsPP.NavigateUrl = db.Url_Admin_Elections("PP");
                            break;

                        default:
                            if (Is_StateCode_State_By_State(ViewState["StateCode"].ToString()))
                            {
                                // State-By-State Reports
                                //TableStateByStateElections.Visible = true;
                                //if (db.QueryString("State") == "U1")
                                switch (ViewState["StateCode"].ToString())
                                {
                                case "U1":
                                    PageTitle.Text  = "U.S. President or State-By-State Elections";
                                    PageTitle.Text += "<br>";
                                    PageTitle.Text += "ADMINISTRATION";
                                    //HyperLinkElectionsUD.Text = "US President State-By-State";
                                    //HyperLinkElectionsUD.NavigateUrl = db.Url_Admin_Elections("U1");
                                    //HyperLinkOfficialsUD.Text = "Current US President";
                                    //HyperLinkOfficialsUD.NavigateUrl = Url_Admin_Officials("U1");
                                    break;

                                case "U2":
                                    PageTitle.Text =
                                        "U.S. Senate Officials or State-By-State Elections";
                                    PageTitle.Text += "<br>";
                                    PageTitle.Text += "ADMINISTRATION";
                                    //HyperLinkElectionsUD.Text = "US Senate State-By-State";
                                    //HyperLinkElectionsUD.NavigateUrl = db.Url_Admin_Elections("U2");
                                    //HyperLinkOfficialsUD.Text = "Current US Senate";
                                    //HyperLinkOfficialsUD.NavigateUrl = Url_Admin_Officials("U2");
                                    break;

                                case "U3":
                                    PageTitle.Text =
                                        "U.S. House of Representatives Officials or State-By-State Elections";
                                    PageTitle.Text += "<br>";
                                    PageTitle.Text += "ADMINISTRATION";
                                    //HyperLinkElectionsUD.Text =
                                    //  "US House of Representatives State-By-State";
                                    //HyperLinkElectionsUD.NavigateUrl = db.Url_Admin_Elections("U3");
                                    //HyperLinkOfficialsUD.Text =
                                    //  "Current US House of Representatives";
                                    //HyperLinkOfficialsUD.NavigateUrl = Url_Admin_Officials("U3");
                                    break;

                                case "U4":
                                    PageTitle.Text =
                                        "Current Governors or State-By-State Elections";
                                    PageTitle.Text += "<br>";
                                    PageTitle.Text += "ADMINISTRATION";
                                    //HyperLinkElectionsUD.Text =
                                    //  "Governors State-By-State Elections";
                                    //HyperLinkElectionsUD.NavigateUrl = db.Url_Admin_Elections("U4");
                                    //HyperLinkOfficialsUD.Text = "Current Governors State-By-State";
                                    //HyperLinkOfficialsUD.NavigateUrl = Url_Admin_Officials("U4");
                                    break;
                                }
                            }
                            break;
                        }
                    }

                    // Help links
                    if (IsMasterUser)
                    {
                        HyperLink_Interns.Visible = true;
                        HyperLink_Help.Visible    = false;
                    }
                    else
                    {
                        HyperLink_Help.Visible    = true;
                        HyperLink_Interns.Visible = false;
                    }

                    if (IsSuperUser &&
                        StateCache.IsValidStateCode(ViewState["StateCode"].ToString()))
                    {
                        // Master Only
                        TableMasterOnly.Visible = true;
                        //TableSendEmails.Visible = true;
                        TableMisc.Visible = true;

                        HyperLinkNames.NavigateUrl =
                            "/Master/MgtReports.aspx?Report=OfficialsNames&State=" +
                            ViewState["StateCode"];

                        RadioButtonListUseBOLBanner.SelectedValue =
                            States_Bool(ViewState["StateCode"].ToString(), "IsUseBOEBanner")
                ? "T"
                : "F";

                        if (
                            Electoral_Class(ViewState["StateCode"].ToString(),
                                            ViewState["CountyCode"].ToString(), ViewState["LocalCode"].ToString()) ==
                            ElectoralClass.State)
                        {
                            // Status Notes of Statewide, Judicial and County Elected Offices and Incumbents
                            TableNotes.Visible = true;
                            TextBoxOfficesStatusStatewide.Text =
                                States_Str(ViewState["StateCode"].ToString(),
                                           "OfficesStatusStatewide");
                            TextBoxOfficesStatusJudicial.Text =
                                States_Str(ViewState["StateCode"].ToString(),
                                           "OfficesStatusJudicial");
                            TextBoxOfficesStatusCounties.Text =
                                States_Str(ViewState["StateCode"].ToString(),
                                           "OfficesStatusCounties");
                        }
                    }
                }
                catch (Exception ex)
                {
                    Msg.Text = Fail(ex.Message);
                    Log_Error_Admin(ex);
                }
            }
        }
Beispiel #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (IsLocalAdminUser)
                {
                    LocalMessage.Visible = true;
                }
                if (IsNullOrWhiteSpace(StateCode))
                {
                    UpdateControls.Visible = false;
                    NoJurisdiction.CreateStateLinks("/admin/?state={StateCode}");
                    NoJurisdiction.ShowHeadOptional(false);
                    NoJurisdiction.Visible = true;
                    return;
                }

                try
                {
                    CountyLinkContainer.Visible  = false;
                    TableParties.Visible         = false;
                    TableBallotDesign.Visible    = false;
                    LocalLinksContainer.Visible  = false;
                    AddOrDeleteDistricts.Visible = false;
                    TableNotes.Visible           = false;

                    MasterOnlySection.Visible = IsMasterUser;

                    var pageTitle = Empty;

                    if (StateCache.IsValidStateCode(StateCode))
                    {
                        pageTitle = Offices.GetElectoralClassDescription(StateCode,
                                                                         CountyCode, LocalKey);

                        // Counties & Locals Links
                        switch (Offices.GetElectoralClass(StateCode, CountyCode, LocalKey))
                        {
                        case ElectoralClass.USPresident:
                        case ElectoralClass.USSenate:
                        case ElectoralClass.USHouse:
                        case ElectoralClass.USGovernors:
                            break;

                        case ElectoralClass.State:
                            LoadCountyLinks();
                            TableBallotDesign.Visible = true;

                            if (IsMasterUser)
                            {
                                TableParties.Visible = true;
                            }

                            break;

                        case ElectoralClass.County:
                        case ElectoralClass.Local:
                            LoadCountyLinks();
                            LoadLocalLinks();
                            EnableAddDeleteLocals();

                            if (IsMasterUser)
                            {
                                TableParties.Visible = true;
                            }
                            break;
                        }

                        if (Offices.IsElectoralClassStateCountyOrLocal(StateCode, CountyCode,
                                                                       LocalKey))
                        {
                            // Political Parties
                            HyperLinkPoliticalParties.NavigateUrl =
                                GetPartiesPageUrl(StateCode);
                            HyperLinkPoliticalParties.Text =
                                Offices.GetElectoralClassDescription(GetStateCode(),
                                                                     Empty, Empty) + " Political Parties";

                            // Ballot Design
                            HyperLinkBallotDesign.NavigateUrl = /*Url_Admin_Ballot()*/
                                                                GetBallotPageUrl(StateCode);
                            HyperLinkBallotDesign.Text =
                                Offices.GetElectoralClassDescription(StateCode, CountyCode,
                                                                     LocalKey) + " Ballot Design and Content";
                        }
                    }
                    else
                    {
                        switch (StateCode)
                        {
                        case "US":
                            pageTitle = Elections.GetElectionTypeDescription("A", "US");
                            break;

                        case "PP":
                            pageTitle = Elections.GetElectionTypeDescription("A", "PP");
                            break;

                        default:
                            if (StateCache.IsValidFederalCode(StateCode) &&
                                !StateCache.IsUS(StateCode))
                            {
                                switch (StateCode)
                                {
                                case "U1":
                                    pageTitle =
                                        "U.S. President or State-By-State Elections";
                                    break;

                                case "U2":
                                    pageTitle =
                                        "U.S. Senate Officials or State-By-State Elections";
                                    break;

                                case "U3":
                                    pageTitle =
                                        "U.S. House of Representatives Officials or State-By-State Elections";
                                    break;

                                case "U4":
                                    pageTitle =
                                        "Current Governors or State-By-State Elections";
                                    break;
                                }
                            }
                            break;
                        }
                    }
                    Page.Title = H1.InnerHtml = pageTitle + " Administration";
                    if (AdminPageLevel == AdminPageLevel.Local)
                    {
                        FormatOtherCountiesMessage(MuliCountyMessage);
                    }

                    if (IsSuperUser && StateCache.IsValidStateCode(StateCode))
                    {
                        // Master Only
                        TableMasterOnly.Visible = true;

                        if (Offices.GetElectoralClass(StateCode, CountyCode, LocalKey) ==
                            ElectoralClass.State)
                        {
                            // Status Notes of Statewide, Judicial and County Elected Offices and Incumbents
                            TableNotes.Visible = true;
                            TextBoxOfficesStatusStatewide.Text =
                                States.GetOfficesStatusStatewide(StateCode);
                            TextBoxOfficesStatusJudicial.Text =
                                States.GetOfficesStatusJudicial(StateCode);
                            TextBoxOfficesStatusCounties.Text =
                                States.GetOfficesStatusCounties(StateCode);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Msg.Text = Fail(ex.Message);
                    LogAdminError(ex);
                }
            }
        }
Beispiel #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _IssueKey    = QueryIssue;
            _QuestionKey = QueryQuestion;

            if (!IsPostBack)
            {
                H1.InnerText = Page.Title = "Issues and Questions";

                if (IsNullOrWhiteSpace(StateCode))
                {
                    UpdateControls.Visible = false;
                    NoJurisdiction.CreateStateLinks("/admin/Issues.aspx?state={StateCode}");
                    NoJurisdiction.ShowHeadOptional(false);
                    NoJurisdiction.Visible = true;
                    return;
                }

                try
                {
                    // Page Title
                    PageTitle.Text = Empty;

                    if (StateCode == "LL")
                    {
                        PageTitle.Text += "<br>All Candidates";
                    }
                    else if (StateCode == "US")
                    {
                        PageTitle.Text += "<br>National Candidates";
                    }
                    else
                    {
                        PageTitle.Text +=
                            $"<br>{StateCache.GetStateName(StateCode)} Candidates";
                    }

                    if (!IsNullOrEmpty(_IssueKey))
                    {
                        PageTitle.Text +=
                            $"<br><span style=color:red>{Issue_Desc(_IssueKey)}</span>";
                    }

                    //On initial entry there is only a StateCode Anchor
                    //Anchors on Issues and Questions Reports have 4 possible query string prameters:
                    //Issue Link => db.QueryString("Issue")
                    //Issue Ok/Omit Link => db.QueryString("Issue") & db.QueryString("Omit")
                    //Question Link => db.QueryString("Issue") & db.QueryString("Question")
                    //Question Ok/Omit Link => db.QueryString("Issue") & db.QueryString("Question") & db.QueryString("Omit")

                    if (IsNullOrEmpty(QueryIssue))
                    {
                        MakeAllControlsNotVisible();
                    }
                    else
                    {
                        // Entry from Link on Issues or Question Reports
                        if (IsNullOrEmpty(QueryQuestion) &&
                            IsNullOrEmpty(GetQueryString("Omit")))
                        {
                            // Issue Link to edit issue and/or issue questions
                            MakeAllControlsNotVisible();
                            Table_Issue_Edit.Visible       = true;
                            Table_Question.Visible         = true;
                            Table_Questions_Report.Visible = true;

                            TextBox_Issue_Description.Text = Issue_Desc(QueryIssue);
                            TextBox_Issue_Order.Text       =
                                Issues.GetIssueOrder(QueryIssue, 0)
                                .ToString(CultureInfo.InvariantCulture);

                            CreateQuestionsReport();
                        }
                        else if (IsNullOrEmpty(QueryQuestion) &&
                                 !IsNullOrEmpty(GetQueryString("Omit")))
                        {
                            // Issue Ok/Omit Link to change status to ok or omit

                            MakeAllControlsNotVisible();

                            Issues.UpdateIsIssueOmit(GetQueryString("Omit").IsEqIgnoreCase("true"),
                                                     QueryIssue);
                        }
                        else if (!IsNullOrEmpty(QueryQuestion) &&
                                 IsNullOrEmpty(GetQueryString("Omit")))
                        {
                            // Question Link to edit question

                            MakeAllControlsNotVisible();
                            Table_Question_Edit.Visible    = true;
                            Table_Question.Visible         = true;
                            Table_Questions_Report.Visible = true;

                            TextBox_Question_Description.Text = Questions.GetQuestion(_QuestionKey);
                            TextBox_Question_Order.Text       =
                                Questions.GetQuestionOrder(_QuestionKey, 0)
                                .ToString(CultureInfo.InvariantCulture);

                            RenumberQuestions();

                            CreateQuestionsReport();
                        }
                        else if (!IsNullOrEmpty(QueryQuestion) &&
                                 !IsNullOrEmpty(GetQueryString("Omit")))
                        {
                            // Question Ok/Omit Link to change status to ok or omit

                            MakeAllControlsNotVisible();
                            Table_Question.Visible         = true;
                            Table_Questions_Report.Visible = true;

                            Questions.UpdateIsQuestionOmit(GetQueryString("Omit").IsEqIgnoreCase("true"),
                                                           QueryQuestion);

                            RenumberQuestions();

                            CreateQuestionsReport();
                        }
                    }

                    RenumberIssues();

                    // Only Master controls
                    if (IsSuperUser)
                    {
                        Table_Delete_Issue.Visible = true;

                        if (!IsNullOrEmpty(QueryIssue) &&
                            IsNullOrEmpty(GetQueryString("Omit")))
                        {
                            Table_Delete_Question.Visible = true;
                        }
                    }
                }
                catch (Exception ex)
                {
                    Msg.Text = Fail(ex.Message);
                    LogAdminError(ex);
                }
            }
            CreateIssuesReport();
        }
Beispiel #13
0
        private void Page_Load(object sender, EventArgs e)
        {
            if (!IsMasterUser && !IsStateAdminUser)
            {
                HandleSecurityException();
            }
            ViewState["PartyKey"]     = _PartyKey = QueryParty;
            ViewState["EmailAddress"] = _EmailAddress = GetQueryString("Email");

            if (IsPostBack)
            {
                var partyKey = ViewState["PartyKey"] as string;
                if (!IsNullOrEmpty(partyKey))
                {
                    _PartyKey = partyKey;
                }
                var emailAddress = (string)ViewState["EmailAddress"];
                if (!IsNullOrEmpty(emailAddress))
                {
                    _EmailAddress = emailAddress;
                }
            }
            else
            {
                Page.Title = "Parties";

                if (IsNullOrWhiteSpace(StateCode))
                {
                    UpdateControls.Visible = false;
                    NoJurisdiction.CreateLink("/admin/Parties.aspx?state=US", "National Parties");
                    NoJurisdiction.CreateStateLinks("/admin/Parties.aspx?state={StateCode}");
                    NoJurisdiction.ShowHeadOptional(false);
                    NoJurisdiction.Visible = true;
                    return;
                }

                try
                {
                    Controls_Entry();

                    ThePageTitle();

                    // Renumber State Parties by 10
                    var order        = 0;
                    var tableParties = Parties.GetCacheDataByStateCode(StateCode)
                                       .OrderBy(r => r.PartyOrder);
                    foreach (var rowParty in tableParties)
                    {
                        order += 10;
                        Parties.UpdatePartyOrder(order, rowParty.PartyKey);
                    }

                    PartiesReport();
                }
                catch (Exception ex)
                {
                    #region

                    Msg_Party.Text = Fail(ex.Message);
                    LogAdminError(ex);

                    #endregion
                }
            }
        }
        private void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Page.Title = "Move Questions and Answers";

                if (string.IsNullOrWhiteSpace(StateCode))
                {
                    UpdateControls.Visible = false;
                    NoJurisdiction.CreateStateLinks(
                        "/admin/QuestionAnswers.aspx?issuelevel=C&state={StateCode}");
                    NoJurisdiction.ShowHeadOptional(false);
                    NoJurisdiction.Visible = true;
                    return;
                }

                #region Security Check and Values for ViewState["StateCode"] ViewState["CountyCode"] ViewState["LocalCode"]

                ViewState["StateCode"]  = G.State_Code();
                ViewState["CountyCode"] = G.County_Code();
                ViewState["LocalCode"]  = G.Local_Code();
                //if (!db.Is_User_Security_Ok())
                //  HandleSecurityException();

                #endregion Security Check and Values for ViewState["StateCode"] ViewState["CountyCode"] ViewState["LocalCode"]

                #region ViewState Values

                #region note

                //Level A = StateCode LL - indicating all politicians
                //Level B = StateCode US - National Issues
                //Level C and higher = StateCode - State Issues

                #endregion note

                ViewState["IssueLevel"] = string.Empty;
                ViewState["StateCode"]  = string.Empty;

                #region QueryStrings: ViewState["IssueLevel"]  ViewState["StateCode"]

                if (!string.IsNullOrEmpty(GetQueryString("IssueLevel")))
                {
                    ViewState["IssueLevel"] = GetQueryString("IssueLevel");
                }
                if (!string.IsNullOrEmpty(QueryState))
                {
                    ViewState["StateCode"] = QueryState;
                }
                //if(ViewState["IssueLevel"].ToString() == "C")
                //  //At State level Group and StateCode are the same
                //  Session["UserStateCode"] = db.QueryString("State");

                #endregion

                #endregion ViewState Values

                #region Additional Security Checks

                if ((ViewState["IssueLevel"].ToString() == string.Empty) ||
                    (ViewState["StateCode"].ToString() == string.Empty))
                {
                    HandleFatalError("The IssueLevel and/or StateCode is missing");
                }

                #endregion Security Checks

                try
                {
                    #region PageTitle commented out

                    //PageTitle.Text = "Move Questions and Answers";
                    //switch (ViewState["IssueLevel"].ToString())
                    //{
                    //  case "A":
                    //    PageTitle.Text += "<br>for ALL Candidates";
                    //    break;
                    //  case "B":
                    //    PageTitle.Text += "<br>for NATIONAL Office Candidates";
                    //    break;
                    //  case "C":
                    //    PageTitle.Text += "<br>for "
                    //      + db.States_Str(ViewState["StateCode"].ToString(), "State").ToUpper()
                    //      + " Office Candidates";
                    //    break;
                    //  case "D":
                    //    PageTitle.Text += "<br>for "
                    //      + db.States_Str(ViewState["StateCode"].ToString(), "State").ToUpper()
                    //      + " Office Candidates";
                    //    break;
                    //}

                    #endregion

                    PageTitle.Text = PageTitle_QuestionAnswers(ViewState["StateCode"].ToString(),
                                                               ViewState["IssueLevel"].ToString());

                    //HyperLinkReport.NavigateUrl = "/Admin/IssuesReport.aspx"
                    //+ "?IssueLevel=" + ViewState["IssueLevel"].ToString()
                    //+ "&StateCode=" + ViewState["StateCode"].ToString();
                    HyperLinkReport.NavigateUrl = Url_Admin_IssuesReport(
                        ViewState["IssueLevel"].ToString()
                        , ViewState["StateCode"].ToString());

                    //ShowReport(ViewState["IssueLevel"].ToString(), ViewState["StateCode"].ToString());
                }
                catch (Exception ex)
                {
                    Msg.Text = Fail(ex.Message);
                    Log_Error_Admin(ex);
                }
            }
        }