コード例 #1
0
 private void AcceptButton_Click(object sender, System.EventArgs e)
 {
     if (isFieldsCorrect())
     {
         if (PhoneTextBox.MaskCompleted)
         {
             Reader reader = readerBL.GetReaderByLogin(LoginTextBox.Text);
             if (reader.Phone == PhoneTextBox.Text)
             {
                 if (NewPasswordTextBox.Text == ConfirmPassTextBox.Text)
                 {
                     authorization.SetNewPassword(reader, NewPasswordTextBox.Text);
                     MessageBox.Show("Password changed, try to sign in");
                     Close();
                 }
                 else
                 {
                     MessageBox.Show("Passwords do not match");
                 }
             }
             else
             {
                 MessageBox.Show("User with this login has a different phone number");
             }
         }
         else
         {
             MessageBox.Show("Wrong phone number");
         }
     }
     else
     {
         MessageBox.Show("Fill in empty fields");
     }
 }
コード例 #2
0
 private void SignInButton_Click(object sender, EventArgs e)
 {
     if (!isFieldsEmpty())
     {
         if (LoginTextBox.Text == "Admin" && PasswordTextBox.Text == "admin")
         {
             Hide();
             AdminMenu menu = new AdminMenu();
             menu.Show();
         }
         else
         {
             if (authorization.isAuthorized(LoginTextBox.Text, PasswordTextBox.Text))
             {
                 Hide();
                 _reader = readerBL.GetReaderByLogin(LoginTextBox.Text);
                 UserForm form = new UserForm(_reader);
                 form.Show();
             }
             else
             {
                 MessageBox.Show("Error, wrong data" + Environment.NewLine + "Check Login or Password");
             }
         }
     }
     else
     {
         MessageBox.Show("Fill in empty fields");
     }
 }