private void AddUser_Closed(object sender, EventArgs e) { UserForm userForm = (UserForm)sender; if (userForm.DialogResult != DialogResult.OK) { return; } try { CUserEntity newUser = new CUserEntity(_currentUser.ConnString); newUser.Usr_Member = userForm.Member; // newUser.Usr_Password = userForm.Password; string pwd = CHelperClass.UserMd5(userForm.Password); string surePwd = CHelperClass.UserMd5(userForm.Surepwd); if (pwd == surePwd) { newUser.Usr_Password = pwd; } else { throw new Exception("密码与确认密码不相等!"); } newUser.Usr_Name = userForm.UserName; newUser.Usr_Email = userForm.Email; newUser.Usr_Organize = _currentUser.Usr_Organize; if (userForm.UserType == (int)USERTYPE.ORGANIZEADMIN) { _currentUser.CreateAdminlUser(newUser); } else { _currentUser.CreateNormalUser(newUser); } this.LoadUsers(); } catch (Exception ex) { MessageBox.Show("创建用户失败:" + ex.Message, "文档管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error); } }