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

📄 channel_class_add.aspx.cs

📁 易想商城系统
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using YXShop.DBUtility;
using Shop.Web.UI;
namespace YXShop.Web.Admin.Article
{
    public partial class Channel_Class_Add : System.Web.UI.Page
    {
        private string channelID = "";
        public string channelBar = "";
        BasePage bp = null;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!PowerTree.PowerPass.isPass("012002002", PowerTree.PowerPanel.PowerType.add))
            {
                bp = new BasePage();
                bp.PageError("对不起,你没有添加分类的权限!", "../index.aspx");
            }
            if (Request["channelID"] != "")
            {
                this.channelID = Request["channelID"].ToString();
            }
            else
            {
                YXShop.Common.alert.show("提供的频道ID有误!");
            }
            if (!Page.IsPostBack)
            {
                BindAddInfo(this.channelID);
                ClassName_Text.Attributes.Add("onblur", "this.value=this.value.replace(/\\s/g,'');");
            }
        }

        #region  绑定初始数据
        public void BindAddInfo(string channelId)
        {
            BLL.YixiangChannel bll = new BLL.YixiangChannel();
            channelBar = bll.ChannelNavigation(channelId);
            ChannelID_Text.Text = SqlHelper.ExecuteScalar(SqlHelper.ConnectionStringLocalTransactionHr, CommandType.Text, "SELECT YX_Name FROM YX_InforChannel where YX_ID="+int.Parse(channelId), null).ToString();
            BindDropDownList(channelId, ParentID_List);
        }
        #endregion

        #region  绑定DropDownList
        public void BindDropDownList(string channelId, System.Web.UI.WebControls.DropDownList dlist)
        {
            SqlDataReader dr = new YXShop.BLL.YixiangChannelClass().SelectChannelClass_Reader(channelId);
            YXShop.BLL.YixiangChannelClass bll = new YXShop.BLL.YixiangChannelClass();
            bll.BindDropDownList_Class(channelId, dlist, dr);
        }
        #endregion

        #region 执行添加
        protected void ClassAddBtn_Click(object sender, EventArgs e)
        {
            YXShop.BLL.YixiangChannelClass bll = new YXShop.BLL.YixiangChannelClass();
            string className = YXShop.Common.WebUtility.InputText(ClassName_Text.Text.ToString(), ClassName_Text.Text.ToString().Length);
            string classDes = YXShop.Common.WebUtility.GetLenghtAll(YXShop.Common.WebUtility.InputText(ClassDes_Text.Text.ToString(), ClassDes_Text.Text.ToString().Length), 800);
            if (ParentID_List.SelectedIndex != -1)
            {
                int result = bll.AddChannelClass(className, Convert.ToInt32(ParentID_List.SelectedValue.ToString()), classDes, Convert.ToInt32(this.channelID));
                if (result != 0)
                {
                    YXShop.Common.alert.showAndGo("添加类别成功!", "Channel_Class_Manage.aspx?channelID=" + this.channelID + "");
                }
                else
                {
                    YXShop.Common.alert.showAndGo("发生异常!添加类别失败!", "Channel_Class_Manage.aspx?channelID=" + this.channelID + "");
                }
            }
            else
            {
                YXShop.Common.alert.show("操作失败!请选择所属的类别!");
            }
        }
        #endregion

    }
}

⌨️ 快捷键说明

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