diff --git a/ENI-2/ENI2/ENI2/App.config b/ENI-2/ENI2/ENI2/App.config
index 0b733dcc..4ef4fabb 100644
--- a/ENI-2/ENI2/ENI2/App.config
+++ b/ENI-2/ENI2/ENI2/App.config
@@ -26,8 +26,8 @@
1000
-
- http://heupferd/bsmd.LockingService/LockingService.svc
+
+ http://heupferd/bsmd.LockingService/LockingService.svc
diff --git a/ENI-2/ENI2/ENI2/Controls/RuleControl.xaml.cs b/ENI-2/ENI2/ENI2/Controls/RuleControl.xaml.cs
index bdcfbc7d..0068094d 100644
--- a/ENI-2/ENI2/ENI2/Controls/RuleControl.xaml.cs
+++ b/ENI-2/ENI2/ENI2/Controls/RuleControl.xaml.cs
@@ -40,8 +40,7 @@ namespace ENI2.Controls
private void DataGridValidationRules_DeleteRequested(bsmd.database.DatabaseEntity obj)
{
- bsmd.database.ValidationRule vr = obj as bsmd.database.ValidationRule;
- if (vr != null)
+ if (obj is bsmd.database.ValidationRule vr)
{
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(vr);
this.ValidationRules.Remove(vr);
@@ -51,8 +50,7 @@ namespace ENI2.Controls
private void DataGridValidationRules_EditRequested(bsmd.database.DatabaseEntity obj)
{
- bsmd.database.ValidationRule vr = obj as bsmd.database.ValidationRule;
- if (vr != null)
+ if (obj is bsmd.database.ValidationRule vr)
{
EditRulesDialog eld = new EditRulesDialog();
eld.ValidationRule = vr;
diff --git a/ENI-2/ENI2/ENI2/Controls/ServerStatusControl.xaml.cs b/ENI-2/ENI2/ENI2/Controls/ServerStatusControl.xaml.cs
index 59be8b2a..c3ddd1e9 100644
--- a/ENI-2/ENI2/ENI2/Controls/ServerStatusControl.xaml.cs
+++ b/ENI-2/ENI2/ENI2/Controls/ServerStatusControl.xaml.cs
@@ -22,9 +22,9 @@ namespace ENI2.Controls
public partial class ServerStatusControl : UserControl
{
- private ObservableCollection entries = new ObservableCollection();
- private static Regex regex = new Regex(@"BSMD_(\d*)-(.*)-(\w*)");
- private static ILog _log = LogManager.GetLogger("ServerStatus");
+ private readonly ObservableCollection entries = new ObservableCollection();
+ private readonly static Regex regex = new Regex(@"BSMD_(\d*)-(.*)-(\w*)");
+ private readonly static ILog _log = LogManager.GetLogger("ServerStatus");
private ProgressBar _updateProgressBar;
private TextBlock _updateTextBlock;
@@ -123,7 +123,7 @@ namespace ENI2.Controls
public class StatusEntry : IComparable
{
- private static Dictionary guidIdDict = new Dictionary();
+ private static readonly Dictionary guidIdDict = new Dictionary();
public string Class { get; set; }
@@ -150,8 +150,7 @@ namespace ENI2.Controls
if (!guidIdDict.ContainsKey(guidString))
{
string idString = "";
- Guid coreId;
- if (Guid.TryParse(m.Groups[2].Value, out coreId))
+ if (Guid.TryParse(m.Groups[2].Value, out Guid coreId))
{
MessageCore aCore = DBManager.Instance.GetMessageCoreById(coreId);
if (aCore != null)
@@ -181,8 +180,8 @@ namespace ENI2.Controls
public int CompareTo(object obj)
{
- if(obj is StatusEntry)
- return -(Timestamp.CompareTo(((StatusEntry)obj).Timestamp));
+ if(obj is StatusEntry entry)
+ return -(Timestamp.CompareTo(entry.Timestamp));
return 0;
}
}
diff --git a/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs
index 6bdf35e7..d19edd53 100644
--- a/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs
+++ b/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs
@@ -221,8 +221,8 @@ namespace ENI2
bool isEnabled = !this.LockedByOtherUser;
detailControl.SetEnabled(isEnabled);
- if (!isEnabled && (detailControl is OverViewDetailControl) && !(Core.Cancelled ?? false))
- ((OverViewDetailControl)detailControl).ShowLockedBy(this.LockedBy);
+ if (!isEnabled && (detailControl is OverViewDetailControl control) && !(Core.Cancelled ?? false))
+ control.ShowLockedBy(this.LockedBy);
controlCache.Add(mg.MessageGroupName, detailControl);
this.buttonSave.Visibility = Visibility.Hidden;
diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/ArrivalNotificationDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/ArrivalNotificationDetailControl.xaml.cs
index 255681f4..19c61f9a 100644
--- a/ENI-2/ENI2/ENI2/DetailViewControls/ArrivalNotificationDetailControl.xaml.cs
+++ b/ENI-2/ENI2/ENI2/DetailViewControls/ArrivalNotificationDetailControl.xaml.cs
@@ -75,9 +75,12 @@ namespace ENI2.DetailViewControls
this.ataGroupBox.DataContext = ata;
- this.dateTimePickerATA.Minimum = DateTime.Now.AddDays(-14);
- this.dateTimePickerATA.Maximum = DateTime.Now.AddDays(14);
- this.dateTimePickerATA.ClipValueToMinMax = false;
+ if (!ata.ATAPortOfCall.HasValue)
+ {
+ this.dateTimePickerATA.Minimum = DateTime.Now.AddDays(-14);
+ this.dateTimePickerATA.Maximum = DateTime.Now.AddDays(14);
+ this.dateTimePickerATA.ClipValueToMinMax = true;
+ }
#endregion
diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/DepartureNotificationDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/DepartureNotificationDetailControl.xaml.cs
index fc1a39a1..410187f8 100644
--- a/ENI-2/ENI2/ENI2/DetailViewControls/DepartureNotificationDetailControl.xaml.cs
+++ b/ENI-2/ENI2/ENI2/DetailViewControls/DepartureNotificationDetailControl.xaml.cs
@@ -2,6 +2,7 @@
// Description: Detailansicht für ATD, TIEFD, POBD, BKRD
//
+using System;
using System.Windows;
using bsmd.database;
@@ -72,6 +73,13 @@ namespace ENI2.DetailViewControls
this.atdGroupBox.DataContext = atd;
+ if (!atd.ATDPortOfCall.HasValue)
+ {
+ this.dateTimePickerATD.Minimum = DateTime.Now.AddDays(-14);
+ this.dateTimePickerATD.Maximum = DateTime.Now.AddDays(14);
+ this.dateTimePickerATD.ClipValueToMinMax = true;
+ }
+
#endregion
#region TIEFD
@@ -174,9 +182,8 @@ namespace ENI2.DetailViewControls
}
private void DataGridBKRD_DeleteRequested(DatabaseEntity obj)
- {
- BRKD brkd = obj as BRKD;
- if (brkd != null)
+ {
+ if (obj is BRKD brkd)
{
// are you sure dialog is in base class
this._bkrdMessage.Elements.Remove(brkd);
diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs
index 767cc91c..73fd8eea 100644
--- a/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs
+++ b/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs
@@ -418,10 +418,11 @@ namespace ENI2.DetailViewControls
this.labelBSMDStatusInternal.DataContext = this.Core;
this.labelBSMDStatusInternal.GetBindingExpression(Label.ContentProperty)?.UpdateTarget();
//MessageBox.Show(string.Format("Visit/Transit ID updated: {0}", this.Core.DisplayId));
- ShowIdDialog sid = new ShowIdDialog
+ ShowIdDialog sid = new ShowIdDialog(this.Core)
{
DisplayId = this.Core.DisplayId
};
+ sid.UpdateId(this.Core.DisplayId);
sid.Show();
this.Core.IsDirty = false; // ist ja schon gespeichert..
}
diff --git a/ENI-2/ENI2/ENI2/EditControls/ShowIdDialog.xaml b/ENI-2/ENI2/ENI2/EditControls/ShowIdDialog.xaml
index 8be6508a..6da2d010 100644
--- a/ENI-2/ENI2/ENI2/EditControls/ShowIdDialog.xaml
+++ b/ENI-2/ENI2/ENI2/EditControls/ShowIdDialog.xaml
@@ -6,18 +6,31 @@
xmlns:local="clr-namespace:ENI2.EditControls"
xmlns:p="clr-namespace:ENI2.Properties"
mc:Ignorable="d"
- Title="{x:Static p:Resources.textVisitTransitId}" Height="152" Width="300" WindowStyle="SingleBorderWindow" WindowStartupLocation="CenterOwner" >
+ Title="{x:Static p:Resources.textVisitTransitId}" Height="236" Width="300" WindowStyle="SingleBorderWindow" WindowStartupLocation="CenterOwner" Loaded="Window_Loaded">
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ENI-2/ENI2/ENI2/EditControls/ShowIdDialog.xaml.cs b/ENI-2/ENI2/ENI2/EditControls/ShowIdDialog.xaml.cs
index 1337b3d2..d449c7ba 100644
--- a/ENI-2/ENI2/ENI2/EditControls/ShowIdDialog.xaml.cs
+++ b/ENI-2/ENI2/ENI2/EditControls/ShowIdDialog.xaml.cs
@@ -6,6 +6,7 @@ using System;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
+using bsmd.database;
namespace ENI2.EditControls
{
@@ -14,9 +15,10 @@ namespace ENI2.EditControls
///
public partial class ShowIdDialog : Window
{
- public ShowIdDialog()
+ public ShowIdDialog(MessageCore core)
{
InitializeComponent();
+ this.Core = core;
}
public string DisplayId
@@ -27,6 +29,8 @@ namespace ENI2.EditControls
public bool OpenCore { get; private set; }
+ public MessageCore Core { get; private set; }
+
public void UpdateId(string id)
{
this.Dispatcher.Invoke(new Action(() =>
@@ -53,5 +57,15 @@ namespace ENI2.EditControls
this.OpenCore = true;
this.Close();
}
+
+ private void Window_Loaded(object sender, RoutedEventArgs e)
+ {
+ if(this.Core != null)
+ {
+ this.labelETA.Content = this.Core.ETADisplay;
+ this.labelPoC.Content = this.Core.PoC;
+ this.labelIMO.Content = this.Core.IMO.IsNullOrEmpty() ? this.Core.ENI : this.Core.IMO;
+ }
+ }
}
}
diff --git a/ENI-2/ENI2/ENI2/MainWindow.xaml b/ENI-2/ENI2/ENI2/MainWindow.xaml
index c70bebf1..a33af61f 100644
--- a/ENI-2/ENI2/ENI2/MainWindow.xaml
+++ b/ENI-2/ENI2/ENI2/MainWindow.xaml
@@ -58,64 +58,73 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ENI-2/ENI2/ENI2/MainWindow.xaml.cs b/ENI-2/ENI2/ENI2/MainWindow.xaml.cs
index 4fa6e545..d4f04749 100644
--- a/ENI-2/ENI2/ENI2/MainWindow.xaml.cs
+++ b/ENI-2/ENI2/ENI2/MainWindow.xaml.cs
@@ -48,7 +48,7 @@ namespace ENI2
private ReportingParty userEntity;
private readonly ILog _log = LogManager.GetLogger(typeof(MainWindow));
private readonly DatabaseEntityWatchdog _dbWatchDog;
- private ShowIdDialog showIdDialog;
+ private readonly Dictionary showIdDict = new Dictionary();
#endregion
@@ -206,7 +206,6 @@ namespace ENI2
e.Cancel = true;
}
-
if (!e.Cancel)
{
if (lockedCores.ContainsKey(tabItem))
@@ -388,6 +387,8 @@ namespace ENI2
VisitIdDialog closedDialog = senderDialog as VisitIdDialog;
if(closedDialog.IsOK)
{
+ Util.UIHelper.SetBusyState();
+
if (!closedDialog.Core.IsDK)
{
// deutsche Häfen fordern eine Visit-Id an, für DK erfolgt hier nur die Anlage eines Datensatzes
@@ -401,26 +402,28 @@ namespace ENI2
closedDialog.Core.DefaultReportingPartyId = this.userEntity.Id;
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(closedDialog.Core);
- // Meldeklassen für neuen Anlauf erzeugen:dam
- bsmd.database.Util.CreateMessagesForCore(closedDialog.Core, null, userEntity);
-
// watchdog registrieren
- this._dbWatchDog.Register(closedDialog.Core);
+ this._dbWatchDog.Register(closedDialog.Core);
// Wartedialog anzeigen
- this.showIdDialog = new ShowIdDialog();
- this.showIdDialog.Closed += (showIdDialog, showIdArgs) =>
+ ShowIdDialog showIdDialog = new ShowIdDialog(closedDialog.Core);
+ showIdDialog.Closed += (sid, showIdArgs) =>
{
- if(this.showIdDialog.OpenCore)
- this.AnmeldungenControl_MessageCoreSelected(closedDialog.Core); // in einem neuen Reiter öffnen
- else
- this._dbWatchDog.UnRegister(closedDialog.Core);
+ if(((ShowIdDialog)sid).OpenCore)
+ this.AnmeldungenControl_MessageCoreSelected(closedDialog.Core); // in einem neuen Reiter öffnen
// wenn der Dialog vorzeitig geschlossen wird erkennt man später dass man die Id dort nicht updaten braucht
- this.showIdDialog = null;
+ if (this.showIdDict.ContainsKey(closedDialog.Core.Id.Value))
+ this.showIdDict[closedDialog.Core.Id.Value] = null;
+ this.UpdateWaitIdLabel();
};
- this.showIdDialog.ShowDialog();
- //
+ this.showIdDict.Add(closedDialog.Core.Id.Value, showIdDialog);
+ showIdDialog.Show();
+ this.UpdateWaitIdLabel();
+
+ // Meldeklassen für neuen Anlauf erzeugen
+ bsmd.database.Util.CreateMessagesForCore(closedDialog.Core, null, userEntity);
+
}
};
visitIdDialog.Show();
@@ -515,7 +518,34 @@ namespace ENI2
{
if (entity is MessageCore changedCore)
{
- this.showIdDialog?.UpdateId(changedCore.VisitId.IsNullOrEmpty() ? changedCore.TransitId : changedCore.VisitId);
+ if (showIdDict.ContainsKey(changedCore.Id.Value))
+ {
+ if (this.showIdDict[changedCore.Id.Value] != null)
+ {
+ this.showIdDict[changedCore.Id.Value].UpdateId(changedCore.VisitId.IsNullOrEmpty() ? changedCore.TransitId : changedCore.VisitId);
+ }
+ else
+ {
+ // Wartedialog nochmal
+ this.Dispatcher.Invoke(new Action(() =>
+ {
+ ShowIdDialog showIdDialog = new ShowIdDialog(changedCore);
+ showIdDialog.Closed += (sid, showIdArgs) =>
+ {
+ if (((ShowIdDialog)sid).OpenCore)
+ this.AnmeldungenControl_MessageCoreSelected(changedCore);
+ };
+ showIdDialog.Show();
+ showIdDialog.UpdateId(changedCore.VisitId.IsNullOrEmpty() ? changedCore.TransitId : changedCore.VisitId);
+ }));
+ }
+ this.showIdDict.Remove(changedCore.Id.Value);
+ // this._dbWatchDog.UnRegister(changedCore); // wird ggf später abgeräumt wenn der Tab geschlossen wird
+ this.Dispatcher.Invoke(new Action(() =>
+ {
+ UpdateWaitIdLabel();
+ }));
+ }
if (this.openTabs.ContainsKey(changedCore.Id.Value))
{
@@ -526,6 +556,7 @@ namespace ENI2
drc?.CoreChanged(changedCore);
}));
}
+
}
}
@@ -624,6 +655,18 @@ namespace ENI2
}
}
+ private void UpdateWaitIdLabel()
+ {
+ if(this.showIdDict.Count == 0)
+ {
+ this.labelStatusId.Content = "";
+ }
+ else
+ {
+ this.labelStatusId.Content = string.Format("waiting for {0} id(s)..", this.showIdDict.Count);
+ }
+ }
+
#endregion
}
diff --git a/Stundensheet.xlsx b/Stundensheet.xlsx
index e66ebc1b..c2d1c3f5 100644
Binary files a/Stundensheet.xlsx and b/Stundensheet.xlsx differ