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.user;
using hqgl.dept;
using WebMessageBox;
using HtmlTextFormat;
public partial class general_user_user_add : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            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)
    {
        userinfo uinfo = new userinfo();
        uinfo.u_id = Request["USER_ID"];
        uinfo.u_name=Request["USER_NAME"];
        uinfo.user_priv = DropDownList1.SelectedValue;
        uinfo.user_no=Text1.Value;
        uinfo.post_priv=Request["POST_PRIV"];
        uinfo.not_login=Request["NOT_LOGIN"];
        uinfo.not_view_user=Request["NOT_VIEW_USER"];
        uinfo.not_view_table=Request["NOT_VIEW_TABLE"];
        uinfo.duty_type=Request["DUTY_TYPE"];
        uinfo.password=Request["password"];
        uinfo.password = TextFormat.EncryptPassWord(uinfo.password);
        uinfo.sex=Request["SEX"];
        uinfo.birthday = Request["BIRTHDAY"];
        uinfo.dept_id =Select1.Value;
        userchuli uch = new userchuli();
        try
        {
            uch.user_add(uinfo);
        }
        catch
        {
            MessageBox.Show("此用户已存在", "user_add.aspx");
        }
        MessageBox.Show("添加成功", "user_add.aspx");
    }
}
