66 lines
1.7 KiB
C#
66 lines
1.7 KiB
C#
using MahApps.Metro.Controls;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
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;
|
|
|
|
namespace ZKuP
|
|
{
|
|
/// <summary>
|
|
/// Interaktionslogik für CheckKennzeichen.xaml
|
|
/// </summary>
|
|
public partial class CheckKennzeichen : MetroWindow
|
|
{
|
|
public CheckKennzeichen()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void btnSearch_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
Search();
|
|
}
|
|
|
|
private void tbKennzeichen_PreviewKeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.Key == Key.Enter)
|
|
Search();
|
|
}
|
|
|
|
|
|
private void Search()
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(tbKennzeichen.Text))
|
|
{
|
|
var list = SQL.ReadSQL($"SELECT Kennzeichen, Name, Ansprechpartner, DATE_FORMAT(Zutritt, \"%d.%m.%y %I:%i\") AS \"Zutritt\" FROM {MainWindow.table}.zutritte WHERE Kennzeichen LIKE '%{tbKennzeichen.Text}%'").Result;
|
|
|
|
if (list.Rows.Count == 0)
|
|
list.Rows.Add("Keine Ergebnisse...");
|
|
|
|
dgKennzeichen.DataContext = list;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
|
{
|
|
Helper.CheckWindowIsInScreenSpace(this);
|
|
}
|
|
|
|
private void Window_LocationChanged(object sender, EventArgs e)
|
|
{
|
|
Helper.CheckWindowIsInScreenSpace(this);
|
|
}
|
|
}
|
|
}
|