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 @@
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+