//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();
                }
            }
        }
        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();
                }
            }
        }
Example #3
0
        //public static string GetSubstitutionText(string textKey)
        //{
        //  // There may be more caching opportunities here
        //  return db.Subsitutions_All(db.Design_This(textKey));
        //}

        public static string GetSubstitutionText(string textKey)
        {
            // There may be more caching opportunities here
            //return db.Subsitutions_All(cache, db.Design_This(textKey));
            return(DomainDesigns.GetDesignStringWithSubstitutions(textKey));
        }