protected void btnSave_Click(object sender, EventArgs e)
        {
            int userId = 0;

            if (Request.QueryString["users_id"] != null)
            {
                userId = int.Parse(Request.QueryString["users_id"]);
            }

            // *验证用户输入的信息*/
            if (string.IsNullOrEmpty(UserName.Text))
            {
                MessageBox.ResponseScript(this, "您好,请填写用户名!");
            }
            if (string.IsNullOrEmpty(Password.Text))
            {
                MessageBox.ResponseScript(this, "您好,请填写密码!");
            }
            if (string.IsNullOrEmpty(CompanyName.Text))
            {
                MessageBox.ResponseScript(this, "您好,请填写公司名称!");
            }

            EnterpriseUserBLL enterpriseUserBll = new EnterpriseUserBLL();
            EnterpriseUser enterpriseUser = new EnterpriseUser();
            if (0 == userId)
            {
                if (enterpriseUserBll.Exists(UserName.Text.Trim().ToLower()))
                {
                    MessageBox.ShowAndRedirect(this, "用户添加失败:此用户名已存在", "AddEnterpriseUser.aspx");
                    return;
                }
                enterpriseUser.Username = UserName.Text.Trim().ToLower();
                enterpriseUser.Users_incname = CompanyName.Text.Trim();
                enterpriseUser.Password = Password.Text.Trim().ToLower();
                enterpriseUser.Users_phone = txtbPhone.Text.Trim();
                enterpriseUser.Users_contact = txtbContact.Text.Trim();

                if (enterpriseUserBll.Add(enterpriseUser) != -1)
                {
                    MessageBox.ShowAndRedirect(this, "企业用户添加成功", "EnterpriseUserList.aspx");
                }
                else
                {
                    MessageBox.ShowAndRedirect(this, "企业用户添加失败", "EnterpriseUserList.aspx");
                }
            }
            else
            {
                enterpriseUser.Id = userId;
                enterpriseUser.Username = UserName.Text.Trim();
                enterpriseUser.Users_incname = CompanyName.Text.Trim();
                enterpriseUser.Password = Password.Text.Trim();
                enterpriseUser.Users_phone = txtbPhone.Text.Trim();
                enterpriseUser.Users_contact = txtbContact.Text.Trim();
                if (enterpriseUserBll.Update(enterpriseUser) == 1)
                {
                    MessageBox.ShowAndRedirect(this, "企业用户修改成功", "EnterpriseUserList.aspx");
                }
                else
                {
                    MessageBox.ShowAndRedirect(this, "企业用户修改失败", "EnterpriseUserList.aspx");
                }
            }
        }
 protected void UserName_TextChanged(object sender, EventArgs e)
 {
     EnterpriseUserBLL enterpriseUserBll = new EnterpriseUserBLL();
     if (enterpriseUserBll.Exists(UserName.Text.Trim().ToLower()))
     {
         lblMessage.Text = "该用户名已经注册";
     }
     else
     {
         lblMessage.Text = "";
     }
 }