示例#1
0
    private void SetValuesToControl()
    {
        objSettings = new tblSettings();
        objEncrypt  = new clsEncryption();
        objSettings.LoadAll();
        if (objSettings.RowCount > 0)
        {
            try
            {
                txtSiteName.Text           = objSettings.AppSiteName;
                txtFooter.Text             = objSettings.AppFooterText;
                chkSiteOffline.Checked     = objSettings.AppIsSiteOffline;
                txtSiteOfflineMessage.Text = objSettings.AppSiteOfflineMessage;
                txtSiteTagLine.Text        = objSettings.AppSiteTagLine;
                ddlPerMenu.SelectedValue   = objSettings.AppSiteDefaultListLimit;
                txtPathToFolder.Text       = objSettings.AppPathToFolder;
                //txtDatasourceName.Text = objSettings.AppDatasource;
                //txtDatasourceUserName.Text = objSettings.AppDatasourceUserName;
                //txtDataBaseName.Text = objSettings.AppDatabaseName;
                txtSMTP.Text           = objSettings.AppSMTP;
                txtSiteEmail.Text      = objSettings.AppSiteEmail;
                txtPortNumber.Text     = objSettings.AppPortNumber;
                txtClientSiteUrl.Text  = objSettings.AppClientSiteURL;
                txtRecepientEmail.Text = objSettings.AppRecepientEmail;

                if (objSettings.AppSiteOfflineImage.ToString() != "" && objSettings.AppSiteOfflineImage.ToString() != null)
                {
                    imgOfflineImage.ImageUrl = objSettings.AppSiteOfflineImage;
                }
                if (objSettings.AppSiteLogo.ToString() != "" && objSettings.AppSiteLogo.ToString() != null)
                {
                    ImgLogo.ImageUrl = objSettings.AppSiteLogo;
                }
                if (objSettings.AppSiteFavicon.ToString() != "" && objSettings.AppSiteFavicon.ToString() != null)
                {
                    ImgFavicon.ImageUrl = objSettings.AppSiteFavicon;
                }
                //txtDatasourcePassword.Attributes.Add("value", objSettings.AppDatasourcePassword);
                txtEmailPassword.Attributes.Add("value", objEncrypt.Decrypt(objSettings.AppEmailPassword, appFunctions.strKey));

                if (objSettings.s_AppIsCOD != "")
                {
                    CHkIsCOD.Checked = objSettings.AppIsCOD;
                }
                else
                {
                    CHkIsCOD.Checked = false;
                }
            }
            catch (Exception e)
            {
            }
        }
        objSettings = null;
    }
示例#2
0
    public void SetUpBlocks()
    {
        tblBlock      objBlock     = new tblBlock();
        StringBuilder blockContent = new StringBuilder();

        objBlockDt = objBlock.GetBlockByControlId();
        if (Cache["SiteName"] == null)
        {
            tblSettings objSettings = new tblSettings();
            objSettings.Query.AddResultColumn(tblSettings.ColumnNames.AppSiteName);
            objSettings.Query.AddResultColumn(tblSettings.ColumnNames.AppSiteTagLine);
            objSettings.Query.AddResultColumn(tblSettings.ColumnNames.AppSiteFavicon);
            objSettings.LoadAll();
            if (objSettings.RowCount > 0)
            {
                Cache["SiteName"] = objSettings.AppSiteName;
            }
        }

        for (int i = 0; i <= objBlockDt.Rows.Count - 1; i++)
        {
            blockContent = new StringBuilder();
            DataRow dr = objBlockDt.Rows[i];

            if (dr["appMenuTypeId"].ToString() != DBNull.Value.ToString() & (bool)dr["appIsShowContent"] == false)
            {
                objMenuItem = new tblMenuItem();
                objMenuDt   = new DataTable();
                objMenuDt   = objMenuItem.GetChildMenus((int)dr["appMenuTypeId"]);

                if (string.Compare(dr["appControlId"].ToString(), "divTopMenu") == 0)
                {
                    blockContent.Append(" <div style=\"background-color: #ED258F;\">");
                    blockContent.Append(" <div class=\"wrap\">");
                    blockContent.Append(" <div class=\"menu\">");
                    blockContent.Append("<ul class=\"megamenu skyblue\">");
                    LoadTopMenu(ref blockContent, 0);
                    blockContent.Append("</ul></div></div></div>");
                }
                else if (string.Compare(dr["appControlId"].ToString(), "divFooterBlock1") == 0)
                {
                    objMenuType = new tblMenuType();
                    if (objMenuType.LoadByPrimaryKey((int)dr["appMenuTypeId"]))
                    {
                        LoadFooterMenu(ref blockContent, 0, objMenuType.AppMenuTypeName);
                    }
                    objMenuType = null;
                }
                else if (string.Compare(dr["appControlId"].ToString(), "divFooterBlock2") == 0)
                {
                    objMenuType = new tblMenuType();
                    if (objMenuType.LoadByPrimaryKey((int)dr["appMenuTypeId"]))
                    {
                        LoadCategory(ref blockContent);
                    }
                    objMenuType = null;
                }
                else if (string.Compare(dr["appControlId"].ToString(), "divCategoryFooter") == 0)
                {
                    LoadCategoryFooter(ref blockContent);
                }
                else if (dr["appMenuTypeId"].ToString() != DBNull.Value.ToString())
                {
                    blockContent.Append("<ul>");
                    SetUpMenu(ref blockContent, 0);
                    blockContent.Append("</ul>");
                }
            }
            else if ((bool)dr["appIsShowContent"] == true)
            {
                blockContent.Append(dr["appContent"]);
            }

            StringBuilder strContent = new StringBuilder();
            strContent.Append(blockContent);
            blockContent = new StringBuilder();
            blockContent.Append(strContent.ToString().Replace("~GetServerURL()~", PageBase.GetServerURL() + "/"));


            if ((this.Master.FindControl("ContentPlaceHolder1").FindControl(dr["appControlId"].ToString()) != null))
            {
                ((HtmlContainerControl)this.Master.FindControl("ContentPlaceHolder1").FindControl(dr["appControlId"].ToString())).InnerHtml = blockContent.ToString();
            }
            else if ((this.Master.FindControl(dr["appControlId"].ToString()) != null))
            {
                ((HtmlContainerControl)this.Master.FindControl(dr["appControlId"].ToString())).InnerHtml = blockContent.ToString();
            }
        }
    }