using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Numerics; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; using Mysqlx.Cursor; namespace Casino { /// /// Interaktionslogik für Login.xaml /// public partial class Login : Window { public Login() { InitializeComponent(); } private void Anmelden_Click(object sender, RoutedEventArgs e) { if (checkLogin(TxtName.Text, TxtPasswort.Text)) { MainWindow mainWindow = new MainWindow(); mainWindow.Show(); Close(); } else { MessageBox.Show("Login fehlgeschlagen!"); } } private bool checkLogin(string name, string passwort) { Database db = new Database(); ObservableCollection users = new ObservableCollection(); users = db.SelectTask(); for (int i = 0; i < users.Count(); i++) { if (name.Equals(users[i].Name)) { if(passwort.Equals(users[i].Passwort)) { return true; } return false; } } return false; } private void Window_MouseDown(object sender, MouseButtonEventArgs e) { if (e.LeftButton == MouseButtonState.Pressed) DragMove(); } } }