Exemple #1
0
        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            var hash = Hasher.SHA1Encrypt(this.txtPassword.Text);
            var result = CallerFactory<IUserService>.Instance.Login(this.txtUserName.Text, hash);

            if (result)
            {
                if (this.chkRemember.Checked)
                {
                    SaveRemember();
                }
                else
                {
                    ConfigUtility.RemoveRememberUser();
                }

                this.user = CallerFactory<IUserService>.Instance.FindByUserName(this.txtUserName.Text);
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                MessageUtil.ShowWarning("用户名或密码错误");
                this.txtPassword.Text = "";
                return;
            }
        }