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_yo3oio40.3.cs
?#pragma checksum "D:\wwwroot\bgsciences\wwwroot\sysmanage\files\new\new.aspx.cs" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "B1DDCD0FCF56EE7C43F22FC8752F451817E43530"

#line 1 "D:\wwwroot\bgsciences\wwwroot\sysmanage\files\new\new.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_new_new : System.Web.UI.Page
{
    protected string strtitle = "颁布新闻";
    protected string strpic = string.Empty;
    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>");
            //}
            BindWZType();
            BindLGType();
            this.txt_date.Text = DateTime.Now.ToString("yyyy-MM-dd") + " " + DateTime.Now.ToLongTimeString();
            if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
            {
                strtitle = "编纂新闻";
                int id = Convert.ToInt32(Request.QueryString["id"]);
                ViewState["id"] = id;
                BindNewsData(id);
            }
        }

    }
    //绑定文章类型
    protected void BindWZType()
    {
        DataTable dt = SQLServerHelper.ExecuteTable("select id,sname from TB_NewClass");
        if (dt.Rows.Count > 0)
        {
            this.ddl_type.Items.Clear();
            //this.ddl_type.Items.Add(new ListItem("请选择", ""));
            this.ddl_type.DataSource = dt;
            this.ddl_type.DataTextField = "sname";
            this.ddl_type.DataValueField = "id";
            this.ddl_type.DataBind();
        }
    }
    //绑定说话版本
    protected void BindLGType()
    {
        DataTable dt = SQLServerHelper.ExecuteTable("select id,lg from TB_LG");
        if (dt.Rows.Count > 0)
        {
            this.ddl_lg.DataSource = dt;
            this.ddl_lg.DataTextField = "lg";
            this.ddl_lg.DataValueField = "id";
            this.ddl_lg.DataBind();
        }
    }
    /// <summary>
    /// 凭据ID取新闻内容
    /// </summary>
    /// <param name="id"></param>
    protected void BindNewsData(int id)
    {
        DataTable dt = SQLServerHelper.ExecuteTable("select * from TB_News where id = " + id + "");
        if (dt.Rows.Count > 0)
        {
            this.txt_title.Text = dt.Rows[0]["title"].ToString();
            this.txt_order.Text = dt.Rows[0]["orders"].ToString();
            this.txt_zhaiyao.Text = dt.Rows[0]["ftitle"].ToString();
            this.txt_content.Value = dt.Rows[0]["contents"].ToString();
            this.ddl_type.SelectedValue = dt.Rows[0]["types"].ToString();
            this.ddl_lg.SelectedValue = dt.Rows[0]["lg"].ToString();
            this.txt_clickcount.Text = dt.Rows[0]["clickcount"].ToString();
            this.txt_date.Text = Convert.ToDateTime(dt.Rows[0]["regtime"].ToString()).ToString("yyyy-M-dd") + " " + Convert.ToDateTime(dt.Rows[0]["regtime"].ToString()).ToLongTimeString();
            if (dt.Rows[0]["pic"].ToString() != "") //图片
            {
                strpic = dt.Rows[0]["pic"].ToString();
                ClientScript.RegisterStartupScript(this.GetType(), "dsf", "<script language='javascript'>setpic('pic_show','pic_up')</script>");
            }
        }
    }


    protected void bt_add_Click(object sender, EventArgs e)
    {
        if (ViewState["id"] != null)
        {
            string strsql = string.Empty;
            string pic = string.Empty;
            if (FileUpPIC.FileName != null && FileUpPIC.FileName != "")
            {
                pic = PicUtil.PicUp(FileUpPIC, "upfile/newspic");//上传照片
                if (pic == "")
                {
                    return;
                }
                strsql = "update TB_News set title='" + this.txt_title.Text.Trim() + "',ftitle='"+this.txt_zhaiyao.Text.Trim()+"',pic = '" + pic + "',contents = '" + this.txt_content.Value + "',types = '" + this.ddl_type.SelectedValue.ToString().Trim() + "',clickcount = " + this.txt_clickcount.Text.Trim() + ",orders = "+this.txt_order.Text.Trim()+",regtime = '" + this.txt_date.Text.Trim() + "',lg = " + this.ddl_lg.SelectedValue.Trim() + " where id = " + ViewState["id"] + "";
            }
            else
            {
                strsql = "update TB_News set title='" + this.txt_title.Text.Trim() + "',ftitle='" + this.txt_zhaiyao.Text.Trim() + "',contents = '" + this.txt_content.Value + "',types = '" + this.ddl_type.SelectedValue.ToString().Trim() + "',clickcount = " + this.txt_clickcount.Text.Trim() + ",orders = " + this.txt_order.Text.Trim() + ",regtime = '" + this.txt_date.Text.Trim() + "',lg = " + this.ddl_lg.SelectedValue.Trim() + " where id = " + ViewState["id"] + "";
            }
            if (SQLServerHelper.execNonQuery(strsql))
            {
                Response.Redirect("newslist.aspx");
                return;
            }

        }
        else
        {
            string pic = string.Empty;
            if (FileUpPIC.FileName != null && FileUpPIC.FileName != "")
            {
                pic = PicUtil.PicUp(FileUpPIC, "upfile/newspic");//上传照片
                if (pic == "")
                {
                    return;
                }
            }
            string strsql = "insert into TB_News (title,ftitle,orders,contents,pic,lg,types,clickcount,regtime) values ('" + this.txt_title.Text.Trim() + "','" + txt_zhaiyao.Text.Trim() + "'," + this.txt_order.Text.Trim() + ",'" + this.txt_content.Value + "','" + pic + "'," + this.ddl_lg.SelectedValue.Trim() + "," + this.ddl_type.SelectedValue + "," + this.txt_clickcount.Text.Trim() + ",'" + this.txt_date.Text.Trim() + "')";
            if (SQLServerHelper.execNonQuery(strsql))
            {
                Response.Redirect("newslist.aspx");
            }
        }


    }
}


#line default
#line hidden