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

📄 mo_templatecontent_modi.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.Data.SqlClient;
using Shop.Web.UI;
namespace YXShop.Web.Admin.Templates
{
    public partial class Mo_TemplateContent_Modi : System.Web.UI.Page
    {
        BasePage bp = null;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!PowerTree.PowerPass.isPass("010002004", PowerTree.PowerPanel.PowerType.update))
            {
                bp = new BasePage();
                bp.PageError("对不起,你没有修改模板的权限!", "../index.aspx");
            }
            if (!IsPostBack)
            {
                if (!string.IsNullOrEmpty(Request["Mo_ID"]))
                {
                    BindData(Request["Mo_ID"]);
                }
                else
                {
                    msg.Text = "<font color='red'>温馨提示:对不起!模板信息已经不存在!</font><a href=# onclick='history.back(-1);'>返回</a>";
                    ModiBtn.Visible = false;
                    viewBtn.Visible = false;
                    msgbtn.Text ="<font color='red'>温馨提示:对不起!模板信息已经不存在!</font><a href=# onclick='history.back(-1);'>返回</a>";
                }

                YXShop.Common.WebUtility.WebControlOnblur(this.MO_Name);//去除空格
               
            }
        }

        public void BindData(string _id)
        {
            Tp_List_Bind();
            try
            {
                string sqlText = "select * from YX_Templates where Mo_ID="+int.Parse(_id);
                SqlDataReader dr = YXShop.DBUtility.SqlHelper.ExecuteReader(YXShop.DBUtility.SqlHelper.ConnectionStringLocalTransactionHr, CommandType.Text, sqlText, null);
                while (dr.Read())
                {
                    MO_Name.Text = dr[1].ToString();
                    TP_List.SelectedValue = dr[2].ToString();
                    channelBak.Value = dr[3].ToString();
                    typeBak.Value = dr[4].ToString();
                    templateContent.Text = dr[5].ToString();
                    isDefault.Checked = dr[6].ToString() == "1" ? true : false ;
                }
                dr.Close();
            }
            catch { }
             
        }

        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 ModiBtn_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(Request["Mo_ID"]))
            {
                if (TP_List.SelectedIndex != -1 && (!string.IsNullOrEmpty(Request["channel"])) && (!string.IsNullOrEmpty(Request["type"])))
                {
                    if ((!string.IsNullOrEmpty(MO_Name.Text)) && (!string.IsNullOrEmpty(TP_List.SelectedValue)) && (!string.IsNullOrEmpty(Request["channel"])) && (!string.IsNullOrEmpty(Request["type"])) && (!string.IsNullOrEmpty(templateContent.Text)))
                    {
                        try
                        {
                            int result = YXShop.TemplateAction.TemplateDo.UpdateTemplate(Request["Mo_ID"], MO_Name.Text, TP_List.SelectedValue, Request["channel"], Request["type"], templateContent.Text, isDefault.Checked == true ? "1" : "0");
                            if (result > -1)
                            {
                                msg.Text = "<font color='red'>温馨提示:修改模板<font color='blue'>" + MO_Name.Text + "</font>成功!</font>";
                                                                 
                            }

                        }
                        catch { }
                    }
                }
            }
        }

        protected void viewBtn_Click(object sender, EventArgs e)
        {

        }
    }
}

⌨️ 快捷键说明

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