diff --git a/ENI-2/ENI2/ENI2/Controls/ReportingPartyControl.xaml b/ENI-2/ENI2/ENI2/Controls/ReportingPartyControl.xaml
index 1406220a..2058f9a3 100644
--- a/ENI-2/ENI2/ENI2/Controls/ReportingPartyControl.xaml
+++ b/ENI-2/ENI2/ENI2/Controls/ReportingPartyControl.xaml
@@ -12,7 +12,7 @@
+ AutoGenerateColumns="False" >
diff --git a/ENI-2/ENI2/ENI2/Controls/ReportingPartyControl.xaml.cs b/ENI-2/ENI2/ENI2/Controls/ReportingPartyControl.xaml.cs
index 35595f9c..197b7033 100644
--- a/ENI-2/ENI2/ENI2/Controls/ReportingPartyControl.xaml.cs
+++ b/ENI-2/ENI2/ENI2/Controls/ReportingPartyControl.xaml.cs
@@ -7,7 +7,7 @@ using System.Windows;
using bsmd.database;
using ENI2.EditControls;
-using System.Collections.Generic;
+using System.Collections.ObjectModel;
using System.Windows.Controls;
namespace ENI2.Controls
@@ -23,7 +23,7 @@ namespace ENI2.Controls
Loaded += ReportingPartyControl_Loaded;
}
- public List ReportingParties { get; set; }
+ public ObservableCollection ReportingParties { get; set; }
private void ReportingPartyControl_Loaded(object sender, RoutedEventArgs e)
{
diff --git a/ENI-2/ENI2/ENI2/Controls/ServerStatusControl.xaml b/ENI-2/ENI2/ENI2/Controls/ServerStatusControl.xaml
new file mode 100644
index 00000000..f9fad8bc
--- /dev/null
+++ b/ENI-2/ENI2/ENI2/Controls/ServerStatusControl.xaml
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ENI-2/ENI2/ENI2/Controls/ServerStatusControl.xaml.cs b/ENI-2/ENI2/ENI2/Controls/ServerStatusControl.xaml.cs
new file mode 100644
index 00000000..63883306
--- /dev/null
+++ b/ENI-2/ENI2/ENI2/Controls/ServerStatusControl.xaml.cs
@@ -0,0 +1,125 @@
+// Copyright (c) 2017 schick Informatik
+// Description: Controls zur Statusanzeige auf dem Server
+//
+
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Windows.Controls;
+using System.Text.RegularExpressions;
+using System.Globalization;
+
+using log4net;
+using bsmd.database;
+using System.ServiceProcess;
+
+namespace ENI2.Controls
+{
+ ///
+ /// Interaction logic for ServerStatusControl.xaml
+ ///
+ 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");
+
+ public ServerStatusControl()
+ {
+ InitializeComponent();
+ this.dataGridStatus.ItemsSource = this.entries;
+ }
+
+ internal void Update(LockingServiceReference.ServerStatus serverStatus)
+ {
+
+ System.Windows.Application.Current.Dispatcher.Invoke(delegate {
+ // Die Dateien müssen in die Objekte
+ entries.Clear();
+ foreach (StatusEntry se in StatusEntry.CreateFromList(serverStatus.IMPFiles, "IMP"))
+ entries.Add(se);
+
+ foreach (StatusEntry se in StatusEntry.CreateFromList(serverStatus.READYFiles, "READY"))
+ entries.Add(se);
+
+ foreach (StatusEntry se in StatusEntry.CreateFromList(serverStatus.CORRUPTFiles, "CORRUPT"))
+ entries.Add(se);
+
+ // Enumeration parsen und text ausgeben
+ ServiceControllerStatus excel = (ServiceControllerStatus)serverStatus.Excel;
+ this.labelStatusExcel.Content = excel.ToString();
+
+ ServiceControllerStatus report = (ServiceControllerStatus)serverStatus.Report;
+ this.labelStatusReport.Content = report.ToString();
+
+ ServiceControllerStatus transmitter = (ServiceControllerStatus)serverStatus.Transmitter;
+ this.labelStatusTransmitter.Content = transmitter.ToString();
+ //this.dataGridStatus.Items.Refresh();
+ });
+ }
+
+ public class StatusEntry
+ {
+ private static Dictionary guidIdDict = new Dictionary();
+
+ public string Class { get; set; }
+
+ public DateTime Timestamp { get; set; }
+
+ public string Id { get; set; }
+
+ public string Status { get; set; }
+
+ public static List CreateFromList(string[] aList, string status)
+ {
+ List result = new List();
+
+ foreach(string listEntry in aList)
+ {
+ if (regex.IsMatch(listEntry))
+ {
+ try
+ {
+ StatusEntry entry = new StatusEntry();
+ Match m = regex.Match(listEntry);
+ entry.Timestamp = DateTime.ParseExact(m.Groups[1].Value, "yyyyMMddHHmmss", CultureInfo.InvariantCulture);
+
+ string guidString = m.Groups[2].Value;
+
+ if (!guidIdDict.ContainsKey(guidString))
+ {
+ string idString = "";
+ Guid coreId;
+ if (Guid.TryParse(m.Groups[2].Value, out coreId))
+ {
+ MessageCore aCore = DBManager.Instance.GetMessageCoreById(coreId);
+ if (aCore != null)
+ {
+ idString = aCore.DisplayId;
+ }
+ }
+ guidIdDict[guidString] = idString;
+ }
+
+ entry.Id = guidIdDict[guidString];
+ entry.Class = m.Groups[3].Value;
+ entry.Status = status;
+
+ result.Add(entry);
+ }
+ catch(Exception ex)
+ {
+ _log.WarnFormat("Problem reading status info: {0}", ex.Message);
+ }
+ }
+ }
+
+ return result;
+ }
+
+ }
+
+ }
+
+}
diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/ArrivalNotificationDetailControl.xaml b/ENI-2/ENI2/ENI2/DetailViewControls/ArrivalNotificationDetailControl.xaml
index 080d9eea..8f38bf2d 100644
--- a/ENI-2/ENI2/ENI2/DetailViewControls/ArrivalNotificationDetailControl.xaml
+++ b/ENI-2/ENI2/ENI2/DetailViewControls/ArrivalNotificationDetailControl.xaml
@@ -27,7 +27,7 @@
-
+
@@ -66,7 +66,7 @@
+ AutoGenerateColumns="False" Margin="0,5,0,0">
diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml.cs
index caa1b4ab..0b3ec763 100644
--- a/ENI-2/ENI2/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml.cs
+++ b/ENI-2/ENI2/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml.cs
@@ -451,7 +451,7 @@ namespace ENI2.DetailViewControls
if (importCrew.Count > 0)
{
- this.dataGridCrewList.Items.Refresh();
+ this.dataGridCrewList.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.CREW);
MessageBox.Show(String.Format(Properties.Resources.textCrewImported, importCrew.Count), Properties.Resources.textCaptionInformation, MessageBoxButton.OK, MessageBoxImage.Information);
}
diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/DepartureNotificationDetailControl.xaml b/ENI-2/ENI2/ENI2/DetailViewControls/DepartureNotificationDetailControl.xaml
index 9d7998a3..22d4dd13 100644
--- a/ENI-2/ENI2/ENI2/DetailViewControls/DepartureNotificationDetailControl.xaml
+++ b/ENI-2/ENI2/ENI2/DetailViewControls/DepartureNotificationDetailControl.xaml
@@ -27,7 +27,7 @@
-
+
diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml b/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml
index 2644a35f..a20461f4 100644
--- a/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml
+++ b/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml
@@ -67,20 +67,15 @@
-
-
-
-
+
+
+
+
-
-
-
-
-
@@ -110,6 +105,11 @@
+
+
+
+
+
diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs
index f46576d4..324202e2 100644
--- a/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs
+++ b/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs
@@ -369,6 +369,10 @@ namespace ENI2.DetailViewControls
this.stackPanelLock.Visibility = Visibility.Visible;
this.textBlockLockUserName.Text = reportingParty.FirstName + " " + reportingParty.LastName;
}
+ else
+ {
+ MessageBox.Show("Reporting party empty, cannot show locked by!", "Notification", MessageBoxButton.OK, MessageBoxImage.Error);
+ }
}
#endregion
diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/PortCallDetailControl.xaml b/ENI-2/ENI2/ENI2/DetailViewControls/PortCallDetailControl.xaml
index 13f41f79..b62fa8fb 100644
--- a/ENI-2/ENI2/ENI2/DetailViewControls/PortCallDetailControl.xaml
+++ b/ENI-2/ENI2/ENI2/DetailViewControls/PortCallDetailControl.xaml
@@ -42,14 +42,14 @@
-
-
-
-
+
+
+
+
-
+
-
+
diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/SecurityDetailControl.xaml b/ENI-2/ENI2/ENI2/DetailViewControls/SecurityDetailControl.xaml
index d98f3c00..ff7f0fdd 100644
--- a/ENI-2/ENI2/ENI2/DetailViewControls/SecurityDetailControl.xaml
+++ b/ENI-2/ENI2/ENI2/DetailViewControls/SecurityDetailControl.xaml
@@ -68,8 +68,8 @@
-
-
+
+
diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/ShipDataDetailControl.xaml b/ENI-2/ENI2/ENI2/DetailViewControls/ShipDataDetailControl.xaml
index 59578995..a113487d 100644
--- a/ENI-2/ENI2/ENI2/DetailViewControls/ShipDataDetailControl.xaml
+++ b/ENI-2/ENI2/ENI2/DetailViewControls/ShipDataDetailControl.xaml
@@ -90,7 +90,7 @@
-
+
diff --git a/ENI-2/ENI2/ENI2/ENI2.csproj b/ENI-2/ENI2/ENI2/ENI2.csproj
index bed34011..918d2585 100644
--- a/ENI-2/ENI2/ENI2/ENI2.csproj
+++ b/ENI-2/ENI2/ENI2/ENI2.csproj
@@ -35,8 +35,8 @@
3.5.1.0
true
publish.html
- 0
- 3.8.7.%2a
+ 1
+ 3.8.8.%2a
false
true
true
@@ -112,6 +112,7 @@
+
@@ -182,6 +183,9 @@
RuleControl.xaml
+
+ ServerStatusControl.xaml
+
ValidationConditionControl.xaml
@@ -365,6 +369,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
@@ -594,6 +602,9 @@
Reference.svcmap
+
+ Reference.svcmap
+
Designer
diff --git a/ENI-2/ENI2/ENI2/EditControls/EditCallPurposeDialog.xaml.cs b/ENI-2/ENI2/ENI2/EditControls/EditCallPurposeDialog.xaml.cs
index bc7671ce..2393d317 100644
--- a/ENI-2/ENI2/ENI2/EditControls/EditCallPurposeDialog.xaml.cs
+++ b/ENI-2/ENI2/ENI2/EditControls/EditCallPurposeDialog.xaml.cs
@@ -39,7 +39,7 @@ namespace ENI2.EditControls
this.OKClicked += EditCallPurposeDialog_OKClicked;
this.AddVisible = true;
- this.comboBoxCode.ItemsSource = Util.GlobalStructures.Edifact8025;
+ this.comboBoxCode.ItemsSource = Util.GlobalStructures.Edifact8025WithKey;
if((this.CallPurpose != null) && (this.CallPurpose.CallPurposeCode != 0))
{
this.comboBoxCode.SelectedValue = this.CallPurpose.CallPurposeCode;
diff --git a/ENI-2/ENI2/ENI2/EditControls/EditPortOfItineraryDialog.xaml b/ENI-2/ENI2/ENI2/EditControls/EditPortOfItineraryDialog.xaml
index 03009e86..aa0c8a99 100644
--- a/ENI-2/ENI2/ENI2/EditControls/EditPortOfItineraryDialog.xaml
+++ b/ENI-2/ENI2/ENI2/EditControls/EditPortOfItineraryDialog.xaml
@@ -21,7 +21,7 @@
-
+
diff --git a/ENI-2/ENI2/ENI2/EditControls/ErrorListDialog.xaml b/ENI-2/ENI2/ENI2/EditControls/ErrorListDialog.xaml
index 78fc0d3f..f26b6029 100644
--- a/ENI-2/ENI2/ENI2/EditControls/ErrorListDialog.xaml
+++ b/ENI-2/ENI2/ENI2/EditControls/ErrorListDialog.xaml
@@ -19,7 +19,13 @@
-
+
+
+
+
+
+
+
diff --git a/ENI-2/ENI2/ENI2/EditControls/NewWithIdDialog.xaml b/ENI-2/ENI2/ENI2/EditControls/NewWithIdDialog.xaml
index 978170f5..7800abab 100644
--- a/ENI-2/ENI2/ENI2/EditControls/NewWithIdDialog.xaml
+++ b/ENI-2/ENI2/ENI2/EditControls/NewWithIdDialog.xaml
@@ -59,6 +59,6 @@
Watermark="Enter ENI" ValueChanged="doubleUpDownENI_ValueChanged" TextAlignment="Left"/>
-
+
diff --git a/ENI-2/ENI2/ENI2/EditControls/NewWithIdDialog.xaml.cs b/ENI-2/ENI2/ENI2/EditControls/NewWithIdDialog.xaml.cs
index e1373d69..89e51f3e 100644
--- a/ENI-2/ENI2/ENI2/EditControls/NewWithIdDialog.xaml.cs
+++ b/ENI-2/ENI2/ENI2/EditControls/NewWithIdDialog.xaml.cs
@@ -70,7 +70,11 @@ namespace ENI2.EditControls
bool imo_OR_eni = ((doubleUpDownIMO.Value.HasValue) && (doubleUpDownIMO.Value >= 1000000) && (doubleUpDownIMO.Value <= 9999999)) ||
((doubleUpDownENI.Value.HasValue) && (doubleUpDownENI.Value >= 100000) && (doubleUpDownENI.Value <= 99999999));
- isComplete &= imo_OR_eni;
+ isComplete &= imo_OR_eni;
+
+ bool isHISSelected = (this.comboBoxInitialHIS.SelectedValue != null);
+
+ isComplete &= isHISSelected;
this.EnableOK(isComplete);
@@ -92,5 +96,10 @@ namespace ENI2.EditControls
{
this.CheckComplete();
}
+
+ private void comboBoxInitialHIS_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ this.CheckComplete();
+ }
}
}
diff --git a/ENI-2/ENI2/ENI2/EditControls/ViolationListDialog.xaml b/ENI-2/ENI2/ENI2/EditControls/ViolationListDialog.xaml
index 2beb993c..e5f21896 100644
--- a/ENI-2/ENI2/ENI2/EditControls/ViolationListDialog.xaml
+++ b/ENI-2/ENI2/ENI2/EditControls/ViolationListDialog.xaml
@@ -24,7 +24,13 @@
-
+
+
+
+
+
+
+
diff --git a/ENI-2/ENI2/ENI2/MainWindow.xaml b/ENI-2/ENI2/ENI2/MainWindow.xaml
index 687eb6fc..5b141dc0 100644
--- a/ENI-2/ENI2/ENI2/MainWindow.xaml
+++ b/ENI-2/ENI2/ENI2/MainWindow.xaml
@@ -67,6 +67,7 @@
+
@@ -75,7 +76,8 @@
-
+
+
diff --git a/ENI-2/ENI2/ENI2/MainWindow.xaml.cs b/ENI-2/ENI2/ENI2/MainWindow.xaml.cs
index 0dd33621..59b4a4d3 100644
--- a/ENI-2/ENI2/ENI2/MainWindow.xaml.cs
+++ b/ENI-2/ENI2/ENI2/MainWindow.xaml.cs
@@ -4,12 +4,14 @@
using System;
using System.Collections.Generic;
+using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Threading;
+using System.Timers;
using bsmd.database;
using System.Windows.Controls;
@@ -33,10 +35,12 @@ namespace ENI2
private ReportingPartyControl rpControl;
private RuleControl ruleControl;
- private bool dbConnected;
+ private ServerStatusControl statusControl;
private SucheControl sucheControl;
+
private List anmeldungen = new List();
private bool efMode = false;
+ private bool dbConnected;
ScaleTransform _transform = new ScaleTransform(1.0, 1.0);
private Dictionary openTabs = new Dictionary();
private Dictionary lockedCores = new Dictionary();
@@ -44,6 +48,7 @@ namespace ENI2
private ReportingParty userEntity = null;
private ILog _log = LogManager.GetLogger(typeof(MainWindow));
private DatabaseEntityWatchdog _dbWatchDog;
+ private System.Timers.Timer _statusTimer;
#endregion
@@ -64,7 +69,12 @@ namespace ENI2
App.SplashScreen.ShowMessage("done");
Thread.Sleep(500);
App.SplashScreen.LoadComplete();
- }
+ this._statusTimer = new System.Timers.Timer();
+ this._statusTimer.AutoReset = true;
+ this._statusTimer.Elapsed += _statusTimer_Elapsed; // TODO: Timer konfigurierbar
+ this._statusTimer.Interval = 10000; // alle 10 Sekunden
+ this._statusTimer.Start();
+ }
#endregion
@@ -108,7 +118,7 @@ namespace ENI2
DetailRootControl drc = new DetailRootControl(aMessageCore);
drc.LockedByOtherUser = !iDidLockIt;
- if (!aMessageCore.Cancelled ?? false)
+ if (!(aMessageCore.Cancelled ?? false))
{
drc.LockedBy = iDidLockIt ? this.userEntity : DBManager.Instance.GetReportingPartyDict()[lockedUserId];
}
@@ -211,7 +221,7 @@ namespace ENI2
{
this.rpControl = new ReportingPartyControl();
Dictionary repPartyDict = DBManager.Instance.GetReportingPartyDict();
- this.rpControl.ReportingParties = new List(repPartyDict.Values);
+ this.rpControl.ReportingParties = new ObservableCollection(repPartyDict.Values);
}
this.rootContainer.Children.Add(this.rpControl);
}
@@ -225,6 +235,14 @@ namespace ENI2
}
this.rootContainer.Children.Add(ruleControl);
}
+ else if(sender == this.buttonStatus)
+ {
+ if(this.statusControl == null)
+ {
+ this.statusControl = new ServerStatusControl();
+ }
+ this.rootContainer.Children.Add(this.statusControl);
+ }
this.buttonNewId.Visibility = newButtonsVisible ? Visibility.Visible : Visibility.Hidden;
this.buttonNewWithId.Visibility = newButtonsVisible ? Visibility.Visible : Visibility.Hidden;
@@ -493,6 +511,7 @@ namespace ENI2
{
this.buttonUserAdmin.Visibility = Visibility.Visible;
this.buttonEditRules.Visibility = Visibility.Visible;
+ this.buttonStatus.Visibility = Visibility.Visible;
}
else
{
@@ -519,6 +538,29 @@ namespace ENI2
}
#endregion
-
+
+ #region Service Status timer handler
+
+ private void _statusTimer_Elapsed(object sender, ElapsedEventArgs e)
+ {
+ if(App.LockingServiceClient != null)
+ {
+ try
+ {
+ LockingServiceReference.ServerStatus serverStatus = App.LockingServiceClient.GetStatus();
+ if ((serverStatus != null) && (this.statusControl != null))
+ {
+ this.statusControl.Update(serverStatus);
+ }
+ }
+ catch(Exception ex)
+ {
+ _log.DebugFormat("LockingService.GetStatus() threw an exception: {0}", ex.Message);
+ }
+ }
+ }
+
+ #endregion
+
}
}
diff --git a/ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs b/ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs
index c882068e..5af03a1f 100644
--- a/ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs
+++ b/ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs
@@ -3731,6 +3731,15 @@ namespace ENI2.Properties {
}
}
+ ///
+ /// Looks up a localized string similar to Server status.
+ ///
+ public static string textServerStatus {
+ get {
+ return ResourceManager.GetString("textServerStatus", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Beneficiary.
///
diff --git a/ENI-2/ENI2/ENI2/Properties/Resources.resx b/ENI-2/ENI2/ENI2/Properties/Resources.resx
index 6dcefee5..e5cfa9a0 100644
--- a/ENI-2/ENI2/ENI2/Properties/Resources.resx
+++ b/ENI-2/ENI2/ENI2/Properties/Resources.resx
@@ -1588,4 +1588,7 @@
Class
+
+ Server status
+
\ No newline at end of file
diff --git a/ENI-2/ENI2/ENI2/Service References/LockingServiceReference/ENI2.LockingServiceReference.ServerStatus.datasource b/ENI-2/ENI2/ENI2/Service References/LockingServiceReference/ENI2.LockingServiceReference.ServerStatus.datasource
new file mode 100644
index 00000000..42ff8b45
--- /dev/null
+++ b/ENI-2/ENI2/ENI2/Service References/LockingServiceReference/ENI2.LockingServiceReference.ServerStatus.datasource
@@ -0,0 +1,10 @@
+
+
+
+ ENI2.LockingServiceReference.ServerStatus, Service References.LockingServiceReference.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
+
\ No newline at end of file
diff --git a/ENI-2/ENI2/ENI2/Service References/LockingServiceReference/LockingService.wsdl b/ENI-2/ENI2/ENI2/Service References/LockingServiceReference/LockingService.wsdl
index 1387d783..f7a42162 100644
--- a/ENI-2/ENI2/ENI2/Service References/LockingServiceReference/LockingService.wsdl
+++ b/ENI-2/ENI2/ENI2/Service References/LockingServiceReference/LockingService.wsdl
@@ -38,6 +38,12 @@
+
+
+
+
+
+
@@ -59,6 +65,10 @@
+
+
+
+
@@ -107,6 +117,15 @@
+
+
+
+
+
+
+
+
+
diff --git a/ENI-2/ENI2/ENI2/Service References/LockingServiceReference/LockingService.xsd b/ENI-2/ENI2/ENI2/Service References/LockingServiceReference/LockingService.xsd
index b813954f..9b51af7f 100644
--- a/ENI-2/ENI2/ENI2/Service References/LockingServiceReference/LockingService.xsd
+++ b/ENI-2/ENI2/ENI2/Service References/LockingServiceReference/LockingService.xsd
@@ -7,4 +7,10 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ENI-2/ENI2/ENI2/Service References/LockingServiceReference/LockingService1.xsd b/ENI-2/ENI2/ENI2/Service References/LockingServiceReference/LockingService1.xsd
index 7c98bdb2..89917055 100644
--- a/ENI-2/ENI2/ENI2/Service References/LockingServiceReference/LockingService1.xsd
+++ b/ENI-2/ENI2/ENI2/Service References/LockingServiceReference/LockingService1.xsd
@@ -1,6 +1,7 @@
+
@@ -14,4 +15,15 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ENI-2/ENI2/ENI2/Service References/LockingServiceReference/LockingService2.xsd b/ENI-2/ENI2/ENI2/Service References/LockingServiceReference/LockingService2.xsd
index 0c14d7de..d4ab8eaa 100644
--- a/ENI-2/ENI2/ENI2/Service References/LockingServiceReference/LockingService2.xsd
+++ b/ENI-2/ENI2/ENI2/Service References/LockingServiceReference/LockingService2.xsd
@@ -70,4 +70,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ENI-2/ENI2/ENI2/Service References/LockingServiceReference/Reference.cs b/ENI-2/ENI2/ENI2/Service References/LockingServiceReference/Reference.cs
index fce6d6ea..e28d8634 100644
--- a/ENI-2/ENI2/ENI2/Service References/LockingServiceReference/Reference.cs
+++ b/ENI-2/ENI2/ENI2/Service References/LockingServiceReference/Reference.cs
@@ -74,6 +74,131 @@ namespace ENI2.LockingServiceReference {
}
}
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
+ [System.Runtime.Serialization.DataContractAttribute(Name="ServerStatus", Namespace="http://schemas.datacontract.org/2004/07/bsmd.LockingService")]
+ [System.SerializableAttribute()]
+ public partial class ServerStatus : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged {
+
+ [System.NonSerializedAttribute()]
+ private System.Runtime.Serialization.ExtensionDataObject extensionDataField;
+
+ [System.Runtime.Serialization.OptionalFieldAttribute()]
+ private string[] CORRUPTFilesField;
+
+ [System.Runtime.Serialization.OptionalFieldAttribute()]
+ private int ExcelField;
+
+ [System.Runtime.Serialization.OptionalFieldAttribute()]
+ private string[] IMPFilesField;
+
+ [System.Runtime.Serialization.OptionalFieldAttribute()]
+ private string[] READYFilesField;
+
+ [System.Runtime.Serialization.OptionalFieldAttribute()]
+ private int ReportField;
+
+ [System.Runtime.Serialization.OptionalFieldAttribute()]
+ private int TransmitterField;
+
+ [global::System.ComponentModel.BrowsableAttribute(false)]
+ public System.Runtime.Serialization.ExtensionDataObject ExtensionData {
+ get {
+ return this.extensionDataField;
+ }
+ set {
+ this.extensionDataField = value;
+ }
+ }
+
+ [System.Runtime.Serialization.DataMemberAttribute()]
+ public string[] CORRUPTFiles {
+ get {
+ return this.CORRUPTFilesField;
+ }
+ set {
+ if ((object.ReferenceEquals(this.CORRUPTFilesField, value) != true)) {
+ this.CORRUPTFilesField = value;
+ this.RaisePropertyChanged("CORRUPTFiles");
+ }
+ }
+ }
+
+ [System.Runtime.Serialization.DataMemberAttribute()]
+ public int Excel {
+ get {
+ return this.ExcelField;
+ }
+ set {
+ if ((this.ExcelField.Equals(value) != true)) {
+ this.ExcelField = value;
+ this.RaisePropertyChanged("Excel");
+ }
+ }
+ }
+
+ [System.Runtime.Serialization.DataMemberAttribute()]
+ public string[] IMPFiles {
+ get {
+ return this.IMPFilesField;
+ }
+ set {
+ if ((object.ReferenceEquals(this.IMPFilesField, value) != true)) {
+ this.IMPFilesField = value;
+ this.RaisePropertyChanged("IMPFiles");
+ }
+ }
+ }
+
+ [System.Runtime.Serialization.DataMemberAttribute()]
+ public string[] READYFiles {
+ get {
+ return this.READYFilesField;
+ }
+ set {
+ if ((object.ReferenceEquals(this.READYFilesField, value) != true)) {
+ this.READYFilesField = value;
+ this.RaisePropertyChanged("READYFiles");
+ }
+ }
+ }
+
+ [System.Runtime.Serialization.DataMemberAttribute()]
+ public int Report {
+ get {
+ return this.ReportField;
+ }
+ set {
+ if ((this.ReportField.Equals(value) != true)) {
+ this.ReportField = value;
+ this.RaisePropertyChanged("Report");
+ }
+ }
+ }
+
+ [System.Runtime.Serialization.DataMemberAttribute()]
+ public int Transmitter {
+ get {
+ return this.TransmitterField;
+ }
+ set {
+ if ((this.TransmitterField.Equals(value) != true)) {
+ this.TransmitterField = value;
+ this.RaisePropertyChanged("Transmitter");
+ }
+ }
+ }
+
+ public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
+
+ protected void RaisePropertyChanged(string propertyName) {
+ System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
+ if ((propertyChanged != null)) {
+ propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
+ }
+ }
+ }
+
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(ConfigurationName="LockingServiceReference.IService")]
public interface IService {
@@ -107,6 +232,12 @@ namespace ENI2.LockingServiceReference {
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IService/Log", ReplyAction="http://tempuri.org/IService/LogResponse")]
System.Threading.Tasks.Task LogAsync(string msg, string host, System.Guid userId);
+
+ [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IService/GetStatus", ReplyAction="http://tempuri.org/IService/GetStatusResponse")]
+ ENI2.LockingServiceReference.ServerStatus GetStatus();
+
+ [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IService/GetStatus", ReplyAction="http://tempuri.org/IService/GetStatusResponse")]
+ System.Threading.Tasks.Task GetStatusAsync();
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
@@ -175,5 +306,13 @@ namespace ENI2.LockingServiceReference {
public System.Threading.Tasks.Task LogAsync(string msg, string host, System.Guid userId) {
return base.Channel.LogAsync(msg, host, userId);
}
+
+ public ENI2.LockingServiceReference.ServerStatus GetStatus() {
+ return base.Channel.GetStatus();
+ }
+
+ public System.Threading.Tasks.Task GetStatusAsync() {
+ return base.Channel.GetStatusAsync();
+ }
}
}
diff --git a/ENI-2/ENI2/ENI2/Util/GlobalStructures.cs b/ENI-2/ENI2/ENI2/Util/GlobalStructures.cs
index 1e3cd2cc..b3af0bf8 100644
--- a/ENI-2/ENI2/ENI2/Util/GlobalStructures.cs
+++ b/ENI-2/ENI2/ENI2/Util/GlobalStructures.cs
@@ -33,30 +33,45 @@ namespace ENI2.Util
public static byte[] ShipSecurityLevels = { 1, 2, 3 };
public static Dictionary Edifact8025 = new Dictionary {
- {1, "1 Cargo operations" },
- {2, "2 Passenger movement" },
- {3, "3 Taking bunkers" },
- {4, "4 Changing crew" },
- {5, "5 Goodwill visit" },
- {6, "6 Taking supplies" },
- {7, "7 Repair" },
- {8, "8 Laid-up" },
- {9, "9 Awaiting orders" },
- {10, "10 Miscellaneous" },
- {11, "11 Crew movement" },
- {12, "12 Cruise, leisure and recreation" },
- {13, "13 Under government order" },
- {14, "14 Quarantine inspection" },
- {15, "15 Refuge" },
- {16, "16 Unloading cargo" },
- {17, "17 Loading cargo" },
- {18, "18 Repair in dry dock" },
- {19, "19 Repair in wet dock" },
- {20, "20 Cargo tank cleaning" },
- {21, "21 Means of transport customs clearance" },
- {22, "22 De-gassing" },
- {23, "23 Waste disposal" }
- };
+ {1, "Cargo operations" },
+ {2, "Passenger movement" },
+ {3, "Taking bunkers" },
+ {4, "Changing crew" },
+ {5, "Goodwill visit" },
+ {6, "Taking supplies" },
+ {7, "Repair" },
+ {8, "Laid-up" },
+ {9, "Awaiting orders" },
+ {10, "Miscellaneous" },
+ {11, "Crew movement" },
+ {12, "Cruise, leisure and recreation" },
+ {13, "Under government order" },
+ {14, "Quarantine inspection" },
+ {15, "Refuge" },
+ {16, "Unloading cargo" },
+ {17, "Loading cargo" },
+ {18, "Repair in dry dock" },
+ {19, "Repair in wet dock" },
+ {20, "Cargo tank cleaning" },
+ {21, "Means of transport customs clearance" },
+ {22, "De-gassing" },
+ {23, "Waste disposal" }
+ };
+
+ private static Dictionary _edifact8025WithKey = null;
+ public static Dictionary Edifact8025WithKey
+ {
+ get
+ {
+ if(_edifact8025WithKey == null)
+ {
+ _edifact8025WithKey = new Dictionary();
+ foreach (int key in Edifact8025.Keys)
+ _edifact8025WithKey.Add(key, string.Format("{0} {1}", key, Edifact8025[key]));
+ }
+ return _edifact8025WithKey;
+ }
+ }
public static string[] vesselClasses =
{
diff --git a/nsw/Source/bsmd.ExcelReadService/ExcelBase.cs b/nsw/Source/bsmd.ExcelReadService/ExcelBase.cs
index a7039db0..346476a6 100644
--- a/nsw/Source/bsmd.ExcelReadService/ExcelBase.cs
+++ b/nsw/Source/bsmd.ExcelReadService/ExcelBase.cs
@@ -74,25 +74,32 @@ namespace bsmd.ExcelReadService
public void Dispose()
{
- if (this._portcall != null)
+ try
{
- this._portcall.Close(0);
- _log.Debug("Close Worksheet");
- Marshal.ReleaseComObject(this._portcall);
- }
+ if (this._portcall != null)
+ {
+ this._portcall.Close(0);
+ _log.Debug("Close Worksheet");
+ Marshal.ReleaseComObject(this._portcall);
+ }
- if (this._excelWorkbooks != null)
- {
- this._excelWorkbooks.Close();
- _log.Debug("Close Workbooks");
- Marshal.ReleaseComObject(this._excelWorkbooks);
- // this._excelWorkbooks.Close();
+ if (this._excelWorkbooks != null)
+ {
+ this._excelWorkbooks.Close();
+ _log.Debug("Close Workbooks");
+ Marshal.ReleaseComObject(this._excelWorkbooks);
+ // this._excelWorkbooks.Close();
+ }
+ if (this._excelApp != null)
+ {
+ _log.Debug("Quit Excel");
+ this._excelApp.Quit();
+ Marshal.ReleaseComObject(this._excelApp);
+ }
}
- if (this._excelApp != null)
+ catch(Exception ex)
{
- _log.Debug("Quit Excel");
- this._excelApp.Quit();
- Marshal.ReleaseComObject(this._excelApp);
+ _log.ErrorFormat("Exception disposing ExcelReader: {0}", ex.Message);
}
}
diff --git a/nsw/Source/bsmd.ExcelReadService/ExcelWriter.cs b/nsw/Source/bsmd.ExcelReadService/ExcelWriter.cs
index 51044947..c096e8e2 100644
--- a/nsw/Source/bsmd.ExcelReadService/ExcelWriter.cs
+++ b/nsw/Source/bsmd.ExcelReadService/ExcelWriter.cs
@@ -8,6 +8,8 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using log4net;
+
namespace bsmd.ExcelReadService
{
@@ -21,7 +23,8 @@ namespace bsmd.ExcelReadService
public ExcelWriter(CountryMode countryMode)
{
- switch(countryMode)
+ _log = LogManager.GetLogger(typeof(ExcelWriter));
+ switch (countryMode)
{
case CountryMode.DK:
diff --git a/nsw/Source/bsmd.ExcelReadService/Util.cs b/nsw/Source/bsmd.ExcelReadService/Util.cs
index 3381948c..8cf832de 100644
--- a/nsw/Source/bsmd.ExcelReadService/Util.cs
+++ b/nsw/Source/bsmd.ExcelReadService/Util.cs
@@ -2546,6 +2546,11 @@ namespace bsmd.ExcelReadService
result = DBManager.Instance.GetMessageCoreByTransitId(visitTransitId);
}
}
+ else
+ {
+ message = "Visit / Transit Id missing!";
+ return null;
+ }
if (result != null)
{
diff --git a/nsw/Source/bsmd.LockingService/IService.cs b/nsw/Source/bsmd.LockingService/IService.cs
index 3bae42e0..cd01e1b7 100644
--- a/nsw/Source/bsmd.LockingService/IService.cs
+++ b/nsw/Source/bsmd.LockingService/IService.cs
@@ -52,6 +52,10 @@ namespace bsmd.LockingService
[WebGet(BodyStyle = WebMessageBodyStyle.Wrapped, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
void Log(string msg, string host, Guid userId);
+ [OperationContract]
+ [WebGet(BodyStyle = WebMessageBodyStyle.Wrapped, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
+ ServerStatus GetStatus();
+
}
}
diff --git a/nsw/Source/bsmd.LockingService/LockingService.svc.cs b/nsw/Source/bsmd.LockingService/LockingService.svc.cs
index 9fba1663..5c88b0a3 100644
--- a/nsw/Source/bsmd.LockingService/LockingService.svc.cs
+++ b/nsw/Source/bsmd.LockingService/LockingService.svc.cs
@@ -6,7 +6,9 @@ using System.Collections.Generic;
using log4net;
using bsmd.database;
using System.ServiceModel.Activation;
+using System.ServiceProcess;
using System.Timers;
+using System.IO;
namespace bsmd.LockingService
{
@@ -116,6 +118,63 @@ namespace bsmd.LockingService
return result;
}
+ public ServerStatus GetStatus()
+ {
+ ServerStatus serverStatus = new ServerStatus();
+
+ // Test if processes are running
+ ServiceController[] services = ServiceController.GetServices();
+
+ foreach (ServiceController serviceController in services)
+ {
+ switch (serviceController.ServiceName)
+ {
+ case "NSW Report Generator":
+ serverStatus.Report = (int)serviceController.Status;
+ break;
+ case "NSWSendService":
+ serverStatus.Transmitter = (int)serviceController.Status;
+ break;
+ case "ExcelReadService":
+ serverStatus.Excel = (int)serviceController.Status;
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ // collect file Names
+ // TODO: evtl. könnte es Sinn ergeben, wenn man diese Daten z.B. nur alle 10 Sekunden erzeugt und
+ // dann allen Aufrufern liefert.
+
+ serverStatus.IMPFiles = new List();
+ string impPath = Path.Combine(Properties.Settings.Default.TransmitterRoot, "IMP");
+ if(Directory.Exists(impPath))
+ {
+ foreach(string file in Directory.GetFiles(impPath))
+ serverStatus.IMPFiles.Add(Path.GetFileNameWithoutExtension(file));
+ }
+
+ serverStatus.READYFiles = new List();
+ string readyPath = Path.Combine(Properties.Settings.Default.TransmitterRoot, "READY");
+ if (Directory.Exists(readyPath))
+ {
+ foreach (string file in Directory.GetFiles(readyPath))
+ serverStatus.READYFiles.Add(Path.GetFileNameWithoutExtension(file));
+ }
+
+ serverStatus.CORRUPTFiles = new List();
+ string corruptPath = Path.Combine(Properties.Settings.Default.TransmitterRoot, "CORRUPT");
+ if (Directory.Exists(corruptPath))
+ {
+ foreach (string file in Directory.GetFiles(corruptPath))
+ serverStatus.CORRUPTFiles.Add(Path.GetFileNameWithoutExtension(file));
+ }
+
+ return serverStatus;
+ }
+
#endregion
#region class LockEntry
diff --git a/nsw/Source/bsmd.LockingService/Properties/Settings.Designer.cs b/nsw/Source/bsmd.LockingService/Properties/Settings.Designer.cs
new file mode 100644
index 00000000..51020cde
--- /dev/null
+++ b/nsw/Source/bsmd.LockingService/Properties/Settings.Designer.cs
@@ -0,0 +1,35 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace bsmd.LockingService.Properties {
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default {
+ get {
+ return defaultInstance;
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("")]
+ public string TransmitterRoot {
+ get {
+ return ((string)(this["TransmitterRoot"]));
+ }
+ }
+ }
+}
diff --git a/nsw/Source/bsmd.LockingService/Properties/Settings.settings b/nsw/Source/bsmd.LockingService/Properties/Settings.settings
new file mode 100644
index 00000000..45df6128
--- /dev/null
+++ b/nsw/Source/bsmd.LockingService/Properties/Settings.settings
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/nsw/Source/bsmd.LockingService/ServerStatus.cs b/nsw/Source/bsmd.LockingService/ServerStatus.cs
index 1bdf54a1..074e69bd 100644
--- a/nsw/Source/bsmd.LockingService/ServerStatus.cs
+++ b/nsw/Source/bsmd.LockingService/ServerStatus.cs
@@ -11,19 +11,25 @@ namespace bsmd.LockingService
public class ServerStatus
{
///
- /// Flag zeigt an ob ExcelReader läuft
+ /// Flag zeigt an ob ExcelReader läuft. Der int ist gecastet von der ServiceControllerStatus Enum
///
- public bool? Excel { get; set; }
+ public int Excel { get; set; }
///
/// Flag zeigt an, ob NSWSendService läuft
///
- public bool? Transmitter { get; set; }
+ public int Transmitter { get; set; }
///
/// Flag zeigt an, ob ReportServer läuft
///
- public bool? Report { get; set; }
+ public int Report { get; set; }
+
+ public List IMPFiles { get; set; }
+
+ public List READYFiles { get; set; }
+
+ public List CORRUPTFiles { get; set; }
}
}
\ No newline at end of file
diff --git a/nsw/Source/bsmd.LockingService/Web.config b/nsw/Source/bsmd.LockingService/Web.config
index cf0f5aa7..74568f2f 100644
--- a/nsw/Source/bsmd.LockingService/Web.config
+++ b/nsw/Source/bsmd.LockingService/Web.config
@@ -1,6 +1,11 @@
+
+
+
+
+
@@ -43,4 +48,11 @@
+
+
+
+ E:\svnlager\BSMD\nsw\HIS-NORD\Transmitter-Tool>
+
+
+
diff --git a/nsw/Source/bsmd.LockingService/bsmd.LockingService.csproj b/nsw/Source/bsmd.LockingService/bsmd.LockingService.csproj
index edf1b003..9f2f5339 100644
--- a/nsw/Source/bsmd.LockingService/bsmd.LockingService.csproj
+++ b/nsw/Source/bsmd.LockingService/bsmd.LockingService.csproj
@@ -48,6 +48,7 @@
True
+
@@ -89,6 +90,11 @@
+
+ True
+ True
+ Settings.settings
+
@@ -101,6 +107,10 @@
bsmdKey.snk
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
Web.config
diff --git a/nsw/Source/bsmd.LockingService/index.htm b/nsw/Source/bsmd.LockingService/index.htm
index 775fabe8..744545c1 100644
--- a/nsw/Source/bsmd.LockingService/index.htm
+++ b/nsw/Source/bsmd.LockingService/index.htm
@@ -7,9 +7,14 @@
- (c) 2017 schick Informatik - Locking Service
- WCF Service für die ausschließliche Bearbeitung von Erfassungsmasken in ENI-2.
-
+ Locking Service (WCF)
+ Funktionen
+
+ - Ausschließliche Bearbeitung von Erfassungsmasken in ENI-2 (Sperren).
+ - Server Prozesse abfragen (Running / Paused / Stopped)
+ - Aktuell verarbeitete Dateien abfragen (Transmitter-Verzeichnis)
+
+ (c) 2017 schick Informatik
diff --git a/nsw/Source/bsmd.ReportGenerator/BSMDDocument.cs b/nsw/Source/bsmd.ReportGenerator/BSMDDocument.cs
index 78c7394b..b875f87d 100644
--- a/nsw/Source/bsmd.ReportGenerator/BSMDDocument.cs
+++ b/nsw/Source/bsmd.ReportGenerator/BSMDDocument.cs
@@ -156,6 +156,10 @@ namespace bsmd.ReportGenerator
Style style = doc.Styles["Normal"];
style.Font.Name = "Verdana";
+ Style grayStyle = doc.Styles.AddStyle("Gray", "Normal");
+ grayStyle.Font.Size = 9;
+ grayStyle.Font.Color = Colors.Gray;
+
Style tableStyle = doc.Styles.AddStyle("Table", "Normal");
tableStyle.Font.Name = "Verdana";
tableStyle.Font.Size = 9;
@@ -294,18 +298,18 @@ namespace bsmd.ReportGenerator
row = table.AddRow();
row.Cells[1].AddParagraph("Visit-ID");
- paragraph = row.Cells[2].AddParagraph(coverInfos["Visit-ID"]);
+ paragraph = row.Cells[2].AddParagraph(coverInfos["Visit-ID"] ?? "");
paragraph.Style = "TableValue";
row.Cells[3].AddParagraph("Name");
- paragraph = row.Cells[4].AddParagraph(coverInfos["Ship"]);
+ paragraph = row.Cells[4].AddParagraph(coverInfos["Ship"] ?? "");
paragraph.Style = "TableValue";
row = table.AddRow();
row.Cells[1].AddParagraph("Port of call");
- paragraph = row.Cells[2].AddParagraph(coverInfos["Port of call"]);
+ paragraph = row.Cells[2].AddParagraph(coverInfos["Port of call"] ?? "");
paragraph.Style = "TableValue";
row.Cells[3].AddParagraph("ETA");
- paragraph = row.Cells[4].AddParagraph(coverInfos["ETA"]);
+ paragraph = row.Cells[4].AddParagraph(coverInfos["ETA"] ?? "");
paragraph.Style = "TableValue";
row = table.AddRow();
@@ -316,26 +320,26 @@ namespace bsmd.ReportGenerator
row = table.AddRow();
row.Cells[1].AddParagraph("Organization");
- paragraph = row.Cells[2].AddParagraph(rp.Name);
+ paragraph = row.Cells[2].AddParagraph(rp.Name ?? "");
paragraph.Style = "TableValue";
row.Cells[2].MergeRight = 2;
row = table.AddRow();
row.Cells[1].AddParagraph("Last name");
- paragraph = row.Cells[2].AddParagraph(rp.LastName);
+ paragraph = row.Cells[2].AddParagraph(rp.LastName ?? "");
paragraph.Style = "TableValue";
row.Cells[3].AddParagraph("City");
- paragraph = row.Cells[4].AddParagraph(rp.City);
+ paragraph = row.Cells[4].AddParagraph(rp.City ?? "");
paragraph.Style = "TableValue";
row = table.AddRow();
row.Cells[1].AddParagraph("Phone");
- paragraph = row.Cells[2].AddParagraph(rp.Phone);
+ paragraph = row.Cells[2].AddParagraph(rp.Phone ?? "");
paragraph.Style = "TableValue";
row.Cells[3].AddParagraph("Email");
- paragraph = row.Cells[4].AddParagraph(rp.EMail);
+ paragraph = row.Cells[4].AddParagraph(rp.EMail ?? "");
paragraph.Style = "TableValue";
}
@@ -1015,7 +1019,9 @@ namespace bsmd.ReportGenerator
KeyValuePair elem = messageText[i];
Row row = table.AddRow();
Cell cell = row.Cells[0];
- cell.AddParagraph(elem.Key);
+ Paragraph aParagraph = cell.AddParagraph(elem.Key);
+ if (elem.Value.IsNullOrEmpty())
+ aParagraph.Style = "Gray";
string val = elem.Value;
// funktioniert leider nicht, müsste das auf PDFsharp umstellen (http://www.pdfsharp.net/wiki/Unicode-sample.ashx)
if (val == "True") val = "Yes"; // @"\u2611"; // unicode ballot box with check
diff --git a/nsw/Source/bsmd.ReportGenerator/ReportService.cs b/nsw/Source/bsmd.ReportGenerator/ReportService.cs
index 2ead5636..323d93f2 100644
--- a/nsw/Source/bsmd.ReportGenerator/ReportService.cs
+++ b/nsw/Source/bsmd.ReportGenerator/ReportService.cs
@@ -280,6 +280,7 @@ namespace bsmd.ReportGenerator
// prepare and send E-Mail with generated attachment
// Schiffsname_ID_Meldeklassen.pdf
string shipName = DBManager.Instance.GetShipNameFromCore(reportCore);
+ if (shipName.IsNullOrEmpty()) shipName = "UNKNOWN";
shipName = shipName.Replace(' ', '_');
string fullPath = string.Format("{0}\\{1}_{2}_{3}.pdf", Properties.Settings.Default.OutputDirectory, shipName, reportCore.DisplayId, classes);
diff --git a/nsw/Source/bsmd.database/AGNT.cs b/nsw/Source/bsmd.database/AGNT.cs
index e5a86394..e996465c 100644
--- a/nsw/Source/bsmd.database/AGNT.cs
+++ b/nsw/Source/bsmd.database/AGNT.cs
@@ -36,6 +36,7 @@ namespace bsmd.database
[LookupName("AGNT.AgentCompanyName")]
[MaxLength(100)]
[ENI2Validation]
+ [Validation(ValidationCode.NOT_NULL)]
public string AgentCompanyName { get; set; }
[ShowReport]
@@ -67,6 +68,7 @@ namespace bsmd.database
[Validation2(ValidationCode.NOT_NULL)]
[MaxLength(100)]
[ENI2Validation]
+ [Validation(ValidationCode.NOT_NULL)]
public string AgentLastName { get; set; }
[ShowReport]
@@ -80,6 +82,7 @@ namespace bsmd.database
[LookupName("AGNT.AgentPhone")]
[MaxLength(100)]
[ENI2Validation]
+ [Validation(ValidationCode.NOT_NULL)]
public string AgentPhone { get; set; }
[ShowReport]
diff --git a/nsw/Source/bsmd.database/BPOL.cs b/nsw/Source/bsmd.database/BPOL.cs
index 124797d2..9117ff00 100644
--- a/nsw/Source/bsmd.database/BPOL.cs
+++ b/nsw/Source/bsmd.database/BPOL.cs
@@ -8,16 +8,16 @@
// Copyright (c) 2015 Informatikbüro Daniel Schick. All rights reserved.
using System;
-using System.Data;
using System.Data.SqlClient;
using System.Collections.Generic;
+using System.Collections.ObjectModel;
namespace bsmd.database
{
public class BPOL : DatabaseEntity, ISublistContainer
{
- private List poi = new List();
+ private ObservableCollection poi = new ObservableCollection();
public BPOL()
{
@@ -36,7 +36,7 @@ namespace bsmd.database
[ENI2Validation]
public bool? CruiseShip { get; set; }
- public List PortOfItineraries { get { return this.poi; } }
+ public ObservableCollection PortOfItineraries { get { return this.poi; } }
#endregion
diff --git a/nsw/Source/bsmd.database/Extensions.cs b/nsw/Source/bsmd.database/Extensions.cs
index bd932b68..ba3f819f 100644
--- a/nsw/Source/bsmd.database/Extensions.cs
+++ b/nsw/Source/bsmd.database/Extensions.cs
@@ -9,6 +9,7 @@
using System;
using System.Collections.Generic;
+using System.Collections.ObjectModel;
using System.Globalization;
using System.Text.RegularExpressions;
using log4net;
@@ -38,6 +39,11 @@ namespace bsmd.database
return (items == null) || (items.Count == 0);
}
+ public static bool IsNullOrEmpty(this ObservableCollection items)
+ {
+ return (items == null) || (items.Count == 0);
+ }
+
public static bool IsNullOrEmpty(this Dictionary items)
{
return (items == null) || (items.Count == 0);
diff --git a/nsw/Source/bsmd.database/HAZ.cs b/nsw/Source/bsmd.database/HAZ.cs
index 8bb5f199..e4b439c2 100644
--- a/nsw/Source/bsmd.database/HAZ.cs
+++ b/nsw/Source/bsmd.database/HAZ.cs
@@ -8,6 +8,7 @@
// Copyright (c) 2015 Informatikbüro Daniel Schick. All rights reserved.
using System.Collections.Generic;
+using System.Collections.ObjectModel;
using System.Data.SqlClient;
using System.Reflection;
@@ -16,11 +17,11 @@ namespace bsmd.database
public class HAZ : DatabaseEntity, ISublistContainer
{
- private List imdgPositions = new List();
- private List ibcPositions = new List();
- private List igcPositions = new List();
- private List imsbcPositions = new List();
- private List marpolPositions = new List();
+ private ObservableCollection imdgPositions = new ObservableCollection();
+ private ObservableCollection ibcPositions = new ObservableCollection();
+ private ObservableCollection igcPositions = new ObservableCollection();
+ private ObservableCollection imsbcPositions = new ObservableCollection();
+ private ObservableCollection marpolPositions = new ObservableCollection();
private bool _isDeparture;
public HAZ()
@@ -69,15 +70,15 @@ namespace bsmd.database
[MaxLength(64)]
public string DPGContactPhone { get; set; }
- public List IMDGPositions { get { return this.imdgPositions; } }
+ public ObservableCollection IMDGPositions { get { return this.imdgPositions; } }
- public List IBCPositions { get { return this.ibcPositions; } }
+ public ObservableCollection IBCPositions { get { return this.ibcPositions; } }
- public List IGCPositions { get { return this.igcPositions; } }
+ public ObservableCollection IGCPositions { get { return this.igcPositions; } }
- public List IMSBCPositions { get { return this.imsbcPositions; } }
+ public ObservableCollection IMSBCPositions { get { return this.imsbcPositions; } }
- public List MARPOLPositions { get { return this.marpolPositions; } }
+ public ObservableCollection MARPOLPositions { get { return this.marpolPositions; } }
// selektor HAZA / HAZD
[ENI2Validation]
diff --git a/nsw/Source/bsmd.database/LADG.cs b/nsw/Source/bsmd.database/LADG.cs
index ebbff642..1b8aedd5 100644
--- a/nsw/Source/bsmd.database/LADG.cs
+++ b/nsw/Source/bsmd.database/LADG.cs
@@ -94,12 +94,12 @@ namespace bsmd.database
public double? CargoGrossQuantity_TNE { get; set; }
[MaxLength(5)]
- [Validation(ValidationCode.LOCODE)]
+ //[Validation(ValidationCode.LOCODE)]
[ENI2Validation]
public string PortOfLoading { get; set; }
[MaxLength(5)]
- [Validation(ValidationCode.LOCODE)]
+ //[Validation(ValidationCode.LOCODE)]
[ENI2Validation]
public string PortOfDischarge { get; set; }
diff --git a/nsw/Source/bsmd.database/MDH.cs b/nsw/Source/bsmd.database/MDH.cs
index 33db3209..b9d9560d 100644
--- a/nsw/Source/bsmd.database/MDH.cs
+++ b/nsw/Source/bsmd.database/MDH.cs
@@ -8,9 +8,9 @@
// Copyright (c) 2015 Informatikbüro Daniel Schick. All rights reserved.
using System;
-using System.Data;
using System.Data.SqlClient;
using System.Collections.Generic;
+using System.Collections.ObjectModel;
using System.Text;
namespace bsmd.database
@@ -18,13 +18,13 @@ namespace bsmd.database
public class MDH : DatabaseEntity, ISublistContainer
{
- private List portOfCallLast30Days = new List();
+ private ObservableCollection portOfCallLast30Days = new ObservableCollection();
- private List sanitaryMeasuresDetails = new List();
+ private ObservableCollection sanitaryMeasuresDetails = new ObservableCollection();
- private List stowawaysJoiningLocations = new List();
+ private ObservableCollection stowawaysJoiningLocations = new ObservableCollection();
- private List infectedAreas = new List();
+ private ObservableCollection infectedAreas = new ObservableCollection();
public MDH()
{
@@ -34,13 +34,13 @@ namespace bsmd.database
#region Properties
- public List PortOfCallLast30Days { get { return this.portOfCallLast30Days; } }
+ public ObservableCollection PortOfCallLast30Days { get { return this.portOfCallLast30Days; } }
- public List SanitaryMeasuresDetails { get { return this.sanitaryMeasuresDetails; } }
+ public ObservableCollection SanitaryMeasuresDetails { get { return this.sanitaryMeasuresDetails; } }
- public List StowawaysJoiningLocations { get { return this.stowawaysJoiningLocations; } }
+ public ObservableCollection StowawaysJoiningLocations { get { return this.stowawaysJoiningLocations; } }
- public List InfectedAreas { get { return this.infectedAreas; } }
+ public ObservableCollection InfectedAreas { get { return this.infectedAreas; } }
[ShowReport]
[Validation1(ValidationCode.NOT_NULL)]
@@ -243,7 +243,8 @@ namespace bsmd.database
DBManager.Instance.Delete(remainingLocation);
this.StowawaysJoiningLocations.Clear();
// add existing and new crew
- this.StowawaysJoiningLocations.AddRange(foundList);
+ foreach (StowawaysJoiningLocation sjl in foundList)
+ this.StowawaysJoiningLocations.Add(sjl);
}
}
}
@@ -533,10 +534,7 @@ namespace bsmd.database
if ((this.NumberOfIllPersonsHigherThanExpected ?? false) && ((this.NumberOfIllPersons ?? 0) == 0))
violations.Add(RuleEngine.CreateViolation(ValidationCode.V762, "Number of ill persons missing", null, this.Title, null, this.Tablename));
- if ((this.SanitaryMeasuresApplied ?? false) && (
- this.SanitaryMeasuresType.IsNullOrEmpty() ||
- !this.SanitaryMeasuresDate.HasValue ||
- this.SanitaryMeasuresLocation.IsNullOrEmpty()))
+ if ((this.SanitaryMeasuresApplied ?? false) && this.SanitaryMeasuresDetails.IsNullOrEmpty())
violations.Add(RuleEngine.CreateViolation(ValidationCode.V763, "Sanitary measure details missing", null, this.Title, null, this.Tablename));
if ((this.StowawaysDetected ?? false) && this.StowawaysJoiningLocation.IsNullOrEmpty())
@@ -546,8 +544,7 @@ namespace bsmd.database
(this.PlaceOfIssue.IsNullOrEmpty() || !this.DateOfIssue.HasValue))
violations.Add(RuleEngine.CreateViolation(ValidationCode.V765, "Cert. Place or Date of issue missing", null, this.Title, null, this.Tablename));
- if ((this.InfectedAreaVisited ?? false) &&
- (!this.InfectedAreaDate.HasValue || this.InfectedAreaPort.IsNullOrEmpty()))
+ if ((this.InfectedAreaVisited ?? false) && this.InfectedAreas.IsNullOrEmpty())
violations.Add(RuleEngine.CreateViolation(ValidationCode.V766, "Infected area date or port missing", null, this.Title, null, this.Tablename));
if (this.portOfCallLast30Days.Count == 0)
diff --git a/nsw/Source/bsmd.database/Message.cs b/nsw/Source/bsmd.database/Message.cs
index ea30413a..ac8caf9b 100644
--- a/nsw/Source/bsmd.database/Message.cs
+++ b/nsw/Source/bsmd.database/Message.cs
@@ -23,7 +23,7 @@ namespace bsmd.database
private List errorList = new List();
private List violationList = new List();
private List systemErrorList = new List();
- private List elements = new List();
+ private ObservableCollection elements = new ObservableCollection();
#endregion
@@ -229,7 +229,7 @@ namespace bsmd.database
/// BRKA, BRKD, LADG, CREW, PAS, SERV, TOWA, TOWD, STO, CREWD, PASD
/// sonst hat die Liste immer ein Element
///
- public List Elements { get { return this.elements; } }
+ public ObservableCollection Elements { get { return this.elements; } }
///
/// Der Meldende
diff --git a/nsw/Source/bsmd.database/NOA_NOD.cs b/nsw/Source/bsmd.database/NOA_NOD.cs
index 2c9e96ec..990283f0 100644
--- a/nsw/Source/bsmd.database/NOA_NOD.cs
+++ b/nsw/Source/bsmd.database/NOA_NOD.cs
@@ -11,13 +11,14 @@ using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections.Generic;
+using System.Collections.ObjectModel;
namespace bsmd.database
{
public class NOA_NOD : DatabaseEntity, ISublistContainer
{
- List callPurposes = new List();
+ ObservableCollection callPurposes = new ObservableCollection();
public NOA_NOD()
{
@@ -36,8 +37,8 @@ namespace bsmd.database
[ENI2Validation]
public DateTime? ETDFromPortOfCall { get; set; }
- [Validation1(ValidationCode.NOT_NULL)]
- public List CallPurposes { get { return this.callPurposes; } }
+ [Validation1(ValidationCode.LIST_EMPTY)]
+ public ObservableCollection CallPurposes { get { return this.callPurposes; } }
[ShowReport]
[Validation2(ValidationCode.NOT_NULL)]
diff --git a/nsw/Source/bsmd.database/PortOfItinerary.cs b/nsw/Source/bsmd.database/PortOfItinerary.cs
index 9f918f82..cd8c7ce6 100644
--- a/nsw/Source/bsmd.database/PortOfItinerary.cs
+++ b/nsw/Source/bsmd.database/PortOfItinerary.cs
@@ -37,7 +37,7 @@ namespace bsmd.database
[ENI2Validation]
public DateTime? PortOfItineraryETA { get; set; }
- [Validation(ValidationCode.LOCODE)]
+ //[Validation(ValidationCode.LOCODE)]
[ENI2Validation]
public string PortOfItineraryLocode { get; set; }
diff --git a/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs b/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs
index f16c5ac8..1bf0dd7b 100644
--- a/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs
+++ b/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs
@@ -2,6 +2,6 @@
[assembly: AssemblyCompany("schick Informatik")]
[assembly: AssemblyProduct("BSMD NSW interface")]
-[assembly: AssemblyInformationalVersion("3.8.7")]
+[assembly: AssemblyInformationalVersion("3.8.8")]
[assembly: AssemblyCopyright("Copyright © 2014-2017 schick Informatik")]
[assembly: AssemblyTrademark("")]
\ No newline at end of file
diff --git a/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs b/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs
index a8be14fb..af5b257f 100644
--- a/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs
+++ b/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs
@@ -1,4 +1,4 @@
using System.Reflection;
-[assembly: AssemblyVersion("3.8.7.*")]
+[assembly: AssemblyVersion("3.8.8.*")]
diff --git a/nsw/Source/bsmd.database/SEC.cs b/nsw/Source/bsmd.database/SEC.cs
index 4b1ed998..28af521a 100644
--- a/nsw/Source/bsmd.database/SEC.cs
+++ b/nsw/Source/bsmd.database/SEC.cs
@@ -11,15 +11,16 @@ using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections.Generic;
+using System.Collections.ObjectModel;
namespace bsmd.database
{
public class SEC : DatabaseEntity, ISublistContainer
{
- private List ltpfc = new List();
+ private ObservableCollection ltpfc = new ObservableCollection();
- private List lsts = new List();
+ private ObservableCollection lsts = new ObservableCollection();
public SEC()
{
@@ -152,9 +153,10 @@ namespace bsmd.database
[ENI2Validation]
public DateTime? KielCanalPassagePlannedOutgoing { get; set; }
- public List LastTenPortFacilitesCalled { get { return this.ltpfc; } }
+ [Validation2(ValidationCode.LIST_EMPTY)]
+ public ObservableCollection LastTenPortFacilitesCalled { get { return this.ltpfc; } }
- public List ShipToShipActivitiesDuringLastTenPortFacilitiesCalled { get { return this.lsts; } }
+ public ObservableCollection ShipToShipActivitiesDuringLastTenPortFacilitiesCalled { get { return this.lsts; } }
#endregion
@@ -343,7 +345,7 @@ namespace bsmd.database
}
public override void Validate(List errors, List violations)
- {
+ {
if (this.GetValidationBlock() == ValidationBlock.BLOCK1)
{
diff --git a/nsw/Source/bsmd.database/STAT.cs b/nsw/Source/bsmd.database/STAT.cs
index e472d3aa..9630b7fa 100644
--- a/nsw/Source/bsmd.database/STAT.cs
+++ b/nsw/Source/bsmd.database/STAT.cs
@@ -115,7 +115,7 @@ namespace bsmd.database
public string ISMCompanyName { get; set; }
[ShowReport]
- [Validation(ValidationCode.STRING_EXACT_LEN, 7)]
+ //[Validation(ValidationCode.STRING_EXACT_LEN, 7)]
[MaxLength(10)]
[ENI2Validation]
public string ISMCompanyId { get; set; }
@@ -301,8 +301,8 @@ namespace bsmd.database
public override void Validate(List errors, List violations)
{
- if (this.ISMCompanyName.IsNullOrEmpty() || this.ISMCompanyId.IsNullOrEmpty())
- violations.Add(RuleEngine.CreateViolation(ValidationCode.V821, "ISMCompanyName", null, this.Title, null, this.Tablename));
+ if ((this.GrossTonnage.HasValue && (this.GrossTonnage.Value >= 500)) && (this.ISMCompanyName.IsNullOrEmpty() || this.ISMCompanyId.IsNullOrEmpty()))
+ violations.Add(RuleEngine.CreateViolation(ValidationCode.V821, "ISMCompanyId/Name must be provided", null, this.Title, null, this.Tablename));
}
#endregion
diff --git a/nsw/Source/bsmd.database/WAS.cs b/nsw/Source/bsmd.database/WAS.cs
index a2eeafb7..9834429f 100644
--- a/nsw/Source/bsmd.database/WAS.cs
+++ b/nsw/Source/bsmd.database/WAS.cs
@@ -11,15 +11,16 @@ using System;
using System.Text;
using System.Data.SqlClient;
using System.Collections.Generic;
+using System.Collections.ObjectModel;
namespace bsmd.database
{
public class WAS : DatabaseEntity, ISublistContainer
{
- private List wdsp = new List();
+ private ObservableCollection wdsp = new ObservableCollection();
- private List waste = new List();
+ private ObservableCollection waste = new ObservableCollection();
private static readonly int[] dkWasteCodes = { 1100, 1200, 1300, 2100, 2200, 2300, 2311, 2308, 2600, 2300, 2309, 3000, 5100, 5200, 5300, 2300 };
private static readonly string[] dkWasteTypes = { "Waste oils - Sludge", "Waste oils - Bilge water", "Waste oils - Other", "Garbage - Food waste", "Garbage - Plastic", "Garbage - Other", "Garbage - Other - Cooking oil", "Garbage - Other - Incinerator ashes and clinkers", "Operational wastes", "Garbage - Other", "Garbage - Other - Animal carcasses", "Sewage", "Cargo residues - Marpol Annex I - Other", "Cargo residues - Marpol Annex II - Other", "Cargo residues - Marpol Annex V - Other", "Garbage - Other" };
@@ -68,9 +69,9 @@ namespace bsmd.database
[ENI2Validation]
public bool? ConfirmationOfSufficiency { get; set; }
- public List Waste { get { return this.waste; } }
+ public ObservableCollection Waste { get { return this.waste; } }
- public List WasteDisposalServiceProvider { get { return this.wdsp; } }
+ public ObservableCollection WasteDisposalServiceProvider { get { return this.wdsp; } }
///
/// Hilfsproperty, um eine kommaseparierte Liste von WasteDisposalServiceProvider (analog ANSW) im ENI-2 anzuzeigen,
@@ -136,7 +137,8 @@ namespace bsmd.database
DBManager.Instance.Delete(remainingProvider);
this.WasteDisposalServiceProvider.Clear();
// add existing and new providers
- this.WasteDisposalServiceProvider.AddRange(foundList);
+ foreach(WasteDisposalServiceProvider wdsp in foundList)
+ this.WasteDisposalServiceProvider.Add(wdsp);
}
}
}
diff --git a/nsw/Source/bsmd.database/Waste.cs b/nsw/Source/bsmd.database/Waste.cs
index 2c341de0..2673d899 100644
--- a/nsw/Source/bsmd.database/Waste.cs
+++ b/nsw/Source/bsmd.database/Waste.cs
@@ -86,8 +86,7 @@ namespace bsmd.database
[ENI2Validation]
public int? WasteType { get; set; }
- [ShowReport]
- [Validation(ValidationCode.NOT_NULL)]
+ [ShowReport]
[MaxLength(100)]
[ENI2Validation]
public string WasteDescription { get; set; }
@@ -113,9 +112,9 @@ namespace bsmd.database
[ShowReport]
[ENI2Validation]
public double? WasteAmountGeneratedTillNextPort_MTQ { get; set; }
-
- // "dänisches" Zusatzfeld
+
[ENI2Validation]
+ [Validation(ValidationCode.NOT_NULL)]
public double? WasteDisposedAtLastPort_MTQ { get; set; }
public string Identifier { get; set; }
diff --git a/nsw/Source/bsmd.database/WasteDisposalServiceProvider.cs b/nsw/Source/bsmd.database/WasteDisposalServiceProvider.cs
index 5bdc79f6..46e492d6 100644
--- a/nsw/Source/bsmd.database/WasteDisposalServiceProvider.cs
+++ b/nsw/Source/bsmd.database/WasteDisposalServiceProvider.cs
@@ -33,6 +33,7 @@ namespace bsmd.database
[ShowReport]
[ENI2Validation]
+ [Validation(ValidationCode.NOT_NULL)]
public byte? WasteDisposalDelivery { get; set; }
public string Identifier { get; set; }