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 hqgl.dept;
using System.Xml;
using WebMessageBox;
using hqgl.user;
public partial class general_dept_dept_add : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        userchuli uch = new userchuli();
        //uch.user_yanzheng();
        deptchuli dpc = new deptchuli();
        ListItemCollection lic = dpc.Make_DropList();
        foreach (ListItem li in lic)
        {
            Select1.Items.Add(li);
        }
    }

    protected void Submit1_ServerClick(object sender, EventArgs e)
    {
        deptinfo dinfo = new deptinfo();
        dinfo.dept_no = Request["DEPT_NO"];
        dinfo.dept_name = Request["DEPT_NAME"];
        dinfo.tel_no = Request["TEL_NO"];
        dinfo.fax_no = Request["FAX_NO"];
        dinfo.DEPT_PARENT = Request["Select1"];
        dinfo.DEPT_FUNC = Request["DEPT_FUNC"];
        deptchuli dch = new deptchuli();
        int res=dch.Dept_Add(dinfo);
        if (res != 1)
            MessageBox.Show("添加失败,请重新添加", "default.aspx");
        else
        { 
            UpDate() ;
            MessageBox.Show("添加成功", "default.aspx");
        }
    }
    public void UpDate()
    {
        Response.Write("<script>parent.document.getElementById(\"left\").src=\"./dept/tree.aspx\"</script>");
    }
    
}
