示例#1
0
        public void AddUser()
        {
            if (User.Password != VerifyPassword)
            {
                PUMessageBox.ShowDialog("两次密码不一致");
                return;
            }

            if (string.IsNullOrEmpty(User.Account) || string.IsNullOrEmpty(User.UserName) || string.IsNullOrEmpty(User.Password) || string.IsNullOrEmpty(User.MobilePhone))
            {
                PUMessageBox.ShowDialog("内容不能为空");
                return;
            }
            UserBusiness userBusiness = new UserBusiness();

            if (userBusiness.VerifyAccountExists(User.Account))
            {
                PUMessageBox.ShowDialog("账号已存在");
            }
            if (userBusiness.AddUser(User))
            {
                PUMessageBox.ShowDialog("添加用户成功");
                User = new User();
            }
            else
            {
                PUMessageBox.ShowDialog("添加用户失败");
            }
        }
示例#2
0
        public void UpdateUser()
        {
            if (User.Password != VerifyPassword)
            {
                PUMessageBox.ShowDialog("两次密码不一致");
                return;
            }
            if (string.IsNullOrEmpty(User.UserName) || string.IsNullOrEmpty(User.Password) || string.IsNullOrEmpty(User.MobilePhone))
            {
                PUMessageBox.ShowDialog("内容不能为空");
                return;
            }
            UserBusiness userBusiness = new UserBusiness();

            if (userBusiness.UpdateUser(User))
            {
                PUMessageBox.ShowDialog("修改成功");
                VerifyPassword = "";
                User           = new User();
            }
            else
            {
                PUMessageBox.ShowDialog("修改失败");
            }
        }