Пример #1
0
        /// <summary>
        /// 登陆
        /// </summary>
        private bool Login()
        {
            var account  = this.accountTbx.Text.Trim();
            var password = this.pwdTbx.Text.Trim();

            if (string.IsNullOrEmpty(account) || account == "请输入账号")
            {
                MessageBox.Show("账号不能为空", "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(false);
            }

            if (string.IsNullOrEmpty(password) || password == "请输入密码")
            {
                MessageBox.Show("密码不能为空", "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(false);
            }
            if (m_LoginService.CheckAccount(account, password))
            {
                return(true);
            }
            else
            {
                MessageBox.Show("账号或密码错误", "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                this.pwdTbx.Text = "";
                return(false);
            }
        }
 public string Login(LoginViewModel account)
 {
     loginService = new LoginImplement();
     if (loginService.CheckAccount(account))
     {
         return("Đăng nhập thành công");
     }
     else
     {
         return("Đăng nhập thất bại");
     }
 }
Пример #3
0
        public IActionResult accountRepeatable()
        {
            bool result = false;
            //前端向后端发送数据
            string account = Request.Form["account"];

            if (service.CheckAccount(account))
            {
                result = true;
            }
            return(Ok(new
            {
                result = result,
                code = 200
            }));
        }
Пример #4
0
        private Login Init()
        {
            string Account   = this.Account.Text;
            string Password  = this.Password.Password;
            string surePass  = this.surePass.Password;
            string Job       = this.Job.Text;
            string EmpNo     = this.EmpNo.Text;
            string UserName  = this.UserName.Text;
            string Age       = this.Age.Text;
            string SexCombox = this.SexCombox.Text;
            string CreatTime = this.CreatTime.Text;
            string Address   = this.Address.Text;

            if (Check.IsEmpty(Account))
            {
                MyCustomControlLibrary.MMessageBox.ShowSuccessAlert("账号不能为空 ^_^ ");
                return(null);
            }
            if (LoginService.CheckAccount(Account))
            {
                MyCustomControlLibrary.MMessageBox.ShowSuccessAlert($"账号:{Account}已存在不能重复添加 ^_^ ");
                return(null);
            }


            if (Check.IsEmpty(Password))
            {
                MyCustomControlLibrary.MMessageBox.ShowSuccessAlert("密码不能为空 ^_^ ");
                return(null);
            }
            if (Check.IsEmpty(surePass))
            {
                MyCustomControlLibrary.MMessageBox.ShowSuccessAlert("确认密码不能为空 ^_^ ");
                return(null);
            }
            else
            {
                if (Password != surePass)
                {
                    MyCustomControlLibrary.MMessageBox.ShowSuccessAlert("确认密码和原密码不一致 ^_^ ");
                    return(null);
                }
            }

            if (Check.IsEmpty(UserName))
            {
                MyCustomControlLibrary.MMessageBox.ShowSuccessAlert("姓名不能为空 ^_^ ");
                return(null);
            }
            if (Check.IsEmpty(Age))
            {
                MyCustomControlLibrary.MMessageBox.ShowSuccessAlert("年龄不能为空 ^_^ ");
                return(null);
            }
            else
            {
                if (!Regex.Match(Age, @"^[0-9]*$").Success)
                {
                    MyCustomControlLibrary.MMessageBox.ShowSuccessAlert("年龄请输入数字 ^_^ ");
                    return(null);
                }
            }
            if (Check.IsEmpty(SexCombox))
            {
                MyCustomControlLibrary.MMessageBox.ShowSuccessAlert("性别不能为空 ^_^ ");
                return(null);
            }

            return(new Login()
            {
                LoginID = GetOnlyOneID.GuidToLongID("AC"),
                Account = Account,
                PassWord = Encryption.SHA512Encrypt(Password),
                UserName = UserName,
                Age = int.Parse(Age),
                Job = Job,
                EmpNo = EmpNo,
                Address = Address,
                Sex = SexCombox == "男" ? 0 : 1,
                Status = "10000000"
            });
        }