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

📄 mo_customlabel_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 Shop.Web.UI;

namespace YXShop.Web.Admin.Templates
{
    public partial class Mo_CustomLabel_Add : System.Web.UI.Page
    {
        BasePage bp = null;
        protected void Page_Load(object sender, EventArgs e)
        {
            YXShop.Common.WebUtility.WebControlOnblur(CusLabelName);
            if (!PowerTree.PowerPass.isPass("011002002", PowerTree.PowerPanel.PowerType.add))
            {
                bp = new BasePage();
                bp.PageError("对不起,你没有添加自定义标签的权限!", "../index.aspx");
            }
            if (!IsPostBack)
            {
                DataBindLabelKind();
                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>]";
                
                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();
        }
        public void DataBindLabelKind()
        {
            try
            {
                CusLabelKind.DataSource = YXShop.TemplateAction.CusLabelDo.GetLabelKindName();
                CusLabelKind.DataTextField = "CusLabelKind_Name";
                CusLabelKind.DataValueField = "CusLabelKind_ID";
                CusLabelKind.DataBind();
            }
            catch { }
            if (CusLabelKind.Items.Count <= 0)
            {
                msgDiv.Visible = true;
            }
            else
            {
                msgDiv.Visible = false;
            }
        }

        protected void addBtn_Click(object sender, EventArgs e)
        {
            if (CusLabelKind.Items.Count > 0)
            {
                if ((!string.IsNullOrEmpty(CusLabelName.Text)) && (!string.IsNullOrEmpty(CusLabelContent.Text)))
                {
                    if (YXShop.TemplateAction.CusLabelDo.CheckLabelNameSame("0", "{@YX_" + CusLabelName.Text + "}") != 1)
                    {
                        try
                        {
                            int result = YXShop.TemplateAction.CusLabelDo.AddCusLabel("{@YX_" + CusLabelName.Text + "}", CusLabelKind.SelectedValue, CusLabelDes.Text, CusLabelContent.Text,Convert.ToInt32(TP_List.SelectedValue));
                            if (result > -1)
                            {
                                CusLabelDes.Text = "";
                                CusLabelContent.Text = "";
                                msg.Text = "<font color='red'>操作提示:添加</font><font color='blue'>{@YX_" + CusLabelName.Text + "}</font><font color='red'>用户自定义标签成功!</font>";
                                CusLabelName.Text = "";
                            }
                            else
                            {
                                msg.Text = "<font color='red'>操作提示:添加</font><font color='blue'>{@YX_" + CusLabelName.Text + "}</font><font color='red'>用户自定义标签失败!</font>";
                            }
                        }
                        catch { }
                    }
                    else
                    {
                        msg.Text = "<font color='red'>温馨提示:对不起!你所添加的</font><font color='blue'>{@YX_" + CusLabelName.Text + "}</font><font color='red'>用户自定义标签名称已经存在,请另换一个!</font>";
                    }
                }
            }
        }

    }
}

⌨️ 快捷键说明

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