From a9594e7702d725514ed5e8f40676e29e08e5d307 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Thu, 24 Aug 2017 16:54:40 +0000 Subject: [PATCH] Version 2.3.6.13: Highlighting erster Ansatz, immer weitere Korrekturen rund um HIS-Nord Versand --- ENI-2/ENI2/ENI2/App.config | 8 +- ENI-2/ENI2/ENI2/ControlTemplates.xaml | 89 ++++++++++++ .../Controls/IHighlightControlContainer.cs | 27 ++++ ENI-2/ENI2/ENI2/DetailBaseControl.cs | 21 ++- ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs | 18 ++- .../ArrivalNotificationDetailControl.xaml.cs | 21 +++ .../BorderPoliceDetailControl.xaml.cs | 25 ++++ .../DangerousGoodsDetailControl.xaml.cs | 18 +++ ...DepartureNotificationDetailControl.xaml.cs | 35 +++++ ...aritimeHealthDeclarationDetailControl.xaml | 2 +- ...timeHealthDeclarationDetailControl.xaml.cs | 26 +++- .../OverViewDetailControl.xaml | 25 ++-- .../OverViewDetailControl.xaml.cs | 5 + .../PSC72hDetailControl.xaml.cs | 21 ++- .../PortCallDetailControl.xaml.cs | 32 +++++ .../PortNotificationDetailControl.xaml.cs | 31 +++- .../SecurityDetailControl.xaml | 2 +- .../SecurityDetailControl.xaml.cs | 22 ++- .../ShipDataDetailControl.xaml | 2 +- .../ShipDataDetailControl.xaml.cs | 21 +++ .../TowageDetailControl.xaml.cs | 22 +++ .../WasteDetailControl.xaml | 2 +- .../WasteDetailControl.xaml.cs | 22 ++- ENI-2/ENI2/ENI2/ENI2.csproj | 10 +- ENI-2/ENI2/ENI2/MainWindow.xaml | 9 +- .../ENI2/Properties/Resources.Designer.cs | 27 ++++ ENI-2/ENI2/ENI2/Properties/Resources.resx | 9 ++ ENI-2/ENI2/ENI2/Util/HighlightService.cs | 134 ++++++++++++++++++ ENI-2/data/crew_import.xlsx | Bin 0 -> 8574 bytes ENI-2/data/pas_import.xlsx | Bin 0 -> 8611 bytes Stundensheet.xlsx | Bin 32797 -> 32850 bytes nsw/HIS-NORD/xsd.2017/his-nord.cs | 20 ++- .../his-nord_nsw_v-1-0_all_reeder.xsd | 7 +- nsw/HIS-NORD/xsd.2017/mdh_reeder.xsd | 8 +- nsw/Source/bsmd.database/Message.cs | 15 +- .../Properties/AssemblyProductInfo.cs | 2 +- .../Properties/AssemblyProjectInfo.cs | 2 +- nsw/Source/bsmd.database/XtraSendLogic.cs | 44 +++++- nsw/Source/bsmd.hisnord/Request.cs | 39 +++-- nsw/Source/bsmd.hisnord/Response.cs | 18 ++- nsw/Source/bsmd.hisnord/his-nord.cs | 51 +++---- 41 files changed, 778 insertions(+), 114 deletions(-) create mode 100644 ENI-2/ENI2/ENI2/ControlTemplates.xaml create mode 100644 ENI-2/ENI2/ENI2/Controls/IHighlightControlContainer.cs create mode 100644 ENI-2/ENI2/ENI2/Util/HighlightService.cs create mode 100644 ENI-2/data/crew_import.xlsx create mode 100644 ENI-2/data/pas_import.xlsx diff --git a/ENI-2/ENI2/ENI2/App.config b/ENI-2/ENI2/ENI2/App.config index b657c69b..26bd10f2 100644 --- a/ENI-2/ENI2/ENI2/App.config +++ b/ENI-2/ENI2/ENI2/App.config @@ -26,12 +26,12 @@ 1000 - http://192.168.2.4/LockingService/LockingService.svc - + + http://heupferd/bsmd.LockingService/LockingService.svc - Data Source=192.168.2.12;Initial Catalog=nsw;Uid=dfuser;Pwd=dfpasswd;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False - + + Data Source=(localdb)\Projects;Initial Catalog=nsw;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False diff --git a/ENI-2/ENI2/ENI2/ControlTemplates.xaml b/ENI-2/ENI2/ENI2/ControlTemplates.xaml new file mode 100644 index 00000000..70eaa254 --- /dev/null +++ b/ENI-2/ENI2/ENI2/ControlTemplates.xaml @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ENI-2/ENI2/ENI2/Controls/IHighlightControlContainer.cs b/ENI-2/ENI2/ENI2/Controls/IHighlightControlContainer.cs new file mode 100644 index 00000000..7872dd3f --- /dev/null +++ b/ENI-2/ENI2/ENI2/Controls/IHighlightControlContainer.cs @@ -0,0 +1,27 @@ +// Copyright (c) 2017 schick Informatik +// Description: Interface für eine gemeinsame Basis von EditWindowBase und +// DetailBaseControl. Beide müssen auf externe Änderungen am Highlighting reagieren +// können und das mögliche Highlighting ihrer Controls abfragen können. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +using bsmd.database; +using ENI2.Util; + +namespace ENI2.Controls +{ + public interface IHighlightControlContainer + { + + void HighlightErrorMessageContainer(); + + void HighlightViolationMessageContainer(); + + void HighlightProperty(Message theMessage, string propertyName, string identifier, HighlightService.HighlightStyle style); + + } +} diff --git a/ENI-2/ENI2/ENI2/DetailBaseControl.cs b/ENI-2/ENI2/ENI2/DetailBaseControl.cs index fb58f0dd..758180b4 100644 --- a/ENI-2/ENI2/ENI2/DetailBaseControl.cs +++ b/ENI-2/ENI2/ENI2/DetailBaseControl.cs @@ -9,10 +9,11 @@ using System.Windows.Controls; using bsmd.database; using System.ComponentModel; using ENI2.Util; +using ENI2.Controls; namespace ENI2 { - public class DetailBaseControl : UserControl + public class DetailBaseControl : UserControl, IHighlightControlContainer { #region Fields @@ -224,6 +225,24 @@ namespace ENI2 #endregion + #region IHighlightControlContainer implementation + + public virtual void HighlightErrorMessageContainer() + { + //throw new NotImplementedException(); + } + + public virtual void HighlightViolationMessageContainer() + { + //throw new NotImplementedException(); + } + + public virtual void HighlightProperty(Message theMessage, string propertyName, string identifier, HighlightService.HighlightStyle style) + { + throw new NotImplementedException(); + } + + #endregion } } diff --git a/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs index f90124e4..b38d5b4c 100644 --- a/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs @@ -29,6 +29,7 @@ namespace ENI2 private Dictionary controlCache = new Dictionary(); private Guid userId = Guid.NewGuid(); // remove THIS!! private object messageListLock = new object(); + private HighlightService highlightService = new HighlightService(); #endregion @@ -141,6 +142,7 @@ namespace ENI2 // Control has been created before: Set visibility of "save" button: bool hasDirtyMessages = false; DetailBaseControl dbc = controlCache[mg.MessageGroupName]; + foreach (Message message in dbc.ControlMessages) if (message.IsDirty) hasDirtyMessages = true; @@ -149,6 +151,11 @@ namespace ENI2 // plug it in ;-) detailView.Children.Clear(); + + // zuerst Vio dann Error + controlCache[mg.MessageGroupName].HighlightViolationMessageContainer(); + controlCache[mg.MessageGroupName].HighlightErrorMessageContainer(); + detailView.Children.Add(controlCache[mg.MessageGroupName]); } } @@ -181,8 +188,13 @@ namespace ENI2 { if (message.IsDirty) { - if ((message.Status == Message.MessageStatus.ACCEPTED) && (message.InternalStatus == Message.BSMDStatus.CONFIRMED)) + if ((message.Status == Message.MessageStatus.ACCEPTED) && + ((message.InternalStatus == Message.BSMDStatus.CONFIRMED) || (message.InternalStatus == Message.BSMDStatus.VIOLATION))) message.InternalStatus = Message.BSMDStatus.UPDATED; + string userName = "?"; + if (this.LockedBy != null) + userName = this.LockedBy.Logon; + message.ChangedBy = string.Format("{0} at {1}", userName, DateTime.Now); DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(message); message.SaveElements(); message.IsDirty = false; @@ -230,7 +242,7 @@ namespace ENI2 } else { - // locking failed: Notify User + // TODO: locking failed: Notify User } } @@ -264,7 +276,7 @@ namespace ENI2 // if the entity has been highlighted (through remote change detection), reset this here this.OnHighlightReset(); - } + } #endregion diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/ArrivalNotificationDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/ArrivalNotificationDetailControl.xaml.cs index c9c5044f..7042f662 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/ArrivalNotificationDetailControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/DetailViewControls/ArrivalNotificationDetailControl.xaml.cs @@ -6,6 +6,7 @@ using System.Windows; using bsmd.database; using ENI2.EditControls; +using System.Windows.Media; namespace ENI2.DetailViewControls { @@ -211,5 +212,25 @@ namespace ENI2.DetailViewControls #endregion + #region Highlighting + + public override void HighlightErrorMessageContainer() + { + if (this._ataMessage.HasErrors) this.ataGroupBox.BorderBrush = Brushes.Red; + if (this._bkraMessage.HasErrors) this.bkraGroupBox.BorderBrush = Brushes.Red; + if (this._pobaMessage.HasErrors) this.pobaGroupBox.BorderBrush = Brushes.Red; + if (this._tiefaMessage.HasErrors) this.tiefaGroupBox.BorderBrush = Brushes.Red; + } + + public override void HighlightViolationMessageContainer() + { + if (this._ataMessage.HasViolations) this.ataGroupBox.BorderBrush = Brushes.Yellow; + if (this._bkraMessage.HasViolations) this.bkraGroupBox.BorderBrush = Brushes.Yellow; + if (this._pobaMessage.HasViolations) this.pobaGroupBox.BorderBrush = Brushes.Yellow; + if (this._tiefaMessage.HasViolations) this.tiefaGroupBox.BorderBrush = Brushes.Yellow; + } + + #endregion + } } diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml.cs index 684a4811..794103ea 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml.cs @@ -469,5 +469,30 @@ namespace ENI2.DetailViewControls } #endregion + + #region Highlighting + + public override void HighlightErrorMessageContainer() + { + if (this._bpolMessage.HasErrors) + HighlightService.HighlightControl(this.groupBoxBorderPolice, HighlightService.HighlightStyle.ERROR, this._bpolMessage); + if (this._crewMessage.HasErrors) + HighlightService.HighlightControl(this.groupBoxCrewList, HighlightService.HighlightStyle.ERROR, this._crewMessage); + if (this._pasMessage.HasErrors) + HighlightService.HighlightControl(this.groupBoxPassengerList, HighlightService.HighlightStyle.ERROR, this._pasMessage); + } + + public override void HighlightViolationMessageContainer() + { + if (this._bpolMessage.HasViolations) + HighlightService.HighlightControl(this.groupBoxBorderPolice, HighlightService.HighlightStyle.VIOLATION, this._bpolMessage); + if (this._crewMessage.HasViolations) + HighlightService.HighlightControl(this.groupBoxCrewList, HighlightService.HighlightStyle.VIOLATION, this._crewMessage); + if (this._pasMessage.HasViolations) + HighlightService.HighlightControl(this.groupBoxPassengerList, HighlightService.HighlightStyle.VIOLATION, this._pasMessage); + } + + #endregion + } } diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/DangerousGoodsDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/DangerousGoodsDetailControl.xaml.cs index c50454ef..94e33b18 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/DangerousGoodsDetailControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/DetailViewControls/DangerousGoodsDetailControl.xaml.cs @@ -490,5 +490,23 @@ namespace ENI2.DetailViewControls #endregion + #region Highlighting + + public override void HighlightErrorMessageContainer() + { + if (this._hazMessage.HasErrors) + { + HighlightService.HighlightControl(this.groupBoxHAZ, HighlightService.HighlightStyle.ERROR, this._hazMessage); + } + } + + public override void HighlightViolationMessageContainer() + { + if (this._hazMessage.HasViolations) + HighlightService.HighlightControl(this.groupBoxHAZ, HighlightService.HighlightStyle.VIOLATION, this._hazMessage); + } + + #endregion + } } diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/DepartureNotificationDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/DepartureNotificationDetailControl.xaml.cs index d6623093..738f9f2f 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/DepartureNotificationDetailControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/DetailViewControls/DepartureNotificationDetailControl.xaml.cs @@ -6,6 +6,7 @@ using System.Windows; using bsmd.database; using ENI2.EditControls; +using ENI2.Util; namespace ENI2.DetailViewControls { @@ -210,5 +211,39 @@ namespace ENI2.DetailViewControls #endregion + #region Highlighting + + public override void HighlightErrorMessageContainer() + { + if (this._atdMessage.HasErrors) + HighlightService.HighlightControl(this.atdGroupBox, HighlightService.HighlightStyle.ERROR, this._atdMessage); + + if (this._tiefdMessage.HasErrors) + HighlightService.HighlightControl(this.tiefdGroupBox, HighlightService.HighlightStyle.ERROR, this._tiefdMessage); + + if (this._pobdMessage.HasErrors) + HighlightService.HighlightControl(this.pobdGroupBox, HighlightService.HighlightStyle.ERROR, this._pobdMessage); + + if (this._bkrdMessage.HasErrors) + HighlightService.HighlightControl(this.bkrdGroupBox, HighlightService.HighlightStyle.ERROR, this._bkrdMessage); + } + + public override void HighlightViolationMessageContainer() + { + if (this._atdMessage.HasViolations) + HighlightService.HighlightControl(this.atdGroupBox, HighlightService.HighlightStyle.VIOLATION, this._atdMessage); + + if (this._tiefdMessage.HasViolations) + HighlightService.HighlightControl(this.tiefdGroupBox, HighlightService.HighlightStyle.VIOLATION, this._tiefdMessage); + + if (this._pobdMessage.HasViolations) + HighlightService.HighlightControl(this.pobdGroupBox, HighlightService.HighlightStyle.VIOLATION, this._pobdMessage); + + if (this._bkrdMessage.HasViolations) + HighlightService.HighlightControl(this.bkrdGroupBox, HighlightService.HighlightStyle.VIOLATION, this._bkrdMessage); + } + + #endregion + } } diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/MaritimeHealthDeclarationDetailControl.xaml b/ENI-2/ENI2/ENI2/DetailViewControls/MaritimeHealthDeclarationDetailControl.xaml index dff95dcf..561ead12 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/MaritimeHealthDeclarationDetailControl.xaml +++ b/ENI-2/ENI2/ENI2/DetailViewControls/MaritimeHealthDeclarationDetailControl.xaml @@ -12,7 +12,7 @@ d:DesignHeight="600" d:DesignWidth="1024"> - + diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/MaritimeHealthDeclarationDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/MaritimeHealthDeclarationDetailControl.xaml.cs index 710ab8ab..76442b90 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/MaritimeHealthDeclarationDetailControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/DetailViewControls/MaritimeHealthDeclarationDetailControl.xaml.cs @@ -5,7 +5,7 @@ using System.Windows; using System.Windows.Controls; using ENI2.EditControls; - +using ENI2.Util; using bsmd.database; @@ -77,7 +77,7 @@ namespace ENI2.DetailViewControls #endregion - this.portCallGroupBox.DataContext = mdh; + this.mdhGroupBox.DataContext = mdh; this._mdh = mdh; this.dataGridPortOfCallLast30Days.Initialize(); @@ -169,7 +169,9 @@ namespace ENI2.DetailViewControls this.textBoxPlaceOfIssue.IsEnabled = !simplified; this.textBoxStowawaysJoiningLocation.IsEnabled = !simplified; this.integerUpDownNumberOfDeaths.IsEnabled = !simplified; + this.integerUpDownNumberOfDeaths.IsReadOnly = simplified; this.integerUpDownNumberOfIllPersons.IsEnabled = !simplified; + this.integerUpDownNumberOfIllPersons.IsReadOnly = simplified; } @@ -410,6 +412,24 @@ namespace ENI2.DetailViewControls } #endregion - + + #region Highlighting + + public override void HighlightErrorMessageContainer() + { + if (this._mdhMessage.HasErrors) + { + HighlightService.HighlightControl(this.mdhGroupBox, HighlightService.HighlightStyle.ERROR, this._mdhMessage); + } + } + + public override void HighlightViolationMessageContainer() + { + if (this._mdhMessage.HasViolations) + HighlightService.HighlightControl(this.mdhGroupBox, HighlightService.HighlightStyle.VIOLATION, this._mdhMessage); + } + + #endregion + } } diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml b/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml index bcf5e7aa..eeec5ce3 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml +++ b/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml @@ -160,7 +160,7 @@ - + @@ -186,13 +186,6 @@ - - - - - - + + + + + + + + + + +