Beispiel #1
0
        private void Back_Click(object sender, RoutedEventArgs e)
        {
            choose win = new choose();

            win.Show();
            this.Close();
        }
Beispiel #2
0
 private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
 {
     if (Regex.IsMatch(login.Text, "^[a-zA-Z0-9]+$"))
     {
         if (login.Text.Length > 0)
         {
             if (password.Password.Length > 0)
             {
                 if (User.Opacity == 1.0d || Admin.Opacity == 1.0d)
                 {
                     if (User.Opacity == 1.0d)
                     {
                         DataTable dt_user = Select("SELECT * FROM [dbo].[users] WHERE [login] = '" + login.Text + "' AND [password] = '" + password.Password + "'");
                         if (dt_user.Rows.Count > 0)
                         {
                             choose p = new choose();
                             this.Close();
                             p.Show();
                         }
                         else
                         {
                             MessageBox.Show("User not found");
                         }
                     }
                     if (Admin.Opacity == 1.0d)
                     {
                         DataTable dt_user = Select("SELECT * FROM [dbo].[admins] WHERE [login] = '" + login.Text + "' AND [password] = '" + password.Password + "'");
                         if (dt_user.Rows.Count > 0)
                         {
                             Admin_choose p = new Admin_choose();
                             this.Close();
                             p.Show();
                         }
                         else
                         {
                             MessageBox.Show("Admin not found");
                         }
                     }
                 }
                 else
                 {
                     MessageBox.Show("Choose authority type");
                 }
             }
             else
             {
                 MessageBox.Show("Enter password");
             }
         }
         else
         {
             MessageBox.Show("Enter login");
         }
     }
     else
     {
         MessageBox.Show("Incorrect symbols");
     }
 }