protected void btnOK_Click(object sender, EventArgs e) { string userName = this.tbUser.Text; char sex = Convert.ToChar(this.ddlSex.SelectedItem.Value); string phoneNum = this.tbPhone.Text; string mPhoneNum = this.tbMPhone.Text; string Email = this.tbEmail.Text; string fax = this.tbFax.Text; string province = this.ddlProvince.SelectedValue; string birth = this.tbBirthday.Value; string dept = this.ddlDept.Text; string type = this.ddlType.SelectedValue.ToString(); string role = this.ddlRole.SelectedValue.ToString(); if (this.btnOK.Text == "修改") { if (UserManage.UpdateUser(Convert.ToInt32(ViewState["userid"]), sex, phoneNum, mPhoneNum, Email, fax, province, birth, dept, type, role)) { // Common.WebTools.Alert(this,"修改成功!"); this.btnOK.SubmitSuccess("修改成功!"); //Page.RegisterStartupScript("script", "<script>alert('修改成功!');window.location.href='UserEdit.aspx?username="******"username"] + "';"); } else { Common.WebTools.Alert(this, "修改失败!"); } } else { if ((UserManage.UserRegisterValidate(userName)).Read()) { Common.WebTools.Alert(this, "该用户名已存在!"); return; } else { if (UserManage.AddEmployee(userName, sex, phoneNum, mPhoneNum, Email, fax, province, birth, dept, type, role)) { this.btnOK.Url = "UserEdit.aspx?username="******"添加成功!"); } else { Common.WebTools.Alert(this, "添加失败!"); } } } }