diff --git a/ENI-2/ENI2/ENI2/App.config b/ENI-2/ENI2/ENI2/App.config
index 4ef4fabb..84d7bb33 100644
--- a/ENI-2/ENI2/ENI2/App.config
+++ b/ENI-2/ENI2/ENI2/App.config
@@ -26,12 +26,12 @@
1000
-
- http://heupferd/bsmd.LockingService/LockingService.svc
+ http://192.168.2.24/LockingService/LockingService.svc
+
-
- 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
+ Initial Catalog=nsw;Data Source=192.168.2.24\SQLEXPRESS;Uid=dfuser;pwd=dfpasswd;Persist Security Info=False;Connection Reset=false
+
diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs
index 73fd8eea..2327546c 100644
--- a/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs
+++ b/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs
@@ -29,6 +29,7 @@ namespace ENI2.DetailViewControls
private Timer _checkStatusTimer;
private DateTime _startStatusCheck;
private readonly object _collectionLock = new object();
+ private MessageSendStatusDialog mssd = null;
public OverViewDetailControl()
{
@@ -267,101 +268,8 @@ namespace ENI2.DetailViewControls
#region Meldeklassen einrichten und Icons / Gruppen / Index zuordnen
- foreach (Message aMessage in this.Messages)
- {
- switch (aMessage.MessageNotificationClass)
- {
- case Message.NotificationClass.VISIT:
- case Message.NotificationClass.TRANSIT:
- aMessage.ENINotificationDetailGroup = Properties.Resources.textOverview;
- aMessage.ENINotificationIconString = "../Resources/documents.png";
- aMessage.ENINotificationDetailIndex = 0;
- break;
- case Message.NotificationClass.NOA_NOD:
- case Message.NotificationClass.AGNT:
- aMessage.ENINotificationIconString = "../Resources/eye_blue.png";
- aMessage.ENINotificationDetailGroup = Properties.Resources.textPortCall;
- aMessage.ENINotificationDetailIndex = 1;
- break;
- case Message.NotificationClass.NAME:
- case Message.NotificationClass.INFO:
- case Message.NotificationClass.SERV:
- case Message.NotificationClass.LADG:
- aMessage.ENINotificationIconString = "../Resources/anchor.png";
- aMessage.ENINotificationDetailGroup = Properties.Resources.textPortNotification;
- aMessage.ENINotificationDetailIndex = 2;
- break;
- case Message.NotificationClass.WAS:
- aMessage.ENINotificationIconString = "../Resources/garbage.png";
- aMessage.ENINotificationDetailGroup = Properties.Resources.textWaste;
- aMessage.ENINotificationDetailIndex = 3;
- break;
- case Message.NotificationClass.ATA:
- case Message.NotificationClass.POBA:
- case Message.NotificationClass.TIEFA:
- case Message.NotificationClass.BKRA:
- aMessage.ENINotificationIconString = "../Resources/arrow_down_right_red.png";
- aMessage.ENINotificationDetailGroup = Properties.Resources.textArrivalNotification;
- aMessage.ENINotificationDetailIndex = 4;
- break;
- case Message.NotificationClass.SEC:
- aMessage.ENINotificationIconString = "../Resources/shield_yellow.png";
- aMessage.ENINotificationDetailGroup = Properties.Resources.textSecurity;
- aMessage.ENINotificationDetailIndex = 5;
- break;
- case Message.NotificationClass.PRE72H:
- aMessage.ENINotificationIconString = "../Resources/alarmclock.png";
- aMessage.ENINotificationDetailGroup = Properties.Resources.textPSC72h;
- aMessage.ENINotificationDetailIndex = 6;
- break;
- case Message.NotificationClass.MDH:
- aMessage.ENINotificationIconString = "../Resources/medical_bag.png";
- aMessage.ENINotificationDetailGroup = Properties.Resources.textMDH;
- aMessage.ENINotificationDetailIndex = 7;
- break;
- case Message.NotificationClass.ATD:
- case Message.NotificationClass.TIEFD:
- case Message.NotificationClass.BKRD:
- case Message.NotificationClass.POBD:
- aMessage.ENINotificationIconString = "../Resources/arrow_up_right_green.png";
- aMessage.ENINotificationDetailGroup = Properties.Resources.textDepartureNotification;
- aMessage.ENINotificationDetailIndex = 8;
- break;
- case Message.NotificationClass.STAT:
- aMessage.ENINotificationIconString = "../Resources/containership.png";
- aMessage.ENINotificationDetailGroup = Properties.Resources.textShipData;
- aMessage.ENINotificationDetailIndex = 9;
- break;
- case Message.NotificationClass.BPOL:
- case Message.NotificationClass.CREW:
- case Message.NotificationClass.PAS:
- aMessage.ENINotificationIconString = "../Resources/policeman_german.png";
- aMessage.ENINotificationDetailGroup = Properties.Resources.textBorderPolice;
- aMessage.ENINotificationDetailIndex = 10;
- break;
-
- case Message.NotificationClass.HAZA:
- aMessage.ENINotificationIconString = "../Resources/sign_warning_radiation.png";
- aMessage.ENINotificationDetailGroup = Properties.Resources.textDGArrival;
- aMessage.ENINotificationDetailIndex = 11;
- break;
- case Message.NotificationClass.HAZD:
- aMessage.ENINotificationIconString = "../Resources/sign_warning_radiation.png";
- aMessage.ENINotificationDetailGroup = Properties.Resources.textDGDeparture;
- aMessage.ENINotificationDetailIndex = 12;
- break;
- case Message.NotificationClass.TOWA:
- case Message.NotificationClass.TOWD:
- aMessage.ENINotificationIconString = "../Resources/ship2.png";
- aMessage.ENINotificationDetailGroup = Properties.Resources.textTowage;
- aMessage.ENINotificationDetailIndex = 13;
- break;
- default:
- aMessage.ENINotificationDetailGroup = "unspecified";
- break;
- }
- }
-
+ Util.UIHelper.SetMessageIcons(this.Messages);
+
#endregion
#region Meldeklassen nach ihrem Vorkommen in den Detailansichten sortieren (SH, 12.5.17)
@@ -506,6 +414,7 @@ namespace ENI2.DetailViewControls
return;
}
+ List watchList = new List();
foreach (Message selectedMessage in this.dataGridMessages.SelectedItems)
{
if (selectedMessage.Reset) selectedMessage.Reset = false; // "nochmal" Versenden ist möglich
@@ -518,15 +427,36 @@ namespace ENI2.DetailViewControls
selectedMessage.ChangedBy = string.Format("{0} at {1} (Send)", userName, DateTime.Now);
selectedMessage.StatusInfo = string.Format(Properties.Resources.textMessageSentAt, DateTime.Now);
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(selectedMessage);
+ watchList.Add(selectedMessage);
}
// komplette Anmeldung auf "zu versenden" stellen
this.Core.BSMDStatusInternal = MessageCore.BSMDStatus.TOSEND;
this.Core.DefaultReportingPartyId = App.UserId;
- DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(this.Core);
+ DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(this.Core); // löst auch den Watchdog aus
this.OnRequestSendValidation();
this.dataGridMessages.Items.Refresh();
+
+ if (this.mssd == null)
+ {
+ this.mssd = new MessageSendStatusDialog(this.Core);
+ this.mssd.Closed += (s,args) => { this.mssd = null; };
+ this.mssd.SendComplete += (() => {
+ this.Dispatcher.Invoke(() =>
+ {
+ if (this.mssd != null)
+ {
+ this.mssd.Close();
+ this.OnRequestReload(this.Core.Id.Value);
+ }
+ });
+ });
+ this.mssd.Show();
+ }
+
+ this.mssd.AddMessages(watchList);
+
}
}
diff --git a/ENI-2/ENI2/ENI2/EditControls/MessageSendStatusDialog.xaml b/ENI-2/ENI2/ENI2/EditControls/MessageSendStatusDialog.xaml
index d595b9ae..f38c028b 100644
--- a/ENI-2/ENI2/ENI2/EditControls/MessageSendStatusDialog.xaml
+++ b/ENI-2/ENI2/ENI2/EditControls/MessageSendStatusDialog.xaml
@@ -4,14 +4,85 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ENI2.EditControls"
+ xmlns:util="clr-namespace:ENI2.Util"
xmlns:enictrl="clr-namespace:ENI2.Controls"
xmlns:p="clr-namespace:ENI2.Properties"
mc:Ignorable="d"
- Title="{x:Static p:Resources.textMessageStatus}" Height="450" Width="400" Loaded="StatusWindowBase_Loaded">
+ Title="{x:Static p:Resources.textMessageStatus}" Height="450" Width="800" Loaded="StatusWindowBase_Loaded" Closing="StatusWindowBase_Closing">
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ENI-2/ENI2/ENI2/EditControls/MessageSendStatusDialog.xaml.cs b/ENI-2/ENI2/ENI2/EditControls/MessageSendStatusDialog.xaml.cs
index 1f5a80d2..bc3087bf 100644
--- a/ENI-2/ENI2/ENI2/EditControls/MessageSendStatusDialog.xaml.cs
+++ b/ENI-2/ENI2/ENI2/EditControls/MessageSendStatusDialog.xaml.cs
@@ -2,23 +2,12 @@
// Description: Overview of messages currently in transmission
//
-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;
-using System.Timers;
using bsmd.database;
using ENI2.Controls;
-using log4net;
+using System;
+using System.Collections.Generic;
+using System.Timers;
+using System.Windows;
namespace ENI2.EditControls
{
@@ -28,30 +17,93 @@ namespace ENI2.EditControls
public partial class MessageSendStatusDialog : StatusWindowBase
{
private readonly Timer bgTimer;
+ private List _messages = new List();
+ private MessageCore _messageCore;
- public MessageSendStatusDialog()
+ public MessageSendStatusDialog(MessageCore core)
{
InitializeComponent();
this.bgTimer = new Timer();
+ _messageCore = core;
this.bgTimer.Elapsed += BgTimer_Elapsed;
this.bgTimer.AutoReset = true;
this.bgTimer.Interval = Properties.Settings.Default.changeTimerTimeout;
}
- List Messages { get; set; }
+ public void AddMessages(List messages)
+ {
+ if (!messages.IsNullOrEmpty())
+ {
+ foreach (Message newMessage in messages)
+ {
+ if (!_messages.Contains(newMessage))
+ _messages.Add(newMessage);
+ }
+ this.RefreshGrid();
+ }
+ }
+
+ public event Action SendComplete;
+
+ private void RefreshGrid()
+ {
+ this.Dispatcher.Invoke(() =>
+ {
+ Util.UIHelper.SetMessageIcons(_messages);
+ this.dataGridMessages.ItemsSource = null;
+ this.dataGridMessages.ItemsSource = _messages;
+ });
+ }
private void BgTimer_Elapsed(object sender, ElapsedEventArgs e)
{
// check if a message has changed its status
+ bool updatedMessage = false;
+ bool finished = true;
+ System.Diagnostics.Trace.WriteLine(string.Format("Watching {0} messages.", _messages.Count));
+ for (int i = 0; i < _messages.Count; i++)
+ {
+ Message testMessage = (Message) DBManager.Instance.GetMessageById(_messages[i].Id.Value);
+
+ if(testMessage.Changed > _messages[i].Changed)
+ {
+ _messages[i] = testMessage; // replace Message in Array with "newer" Message
+ updatedMessage = true;
+ System.Diagnostics.Trace.WriteLine(string.Format("Updating {0} To status {1}", testMessage.Id, testMessage.InternalStatus));
+ }
+ finished &= (testMessage.InternalStatus != Message.BSMDStatus.TOSEND);
+ }
+
+ if (finished)
+ {
+ _messageCore.IsHighlighted = true;
+ this.OnSendComplete();
+ }
+
+ if(updatedMessage)
+ {
+ this.RefreshGrid();
+ }
}
private void StatusWindowBase_Loaded(object sender, RoutedEventArgs e)
+ {
+ this.bgTimer.Start();
+ this.dataGridMessages.DataContext = _messages;
+ }
+
+ protected void OnSendComplete()
{
- if (!this.Messages.IsNullOrEmpty())
- this.bgTimer.Start();
+ this.SendComplete?.Invoke();
+ }
+
+ private void StatusWindowBase_Closing(object sender, System.ComponentModel.CancelEventArgs e)
+ {
+ this.bgTimer.Stop();
+ this.bgTimer.Dispose();
}
}
}
diff --git a/ENI-2/ENI2/ENI2/MainWindow.xaml.cs b/ENI-2/ENI2/ENI2/MainWindow.xaml.cs
index d4f04749..755ad485 100644
--- a/ENI-2/ENI2/ENI2/MainWindow.xaml.cs
+++ b/ENI-2/ENI2/ENI2/MainWindow.xaml.cs
@@ -510,6 +510,7 @@ namespace ENI2
if (tabitem is ClosableTabItem closableTabItem)
(closableTabItem).IsHighlighted = true;
}));
+ changedCore.IsHighlighted = false;
}
}
}
diff --git a/ENI-2/ENI2/ENI2/Util/DatabaseEntityWatchdog.cs b/ENI-2/ENI2/ENI2/Util/DatabaseEntityWatchdog.cs
index 77ad22f0..2b846810 100644
--- a/ENI-2/ENI2/ENI2/Util/DatabaseEntityWatchdog.cs
+++ b/ENI-2/ENI2/ENI2/Util/DatabaseEntityWatchdog.cs
@@ -42,12 +42,19 @@ namespace ENI2.Util
MessageCore entity = DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).GetMessageCoreById(watchedEntity.Id ?? Guid.Empty);
if (entity != null)
{
- if (entity.Changed > this._watchedEntities[watchedEntity])
+ // Der Core muss einen dieser Zustände einnehmen bevor das Highlighting erlaubt ist. Diese Zustände werden im Send Prozess gesetzt
+ // (wenn die Nachrichten bearbeitet sind)
+ bool isValidState = (entity.BSMDStatusInternal == MessageCore.BSMDStatus.FAILURE) ||
+ (entity.BSMDStatusInternal == MessageCore.BSMDStatus.SENT) ||
+ (entity.BSMDStatusInternal == MessageCore.BSMDStatus.PREPARE);
+
+ if (isValidState && ((entity.Changed > this._watchedEntities[watchedEntity]) || watchedEntity.IsHighlighted))
{
OnDatabaseEntityChanged(entity);
changedCores.Add(entity);
}
+ // Test ob eventuell Visit/Transit-ID inzwischen gesetzt wurde
if(entity.IsTransit)
{
if (!entity.TransitId.IsNullOrEmpty() && watchedEntity.TransitId.IsNullOrEmpty() && !entity.TransitId.Equals(watchedEntity.TransitId))
diff --git a/ENI-2/ENI2/ENI2/Util/UIHelper.cs b/ENI-2/ENI2/ENI2/Util/UIHelper.cs
index 354677b0..f8535e19 100644
--- a/ENI-2/ENI2/ENI2/Util/UIHelper.cs
+++ b/ENI-2/ENI2/ENI2/Util/UIHelper.cs
@@ -4,12 +4,15 @@
// https://stackoverflow.com/a/7482321
using System;
+using System.Collections.Generic;
using System.Reflection;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Threading;
+using bsmd.database;
+
namespace ENI2.Util
{
public static class UIHelper
@@ -56,5 +59,103 @@ namespace ENI2.Util
return Color.FromRgb((byte) r.Next(150, 255), (byte) r.Next(150, 255), (byte) r.Next(150, 255));
}
+ public static void SetMessageIcons(List messages)
+ {
+ foreach (Message aMessage in messages)
+ {
+ switch (aMessage.MessageNotificationClass)
+ {
+ case Message.NotificationClass.VISIT:
+ case Message.NotificationClass.TRANSIT:
+ aMessage.ENINotificationDetailGroup = Properties.Resources.textOverview;
+ aMessage.ENINotificationIconString = "../Resources/documents.png";
+ aMessage.ENINotificationDetailIndex = 0;
+ break;
+ case Message.NotificationClass.NOA_NOD:
+ case Message.NotificationClass.AGNT:
+ aMessage.ENINotificationIconString = "../Resources/eye_blue.png";
+ aMessage.ENINotificationDetailGroup = Properties.Resources.textPortCall;
+ aMessage.ENINotificationDetailIndex = 1;
+ break;
+ case Message.NotificationClass.NAME:
+ case Message.NotificationClass.INFO:
+ case Message.NotificationClass.SERV:
+ case Message.NotificationClass.LADG:
+ aMessage.ENINotificationIconString = "../Resources/anchor.png";
+ aMessage.ENINotificationDetailGroup = Properties.Resources.textPortNotification;
+ aMessage.ENINotificationDetailIndex = 2;
+ break;
+ case Message.NotificationClass.WAS:
+ aMessage.ENINotificationIconString = "../Resources/garbage.png";
+ aMessage.ENINotificationDetailGroup = Properties.Resources.textWaste;
+ aMessage.ENINotificationDetailIndex = 3;
+ break;
+ case Message.NotificationClass.ATA:
+ case Message.NotificationClass.POBA:
+ case Message.NotificationClass.TIEFA:
+ case Message.NotificationClass.BKRA:
+ aMessage.ENINotificationIconString = "../Resources/arrow_down_right_red.png";
+ aMessage.ENINotificationDetailGroup = Properties.Resources.textArrivalNotification;
+ aMessage.ENINotificationDetailIndex = 4;
+ break;
+ case Message.NotificationClass.SEC:
+ aMessage.ENINotificationIconString = "../Resources/shield_yellow.png";
+ aMessage.ENINotificationDetailGroup = Properties.Resources.textSecurity;
+ aMessage.ENINotificationDetailIndex = 5;
+ break;
+ case Message.NotificationClass.PRE72H:
+ aMessage.ENINotificationIconString = "../Resources/alarmclock.png";
+ aMessage.ENINotificationDetailGroup = Properties.Resources.textPSC72h;
+ aMessage.ENINotificationDetailIndex = 6;
+ break;
+ case Message.NotificationClass.MDH:
+ aMessage.ENINotificationIconString = "../Resources/medical_bag.png";
+ aMessage.ENINotificationDetailGroup = Properties.Resources.textMDH;
+ aMessage.ENINotificationDetailIndex = 7;
+ break;
+ case Message.NotificationClass.ATD:
+ case Message.NotificationClass.TIEFD:
+ case Message.NotificationClass.BKRD:
+ case Message.NotificationClass.POBD:
+ aMessage.ENINotificationIconString = "../Resources/arrow_up_right_green.png";
+ aMessage.ENINotificationDetailGroup = Properties.Resources.textDepartureNotification;
+ aMessage.ENINotificationDetailIndex = 8;
+ break;
+ case Message.NotificationClass.STAT:
+ aMessage.ENINotificationIconString = "../Resources/containership.png";
+ aMessage.ENINotificationDetailGroup = Properties.Resources.textShipData;
+ aMessage.ENINotificationDetailIndex = 9;
+ break;
+ case Message.NotificationClass.BPOL:
+ case Message.NotificationClass.CREW:
+ case Message.NotificationClass.PAS:
+ aMessage.ENINotificationIconString = "../Resources/policeman_german.png";
+ aMessage.ENINotificationDetailGroup = Properties.Resources.textBorderPolice;
+ aMessage.ENINotificationDetailIndex = 10;
+ break;
+
+ case Message.NotificationClass.HAZA:
+ aMessage.ENINotificationIconString = "../Resources/sign_warning_radiation.png";
+ aMessage.ENINotificationDetailGroup = Properties.Resources.textDGArrival;
+ aMessage.ENINotificationDetailIndex = 11;
+ break;
+ case Message.NotificationClass.HAZD:
+ aMessage.ENINotificationIconString = "../Resources/sign_warning_radiation.png";
+ aMessage.ENINotificationDetailGroup = Properties.Resources.textDGDeparture;
+ aMessage.ENINotificationDetailIndex = 12;
+ break;
+ case Message.NotificationClass.TOWA:
+ case Message.NotificationClass.TOWD:
+ aMessage.ENINotificationIconString = "../Resources/ship2.png";
+ aMessage.ENINotificationDetailGroup = Properties.Resources.textTowage;
+ aMessage.ENINotificationDetailIndex = 13;
+ break;
+ default:
+ aMessage.ENINotificationDetailGroup = "unspecified";
+ break;
+ }
+ }
+ }
+
}
}
diff --git a/Stundensheet.xlsx b/Stundensheet.xlsx
index 65bbdb27..872f656a 100644
Binary files a/Stundensheet.xlsx and b/Stundensheet.xlsx differ
diff --git a/nsw/Source/SQL/Update_6.1_To_6.0.10.sql b/nsw/Source/SQL/Update_6.1_To_6.0.10.sql
index 8cf99b7d..ae2da3f7 100644
--- a/nsw/Source/SQL/Update_6.1_To_6.0.10.sql
+++ b/nsw/Source/SQL/Update_6.1_To_6.0.10.sql
@@ -8,4 +8,20 @@ GO
ALTER TABLE [dbo].[MessageCore]
ADD [POATA] DATETIME NULL;
+GO
+
+-- genauere Auflösung für Changed Spalte!
+
+PRINT N'Altering [dbo].[MessageHeader]...';
+
+GO
+ALTER TABLE [dbo].[MessageHeader] ALTER COLUMN [Changed] DATETIME NULL;
+
+GO
+
+PRINT N'Altering [dbo].[MessageCore]...';
+
+GO
+ALTER TABLE [dbo].[MessageCore] ALTER COLUMN [Changed] DATETIME NULL;
+
GO
\ No newline at end of file
diff --git a/nsw/Source/bsmd.database/MessageCore.cs b/nsw/Source/bsmd.database/MessageCore.cs
index e20bf7b7..f5baab54 100644
--- a/nsw/Source/bsmd.database/MessageCore.cs
+++ b/nsw/Source/bsmd.database/MessageCore.cs
@@ -323,7 +323,10 @@ namespace bsmd.database
#region Flag properties not backed by field
-
+ ///
+ /// ENI helper to mark this Core in Overview (tabheader)
+ ///
+ public bool IsHighlighted { get; set; }
#endregion