diff --git a/ENI2/Controls/ServerStatusControl.xaml.cs b/ENI2/Controls/ServerStatusControl.xaml.cs
index 94a92bca..816dc43b 100644
--- a/ENI2/Controls/ServerStatusControl.xaml.cs
+++ b/ENI2/Controls/ServerStatusControl.xaml.cs
@@ -96,14 +96,14 @@ namespace ENI2.Controls
tmpList.Sort();
- //System.Windows.Application.Current.Dispatcher.Invoke(delegate {
+ System.Windows.Application.Current.Dispatcher.Invoke(delegate {
foreach (StatusEntry se in tmpList)
entries.Add(se);
- //});
+ });
};
bgWorker.RunWorkerCompleted += (o, e) =>
- {
+ {
// Enumeration parsen und text ausgeben
ServiceControllerStatus excel = (ServiceControllerStatus)serverStatus.Excel;
diff --git a/ENI2/DetailViewControls/PortNotificationDetailControl.xaml b/ENI2/DetailViewControls/PortNotificationDetailControl.xaml
index f0fbd580..634feb3f 100644
--- a/ENI2/DetailViewControls/PortNotificationDetailControl.xaml
+++ b/ENI2/DetailViewControls/PortNotificationDetailControl.xaml
@@ -60,6 +60,7 @@
+
@@ -70,6 +71,18 @@
+
+
+
+
+
+
+
+
diff --git a/ENI2/DetailViewControls/PortNotificationDetailControl.xaml.cs b/ENI2/DetailViewControls/PortNotificationDetailControl.xaml.cs
index 45787c79..4367f7ef 100644
--- a/ENI2/DetailViewControls/PortNotificationDetailControl.xaml.cs
+++ b/ENI2/DetailViewControls/PortNotificationDetailControl.xaml.cs
@@ -6,6 +6,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
+using System.Linq;
using System.Windows;
using System.Windows.Controls;
@@ -26,6 +27,7 @@ namespace ENI2.DetailViewControls
private Message _infoMessage;
private Message _servMessage;
private Message _ladgMessage;
+ private Dictionary portAreas = null;
private static readonly string[] shippingAreas = {
Properties.Resources.textShippingAreaNORTHBALTIC,
@@ -109,11 +111,11 @@ namespace ENI2.DetailViewControls
_infoMessage.Elements.Add(info);
}
- Dictionary portAreas = LocalizedLookup.getPortAreasForLocode(this.Core.PoC);
+ portAreas = LocalizedLookup.getPortAreasForLocode(this.Core.PoC);
this.comboBoxPortArea.ItemsSource = portAreas;
this.comboBoxShippingArea.ItemsSource = shippingAreas;
- this.infoGroupBox.DataContext = info;
+ this.infoGroupBox.DataContext = info;
@@ -161,6 +163,15 @@ namespace ENI2.DetailViewControls
if (this.Core.IsFlagSet(MessageCore.CoreFlags.HOEGH)) this.comboBoxGroup.SelectedIndex = 4;
#endregion
+
+ #region init port area helper
+
+ if (LocalizedLookup.getPortAreaInfos().ContainsKey(this.Core.PoC))
+ {
+ this.comboBoxPortAreaHelper.ItemsSource = LocalizedLookup.getPortAreaInfos()[this.Core.PoC];
+ }
+
+ #endregion
}
#region datagrid LADG
@@ -459,5 +470,31 @@ namespace ENI2.DetailViewControls
#endregion
+ #region set port area code from selected combobox item
+
+ private void buttonSetPortArea_Click(object sender, RoutedEventArgs e)
+ {
+ if (this.comboBoxPortAreaHelper.SelectedItem != null)
+ {
+ PortAreaInfo pai = this.comboBoxPortAreaHelper.SelectedItem as PortAreaInfo;
+ if (portAreas.ContainsKey(pai.PortAreaCode))
+ {
+ var pair = portAreas.SingleOrDefault(p => p.Key == pai.PortAreaCode);
+ this.comboBoxPortArea.SelectedItem = pair;
+ }
+ }
+ }
+
+ private void comboBoxPortAreaHelper_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ if (this.comboBoxPortAreaHelper.SelectedItem != null)
+ {
+ PortAreaInfo pai = this.comboBoxPortAreaHelper.SelectedItem as PortAreaInfo;
+ this.comboBoxPortAreaHelper.ToolTip = $"{pai.Remark} Ships: {pai.Ships} Agentur: {pai.Agency} Liegeplatz: {pai.Berth}";
+ }
+
+ }
+
+ #endregion
}
}
diff --git a/ENI2/Excel/ExcelUtil.cs b/ENI2/Excel/ExcelUtil.cs
index 026f7b60..791465f0 100644
--- a/ENI2/Excel/ExcelUtil.cs
+++ b/ENI2/Excel/ExcelUtil.cs
@@ -956,9 +956,15 @@ namespace ENI2.Excel
string portArea = reader.ReadText("INFO.PortArea")?.ToUpper();
if (!portArea.IsNullOrEmpty() && DBManager.Instance.GetPortAreaDict().ContainsKey(portArea))
+ {
info.PortArea = portArea;
+ }
else
+ {
info.PortArea = "";
+ if (!portArea.IsNullOrEmpty() && info.RequestedPositionInPortOfCall.IsNullOrEmpty())
+ info.RequestedPositionInPortOfCall = portArea;
+ }
info.ShippingArea = reader.ReadShippingArea("INFO.ShippingArea"); // enum read func
bool? fumigatedBulkCargo = reader.ReadBoolean("INFO.FumigatedBulkCargo");
diff --git a/ENI2/LocalizedLookup.cs b/ENI2/LocalizedLookup.cs
index 4956f671..ae8979e6 100644
--- a/ENI2/LocalizedLookup.cs
+++ b/ENI2/LocalizedLookup.cs
@@ -16,6 +16,7 @@ namespace ENI2
private static readonly SQLiteConnection _con;
private const string _locode_DB_NAME = "db.sqlite";
private static Dictionary _nationalities = null;
+ private static Dictionary> _portAreaInfos = null;
static LocalizedLookup()
{
@@ -188,6 +189,8 @@ namespace ENI2
return result;
}
+
+
public static Dictionary getCargoCodesNST()
{
Dictionary result = new Dictionary();
@@ -304,5 +307,41 @@ namespace ENI2
reader.Close();
return result;
}
+
+ public static Dictionary> getPortAreaInfos()
+ {
+ if(_portAreaInfos == null)
+ {
+ _portAreaInfos = new Dictionary>();
+ string query = @"SELECT Locode, Agentur, Schiffe, Liegeplatz, Hafengebiet, `Hafengebiet-Code`, Bemerkungen from INFO_PortArea_Helper";
+ SQLiteCommand cmd = new SQLiteCommand(query, _con);
+ IDataReader reader = cmd.ExecuteReader();
+ while(reader.Read())
+ {
+ PortAreaInfo pai = new PortAreaInfo();
+ if (reader.IsDBNull(0)) continue;
+ pai.Locode = reader.GetString(0);
+ if (!reader.IsDBNull(1))
+ pai.Agency = reader.GetString(1);
+ if (!reader.IsDBNull(2))
+ pai.Ships = reader.GetString(2);
+ if (!reader.IsDBNull(3))
+ pai.Berth = reader.GetString(3);
+ if (!reader.IsDBNull(4))
+ pai.PortArea = reader.GetString(4);
+ if (!reader.IsDBNull(5))
+ pai.PortAreaCode = reader.GetString(5);
+ if (!reader.IsDBNull(6))
+ pai.Remark = reader.GetString(6);
+ if (!_portAreaInfos.ContainsKey(pai.Locode))
+ {
+ _portAreaInfos[pai.Locode] = new List();
+ }
+ _portAreaInfos[pai.Locode].Add(pai);
+ }
+ }
+ return _portAreaInfos;
+ }
+
}
}
diff --git a/bsmd.database/INFO.cs b/bsmd.database/INFO.cs
index 64d2055e..3178b061 100644
--- a/bsmd.database/INFO.cs
+++ b/bsmd.database/INFO.cs
@@ -234,4 +234,34 @@ namespace bsmd.database
#endregion
}
+
+ #region class PortAreaInfo
+
+ ///
+ /// simple helper class container to map support data from sqlite lookup db
+ ///
+ public class PortAreaInfo
+ {
+ public string Locode { get; set; }
+
+ public string Agency { get; set; }
+
+ public string Ships { get; set; }
+
+ public string Berth { get; set; }
+
+ public string PortArea { get; set; }
+
+ public string PortAreaCode { get; set; }
+
+ public string Remark { get; set; }
+
+ public override string ToString()
+ {
+ return string.Format("{0} ({1})", PortArea, PortAreaCode);
+ }
+ }
+
+ #endregion
+
}
\ No newline at end of file
diff --git a/misc/db.sqlite b/misc/db.sqlite
index fde90946..639d6066 100644
Binary files a/misc/db.sqlite and b/misc/db.sqlite differ