using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
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 admin_News_AddNews : BasePage
{
    public EasyAccess AccessHelper = new EasyAccess();
    protected void Page_Load(object sender, EventArgs e)
    {
       // TextBox3.Text = DateTime.Now.ToString();
        if (!IsPostBack)
        {
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (DropDownList1.SelectedValue=="0")
        {
            JWindow.ShowDialog("请选择信息分类.");
            return;
        }
        string sql = "insert into news(n_title,n_user,n_date,n_content,tid,ischild) values ('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" + FCKeditor1.Value + "','"+DropDownList1.SelectedValue+"','0')";
        if (DropDownList2.Visible)
        {
            if (DropDownList2.SelectedValue == "0")
            {
                JWindow.ShowDialog("请选择信息子分类.");
                return;
            }
            sql = "insert into news(n_title,n_user,n_date,n_content,tid,childtype,ischild) values ('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" + FCKeditor1.Value + "','" + DropDownList1.SelectedValue + "','"+DropDownList2.SelectedValue+"','1')";
        }
        //Response.Write(sql);
        bool IsOK = AccessHelper.ExecuteNonQuery(sql);
        if (IsOK)
        {
            JWindow.ShowDialog("信息添加成功！");
        }
        else
        {
            JWindow.ShowDialog("信息添加失败！");
        }
    }

    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        string tid=DropDownList1.SelectedValue.ToString();
        switch (tid)
        {
            case "10102813384223"://文件下载
                DropDownList2.Visible = true; DropDownList2.Items.Clear();
                DropDownList2.Items.Insert(0,new ListItem("==请选择==","0"));
                DropDownList2.Items.Insert(1, new ListItem("招标文件", "1"));
                DropDownList2.Items.Insert(2, new ListItem("资格预审文件", "2"));
                DropDownList2.Items.Insert(3, new ListItem("工程量清单", "3"));
                DropDownList2.Items.Insert(4, new ListItem("补遗书", "4"));
                DropDownList2.Items.Insert(5, new ListItem("图纸", "5"));
                DropDownList2.Items.Insert(6, new ListItem("其他", "6"));
                break;
            case "10102813400000"://公示
                DropDownList2.Visible = true;
                DropDownList2.Items.Clear();
                DropDownList2.Items.Insert(0, new ListItem("==请选择==","0"));
                DropDownList2.Items.Insert(1, new ListItem("资格预审结果公示","7"));
                DropDownList2.Items.Insert(2, new ListItem("中标公示", "8"));
                DropDownList2.Items.Insert(3, new ListItem("招标人报价公示", "9"));
                break;
             default:
                DropDownList2.Visible = false;
                break;
        }
    }
}
