From dee300ade9207b601f87b5b8dd061546db6eca84 Mon Sep 17 00:00:00 2001 From: Marcus Date: Thu, 4 Dec 2025 10:20:51 +0100 Subject: [PATCH] =?UTF-8?q?Arrows=20f=C3=BCr=20Asp=20eingebaut=20Aktualisi?= =?UTF-8?q?erungsm=C3=B6glichkeit=20und=20Export=20f=C3=BCr=20Today=20f?= =?UTF-8?q?=C3=BCr=20den=20Pf=C3=B6rtner=20eingebaut?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ZKuP/MainWindow.xaml | 19 ++++- ZKuP/MainWindow.xaml.cs | 88 ++++++++++++++++---- ZKuP/ManageAsp.xaml | 115 +++++++++++++++++++++++++- ZKuP/ManageAsp.xaml.cs | 54 +++++++++++- ZKuP/Resources/Refresh.png | Bin 0 -> 738 bytes ZKuP/Resources/TableExport.png | Bin 0 -> 209727 bytes ZKuP/Resources/arrow.png | Bin 0 -> 1008 bytes ZKuP/RoleManager.cs | 5 ++ ZKuP/TableExporter.cs | 146 +++++++++++++++++++++++++++++++++ ZKuP/ZKuP.csproj | 10 +++ 10 files changed, 413 insertions(+), 24 deletions(-) create mode 100644 ZKuP/Resources/Refresh.png create mode 100644 ZKuP/Resources/TableExport.png create mode 100644 ZKuP/Resources/arrow.png create mode 100644 ZKuP/TableExporter.cs diff --git a/ZKuP/MainWindow.xaml b/ZKuP/MainWindow.xaml index 3159133..8e8ee41 100644 --- a/ZKuP/MainWindow.xaml +++ b/ZKuP/MainWindow.xaml @@ -173,7 +173,7 @@ - + @@ -554,8 +554,19 @@ + - + + + @@ -786,13 +797,13 @@ - + - + diff --git a/ZKuP/MainWindow.xaml.cs b/ZKuP/MainWindow.xaml.cs index 302e506..ddc9b7f 100644 --- a/ZKuP/MainWindow.xaml.cs +++ b/ZKuP/MainWindow.xaml.cs @@ -3,6 +3,7 @@ using ControlzEx.Standard; using FuzzySharp; using MahApps.Metro.Controls; using Microsoft.Toolkit.Uwp.Notifications; +using Microsoft.Win32; using MySql.Data.MySqlClient; using MySql.Data.Types; using System; @@ -28,6 +29,8 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; using System.Windows.Threading; +using Windows.Storage.Pickers; +using Windows.Storage.Streams; using Windows.UI.Composition; using Process = System.Diagnostics.Process; @@ -46,7 +49,7 @@ namespace ZKuP PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } - public static string Version { get; } = "5.2.5.2"; + public static string Version { get; } = "5.2.6.1"; //public static Roles LoggedInRole { get; private set; } = Roles.None; internal static MainWindow main; ThemeManager TM; @@ -369,6 +372,7 @@ namespace ZKuP private void OnWindowMoveFinished() { + CheckArrivalsSpacing(gridSplitter, null); Helper.CheckScale(this); } @@ -537,23 +541,36 @@ namespace ZKuP RoleManager.LoggedInRole != Roles.None) { var id = SQL.ReadSingleValue($"SELECT idusers FROM {MainWindow.table}.users WHERE `Username` = '{Environment.UserName}'"); - var aspId = SQL.ReadSingleValue($"SELECT EXISTS (SELECT 1 FROM ansprechpartner WHERE CreatorID = '{id}')"); + var aspId = SQL.ReadSingleValue($"SELECT EXISTS (SELECT 1 FROM {MainWindow.table}.ansprechpartner WHERE CreatorID = '{id}')"); if (aspId != "0") { var res = SQL.ReadSQL($"SELECT * FROM {MainWindow.table}.ansprechpartner WHERE CreatorID = '{id}'").Result; var firstRow = res.Rows[0]; - bool hasEmptyOrNull = firstRow.ItemArray.Any(field => - field == DBNull.Value || - (field is string str && string.IsNullOrWhiteSpace(str)) - ); + var emptyFields = firstRow.Table.Columns + .Cast() + .Where(col => + { + var value = firstRow[col]; + return value == DBNull.Value || + (value is string s && string.IsNullOrWhiteSpace(s)); + }) + .Select(col => col.ColumnName) + .ToList(); - if (hasEmptyOrNull) + //bool hasEmptyOrNull = firstRow.ItemArray.Any(field => + // field == DBNull.Value || + // (field is string str && string.IsNullOrWhiteSpace(str)) + // ); + + if (emptyFields.Count > 0) { if (MessageBoxResult.OK == MessageBox.Show("Ihr Eintrag als Ansprechpartner ist nicht vorhanden oder unvollständig!\n\nBitte erstellen oder vervollständigen", "Fehlende Asp Informationen", MessageBoxButton.OK, MessageBoxImage.Warning)) { - ManageAsp map = new ManageAsp(); + ManageAsp map = new ManageAsp(emptyFields); map.ShowDialog(); + + } } } @@ -1135,7 +1152,12 @@ namespace ZKuP private async Task getToday() { bool isVisible = false; - Dispatcher.Invoke(() => isVisible = gridToday.Visibility == Visibility.Visible); + Dispatcher.Invoke(() => + { + isVisible = gridToday.Visibility == Visibility.Visible; + Cursor = Cursors.Wait; + }); + if (isVisible) { //bool changeTable = false; @@ -1250,6 +1272,8 @@ namespace ZKuP q.Click += BtnInfo_Click; })); } + + Dispatcher.Invoke(() => Cursor = Cursors.Arrow); } @@ -2740,6 +2764,11 @@ namespace ZKuP private void gridSplitter_DragCompleted(object sender, System.Windows.Controls.Primitives.DragCompletedEventArgs e) + { + CheckArrivalsSpacing(sender, e); + } + + private void CheckArrivalsSpacing(object sender, DragCompletedEventArgs e) { GridSplitter splitter = sender as GridSplitter; Window window = Window.GetWindow(splitter); @@ -2748,16 +2777,29 @@ namespace ZKuP Point splitterPosition = splitter.TransformToAncestor(window).Transform(new Point(0, 0)); - if (splitterPosition.Y > ((this.ActualHeight - 190) / Helper.scale)) - { - e.Handled = true; // Bewegung stoppen - gridRowTop.Height = new GridLength((this.ActualHeight - 160 - 190) / (Helper.scale == 0 ? 1 : Helper.scale)); + var arrivalsHeight = this.ActualHeight - splitterPosition.Y; + + var x = gridRowArrivals.ActualHeight; + + + if(arrivalsHeight < 100) + { + //if (arrivalsHeight < ((this.ActualHeight * .05))) + //{ + if(e != null) e.Handled = true; // Bewegung stoppen 160: MenuRow Height + //gridRowTop.Height = new GridLength((this.ActualHeight - Main.ActualHeight - (this.ActualHeight * .05)) / (Helper.scale == 0 ? 1 : Helper.scale)); + //gridRowTop.Height = new GridLength(this.ActualHeight - Main.ActualHeight - (this.ActualHeight * .05));// / (Helper.scale == 0 ? 1 : Helper.scale)); + gridRowTop.Height = new GridLength(this.ActualHeight - Main.ActualHeight - 100); } + //if (splitterPosition.Y > ((this.ActualHeight - 160) / Helper.scale)) + //{ + // e.Handled = true; // Bewegung stoppen 160: MenuRow Height + // gridRowTop.Height = new GridLength((this.ActualHeight - 160 - 160) / (Helper.scale == 0 ? 1 : Helper.scale)); + //} Settings.WriteSetting("SplitterPos", gridRowTop.Height.Value); } - private void Window_SizeChanged(object sender, SizeChangedEventArgs e) { @@ -3053,6 +3095,24 @@ namespace ZKuP lAb.WindowStartupLocation = WindowStartupLocation.CenterScreen; lAb.ShowDialog(); } + + + + private void btnTableExport_Click(object sender, RoutedEventArgs e) + { + FileDialog file = new SaveFileDialog(); + file.DefaultExt = "*.csv"; + file.Filter = "CSV Datei | *.csv"; + file.ShowDialog(); + + if (!string.IsNullOrWhiteSpace(file.FileName)) + TableExporter.ExportToCsv(file.FileName, new DataGrid[] { dgToday, dgTodayBesucher }); + } + + private void btnRefresh_Click(object sender, RoutedEventArgs e) + { + getToday(); + } } diff --git a/ZKuP/ManageAsp.xaml b/ZKuP/ManageAsp.xaml index 6a9db77..e532d5d 100644 --- a/ZKuP/ManageAsp.xaml +++ b/ZKuP/ManageAsp.xaml @@ -7,8 +7,72 @@ xmlns:local="clr-namespace:ZKuP" mc:Ignorable="d" Title="Ansprechpartner verwalten" Height="450" Width="1180" - WindowStartupLocation="CenterScreen" MinHeight="450" MinWidth="1180"> - + WindowStartupLocation="CenterScreen" MinHeight="450" MinWidth="1180" ClipToBounds="False"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -42,13 +106,56 @@ -