Beispiel #1
0
        private void Submit_AddUser(object sender, RoutedEventArgs e)
        {
            if (ValidateUtil.CheckFolderName(this.account.Text) == false)
            {
                JXMessageBox.Show(Window.GetWindow(this), "请填写帐号!", MsgImage.Error);
                return;
            }
            if (ValidateUtil.CheckFolderName(this.userName.Text) == false)
            {
                JXMessageBox.Show(Window.GetWindow(this), "请填写用户姓名!", MsgImage.Error);
                return;
            }
            if (ValidateUtil.CheckPasswordStrength(this.password.Password) == false)
            {
                JXMessageBox.Show(Window.GetWindow(this), "请输入6位以上的密码长度!", MsgImage.Error);
                return;
            }

            if (!this.password.Password.Equals(this.password2.Password))
            {
                JXMessageBox.Show(Window.GetWindow(this), "输入密码不一致,请重新输入!", MsgImage.Error);
                return;
            }
            Users     u     = new Users();
            UserBean  bean  = new UserBean();
            QueryUser query = new QueryUser();

            query.Account   = UserManagerBean.AddUser.queryAccount.Text;
            query.UserName  = UserManagerBean.AddUser.queryName.Text;
            bean.Account    = this.account.Text;
            bean.UserName   = this.userName.Text;
            bean.Password   = this.password.Password;
            bean.Status     = 0;
            bean.CreateId   = Session.UserId;
            bean.CreateTime = Convert.ToDateTime(DateTime.Now);
            bean.Phone      = this.phone.Text;
            ComboBoxItem type = (ComboBoxItem)this.userType.SelectedItem;

            bean.Type = int.Parse(type.Tag.ToString());
            int    state = u.registUser(bean);
            Window targe = Window.GetWindow(this);

            if (state == BaseRequest.HAS)
            {
                JXMessageBox.Show(Window.GetWindow(this), "该账号已被使用!", MsgImage.Error);
            }
            else if (state == BaseRequest.SUCCESS)
            {
                JXMessageBox.Show(Window.GetWindow(this), "新增用户成功!", MsgImage.Error);
                UserManagerBean.AddUser.page.ShowPages(UserManagerBean.AddUser.userData, u.getUsersList(query), BaseRequest.PAGE_SIZE);
                this.Close();
            }
            else
            {
                JXMessageBox.Show(Window.GetWindow(this), "系统异常,请联系管理员!", MsgImage.Error);
            }
        }
Beispiel #2
0
        public static bool CheckPasswordStrength(System.Windows.Forms.Control Control)
        {
            // 返回值
            bool   returnValue = true;
            string password    = Control.Text;

            if (!ValidateUtil.CheckPasswordStrength(password))
            {
                MessageBox.Show(AppMessage.MSG8000, AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
                Control.Focus();
                returnValue = false;
            }
            return(returnValue);
        }