⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mo_style_add.aspx.cs

📁 易想商城系统
💻 CS
字号:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Text;
using Shop.Web.UI;
namespace YXShop.Web.Admin.Templates
{
    public partial class Mo_Style_Add : System.Web.UI.Page
    {
        BasePage bp = null;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!PowerTree.PowerPass.isPass("010004002", PowerTree.PowerPanel.PowerType.add))
            {
                bp = new BasePage();
                bp.PageError("对不起,你没有添加风格样式的权限!", "../index.aspx");
            }
            if (!IsPostBack)
            {
                YXShop.Common.WebUtility.WebControlOnblur(this.cssName);//去除空格
                BindData();
            }
        }
        public void BindData()
        {
            Tp_List_Bind();
            if (TP_List.Items.Count <= 0)
            {
                TP_List.Visible = false;
                msgkind.Text = "请[<a href='Mo_Add.aspx' style='color:red'>添加模板方案</a>]";
                addBtn.Visible = false;
                msgbtn.Text = "温馨提示:当前暂无任何模板方案!请先[<a href='Mo_Add.aspx' style='color:red'>添加模板方案</a>]";
            }
        }
   
        public void Tp_List_Bind()
        {
          TP_List.DataSource= YXShop.TemplateAction.TemplateDo.GetTemplateList();
          TP_List.DataTextField = "TP_Name";
          TP_List.DataValueField = "TP_ID";
          TP_List.DataBind();
        }
        
        protected void addBtn_Click(object sender, EventArgs e)
        {

            if ((!string.IsNullOrEmpty(cssName.Text)) && (!string.IsNullOrEmpty(cssFileName.Text)) && (!string.IsNullOrEmpty(cssContent.Text)))
            {
                if(TP_List.SelectedIndex!=-1)
                {
                    try
                    {
                        YXShop.DBUtility.fileHelper.WriteTextFile(Server.MapPath("~/Skins/Skins" + TP_List.SelectedValue.ToString() + "/" + cssFileName.Text + ".css"), cssContent.Text, false, true, Encoding.Default);
                        string sqlText = "insert into YX_Css(Css_TP,Css_Name,Css_FileName,Css_IsDefault) values(" + TP_List.SelectedValue + ",'" + cssName.Text + "','" + cssFileName.Text + "',0)";
                        YXShop.DBUtility.SqlHelper.ExecuteNonQuery(YXShop.DBUtility.SqlHelper.ConnectionStringLocalTransactionHr, CommandType.Text, sqlText, null);
                        msg.Text = "<font color='red'>添加css样式成功![<a href='Mo_Style_Manage.aspx'>管理Css样式</a>]</font>";
                    }
                    catch
                    {
                        msg.Text = "<font color='red'>添加css样式失败![<a href='Mo_Style_Manage.aspx'>管理Css样式</a>]</font>";

                    }
                }
            }
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -