74 lines
1.8 KiB
C#
74 lines
1.8 KiB
C#
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
|
|
{
|
|
/// <summary>
|
|
/// Interaktionslogik für Login.xaml
|
|
/// </summary>
|
|
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<User> users = new ObservableCollection<User>();
|
|
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();
|
|
}
|
|
}
|
|
}
|