示例#1
0
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.txtUserName.Text))
            {
                XtraMessageBox.Show("User name is empty!", "提示", MessageBoxButtons.OK);
                return;
            }
            if (string.IsNullOrEmpty(this.txtPassword.Text))
            {
                XtraMessageBox.Show("Password is empty!", "提示", MessageBoxButtons.OK);
                return;
            }



            UserVM vm = _bll.Login(new UserVM {
                Account = this.txtUserName.Text.Trim()
            });

            if (vm != null)
            {
                if (vm.Password == this.txtPassword.Text.Trim())
                {
                    RememberPassword();
                    GlobalObject.User = vm;

                    GetUserRoles();
                }
                else
                {
                    XtraMessageBox.Show("Password is not correct!", "提示", MessageBoxButtons.OK);
                    return;
                }
            }
            else
            {
                XtraMessageBox.Show("User name is not exists!", "提示", MessageBoxButtons.OK);

                return;
            }
        }