Пример #1
0
        public bool Authorization(AuthInformationDTO authInfo)
        {
            User user = repository.Users.GetUser(authInfo.Login, authInfo.Password);

            if (user != null && user.Password == authInfo.Password)
            {
                this.user = user;
                form.Close();
                return(true);
            }
            return(false);
        }
        private void btnAuhorization_Click(object sender, EventArgs e)
        {
            AuthInformationDTO authInformation = new AuthInformationDTO();

            authInformation.Login    = tbLogin.Text;
            authInformation.Password = tbPassword.Text;

            if (myAppContext.Authorization(authInformation) != true)
            {
                toolStripStatusLabel1.Text = "Ошибка авторизации";
            }
            else
            {
                toolStripStatusLabel1.Text = "Авторизация успешна";
            }
        }