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

📄 special_add.aspx.cs

📁 最好用的站点内容管理系统 全部源代码都有
💻 CS
字号:
//======================================================
//==     (c)2008 aspxcms inc by NeTCMS v1.0              ==
//==          Forum:bbs.aspxcms.com                   ==
//==         Website:www.aspxcms.com                  ==
//======================================================
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 NetCMS.Content;
using NetCMS.Model;

public partial class manage_channel_Special_add : NetCMS.Web.UI.ManagePage
{
    public manage_channel_Special_add()
    {
        this.Authority_Code = "D006";
    }
    Channel rd = new Channel();
    public static string dirm = NetCMS.Config.UIConfig.dirDumm;
    public static string htmldir = string.Empty;
    public static string sId = string.Empty;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (SiteID != "0")
            {
                PageError("分站没权限操作", "javascript:history.back();", true);
            }
            copyright.InnerHtml = CopyRight;
            if (dirm.Trim() != string.Empty) { dirm = "/" + dirm; }
            string ChID = Request.QueryString["ChID"];
            string SpecialID = Request.QueryString["SpecialID"];
            string Action = Request.QueryString["Action"];
            string sId = Request.QueryString["sId"];
            if (SpecialID != string.Empty && SpecialID != null)
            {
                gParentID.InnerHtml = rd.getSpecialName(int.Parse(SpecialID.ToString()));
                ParanetID.Value = SpecialID.ToString();
                gSpecialID.Value = ClassID.ToString();
            }
            else
            {
                gParentID.InnerHtml = "根专题";
                ParanetID.Value = "0";
            }
            if (ChID == string.Empty || ChID == null)
            {
                PageError("错误的参数", "javascript:history.back()", true);
            }
            else
            {
                IDataReader gCdr = rd.ChannelInfo(int.Parse(ChID.ToString()));
                if (gCdr.Read())
                {
                    ChannelName.InnerHtml = gCdr["channelName"].ToString();
                }
                gCdr.Close();
                if (Action != string.Empty && Action != null)
                {
                    if (sId != null && sId != string.Empty)
                    {
                        IDataReader gsdr = rd.getSpecialInfo(int.Parse(sId.ToString()));
                        if (gsdr.Read())
                        {
                            this.specialCName.Text = gsdr["specialCName"].ToString();
                            this.specialEName.Text = gsdr["specialEName"].ToString();
                            this.binddomain.Text = gsdr["binddomain"].ToString();
                            this.navicontent.Text = gsdr["navicontent"].ToString();
                            this.savePath.Text = gsdr["savePath"].ToString();
                            this.filename.Text = gsdr["filename"].ToString();
                            this.templet.Text = gsdr["templet"].ToString();
                            this.PicURL.Text = gsdr["PicURL"].ToString();
                            this.OrderID.Text = gsdr["OrderID"].ToString();
                            if (gsdr["isLock"].ToString() == "1")
                            {
                                this.isLock.Checked = true;
                            }
                            if (gsdr["isRec"].ToString() == "1")
                            {
                                this.isRec.Checked = true;
                            }
                        }
                        gsdr.Close();
                    }
                    else
                    {
                        PageError("参数传递错误", "javascript:history.back()", true);
                    }
                }
                else
                {
                    this.Authority_Code = "D006";
                    this.CheckAdminAuthority();
                    if (SpecailID != null && SpecailID != string.Empty)
                    {
                        IDataReader sdr = rd.getSpecialInfo(int.Parse(SpecailID.ToString()));
                        if (sdr.Read())
                        {
                            this.savePath.Text = sdr["savePath"].ToString();
                            this.templet.Text = sdr["templet"].ToString();
                            this.filename.Text = sdr["filename"].ToString();
                        }
                        sdr.Close();
                    }
                    else
                    {
                        IDataReader dr = rd.ChannelInfo(int.Parse(ChID.ToString()));
                        if (dr.Read())
                        {
                            this.savePath.Text = "special";
                            this.templet.Text = "/{@dirTemplet}/" + dr["TempletPath"].ToString() + "/" + dr["specialtemplet"].ToString();
                        }
                        dr.Close();
                    }
                }
            }
        }
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            int ParentID = 0;
            if (Request.QueryString["SpecialID"] != string.Empty && Request.QueryString["SpecialID"] != null)
            {
                ParentID = int.Parse(Request.QueryString["SpecialID"]);
            }
            int ID = 0;
            if (Request.QueryString["sId"] != string.Empty && Request.QueryString["sId"] != null)
            {
                ID = int.Parse(Request.QueryString["sId"]);
            }
            int ChID = int.Parse(Request.QueryString["ChID"]);
            string specialCName = this.specialCName.Text;
            string specialEName = this.specialEName.Text;
            if (rd.getSpecialCord(specialEName, ID) > 0)
            {
                PageError("专题英文名称已经存在", "javascript:history.back()", true);
            }
            string binddomain = this.binddomain.Text;
            string navicontent = this.navicontent.Text;
            if (navicontent.Length > 200)
            {
                PageError("专题导读最大为200字符", "javascript:history.back()", true);
            }
            int OrderID = 0;
            if (NetCMS.Common.Input.IsInteger(this.OrderID.Text))
            {
                OrderID = int.Parse(this.OrderID.Text);
            }
            string savePath = this.savePath.Text;
            string filename = this.filename.Text;
            string templet = this.templet.Text;
            string PicURL = this.PicURL.Text;
            int islock = 0;
            if (this.isLock.Checked)
            {
                islock = 1;
            }
            int isRec = 0;
            if (this.isRec.Checked)
            {
                isRec = 1;
            }
            ChannelSpecialInfo uc = new ChannelSpecialInfo();
            uc.Id = ID;
            uc.ParentID = ParentID;
            uc.ChID = ChID;
            uc.specialCName = specialCName;
            uc.specialEName = specialEName;
            uc.binddomain = binddomain;
            uc.navicontent = navicontent;
            uc.savePath = savePath;
            uc.filename = filename;
            uc.templet = templet;
            uc.PicURL = PicURL;
            uc.islock = islock;
            uc.isRec = isRec;
            uc.OrderID = OrderID;
            if (ID != 0)
            {
                //修改
                rd.updateSpecialInfo(uc);
                PageRight("修改专题成功", "Special_list.aspx?ChID=" + Request.QueryString["ChID"] + "", true);
            }
            else
            { 
                //插入新记录
                rd.insertSpecialInfo(uc);
                PageRight("添加专题成功", "Special_list.aspx?ChID=" + Request.QueryString["ChID"] + "", true);
            }

        }
    }
}

⌨️ 快捷键说明

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