private void InsertTest() { string time = Stopwatch(() => { for (int i = 1; i < 5; i++) { string time2 = Stopwatch(() => { string key = Guid.NewGuid().ToString().Replace("-", ""); string md5 = Md5Helper.Md5("123456"); string realPassword = Md5Helper.Md5(DESEncryptHelper.Encrypt(md5, key)); UserEntity user = new UserEntity { UserId = Guid.NewGuid().ToString().Replace("-", ""), Account = "dashixiong" + i, NickName = "大师兄" + i, Birthday = DateTime.Now.AddDays(-1000), Secretkey = key, Password = realPassword }; user.Create(); bool res = UserBll.AddUser(user); }); Console.WriteLine("开始测试" + i + ",耗时:" + time2); } }); Console.WriteLine("执行结束,耗时:" + time); }
public void AddUserTest1() { var mockUserInfoModel = new Mock <DbSet <WUserInfoModel> >(); mockDbContext.Setup(n => n.UserInfoModels).Returns(mockUserInfoModel.Object); mockDbContext.Setup(n => n.SaveChanges()).Returns(1); var result = userBll.AddUser("曾小贤"); Assert.IsTrue(result); }
public ActionResult RegisterVail(string UserName, string Password, int roleId) { JsonModel jm = new JsonModel(); Users user = new Users(); string msg = ""; DataSet ds = new DataSet(); user.Uname = UserName; user.Pwd = Password; ds = bll.GetUserNameList(user); if (ds.Tables[0].Rows.Count > 0) { jm.status = 0; jm.msg = "此用户已经存在!"; } else { user.roleId = roleId; int n = bll.AddUser(user); //int n = bll.AddUser(UserName,Password,roleId); if (n > 0) { jm.status = 1; } else { jm.status = 0; jm.msg = msg; } } return(Json(jm, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 添加用户 /// </summary> /// <param name="openID"></param> /// <param name="nickname"></param> /// <returns></returns> public JsonResult GetUserInfo(string openid, string nickname) { try { UserModel model = new UserModel(); UserBLL bll = new UserBLL(); model = bll.GetUserModelByID(openid); if (model != null) { return(Json(new { Model = model, IsExist = true }, JsonRequestBehavior.AllowGet)); } else { model = new UserModel(); model.OpenID = openid; model.NickName = nickname; bll.AddUser(model); return(Json(new { Model = model, IsExist = false }, JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { throw ex; } }
/// <summary> /// 上传头像 /// </summary> /// <returns></returns> public ActionResult UploadFile() { HttpFileCollection files = System.Web.HttpContext.Current.Request.Files; //没有文件上传,直接返回 if (files[0].ContentLength == 0 || string.IsNullOrEmpty(files[0].FileName)) { return(HttpNotFound()); } string fileEextension = Path.GetExtension(files[0].FileName); string userId = OperatorProvider.Provider.Current().UserId; string virtualPath = string.Format("/upload/images/head/{0}{1}", userId, fileEextension); string fullFileName = DirFileHelper.MapPath(virtualPath); //创建文件夹,保存文件 string path = Path.GetDirectoryName(fullFileName); if (!string.IsNullOrEmpty(path)) { Directory.CreateDirectory(path); files[0].SaveAs(fullFileName); } UserEntity userEntity = new UserEntity { Id = OperatorProvider.Provider.Current().UserId, HeadIcon = virtualPath, EnabledMark = true, DeleteMark = false }; bool isSucc = userBLL.AddUser(userEntity.Id, userEntity, out userId); return(Success(isSucc ? "上传成功。" : "上传失败")); }
public void Register_User() { UserInfo user = new UserInfo() { UserId = HttpContext.Current.Request["UserId"], UserName = HttpContext.Current.Request["UserName"], PassWord = HttpContext.Current.Request["PassWord"], Sex = HttpContext.Current.Request["Sex"], Age = Convert.ToInt32(HttpContext.Current.Request["Age"]), Email = HttpContext.Current.Request["Email"], OnlineTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Status = StatusEnum.在线.ToString() }; if (!userBLL.AddUser(user)) { responseResult.ResponseDetails = "注册用户失败!"; responseResult.ResponseStatus = 0; } else { responseResult.ResponseData = user; responseResult.ResponseDetails = "注册用户成功!"; responseResult.ResponseStatus = 1; } responseResult.ResponseWrite(); }
public ActionResult AddUser(UserDTO model) { if (model.UserImage == null) { ViewBag.ProcessState = General.Messages.ImageMissing; } else if (ModelState.IsValid) { string filename = ""; HttpPostedFileBase postedfile = model.UserImage; Bitmap UserImage = new Bitmap(postedfile.InputStream); Bitmap resizeImage = new Bitmap(UserImage, 128, 128); string ext = Path.GetExtension(postedfile.FileName); if (ext == ".jpg" || ext == ".jpeg" || ext == ".png" || ext == ".gif") { string uniqueNumber = Guid.NewGuid().ToString(); filename = uniqueNumber + postedfile.FileName; resizeImage.Save(Server.MapPath("~/Areas/Admin/Content/UserImage/" + filename)); model.Imagepath = filename; bll.AddUser(model); ViewBag.ProcessState = General.Messages.AddSuccess; ModelState.Clear(); model = new UserDTO(); } else { ViewBag.ProcessState = General.Messages.ExtensionError; } } else { ViewBag.ProcessState = General.Messages.EmptyArea; } return(View(model)); }
/// <summary> /// 添加用户 /// </summary> /// <param name="openID"></param> /// <param name="nickname"></param> /// <returns></returns> public JsonResult GetUserInfo(string code, string nickname) { try { string openid = GetOpenidByCode(code); UserModel model = new UserModel(); UserBLL bll = new UserBLL(); model = bll.GetUserModelByID(openid); if (model != null) { return(Json(new { OpenID = model.OpenID }, JsonRequestBehavior.AllowGet)); } else { model = new UserModel(); model.OpenID = openid; model.NickName = nickname; model.Createtime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); model.Modifytime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); bll.AddUser(model); return(Json(new { OpenID = openid }, JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { throw ex; } }
protected void UserOk_Click(object sender, EventArgs e) { if (ErrUserList.Count == 0) { if (UserList.Count > 0) { UserOk.Enabled = false; foreach (UserInfo Item in UserList) { Item.CompanyID = CompanyId; Item.Address = CompanyAddress; UserBLL.AddUser(Item); } UserList.Clear(); ScriptHelper.Alert("导入成功!"); } else { ScriptHelper.Alert("异常错误,请重新导入!"); } } else { ScriptHelper.Alert("请修正完错误后,再入库!"); } }
private void btnOk_Click(object sender, EventArgs e) { //判断验证码和2次密码是否相同 if (txtPwd1.Text != txtPwd2.Text) { CCWin.MessageBoxEx.Show("两次密码不一样"); return; } if (txtCode.Text.Trim().ToLower() != skinCode1.CodeStr.ToLower()) { CCWin.MessageBoxEx.Show("验证码输入不正确!!"); skinCode1.NewCode(); return; } //处理数据 User model = new User(); UserBLL bll = new UserBLL(); model.Name = txtName.Text.Trim(); model.Pwd = txtPwd1.Text.Trim(); model.Remark = txtRemark.Text.Trim(); model.Role_id = (int)cmbRole.SelectedValue; model.Submitter_id = frmMain.current_user.Id; SelfForm.Msbox.Show(bll.AddUser(model)?"添加成功":"添加失败"); this.Close(); }
private void btnAdd_Click(object sender, EventArgs e) { if (ValidateInput()) { User u = new User(); u.Account = txtUserName.Text.Trim(); u.Password = txtPwd.Text.Trim(); u.RealName = txtName.Text.Trim(); u.RoleID = (int)cboRole.SelectedValue; u.IsActive = (bool)ckbIsActive.Checked; try { int count = ubll.AddUser(u); if (count > 0) { this.DialogResult = DialogResult.OK; MessageBox.Show("添加成功"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
public HttpResponseMessage AddUser()//User user) { HttpRequestBase request = ((HttpContextWrapper)this.Request.Properties["MS_HttpContext"]).Request; User user = new Model.User(); //文件上传 HttpFileCollectionBase files = request.Files; if (files != null && files.Count > 0) { FileUploadClass fileClass = new FileUploadClass(); if (files["file"].ContentLength != 0) { fileClass = FileHelper.UploadFile(files["file"], ConfigManageClass.UserUrlOriginalPath); user.avatar = fileClass.OriginalPath; } } if (!string.IsNullOrEmpty(request["UnitID"])) { user.UnitID = Convert.ToInt32(request["UnitID"]); } user.LoginName = request["LoginName"]; user.Code = request["Code"]; user.DisplayName = request["DisplayName"]; user.LoginPwd = request["Password"]; if (!string.IsNullOrEmpty(request["UserTypeID"])) { user.UserTypeID = Convert.ToInt32(request["UserTypeID"]); } user.UnitName = request["UnitName"]; string[] input = request["RoleIDArr"].Split(','); int[] output = Array.ConvertAll <string, int>(input, delegate(string s) { return(int.Parse(s)); }); user.RoleIDArr = output; user.mobile = request["mobile"]; if (!string.IsNullOrEmpty(request["Sepon"])) { user.Sepon = Convert.ToInt32(request["Sepon"]); } user.phone = request["phone"]; user.shortnumber = request["shortnumber"]; user.remarks1 = request["remarks1"]; int result = bll.AddUser(user); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK); if (result == 1) { response.Content = new StringContent("{\"success\":1}", Encoding.GetEncoding("UTF-8"), "text/html"); } else if (result == 2) { response.Content = new StringContent("{\"success\":2}", Encoding.GetEncoding("UTF-8"), "text/html"); } else { response.Content = new StringContent("{\"success\":false}", Encoding.GetEncoding("UTF-8"), "text/html"); } return(response); }
public void AddUserTest1() { UserBLL target = new UserBLL(); // TODO: Initialize to an appropriate value User user = null; // TODO: Initialize to an appropriate value target.AddUser(user); Assert.Inconclusive("A method that does not return a value cannot be verified."); }
/// <summary> /// Save and Update Data into Database /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { UserBO objUser = new UserBO(); UserBLL objUserBLL = new UserBLL(); objUser.CellNumber = txtCellNumber.Text.Trim(); objUser.DisplayName = txtDisplayName.Text.Trim(); objUser.Pwd = txtUsername.Text.Trim(); objUser.UserName = txtUsername.Text.Trim(); objUser.EmailID = txtEmailID.Text.Trim(); if (ViewState["UserID"] != null) { objUser.UserID = Convert.ToInt32(ViewState["UserID"].ToString()); } objUser.RoleID = Convert.ToInt32(ddlRole.SelectedValue.ToString()); objUser.IsDeleted = "False"; objUser.CreatedBy = Convert.ToInt32(Session["USER_ID"].ToString()); objUser.CreatedDate = DateTime.Now; string AlertMessage = string.Empty; string message = string.Empty; if (objUser.UserID < 1) { //If UserID does Not exists then SaveUser objUser.UserID = -1;//For New User message = objUserBLL.AddUser(objUser); AlertMessage = "alert('" + message + "');"; if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Data saved successfully"; ClearDetails(); } } else { //If UserID exists then UpdateUser message = objUserBLL.UpdateUser(objUser); if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Data updated successfully"; ClearDetails(); SetUpdateMode(false); } } BindGrid(); AlertMessage = "alert('" + message + "');"; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", AlertMessage, true); }
private void InsertTest(int toatl = 10) { Console.WriteLine("\r\n开始测试插入数据...\r\n"); string time = Stopwatch(() => { for (int i = 1; i < toatl; i++) { string time2 = Stopwatch(() => { string key = Guid.NewGuid().ToString().Replace("-", ""); string md5 = Md5Helper.Md5("123456"); string realPassword = Md5Helper.Md5(DESEncryptHelper.Encrypt(md5, key)); UserEntity user = new UserEntity { Account = "System" + i, NickName = "大师兄" + i, Birthday = DateTime.Now.AddDays(-1000), Secretkey = key, Password = realPassword, Gender = 1, SortCode = i //RoleId = CommonHelper.GetGuid() }; user.Create(); ////表名 //string table = EntityAttributeHelper.GetEntityTable<UserEntity>(); ////获取不做映射的字段 //List<string> notMappedField = EntityAttributeHelper.GetNotMappedFields<UserEntity>(); bool res = _userBll.AddUser(user); }); Console.WriteLine("开始测试" + i + ",耗时:" + time2); } }); Console.WriteLine("执行结束,耗时:" + time); }
public JsonResult SubRegister() { string userName = Request["UserName"]; string password = Request["passwordOne"]; string email = Request["Email"]; string captchaId = Request["CaptchaId"]; string userInput = Request["UserInput"]; string instanceId = Request["InstanceId"]; //检查用户名,密码,邮箱 [email protected] Regex regex = new Regex("^[0-9a-zA-Z._-]+[@][0-9a-zA-Z_-]+([.][a-zA-Z]+){1,2}$"); bool result = regex.IsMatch(email); if (string.IsNullOrEmpty(userName) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(email) || !regex.IsMatch(email)) { return(Json(new { Status = "error", Msg = "data error" }, JsonRequestBehavior.AllowGet)); } //检查验证码 if (!Captcha.AjaxValidate(captchaId, userInput, instanceId)) { return(Json(new { Status = "error", Msg = "验证码错误" }, JsonRequestBehavior.AllowGet)); } UserBLL userBll = new UserBLL(); //判断用户名是否存在 bool exist = userBll.IsUserNameExist(userName); if (exist) { return(Json(new { Status = "error", Msg = "用户名已存在" }, JsonRequestBehavior.AllowGet)); } //新增用户,发送激活邮件 int userId = userBll.AddUser(userName, password, email); string guid = Guid.NewGuid().ToString(); string url = string.Format("http://localhost:5555/UserOperation/ActiveUser?id={0}&uid={1}", guid, userId); string body = string.Format("请点击以下链接进行用户激活:<br/><a href='{0}'>{0}</a>", url); EmailModel model = new EmailModel() { MailTo = email, Subject = "SharePlat用户激活邮件", Body = body }; string data = JsonConvert.SerializeObject(model); RedisHelper.Enqueue("sendActiveEmail", data); //使用消息队列发送激活邮件 RedisHelper.Set <string>(guid, userId.ToString(), 10); //设置激活有效期 return(Json(new { Status = "ok", Msg = "" }, JsonRequestBehavior.AllowGet)); }
private void BtnOk_Click(object sender, RoutedEventArgs e) { UserData user = (UserData)gridUser.DataContext; if (IsAdd) { if (bll.AddUser(user)) { MessageBox.Show("添加成功!"); } } this.Close(); }
public ActionResult SaveForm(string keyValue, string strUserEntity, string formInstanceId, string strModuleFormInstanceEntity) { UserEntity userEntity = strUserEntity.JsonToEntity <UserEntity>(); ModuleFormInstanceEntity moduleFormInstanceEntity = strModuleFormInstanceEntity.JsonToEntity <ModuleFormInstanceEntity>(); string objectId; bool isSucc = userBLL.AddUser(keyValue, userEntity, out objectId); moduleFormInstanceEntity.ObjectId = objectId; moduleFormInstanceBll.SaveEntity(formInstanceId, moduleFormInstanceEntity); return(Success("操作成功。")); }
//User ADD private void btnAddUser_Click(object sender, EventArgs e) { var sonuc = UserBLL.AddUser(txtUserName.Text, txtPassword.Text, (int)cmbCalisan.SelectedValue); if (sonuc.Item1) { MessageBox.Show(sonuc.Item2); } else { MessageBox.Show(sonuc.Item2); } ListUsers(UserBLL.GetUsers()); }
public ResultModel Post([FromBody] User user) { try { _userBLL.AddUser(user); return(new ResultModel(Code.CREATED, "thành công")); } catch (Exception ex) { if (ex.Message.Contains("User name can't duplicate")) { return(new ResultModel(Code.CONFLICT, "username đã tồn tại")); } return(new ResultModel(Code.SVERROR, "lỗi hệ thống")); } }
private void btnLogin_Click(object sender, RoutedEventArgs e) { UserBLL bll = new UserBLL(); try { User itemUser = new User(); Student itemStudent = null; Teacher itemTeacher = null; if (radStudent.IsChecked.Value) { itemStudent = new Student(); itemStudent.SClassID = Convert.ToInt32(this.cboData.SelectedValue); itemUser.UserRole = (int)ClassRoom.Enum.UserRoleTypeEnum.Student; itemUser.Student = itemStudent; } if (radTeacher.IsChecked.Value) { itemTeacher = new Teacher(); itemTeacher.CourseID = Convert.ToInt32(this.cboData.SelectedValue); itemUser.UserRole = (int)ClassRoom.Enum.UserRoleTypeEnum.Teacher; itemUser.Teacher = itemTeacher; //TeacherBLL.AddTeacher(itemTeacher); } itemUser.Sex = this.radioButton1.IsChecked; itemUser.Realname = this.tbRealName.Text; itemUser.Email = this.tbEmail.Text; itemUser.Password = this.tbPassword.Text; bool result = bll.AddUser(itemUser, itemStudent, itemTeacher); if (result) { MessageBox.Show("保存成功!"); } } catch (Exception ex) { MessageBox.Show(ex.InnerException.ToString()); } }
public ActionResult SaveForm(string keyValue, string strUserEntity, string formInstanceId, string strModuleFormInstanceEntity) { UserEntity userEntity = strUserEntity.JsonToEntity <UserEntity>(); ModuleFormInstanceEntity moduleFormInstanceEntity = strModuleFormInstanceEntity.JsonToEntity <ModuleFormInstanceEntity>(); string key = CommonHelper.GetGuid(); string md5 = Md5Helper.Md5(userEntity.Password); string realPassword = Md5Helper.Md5(DESEncryptHelper.Encrypt(md5, key)); userEntity.Secretkey = key; userEntity.Password = realPassword; string objectId; bool isSucc = userBLL.AddUser(keyValue, userEntity, out objectId); moduleFormInstanceEntity.ObjectId = objectId; moduleFormInstanceBll.SaveEntity(formInstanceId, moduleFormInstanceEntity); return(Success("操作成功。")); }
private void btnSave_Click1(object sender, RoutedEventArgs e) { User user = (User)gridUser.DataContext; if (isAdd) { if (bll.AddUser(user)) { MessageBox.Show("添加成功!"); } } else { if (bll.UpdateUser(user)) { MessageBox.Show("修改成功!"); } } this.Close(); }
protected void AddUser_btn_Click(object sender, EventArgs e) { UserModel model = new UserModel(); model.UserName = Name_txt.Text; model.Passwords = Convert.ToString(pwd_txt.Text); model.Sex = Convert.ToInt32(RadioButtonList1.SelectedValue); model.Phone = Convert.ToInt32(phone_txt.Text); model.Email = Convert.ToString(email_txt.Text); model.Birthday = Convert.ToDateTime(birthday_txt.Text); UserBLL bll = new UserBLL(); int result = 0; //与数据库交互 if (Request.QueryString["UserId"] == null) { result = bll.AddUser(model); } else { //获取浏览器上的id model.UserId = Convert.ToInt32(Request.QueryString["UserId"]); //调用更新方法,更新model result = bll.UpdateUser(model); } if (result > 0) { if (result == 100) { Response.Write("<script>alert('添加用户已经存在!')</script>"); return; } Response.Write("<script>alert('添加成功!')</script>"); Response.Redirect("UserList.aspx"); return; } else { Response.Write("<script>alert('添加失败!')</script>"); } }
//点击添加按钮 private void BtnAdd_Click(object sender, RoutedEventArgs e) { try { CheckValid(); User newUser = new User(); newUser.Age = Convert.ToInt32(txtBox_Age.Text); newUser.Folk = txtBox_Folk.Text; newUser.Job = combox_addjob.Text; newUser.Name = txtBox_Name.Text; newUser.Phone = txtBox_Phone.Text; newUser.Work_Time = Convert.ToInt32(txtBox_WorkTime.Text); newUser.Birthday = dp_Birthday.DisplayDate; userBll.AddUser(newUser); this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message, "添加用户时出错"); } }
public ActionResult AddUser(WebUser webUser) { UserBLL userBLL = new UserBLL(); webUser.ProjectID = this.GetCurrentProjectID(); webUser.CreateUserID = this.GetCurrentUserID(); webUser.OrderClientID = this.GetCurrentOrderClientID(); CResult <bool> cResult = userBLL.AddUser(webUser); return(JsonContentHelper.GetJsonContent(cResult)); //if (cResult.Code == 0) //{ //} //else //{ // ViewBag.IsErr = true; // ViewBag.ErrMsg = cResult.Msg; // return View(webUser); //} }
// POST api/user public User Post(User value) { User user = HttpContext.Current.Session["SigninedUser"] as User; if (user == null || !user.IsAdmin) { throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Forbidden)); } string ResultMessage; int ResultStatus = UserBLL.AddUser(ref value, out ResultMessage); if (ResultStatus == 0) { throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound)); } else if (ResultStatus == -1) { throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.BadRequest)); } return(value); }
private void btnSave_Click1(object sender, RoutedEventArgs e) { if (depName.SelectedIndex == 0) { MessageBox.Show("请选择部门"); return; } if (boy.IsChecked == false && girl.IsChecked == false) { MessageBox.Show("请选择性别"); return; } if (tbPassword.Password != tbSurePassword.Password) { MessageBox.Show("两次输入的密码不一致"); return; } User user = new User(); byte[] img = File.ReadAllBytes(AvatarPath.Text); user.Username = tbUserName.Text; user.Name = tbName.Text; user.Password = tbSurePassword.Password; user.Position = tbPosition.Text; user.Phone = tbPhone.Text; user.Worknum = Convert.ToInt32(tbWorknum.Text); user.Deptid = Convert.ToInt32(depName.SelectedIndex); user.Gender = (boy.IsChecked == true) ? 1 : 0; user.Control = (Admin.IsChecked == true) ? 1 : 0; user.State = 0; user.Check = 1; user.Avatar = img; user.Ipaddress = "0.0.0.0"; if (bll.AddUser(user)) MessageBox.Show("添加成功!"); this.Close(); }
private void Button_Login(object sender, RoutedEventArgs e) { if (firstName.Text != "" && lastName.Text != "" && login.Text != "") { if (_userBLL.CheckUserIdentity(login.Text)) { if (pwd.Password.ToString() == pwd2.Password.ToString() && pwd.Password.ToString() != "") { try { _userBLL.AddUser(firstName.Text, lastName.Text, login.Text, pwd.Password.ToString()); _personBLL.AddPerson(login.Text); _userBLL.LoginWrite(login.Text); HomePage main = new HomePage() { WindowStartupLocation = WindowStartupLocation.CenterScreen }; main.Show(); this.Close(); } catch { MessageBox.Show("Error!"); } } else { MessageBox.Show("Invalid password!"); } } else { MessageBox.Show("This login already used!"); } } else { MessageBox.Show("Empty fields!"); } }
private void Button_Click(object sender, RoutedEventArgs e) { string Type = this.txbUserType.Text.Trim(); string name = this.txtUserName.Text.Trim(); string pwd = this.Pwd.Password.Trim(); string Mail = this.txtMail.Text.Trim(); // string kc = this.kc.Text.Trim(); if (Type == "" || name == "" || pwd == "" || Mail == "") { // 有信息未填 MessageBox.Show("所有信息不能为空!"); return; } // Book book = new Book(int.Parse(ID), name, cbs, int.Parse(price), int.Parse(kc)); User user = new User(); BookStore.BLL.UserBLL bll = new UserBLL(); bool flag = false; user.Type = Convert.ToInt32(this.txbUserType.Text.Trim());//int.Parse(ID); user.Name = name; user.Password = this.Pwd.Password.Trim(); user.Email = this.txtMail.Text.Trim(); flag = bll.AddUser(user); if (flag) { MessageBoxResult boxResult = MessageBox.Show("注册成功!", "提示:", MessageBoxButton.YesNo, MessageBoxImage.Information, MessageBoxResult.No); } // MessageBox.Show("注册成功!"); }