918博天堂

Server : Microsoft-IIS/10.0
System : Windows NT EBS-6136 10.0 build 17763 (Windows Server 2016) i586
User : jxgj ( 0)
PHP Version : 7.0.33
Disable Function : passthru,exec,system,shell_exec,proc_open,popen,pcntl_exec,socket_bind,stream_socket_server
Directory :  D:/tmp_aspnet/root/712bd9e6/ca967f19/
Upload File :
Current Directory [ Writeable ] Root Directory [ Writeable ]


Current File : D:/tmp_aspnet/root/712bd9e6/ca967f19/App_Web_l0cr3nog.15.cs
?#pragma checksum "D:\wwwroot\bgsciences\wwwroot\sysmanage\files\left\addcoulum.aspx.cs" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "A8E77577BBAC2F0158360D9E4D3CB944B0E674B8"

#line 1 "D:\wwwroot\bgsciences\wwwroot\sysmanage\files\left\addcoulum.aspx.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;


public partial class sysmanage_files_left_addcoulum : System.Web.UI.Page
{
    protected string strtitle = "新建栏目";
    protected void Page_Load(object sender, EventArgs e)
    {
        login.OnLine();

        if (!IsPostBack)
        {
            //if (Session["UserName"] == null)
            //{
            //    Page.Response.Write("<script language='javascript'> top.window.location = '../../login.aspx' </script>");
            //}
            if (Request.Form["Option"] != null && Request.Form["Option"] != "")
            {
                int id = Convert.ToInt32(Request.Form["id"]);
                DataTable dtcount = SQLServerHelper.ExecuteTable("select * from J_leftcoulum where fid = " + id + "");
                if (dtcount.Rows.Count != 0)
                {
                    Response.Write("删除失败,请先删除下属子类");
                    Response.End();
                }
                SQLServerHelper.execNonQuery("delete from J_leftcoulum where id = " + id + "");
                Response.Write("栏目删除成功");
                Response.End();
            }
            if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
            {
                int id = Convert.ToInt32(Request.QueryString["id"]);
                ViewState["id"] = id;
                GetColData(id);
                strtitle = "编纂栏目";
                this.ddl_type.Enabled = false;
                this.bt_add.Text = "编纂";
                this.txt_url.Enabled = false;
                GetTypeKids(id);
                ClientScript.RegisterStartupScript(this.GetType(), "onlod", "<script type='text/javascript'>divdisplay()</script>");
            }

            BindTypes();


        }
    }
    //绑定栏目一级分类
    protected void BindTypes()
    {
        this.ddl_type.DataSource = SQLServerHelper.ExecuteTable("select id,sname from J_leftcoulum where fid = 0");
        this.ddl_type.Items.Clear();
        this.ddl_type.Items.Add(new ListItem("==选择==", "0"));
        this.ddl_type.DataTextField = "sname";
        this.ddl_type.DataValueField = "id";
        this.ddl_type.DataBind();
    }
    //加载栏目信息
    protected void GetColData(int id)
    {
        DataTable dtdata = SQLServerHelper.ExecuteTable("select * from J_leftcoulum where id = " + id + "");
        if (dtdata.Rows.Count != 0)
        {
            this.txt_name.Text = dtdata.Rows[0]["sname"].ToString();
            this.ddl_type.Items.Clear();
            this.txt_bz.Text = dtdata.Rows[0]["bz"].ToString();
        }
    }
    //加载所属子类
    protected void GetTypeKids(int id)
    {
        this.dl_typekids.DataSource = SQLServerHelper.ExecuteTable("select * from J_leftcoulum where fid = " + id + "");
        this.dl_typekids.DataBind();
    }
    protected void bt_add_Click(object sender, EventArgs e)
    {
        if (ViewState["id"] != null)
        {
            string strsql = "update J_leftcoulum set sname='" + this.txt_name.Text.Trim() + "',bz='" + this.txt_bz.Text.Trim() + "' where id = " + Convert.ToInt32(ViewState["id"]) + "";
            
            if (SQLServerHelper.execNonQuery(strsql))
            {
                MessageBox.Show(this, "编纂成功");
                Response.Redirect("coulumlist.aspx");
                return;
            }

        }
        else
        {
            if (ddl_type.SelectedValue != "0")
            {
                string strsql = "insert into J_leftcoulum (sname,url,bz,fid) values ('" + this.txt_name.Text.Trim() + "','" + this.txt_url.Text.Trim() + "','" + this.txt_bz.Text.Trim() + "'," + this.ddl_type.SelectedValue + ")";
                
                if (SQLServerHelper.execNonQuery(strsql))
                {
                    MessageBox.Show(this, "增长成功");
                    Response.Redirect("coulumlist.aspx");
                }

            }
            else
            {
                string strsql = "insert into J_leftcoulum (sname,bz,fid) values ('" + this.txt_name.Text.Trim() + "','" + this.txt_bz.Text.Trim() + "',0)";
                
                if (SQLServerHelper.execNonQuery(strsql))
                {
                    MessageBox.Show(this, "增长成功");
                    Response.Redirect("coulumlist.aspx");
                }
            }
        }

    }

    protected void bt_back_Click(object sender, EventArgs e)
    {
        Response.Redirect("coulumlist.aspx");
    }
}


#line default
#line hidden