From 6aa3944ee9d4f90a0292c759adcd4999a7b39d52 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Mon, 9 Dec 2019 06:08:24 +0000 Subject: [PATCH] Date und DateTimePicker Tastatureingabe only (shortcut) --- BSMD_Webplattform_VPN.scx | 54 +++++++++++++++++++ ENI-2/ENI2/ENI2/App.config | 8 +-- ENI-2/ENI2/ENI2/Controls/EditWindowBase.cs | 45 +++++++++++++++- ENI-2/ENI2/ENI2/DetailBaseControl.cs | 50 ++++++++++++++++- ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs | 12 ++--- .../ArrivalNotificationDetailControl.xaml | 6 +-- .../DepartureNotificationDetailControl.xaml | 2 +- ...aritimeHealthDeclarationDetailControl.xaml | 2 +- .../PSC72hDetailControl.xaml | 2 +- .../PortCallDetailControl.xaml.cs | 29 +--------- .../SecurityDetailControl.xaml | 8 +-- .../WasteDetailControl.xaml | 2 +- .../ENI2/EditControls/EditCREWDialog.xaml | 2 +- .../ENI2/EditControls/EditLADGDialog.xaml.cs | 4 +- .../EditLast10PortFacilitiesDialog.xaml | 4 +- .../ENI2/ENI2/EditControls/EditPasDialog.xaml | 2 +- .../EditPortOfCallLast30DaysDialog.xaml | 2 +- .../EditShip2ShipActivitiesDialog.xaml | 4 +- .../ENI2/EditControls/NewWithIdDialog.xaml | 2 +- .../ENI2/ENI2/EditControls/VisitIdDialog.xaml | 2 +- ENI-2/ENI2/ENI2/MainWindow.xaml.cs | 31 +++++++++-- server.txt | 4 ++ 22 files changed, 211 insertions(+), 66 deletions(-) create mode 100644 BSMD_Webplattform_VPN.scx diff --git a/BSMD_Webplattform_VPN.scx b/BSMD_Webplattform_VPN.scx new file mode 100644 index 00000000..90cd58aa --- /dev/null +++ b/BSMD_Webplattform_VPN.scx @@ -0,0 +1,54 @@ +{ + "name": "BSMD_Webplattform_VPN", + "display_name": "BSMD_Webplattform_VPN", + "domain_suffix": "", + "type": "xg", + "managed": false, + "version": 1, + "gateway": "212.185.197.98", + "vip": "0.0.0.0", + "auto_connect": { + "required": false, + "enabled": false + }, + "run_logon_script": false, + "proposals": [ + "aes256-sha2_256-modp2048" + ], + "dpd_delay": 60, + "rekey_time": 15300, + "start_action": "none", + "local_auth": { + "psk": { + "id": "0.0.0.0" + }, + "xauth": { + "can_save": false + }, + "otp": true + }, + "remote_auth": { + "otp": false, + "psk": { + "id": "%any", + "secret": "Winter2019*+#Winter2019*+#" + } + }, + "child": { + "proposals": [ + "aes256-sha2_256-modp2048" + ], + "rekey_time": 3060, + "remote_ts": [ + "192.168.123.0/24", + "192.168.2.0/24", + "192.168.99.0/24", + "52.5.76.173/32" + ] + }, + "history": { + "connect_time": 0, + "connect_result": 0 + }, + "favicon": "" +} \ No newline at end of file diff --git a/ENI-2/ENI2/ENI2/App.config b/ENI-2/ENI2/ENI2/App.config index 41adfc61..fbb9572e 100644 --- a/ENI-2/ENI2/ENI2/App.config +++ b/ENI-2/ENI2/ENI2/App.config @@ -26,12 +26,12 @@ 1000 - http://192.168.2.24/LockingService/LockingService.svc - + + http://heupferd/bsmd.LockingService/LockingService.svc - Initial Catalog=nsw;Data Source=192.168.2.24\SQLEXPRESS;Uid=dfuser;pwd=dfpasswd;Persist Security Info=False;Connection Reset=false - + + Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=E:\DATA\DB\NSW.MDF;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False diff --git a/ENI-2/ENI2/ENI2/Controls/EditWindowBase.cs b/ENI-2/ENI2/ENI2/Controls/EditWindowBase.cs index 47853a0e..0ed4811b 100644 --- a/ENI-2/ENI2/ENI2/Controls/EditWindowBase.cs +++ b/ENI-2/ENI2/ENI2/Controls/EditWindowBase.cs @@ -6,6 +6,10 @@ using System; using System.Windows; using System.Windows.Controls; using System.ComponentModel; +using System.Text.RegularExpressions; + +using Xceed.Wpf.Toolkit; + using ENI2.Util; namespace ENI2.Controls @@ -22,7 +26,8 @@ namespace ENI2.Controls public event Action OKClicked; public event Action CancelClicked; public event Action AddClicked; - + private static readonly Regex rdt = new Regex(@"^(\d{12})$"); + private static readonly Regex rd = new Regex(@"^(\d{8})$"); protected bool shouldCancel; static EditWindowBase() @@ -73,6 +78,44 @@ namespace ENI2.Controls OKClicked?.Invoke(); } + #region "BHV Spezial" Datetime Parsing.. + + protected void DateTimePicker_PreviewKeyUp(object sender, System.Windows.Input.KeyEventArgs e) + { + if ((sender is DateTimePicker thePicker) && rdt.IsMatch(thePicker.Text)) + { + try + { + string timevalText = rdt.Match(thePicker.Text).Captures[0].Value; + int day = Int32.Parse(timevalText.Substring(0, 2)); + int month = Int32.Parse(timevalText.Substring(2, 2)); + int year = Int32.Parse(timevalText.Substring(4, 4)); + int hour = Int32.Parse(timevalText.Substring(8, 2)); + int minute = Int32.Parse(timevalText.Substring(10, 2)); + thePicker.Value = new DateTime(year, month, day, hour, minute, 0); + } + catch (FormatException) { } + } + } + + protected void DateTimePicker_PreviewKeyUpDate(object sender, System.Windows.Input.KeyEventArgs e) + { + if ((sender is DatePicker thePicker) && rd.IsMatch(thePicker.Text)) + { + try + { + string timevalText = rd.Match(thePicker.Text).Captures[0].Value; + int day = Int32.Parse(timevalText.Substring(0, 2)); + int month = Int32.Parse(timevalText.Substring(2, 2)); + int year = Int32.Parse(timevalText.Substring(4, 4)); + thePicker.SelectedDate = new DateTime(year, month, day, 0, 0, 0); + } + catch (FormatException) { } + } + } + + #endregion + #region combobox content filtering protected void ComboBox_KeyUp(object sender, System.Windows.Input.KeyEventArgs e) diff --git a/ENI-2/ENI2/ENI2/DetailBaseControl.cs b/ENI-2/ENI2/ENI2/DetailBaseControl.cs index 21214979..05f5c214 100644 --- a/ENI-2/ENI2/ENI2/DetailBaseControl.cs +++ b/ENI-2/ENI2/ENI2/DetailBaseControl.cs @@ -4,10 +4,14 @@ using System; using System.Collections.Generic; +using System.ComponentModel; +using System.Text.RegularExpressions; using System.Windows.Controls; +using Xceed.Wpf.Toolkit; + using bsmd.database; -using System.ComponentModel; + using ENI2.Util; using ENI2.Controls; @@ -32,6 +36,8 @@ namespace ENI2 private readonly Dictionary _controlClassDict = new Dictionary(); private readonly Dictionary _typeMessageDict = new Dictionary(); + private static readonly Regex rdt = new Regex(@"^(\d{12})$"); + private static readonly Regex rd = new Regex(@"^(\d{8})$"); #endregion @@ -258,6 +264,48 @@ namespace ENI2 } } + #region "BHV Spezial" Datetime Parsing.. + + protected void DateTimePicker_PreviewKeyUp(object sender, System.Windows.Input.KeyEventArgs e) + { + if ((sender is DateTimePicker thePicker) && rdt.IsMatch(thePicker.Text)) + { + try + { + string timevalText = rdt.Match(thePicker.Text).Captures[0].Value; + int day = Int32.Parse(timevalText.Substring(0, 2)); + int month = Int32.Parse(timevalText.Substring(2, 2)); + int year = Int32.Parse(timevalText.Substring(4, 4)); + int hour = Int32.Parse(timevalText.Substring(8, 2)); + int minute = Int32.Parse(timevalText.Substring(10, 2)); + thePicker.Value = new DateTime(year, month, day, hour, minute, 0); + } + catch (FormatException) { } + } + } + + protected void DateTimePicker_PreviewKeyUpDate(object sender, System.Windows.Input.KeyEventArgs e) + { + if ((sender is DatePicker thePicker) && rd.IsMatch(thePicker.Text)) + { + try + { + string timevalText = rd.Match(thePicker.Text).Captures[0].Value; + int day = Int32.Parse(timevalText.Substring(0, 2)); + int month = Int32.Parse(timevalText.Substring(2, 2)); + int year = Int32.Parse(timevalText.Substring(4, 4)); + thePicker.SelectedDate = new DateTime(year, month, day, 0, 0, 0); + } + catch (FormatException) { } + } + } + + #endregion + + #endregion + + #region private + private void controlContentChanged(object ctrl, EventArgs args) { if (this._controlClassDict.ContainsKey(ctrl)) diff --git a/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs index 4df0a986..76c88c39 100644 --- a/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs @@ -57,7 +57,7 @@ namespace ENI2 get { return this.buttonSave.Visibility == Visibility.Visible; } // schwach aber es wird's tun } - public bool HasUnsentMessages + public List HasUnsentMessages { get { @@ -65,7 +65,7 @@ namespace ENI2 // wenn in einer Meldeklasse zwar Daten vorhanden sind, eingespielt durch Excel import oder // Handeingabe, diese aber NICHT gesendet wurden. // TODO: Hier wird noch ein Flag benötigt, dass die erfolgte Anzeige des Warndialogs speichert - bool result = false; + List result = new List(); foreach (Message aMessage in _messages) { @@ -76,7 +76,7 @@ namespace ENI2 { aMessage.UnsentMessageWarningShown = true; DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(aMessage); - result = true; + result.Add(aMessage.MessageNotificationClassDisplay); } } @@ -84,11 +84,11 @@ namespace ENI2 } } - public bool HasUnConfirmedMessages + public List HasUnConfirmedMessages { get { - bool result = false; + List result = new List(); foreach(Message aMessage in _messages) { @@ -98,7 +98,7 @@ namespace ENI2 { aMessage.UnconfirmedMessageWarningShown = true; DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(aMessage); - result = true; + result.Add(aMessage.MessageNotificationClassDisplay); } } return result; diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/ArrivalNotificationDetailControl.xaml b/ENI-2/ENI2/ENI2/DetailViewControls/ArrivalNotificationDetailControl.xaml index 99c2b2cc..b92d505a 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/ArrivalNotificationDetailControl.xaml +++ b/ENI-2/ENI2/ENI2/DetailViewControls/ArrivalNotificationDetailControl.xaml @@ -27,9 +27,9 @@ -