diff --git a/ENI-2/ENI2/ENI2/App.config b/ENI-2/ENI2/ENI2/App.config
index 9ff3f9c0..77790c5b 100644
--- a/ENI-2/ENI2/ENI2/App.config
+++ b/ENI-2/ENI2/ENI2/App.config
@@ -26,12 +26,12 @@
1000
- http://192.168.2.4/LockingService/LockingService.svc
-
+
+ http://heupferd/bsmd.LockingService/LockingService.svc
- Data Source=192.168.2.12;Initial Catalog=nsw;Uid=dfuser;Pwd=dfpasswd;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False
-
+
+ Data Source=(localdb)\Projects;Initial Catalog=nsw;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False
diff --git a/ENI-2/ENI2/ENI2/DetailBaseControl.cs b/ENI-2/ENI2/ENI2/DetailBaseControl.cs
index 31ef84a3..669f0dd7 100644
--- a/ENI-2/ENI2/ENI2/DetailBaseControl.cs
+++ b/ENI-2/ENI2/ENI2/DetailBaseControl.cs
@@ -124,7 +124,11 @@ namespace ENI2
{
_typeMessageDict[message.MessageNotificationClass] = message;
}
+ }
+ public virtual void SetEnabled(bool enabled)
+ {
+ this.IsEnabled = enabled;
}
#endregion
diff --git a/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs
index ebdde657..dc11b925 100644
--- a/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs
+++ b/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs
@@ -84,10 +84,7 @@ namespace ENI2
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textTowage, MessageGroupControlType = typeof(TowageDetailControl), ImagePath = "Resources/ship2.png" });
- this.listBoxMessages.ItemsSource = this._listBoxList;
-
- // Locking ergänzt. Ich habe den Eindruck, dass die DataReader Fehler beim BSMD daran liegen, dass das hier länger dauert als
- // man eine neue Anmeldung anklickt -> paralleles Laden -> Autsch
+ this.listBoxMessages.ItemsSource = this._listBoxList;
_messages = DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).GetMessagesForCore(_core, DBManager.MessageLoad.ALL);
@@ -144,9 +141,10 @@ namespace ENI2
detailControl.RequestDisable += DetailControl_RequestDisable;
detailControl.Initialize();
- detailControl.IsEnabled = !this.LockedByOtherUser;
+ bool isEnabled = !this.LockedByOtherUser;
+ detailControl.SetEnabled(isEnabled);
- if (!detailControl.IsEnabled && (detailControl is OverViewDetailControl) && !(_core.Cancelled ?? false))
+ if (!isEnabled && (detailControl is OverViewDetailControl) && !(_core.Cancelled ?? false))
((OverViewDetailControl)detailControl).ShowLockedBy(this.LockedBy);
controlCache.Add(mg.MessageGroupName, detailControl);
@@ -272,6 +270,14 @@ namespace ENI2
{
this.SaveMessage(message);
}
+
+ DetailBaseControl currentControl = this.detailView.Children[0] as DetailBaseControl;
+ if (currentControl is OverViewDetailControl)
+ {
+ // ggf. hat sich die Ticketnr geändert..
+ DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(currentControl.Core);
+ }
+
this.buttonSaveAll.Visibility = Visibility.Hidden;
this.buttonSave.Visibility = Visibility.Hidden;
}
@@ -379,7 +385,10 @@ namespace ENI2
}
// "neue" regelbasierte Validierung: Hier werden die einzelnen Regeln geprüft.
+ bsmd.database.ValidationRule.PrepareNameLookupDict(this.Core, this._messages);
+
List validationRules = DBManager.Instance.GetValidationRules();
+
foreach (bsmd.database.ValidationRule validationRule in validationRules) {
if (!validationRule.IsActive ?? false) continue;
// Regel auspacken
diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml.cs
index 6ce206c8..caa1b4ab 100644
--- a/ENI-2/ENI2/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml.cs
+++ b/ENI-2/ENI2/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml.cs
@@ -41,6 +41,8 @@ namespace ENI2.DetailViewControls
this.RegisterCheckboxChange(this.checkBoxStowaways, Message.NotificationClass.BPOL);
}
+
+
public override void Initialize()
{
base.Initialize();
@@ -120,7 +122,18 @@ namespace ENI2.DetailViewControls
#endregion
- }
+ }
+
+ #region SetEnabled
+
+ public override void SetEnabled(bool enabled)
+ {
+ this.groupBoxBorderPolice.IsEnabled = enabled;
+ this.groupBoxCrewList.IsEnabled = enabled;
+ this.groupBoxPassengerList.IsEnabled = enabled;
+ }
+
+ #endregion
#region port of itinerary grid
diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/DangerousGoodsDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/DangerousGoodsDetailControl.xaml.cs
index c4c480e5..649ebd43 100644
--- a/ENI-2/ENI2/ENI2/DetailViewControls/DangerousGoodsDetailControl.xaml.cs
+++ b/ENI-2/ENI2/ENI2/DetailViewControls/DangerousGoodsDetailControl.xaml.cs
@@ -184,6 +184,23 @@ namespace ENI2.DetailViewControls
this._initialized = true;
}
+ #region SetEnabled
+
+ public override void SetEnabled(bool enabled)
+ {
+ this.dataGridIBCItems.IsEnabled = enabled;
+ this.checkBoxDangerousGoodsOnBoard.IsEnabled = enabled;
+ this.checkBoxDGManifestOnBoard.IsEnabled = enabled;
+ this.checkBoxMoUBaltic.IsEnabled = enabled;
+ this.dataGridIBCItems.IsEnabled = enabled;
+ this.dataGridIMDGItems.IsEnabled = enabled;
+ this.dataGridIGCItems.IsEnabled = enabled;
+ this.dataGridIMSBCItems.IsEnabled = enabled;
+ this.dataGridMARPOLItems.IsEnabled = enabled;
+ }
+
+ #endregion
+
#region Copy event handler
private void copyMARPOL(object sender, RoutedEventArgs e)
diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/MaritimeHealthDeclarationDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/MaritimeHealthDeclarationDetailControl.xaml.cs
index 27dfa717..89a43b7a 100644
--- a/ENI-2/ENI2/ENI2/DetailViewControls/MaritimeHealthDeclarationDetailControl.xaml.cs
+++ b/ENI-2/ENI2/ENI2/DetailViewControls/MaritimeHealthDeclarationDetailControl.xaml.cs
@@ -123,7 +123,24 @@ namespace ENI2.DetailViewControls
#endregion
- }
+ }
+
+ #region SetEnabled
+
+ public override void SetEnabled(bool enabled)
+ {
+ this.mdhGroupBox.IsEnabled = enabled;
+ this.dataGridPortOfCallLast30Days.IsEnabled = enabled;
+ this.buttonImportFromSEC.IsEnabled = enabled;
+ this.checkBoxHasShipVisited.IsEnabled = enabled;
+ this.dataGridInfectedAreas.IsEnabled = enabled;
+ this.checkBoxSanitaryMeasuresApplied.IsEnabled = enabled;
+ this.dataGridSanitaryMeasures.IsEnabled = enabled;
+ }
+
+ #endregion
+
+ #region Enable Controls based on Checkbox (fixed)
private void CheckBoxSanitaryControlExemption_Checked(object sender, RoutedEventArgs e)
{
@@ -192,6 +209,8 @@ namespace ENI2.DetailViewControls
this.dataGridSanitaryMeasures.IsReadOnly = !(this.checkBoxSanitaryMeasuresApplied.IsChecked ?? false);
}
+ #endregion
+
private void MaritimeHealthDeclarationDetailControl_Loaded(object sender, RoutedEventArgs e)
{
diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml b/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml
index 98819b8b..2644a35f 100644
--- a/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml
+++ b/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml
@@ -76,7 +76,7 @@
-
+
diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs
index d6aeb453..ab9a6175 100644
--- a/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs
+++ b/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs
@@ -28,6 +28,7 @@ namespace ENI2.DetailViewControls
private Message _noanodMessage;
private Timer _checkStatusTimer;
private DateTime _startStatusCheck;
+ private object _collectionLock = new object();
public OverViewDetailControl()
{
@@ -88,7 +89,52 @@ namespace ENI2.DetailViewControls
if (this.Core.Cancelled ?? false) this.ShowCancelledLabel();
- #region Meldeklassen einrichten und Icons / Gruppen / Index zuordnen
+ #region Context-Menu Meldeklassen
+
+ // wenn man das mal aufwendig "schön" machen will (die Items enabled abh. vom Zustand der Meldeklasse) sollte man
+ // Command Bindings verwenden. Hier ist das erklärt: https://docs.microsoft.com/en-us/dotnet/framework/wpf/advanced/commanding-overview#code-snippet-2
+
+ this.dataGridMessages.ContextMenu = new ContextMenu();
+ MenuItem sendItem = new MenuItem();
+ sendItem.Header = Properties.Resources.textSendToNSW;
+ sendItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/mail_forward.png")) };
+ //sendItem.Command =
+ sendItem.Click += new RoutedEventHandler(this.contextSendMessage);
+ this.dataGridMessages.ContextMenu.Items.Add(sendItem);
+
+ MenuItem resetItem = new MenuItem();
+ resetItem.Header = Properties.Resources.textReset;
+ resetItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/mail_delete.png")) };
+ resetItem.Click += new RoutedEventHandler(this.contextResetMessage);
+ this.dataGridMessages.ContextMenu.Items.Add(resetItem);
+
+ MenuItem systemErrorItem = new MenuItem();
+ systemErrorItem.Header = Properties.Resources.textSystemErrors;
+ systemErrorItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/hand_red_card.png")) };
+ systemErrorItem.Click += new RoutedEventHandler(this.buttonSystemErrors_Click);
+ this.dataGridMessages.ContextMenu.Items.Add(systemErrorItem);
+
+ MenuItem errorItem = new MenuItem();
+ errorItem.Header = Properties.Resources.textErrors;
+ errorItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/error.png")) };
+ errorItem.Click += new RoutedEventHandler(this.buttonErrors_Click);
+ this.dataGridMessages.ContextMenu.Items.Add(errorItem);
+
+ MenuItem vioItem = new MenuItem();
+ vioItem.Header = Properties.Resources.textViolations;
+ vioItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/sign_warning.png")) };
+ vioItem.Click += new RoutedEventHandler(this.buttonWarnings_Click);
+ this.dataGridMessages.ContextMenu.Items.Add(vioItem);
+
+ MenuItem pdfItem = new MenuItem();
+ pdfItem.Header = Properties.Resources.textCreatePDF;
+ pdfItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/document_pdf.png")) };
+ pdfItem.Click += new RoutedEventHandler(this.buttonCreatePDF_Click);
+ this.dataGridMessages.ContextMenu.Items.Add(pdfItem);
+
+ #endregion
+
+ #region lokale Meldeklassen
foreach (Message aMessage in this.Messages)
{
@@ -100,7 +146,100 @@ namespace ENI2.DetailViewControls
this._atdMessage = aMessage;
if (aMessage.MessageNotificationClass == Message.NotificationClass.NOA_NOD)
this._noanodMessage = aMessage;
+ }
+ #endregion
+
+ #region init ATA
+
+ // ganz hakelig ich weiß dafür kapiert das gleich jeder
+ if (this._ataMessage == null)
+ {
+ this._ataMessage = this.Core.CreateMessage(Message.NotificationClass.ATA);
+ this.Messages.Add(this._ataMessage);
+ this._ataMessage.ENINotificationIconString = "../Resources/arrow_down_right_red.png";
+ this._ataMessage.ENINotificationDetailGroup = Properties.Resources.textArrivalNotification;
+ this._ataMessage.ENINotificationDetailIndex = 4;
+ }
+
+ ATA ata = null;
+ if (this._ataMessage.Elements.Count > 0)
+ ata = this._ataMessage.Elements[0] as ATA;
+
+ if (ata == null)
+ {
+ ata = new ATA();
+ ata.MessageCore = this.Core;
+ ata.MessageHeader = this._ataMessage;
+ _ataMessage.Elements.Add(ata);
+ }
+
+ this.dateTimePickerATA.DataContext = ata;
+ this.ControlMessages.Add(this._ataMessage);
+
+ #endregion
+
+ #region init ATD
+
+ if (this._atdMessage == null)
+ {
+ this._atdMessage = this.Core.CreateMessage(Message.NotificationClass.ATD);
+ this.Messages.Add(this._atdMessage);
+ this._atdMessage.ENINotificationIconString = "../Resources/arrow_up_right_green.png";
+ this._atdMessage.ENINotificationDetailGroup = Properties.Resources.textDepartureNotification;
+ this._atdMessage.ENINotificationDetailIndex = 10;
+ }
+
+ ATD atd = null;
+ if (this._atdMessage.Elements.Count > 0)
+ atd = this._atdMessage.Elements[0] as ATD;
+
+ if (atd == null)
+ {
+ atd = new ATD();
+ atd.MessageCore = this.Core;
+ atd.MessageHeader = this._atdMessage;
+ _atdMessage.Elements.Add(atd);
+ }
+
+ this.dateTimePickerATD.DataContext = atd;
+ this.ControlMessages.Add(this._atdMessage);
+
+ #endregion
+
+ #region init NOA_NOD
+
+ if (this._noanodMessage == null)
+ {
+ this._noanodMessage = this.Core.CreateMessage(Message.NotificationClass.NOA_NOD);
+ this.Messages.Add(this._noanodMessage);
+ _noanodMessage.ENINotificationIconString = "../Resources/eye_blue.png";
+ _noanodMessage.ENINotificationDetailGroup = Properties.Resources.textPortCall;
+ _noanodMessage.ENINotificationDetailIndex = 1;
+ }
+
+ NOA_NOD noa_nod = null;
+ if (this._noanodMessage.Elements.Count > 0)
+ noa_nod = this._noanodMessage.Elements[0] as NOA_NOD;
+
+ if (noa_nod == null)
+ {
+ noa_nod = new NOA_NOD();
+ noa_nod.MessageCore = this.Core;
+ noa_nod.MessageHeader = this._noanodMessage;
+ _noanodMessage.Elements.Add(noa_nod);
+ }
+
+ this.dateTimePickerETD.DataContext = noa_nod;
+ this.dateTimePickerETA.DataContext = noa_nod;
+ this.ControlMessages.Add(this._noanodMessage);
+
+ #endregion
+
+ #region Meldeklassen einrichten und Icons / Gruppen / Index zuordnen
+
+ foreach (Message aMessage in this.Messages)
+ {
switch (aMessage.MessageNotificationClass)
{
case Message.NotificationClass.VISIT:
@@ -196,7 +335,8 @@ namespace ENI2.DetailViewControls
#endregion
- // Meldeklassen nach ihrem Vorkommen in den Detailansichten sortieren (SH, 12.5.17)
+ #region Meldeklassen nach ihrem Vorkommen in den Detailansichten sortieren (SH, 12.5.17)
+
this.Messages.Sort((a, b) =>
{
if (a.ENINotificationDetailIndex == b.ENINotificationDetailIndex)
@@ -208,140 +348,12 @@ namespace ENI2.DetailViewControls
{
// kann das eigentlich passieren??!
}
-
-
- #region Context-Menu Meldeklassen
-
- // wenn man das mal aufwendig "schön" machen will (die Items enabled abh. vom Zustand der Meldeklasse) sollte man
- // Command Bindings verwenden. Hier ist das erklärt: https://docs.microsoft.com/en-us/dotnet/framework/wpf/advanced/commanding-overview#code-snippet-2
-
- this.dataGridMessages.ContextMenu = new ContextMenu();
- MenuItem sendItem = new MenuItem();
- sendItem.Header = Properties.Resources.textSendToNSW;
- sendItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/mail_forward.png")) };
- //sendItem.Command =
- sendItem.Click += new RoutedEventHandler(this.contextSendMessage);
- this.dataGridMessages.ContextMenu.Items.Add(sendItem);
-
- MenuItem resetItem = new MenuItem();
- resetItem.Header = Properties.Resources.textReset;
- resetItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/mail_delete.png")) };
- resetItem.Click += new RoutedEventHandler(this.contextResetMessage);
- this.dataGridMessages.ContextMenu.Items.Add(resetItem);
-
- MenuItem systemErrorItem = new MenuItem();
- systemErrorItem.Header = Properties.Resources.textSystemErrors;
- systemErrorItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/hand_red_card.png")) };
- systemErrorItem.Click += new RoutedEventHandler(this.buttonSystemErrors_Click);
- this.dataGridMessages.ContextMenu.Items.Add(systemErrorItem);
-
- MenuItem errorItem = new MenuItem();
- errorItem.Header = Properties.Resources.textErrors;
- errorItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/error.png")) };
- errorItem.Click += new RoutedEventHandler(this.buttonErrors_Click);
- this.dataGridMessages.ContextMenu.Items.Add(errorItem);
-
- MenuItem vioItem = new MenuItem();
- vioItem.Header = Properties.Resources.textViolations;
- vioItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/sign_warning.png")) };
- vioItem.Click += new RoutedEventHandler(this.buttonWarnings_Click);
- this.dataGridMessages.ContextMenu.Items.Add(vioItem);
-
- MenuItem pdfItem = new MenuItem();
- pdfItem.Header = Properties.Resources.textCreatePDF;
- pdfItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/document_pdf.png")) };
- pdfItem.Click += new RoutedEventHandler(this.buttonCreatePDF_Click);
- this.dataGridMessages.ContextMenu.Items.Add(pdfItem);
#endregion
- #region init ATA
-
- // ganz hakelig ich weiß dafür kapiert das gleich jeder
- if (this._ataMessage == null)
- {
- this._ataMessage = this.Core.CreateMessage(Message.NotificationClass.ATA);
- this.Messages.Add(this._ataMessage);
- this._ataMessage.ENINotificationIconString = "../Resources/arrow_down_right_red.png";
- this._ataMessage.ENINotificationDetailGroup = Properties.Resources.textArrivalNotification;
- this._ataMessage.ENINotificationDetailIndex = 4;
- }
-
- ATA ata = null;
- if (this._ataMessage.Elements.Count > 0)
- ata = this._ataMessage.Elements[0] as ATA;
-
- if (ata == null)
- {
- ata = new ATA();
- ata.MessageCore = this.Core;
- ata.MessageHeader = this._ataMessage;
- _ataMessage.Elements.Add(ata);
- }
-
- this.dateTimePickerATA.DataContext = ata;
- this.ControlMessages.Add(this._ataMessage);
-
- #endregion
-
- #region init ATD
-
- if (this._atdMessage == null)
- {
- this._atdMessage = this.Core.CreateMessage(Message.NotificationClass.ATD);
- this.Messages.Add(this._atdMessage);
- this._atdMessage.ENINotificationIconString = "../Resources/arrow_up_right_green.png";
- this._atdMessage.ENINotificationDetailGroup = Properties.Resources.textDepartureNotification;
- this._atdMessage.ENINotificationDetailIndex = 10;
- }
-
- ATD atd = null;
- if (this._atdMessage.Elements.Count > 0)
- atd = this._atdMessage.Elements[0] as ATD;
-
- if (atd == null)
- {
- atd = new ATD();
- atd.MessageCore = this.Core;
- atd.MessageHeader = this._atdMessage;
- _atdMessage.Elements.Add(atd);
- }
-
- this.dateTimePickerATD.DataContext = atd;
- this.ControlMessages.Add(this._atdMessage);
-
- #endregion
-
- #region init NOA_NOD
-
- if (this._noanodMessage == null)
- {
- this._noanodMessage = this.Core.CreateMessage(Message.NotificationClass.NOA_NOD);
- this.Messages.Add(this._noanodMessage);
- _noanodMessage.ENINotificationIconString = "../Resources/eye_blue.png";
- _noanodMessage.ENINotificationDetailGroup = Properties.Resources.textPortCall;
- _noanodMessage.ENINotificationDetailIndex = 1;
- }
-
- NOA_NOD noa_nod = null;
- if (this._noanodMessage.Elements.Count > 0)
- noa_nod = this._noanodMessage.Elements[0] as NOA_NOD;
-
- if (noa_nod == null)
- {
- noa_nod = new NOA_NOD();
- noa_nod.MessageCore = this.Core;
- noa_nod.MessageHeader = this._noanodMessage;
- _noanodMessage.Elements.Add(noa_nod);
- }
-
- this.dateTimePickerETD.DataContext = noa_nod;
- this.dateTimePickerETA.DataContext = noa_nod;
- this.ControlMessages.Add(this._noanodMessage);
-
- #endregion
-
+ BindingOperations.EnableCollectionSynchronization(this.Messages, _collectionLock);
this.dataGridMessages.ItemsSource = this.Messages;
+
base.Initialize(); // wenn Meldeklassen erst bei der Init. erzeugt werden, fehlen die Handler, die hier erneut festgelegt werden
this._initialized = true;
}
@@ -623,12 +635,15 @@ namespace ENI2.DetailViewControls
private void buttonCreatePDF_Click(object sender, RoutedEventArgs e)
{
+ for(int i = 0; i < this.dataGridMessages.SelectedItems.Count; i++)
+ {
+ Message selectedMessage = this.dataGridMessages.SelectedItems[i] as Message;
+ selectedMessage.InternalStatus = Message.BSMDStatus.REPORT;
+ selectedMessage.ReportingPartyId = App.UserId; // wichtig damit der Richtige(!) die Mail mit dem PDF bekommt
+ DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(selectedMessage);
+ }
if (this.dataGridMessages.SelectedItems.Count > 0)
{
- Message selectedMessage = this.dataGridMessages.SelectedItems[0] as Message;
- selectedMessage.InternalStatus = Message.BSMDStatus.REPORT;
- selectedMessage.ReportingPartyId = App.UserId; // wichtig damit der richtige die Mail mit dem PDF bekommt
- DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(selectedMessage);
this.Core.ReportStatus = MessageCore.ReportStatusEnum.SINGLE;
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(this.Core);
this.dataGridMessages.Items.Refresh();
diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/SecurityDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/SecurityDetailControl.xaml.cs
index 84834f12..2f4074e9 100644
--- a/ENI-2/ENI2/ENI2/DetailViewControls/SecurityDetailControl.xaml.cs
+++ b/ENI-2/ENI2/ENI2/DetailViewControls/SecurityDetailControl.xaml.cs
@@ -95,7 +95,18 @@ namespace ENI2.DetailViewControls
#endregion
- }
+ }
+
+ #region SetEnabled
+
+ public override void SetEnabled(bool enabled)
+ {
+ this.secGroupBox.IsEnabled = enabled;
+ this.dataGridLast10PortFacilities.IsEnabled = enabled;
+ this.dataGridShip2ShipActivities.IsEnabled = enabled;
+ }
+
+ #endregion
#region data grid ship 2 ship activities
diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/WasteDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/WasteDetailControl.xaml.cs
index 80d1d8ff..18830771 100644
--- a/ENI-2/ENI2/ENI2/DetailViewControls/WasteDetailControl.xaml.cs
+++ b/ENI-2/ENI2/ENI2/DetailViewControls/WasteDetailControl.xaml.cs
@@ -58,49 +58,9 @@ namespace ENI2.DetailViewControls
private void buttonAddMissingEntries_Click(object sender, RoutedEventArgs e)
{
-
- // Convenience Methode, die fehlende Waste Einträge ergänzt (interessant bei "manuellen" Anmeldungen)
- foreach (int wasteCode in WAS.DKWasteCodes)
- {
- Waste foundWaste = null;
- foreach (Waste waste in this._was.Waste)
- {
- if (waste.WasteType.HasValue && waste.WasteType.Value == wasteCode)
- {
- foundWaste = waste;
- break;
- }
- }
- if (foundWaste == null)
- {
- Waste newWaste = new Waste();
- newWaste.Identifier = DatabaseEntity.GetNewIdentifier(this._was.Waste);
- newWaste.WAS = _was;
- newWaste.WasteAmountGeneratedTillNextPort_MTQ = 0;
- newWaste.WasteAmountRetained_MTQ = 0;
- newWaste.WasteCapacity_MTQ = 0;
- newWaste.WasteDescription = (wasteCode == 1300) ? "-" : "";
- newWaste.WasteDisposalAmount_MTQ = 0;
- newWaste.WasteDisposalPort = "ZZUKN";
- newWaste.WasteDisposedAtLastPort_MTQ = 0;
- newWaste.WasteType = wasteCode;
- this._was.Waste.Add(newWaste);
- }
- else
- {
- if (!foundWaste.WasteAmountGeneratedTillNextPort_MTQ.HasValue) foundWaste.WasteAmountGeneratedTillNextPort_MTQ = 0;
- if (!foundWaste.WasteAmountRetained_MTQ.HasValue) foundWaste.WasteAmountRetained_MTQ = 0;
- if (!foundWaste.WasteCapacity_MTQ.HasValue) foundWaste.WasteCapacity_MTQ = 0;
- if ((wasteCode == 1300) && foundWaste.WasteDescription.IsNullOrEmpty()) foundWaste.WasteDescription = "-";
- if (!foundWaste.WasteDisposalAmount_MTQ.HasValue) foundWaste.WasteDisposalAmount_MTQ = 0;
- if (foundWaste.WasteDisposalPort.IsNullOrEmpty()) foundWaste.WasteDisposalPort = "ZZUKN";
- if (!foundWaste.WasteDisposedAtLastPort_MTQ.HasValue) foundWaste.WasteDisposedAtLastPort_MTQ = 0;
- }
- }
-
+ this._was.AddMissingWaste();
this.SublistElementChanged(Message.NotificationClass.WAS);
this.dataGridWaste.Items.Refresh();
-
}
public override void Initialize()
diff --git a/ENI-2/ENI2/ENI2/ENI2.csproj b/ENI-2/ENI2/ENI2/ENI2.csproj
index 903e822c..5c38a899 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.5.%2a
+ 1
+ 3.8.6.%2a
false
true
true
diff --git a/ENI-2/ENI2/ENI2/EditControls/EditIMDGDialog.xaml.cs b/ENI-2/ENI2/ENI2/EditControls/EditIMDGDialog.xaml.cs
index a85a9fea..df9ddf18 100644
--- a/ENI-2/ENI2/ENI2/EditControls/EditIMDGDialog.xaml.cs
+++ b/ENI-2/ENI2/ENI2/EditControls/EditIMDGDialog.xaml.cs
@@ -52,6 +52,7 @@ namespace ENI2.EditControls
this.decimalUpDownMaxActivity.Value = this.IMDG.Class7MaxActivity_BQL;
this.decimalUpDownNetExplosiveMass.Value = this.IMDG.NetExplosiveMass_KGM;
this.decimalUpDownNetQuantity.Value = this.IMDG.NetQuantity_KGM;
+ this.doubleUpDownCargoVolume.Value = this.IMDG.Volume_MTQ;
this.integerUpDownCategory.Value = this.IMDG.Class7Category;
this.integerUpDownNumberOfPackages.Value = this.IMDG.NumberOfPackages;
@@ -105,6 +106,7 @@ namespace ENI2.EditControls
this.IMDG.Class7MaxActivity_BQL = this.decimalUpDownMaxActivity.Value;
this.IMDG.NetExplosiveMass_KGM = this.decimalUpDownNetExplosiveMass.Value;
this.IMDG.NetQuantity_KGM = this.decimalUpDownNetQuantity.Value;
+ this.IMDG.Volume_MTQ = this.doubleUpDownCargoVolume.Value;
this.IMDG.Class7Category = this.integerUpDownCategory.Value;
this.IMDG.NumberOfPackages = this.integerUpDownNumberOfPackages.Value;
diff --git a/ENI-2/ENI2/ENI2/EditControls/ViolationListDialog.xaml b/ENI-2/ENI2/ENI2/EditControls/ViolationListDialog.xaml
index 9977d70c..897be7f3 100644
--- a/ENI-2/ENI2/ENI2/EditControls/ViolationListDialog.xaml
+++ b/ENI-2/ENI2/ENI2/EditControls/ViolationListDialog.xaml
@@ -11,10 +11,14 @@
Title="{x:Static p:Resources.textViolations}" Height="300" Width="600" Background="AliceBlue">
-
+
+
+
+
+
+ SelectionMode="Single" AutoGenerateColumns="False" Margin="5,5,5,0" x:Name="dataGridViolations">
diff --git a/ENI-2/ENI2/ENI2/Themes/Generic.xaml b/ENI-2/ENI2/ENI2/Themes/Generic.xaml
index 0aac0d36..8398b911 100644
--- a/ENI-2/ENI2/ENI2/Themes/Generic.xaml
+++ b/ENI-2/ENI2/ENI2/Themes/Generic.xaml
@@ -28,21 +28,16 @@
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
/-->
-
-
-
-
-
-
-
-
+
-
+
-
+
+
+
diff --git a/Stundensheet.xlsx b/Stundensheet.xlsx
index ae9bd5fc..f508c58b 100644
Binary files a/Stundensheet.xlsx and b/Stundensheet.xlsx differ
diff --git a/nsw/Deutschland/Reference_Sheet_DE.xltx b/nsw/Deutschland/Reference_Sheet_DE.xltx
index 62a2aa8f..04b544b9 100644
Binary files a/nsw/Deutschland/Reference_Sheet_DE.xltx and b/nsw/Deutschland/Reference_Sheet_DE.xltx differ
diff --git a/nsw/Source/bsmd.ExcelReadService/Util.cs b/nsw/Source/bsmd.ExcelReadService/Util.cs
index a5dadeec..3381948c 100644
--- a/nsw/Source/bsmd.ExcelReadService/Util.cs
+++ b/nsw/Source/bsmd.ExcelReadService/Util.cs
@@ -1283,11 +1283,10 @@ namespace bsmd.ExcelReadService
was.Waste.Add(waste);
}
- waste.WasteType = (int?) reader.ReadNumber(wasteCode);
+ waste.WasteType = (int?) reader.ReadNumber(wasteCode);
if (waste.WasteType.HasValue && (waste.WasteType == 2313))
- waste.WasteType = 2600;
-
+ waste.WasteType = 2600;
if (reader.Mode == ExcelReader.CountryMode.DE)
{
@@ -1392,31 +1391,13 @@ namespace bsmd.ExcelReadService
}
}
-
- }
- /*
- try
- {
- // Übergangsphase: Für "DE" werden nur 9 Positionen verwendet
- // EMail Christin mit angehängtem Excel Sheet vom 30.1.2017
- if (reader.Mode == ExcelReader.CountryMode.DE)
+ if (!waste.WasteType.HasValue)
{
- Waste nrSeven = was.GetSublistElementWithIdentifier("7") as Waste;
- Waste nrEleven = was.GetSublistElementWithIdentifier("11") as Waste;
- nrSeven.WasteDescription = nrEleven.WasteDescription;
- nrSeven.WasteDisposalAmount_MTQ = nrEleven.WasteDisposalAmount_MTQ;
- nrSeven.WasteCapacity_MTQ = nrEleven.WasteCapacity_MTQ;
- nrSeven.WasteAmountRetained_MTQ = nrEleven.WasteAmountRetained_MTQ;
- nrSeven.WasteDisposalPort = nrEleven.WasteDisposalPort;
- nrSeven.WasteAmountGeneratedTillNextPort_MTQ = nrEleven.WasteAmountGeneratedTillNextPort_MTQ;
- // was.Waste.RemoveRange(9, 6); // 9-15 entfernen
+ was.Waste.Remove(waste);
}
}
- catch(Exception ex)
- {
- _log.ErrorFormat("Error Waste Workaround DE: {0}", ex.Message);
- }
- */
+
+ was.AddMissingWaste();
}
#endregion
@@ -2667,9 +2648,18 @@ namespace bsmd.ExcelReadService
if(result != null)
{
_log.InfoFormat("Core [{3}] found for IMO {0}, ETA {1}, Poc {2}", imo, eta, poc, result.Id);
-
result.HerbergReportType = reader.ReadText("ReferenceNumber");
reader.Conf.ConfirmText("ReferenceNumber", result.HerbergReportType, result.HerbergReportType.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
+
+ // Spezialfall: Wenn ein Core gefunden wird, dieser jedoch eine andere Visit/Transit Id hat als die Anmeldung ist das eine Neuanlage!
+ // Eingebaut 17.11.17
+ if(!visitTransitId.IsNullOrEmpty() && !result.DisplayId.IsNullOrEmpty() &&
+ (visitTransitId != result.DisplayId))
+ {
+ _log.WarnFormat("Different visit ID ({0} (Sheet) {1} (Core) for the same decl. treating as NEW!", visitTransitId, result.DisplayId);
+ result = null;
+ }
+
}
}
diff --git a/nsw/Source/bsmd.ReportGenerator/BSMDDocument.cs b/nsw/Source/bsmd.ReportGenerator/BSMDDocument.cs
index fe390961..78c7394b 100644
--- a/nsw/Source/bsmd.ReportGenerator/BSMDDocument.cs
+++ b/nsw/Source/bsmd.ReportGenerator/BSMDDocument.cs
@@ -17,6 +17,10 @@ using MigraDoc.DocumentObjectModel.Shapes;
using MigraDoc.DocumentObjectModel.Tables;
using MigraDoc.Rendering;
+// keine "echten" Dependencies, nur durch File Link notwendig (Code sharing)
+using ENI2;
+using bsmd.ExcelReadService;
+
using bsmd.database;
namespace bsmd.ReportGenerator
@@ -63,10 +67,10 @@ namespace bsmd.ReportGenerator
BSMDDocument.DefineSingleStyle(document);
BSMDDocument.DefineSingleHeader(document, coverInfos, rp);
BSMDDocument.DefineContentSectionInitial(document);
-
+ DatabaseEntity.ReportReplacer += DatabaseEntity_ReportReplacer;
return document;
- }
+ }
///
/// create the final output document
@@ -236,6 +240,7 @@ namespace bsmd.ReportGenerator
static List> ReplaceLabels(List> messageText)
{
+ if (messageText == null) return null;
List> result = new List>();
foreach(KeyValuePair field in messageText)
{
@@ -473,7 +478,7 @@ namespace bsmd.ReportGenerator
#endregion
if (messageParagraph.MessageText != null) // komplette Nachricht (z.B. STAT)
- BSMDDocument.AddActualTableParagraph(document, BSMDDocument.ReplaceLabels(messageParagraph.MessageText), false);
+ BSMDDocument.AddActualTableParagraph(document, messageParagraph, false);
#region SEC
@@ -501,7 +506,7 @@ namespace bsmd.ReportGenerator
{
foreach (IMessageParagraph childParagraph in messageParagraph.ChildParagraphs)
{
- BSMDDocument.AddActualTableParagraph(document, BSMDDocument.ReplaceLabels(childParagraph.MessageText), true);
+ BSMDDocument.AddActualTableParagraph(document, childParagraph, true);
}
}
@@ -981,8 +986,18 @@ namespace bsmd.ReportGenerator
#endregion
- private static void AddActualTableParagraph(Document document, List> messageText, bool isSubTable)
- {
+ private static void AddActualTableParagraph(Document document, IMessageParagraph paragraph, bool isSubTable)
+ {
+
+ if(isSubTable)
+ {
+ if(!paragraph.Title.IsNullOrEmpty())
+ document.LastSection.AddParagraph(BSMDDocument.ReplaceTitle(paragraph.Title), "Heading3");
+ if(!paragraph.Subtitle.IsNullOrEmpty())
+ document.LastSection.AddParagraph(BSMDDocument.ReplaceTitle(paragraph.Subtitle), "Heading4");
+ }
+
+ List> messageText = BSMDDocument.ReplaceLabels(paragraph.MessageText);
Table table = document.LastSection.AddTable();
table.Borders.Color = Colors.LightGray;
@@ -1001,7 +1016,11 @@ namespace bsmd.ReportGenerator
Row row = table.AddRow();
Cell cell = row.Cells[0];
cell.AddParagraph(elem.Key);
- row.Cells[1].AddParagraph(elem.Value);
+ 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
+ if (val == "False") val = "No"; // @"\u2610"; // unicode ballot box
+ row.Cells[1].AddParagraph(val);
}
if (isSubTable)
@@ -1011,6 +1030,55 @@ namespace bsmd.ReportGenerator
document.LastSection.AddParagraph();
+ if (isSubTable)
+ {
+ if (paragraph.ChildParagraphs != null)
+ {
+ foreach (IMessageParagraph childParagraph in paragraph.ChildParagraphs)
+ AddActualTableParagraph(document, childParagraph, true);
+ }
+ }
+ }
+
+ #endregion
+
+ #region Spezialbehandlung Ersetzen einzelner Felder durch Klartexte
+ ///
+ /// Auf besonderen Wunsch einer einzelnen Dame :D
+ ///
+ /// Name des Felds (ohne Klassenname)
+ /// Aktueller Wert / Wert aus der DB
+ /// ggf. ersetzter Wert
+
+ private static string DatabaseEntity_ReportReplacer(string propertyName, string value)
+ {
+ if (propertyName.IsNullOrEmpty()) return value;
+ if (value.IsNullOrEmpty()) return value;
+
+ string result = value;
+
+ switch(propertyName)
+ {
+ case "PackageType":
+ if (LocalizedLookup.getPackageTypes().ContainsKey(value))
+ result = string.Format("{0} - {1}", value, LocalizedLookup.getPackageTypes()[value]);
+ break;
+ case "PortOfLoading":
+ case "PortOfDischarge":
+ case "PoC":
+ {
+ string portName = LocodeDB.PortNameFromLocode(value);
+ if (!portName.IsNullOrEmpty())
+ {
+ result = string.Format("{0} - {1}", value, portName);
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ return result;
}
#endregion
diff --git a/nsw/Source/bsmd.ReportGenerator/ReportService.cs b/nsw/Source/bsmd.ReportGenerator/ReportService.cs
index 204f4681..2ead5636 100644
--- a/nsw/Source/bsmd.ReportGenerator/ReportService.cs
+++ b/nsw/Source/bsmd.ReportGenerator/ReportService.cs
@@ -250,6 +250,8 @@ namespace bsmd.ReportGenerator
reportingPartyId = aMessage.ReportingPartyId.Value;
}
}
+
+ if (sb.Length > 0) sb.Remove(sb.Length - 1, 1);
string classes = sb.ToString();
if (!classes.IsNullOrEmpty())
{
@@ -260,8 +262,8 @@ namespace bsmd.ReportGenerator
Dictionary coverInfos = new Dictionary();
coverInfos.Add("Ship", DBManager.Instance.GetShipNameFromCore(reportCore));
- coverInfos.Add("ETA", reportCore.ETADisplay.ToString());
- coverInfos.Add("Port of call", reportCore.PoC);
+ coverInfos.Add("ETA", reportCore.ETA_NOA_NOD.ToString());
+ coverInfos.Add("Port of call", reportCore.Portname);
coverInfos.Add("Visit-ID", reportCore.DisplayId);
coverInfos.Add("Class", classes);
@@ -278,7 +280,7 @@ namespace bsmd.ReportGenerator
// prepare and send E-Mail with generated attachment
// Schiffsname_ID_Meldeklassen.pdf
string shipName = DBManager.Instance.GetShipNameFromCore(reportCore);
- shipName = shipName.Replace(' ', '_');
+ shipName = shipName.Replace(' ', '_');
string fullPath = string.Format("{0}\\{1}_{2}_{3}.pdf", Properties.Settings.Default.OutputDirectory, shipName, reportCore.DisplayId, classes);
BSMDDocument.RenderDocument(migraDocument, fullPath);
diff --git a/nsw/Source/bsmd.ReportGenerator/bsmd.ReportGenerator.csproj b/nsw/Source/bsmd.ReportGenerator/bsmd.ReportGenerator.csproj
index 01be90b4..669e7b62 100644
--- a/nsw/Source/bsmd.ReportGenerator/bsmd.ReportGenerator.csproj
+++ b/nsw/Source/bsmd.ReportGenerator/bsmd.ReportGenerator.csproj
@@ -79,6 +79,9 @@
+
+ LocalizedLookup.cs
+
Properties\AssemblyProductInfo.cs
@@ -88,6 +91,9 @@
Properties\AssemblyProjectKeyInfo.cs
+
+ LocodeDB.cs
+
@@ -113,6 +119,10 @@
+
+ db.sqlite
+ PreserveNewest
+
report.db
PreserveNewest
diff --git a/nsw/Source/bsmd.database/DBManager.cs b/nsw/Source/bsmd.database/DBManager.cs
index 497fe108..9a9cb1c0 100644
--- a/nsw/Source/bsmd.database/DBManager.cs
+++ b/nsw/Source/bsmd.database/DBManager.cs
@@ -155,7 +155,11 @@ namespace bsmd.database
List result = new List();
foreach (MessageCore core in cores)
{
+
this.LoadCustomer(core);
+ this.LoadETA_ETD(core);
+ this.LoadSTATShipName(core);
+
result.Add(core);
}
@@ -1106,14 +1110,14 @@ namespace bsmd.database
}
reader.Close();
- if (!core.ETA_NOA_NOD.HasValue && !core.IsTransit)
+ if (!core.ETA_NOA_NOD.HasValue && !core.IsTransit && core.ETA.HasValue)
{
// die Zeit aus MessageCore ist nur ein Datum. Daher verwendet er 00:00 als lokale Zeit, was z.B. nach 01:00 MET zur Anzeige konvertiert wird.
// Das darf in diesem Fall nicht sein, der Wert müsste also gefakt lokal gesetzt werden.. ouch hack
core.ETA_NOA_NOD = DateTime.SpecifyKind(core.ETA.Value, DateTimeKind.Local).ToUniversalTime();
}
- if (!core.ETA_NOA_NOD.HasValue && core.IsTransit)
+ if (!core.ETA_NOA_NOD.HasValue && core.IsTransit && core.ETAKielCanal.HasValue)
{
core.ETA_NOA_NOD = DateTime.SpecifyKind(core.ETAKielCanal.Value, DateTimeKind.Local).ToUniversalTime();
}
diff --git a/nsw/Source/bsmd.database/DatabaseEntity.cs b/nsw/Source/bsmd.database/DatabaseEntity.cs
index 090088d3..34ceb540 100644
--- a/nsw/Source/bsmd.database/DatabaseEntity.cs
+++ b/nsw/Source/bsmd.database/DatabaseEntity.cs
@@ -24,6 +24,13 @@ namespace bsmd.database
protected string tablename;
private Guid instance_id = Guid.NewGuid(); // Comparison id in case entity has not been saved
+ #region delegate / events
+ // Ein etwas hakeliger Mechanismus, damit ein abhängiges Projekt (ReportGenerator) die Werte ersetzen kann ohne dass die ganze Logik
+ // hier in die Basisklasse muss
+ public delegate string ReplaceValFunc(string propertyName, string value);
+ public static event ReplaceValFunc ReportReplacer;
+ #endregion
+
#region enum ValidationBlock
public enum ValidationBlock
@@ -290,23 +297,40 @@ namespace bsmd.database
foreach (PropertyInfo property in props)
{
- bool isDouble = (property.PropertyType == typeof(Nullable));
- object propValue = property.GetValue(this, null);
- string value = (propValue == null) ? string.Empty : (isDouble ? ((double) propValue).ToString("N2") : propValue.ToString());
+
string displayName = property.Name;
if(Attribute.IsDefined(property, typeof(ReportDisplayNameAttribute))) {
ReportDisplayNameAttribute reportDisplayNameAttribute = Attribute.GetCustomAttribute(property, typeof(ReportDisplayNameAttribute))
as ReportDisplayNameAttribute;
displayName = reportDisplayNameAttribute.DisplayName;
- }
-
- result.Add(new KeyValuePair(displayName, value));
+ }
+ result.Add(new KeyValuePair(displayName, this.GetDisplayValue(property)));
}
return result;
}
}
+ public virtual string GetDisplayValue(PropertyInfo property)
+ {
+ bool isDouble = (property.PropertyType == typeof(Nullable));
+ object propValue = property.GetValue(this, null);
+ if (propValue == null) return "";
+ string value = propValue.ToString();
+ if(isDouble)
+ {
+ value = ((double)propValue).ToString("N2");
+ }
+ else
+ {
+ if(ReportReplacer != null)
+ {
+ value = ReportReplacer(property.Name, value);
+ }
+ }
+ return value;
+ }
+
public virtual List ChildParagraphs { get { return null; } }
#endregion
diff --git a/nsw/Source/bsmd.database/HAZ.cs b/nsw/Source/bsmd.database/HAZ.cs
index 91dfc543..8bb5f199 100644
--- a/nsw/Source/bsmd.database/HAZ.cs
+++ b/nsw/Source/bsmd.database/HAZ.cs
@@ -9,6 +9,7 @@
using System.Collections.Generic;
using System.Data.SqlClient;
+using System.Reflection;
namespace bsmd.database
{
@@ -26,8 +27,7 @@ namespace bsmd.database
{ }
#region Properties
-
- [ShowReport]
+
[Validation(ValidationCode.NOT_NULL)]
[ENI2Validation]
public bool? NoDPGOnBoardOnArrival { get; set; }
@@ -43,33 +43,30 @@ namespace bsmd.database
[ShowReport]
[ENI2Validation]
public bool? MOUBaltic { get; set; }
-
- [ShowReport]
+
[ENI2Validation]
public bool? DPGClassificationIMDG { get; set; }
- [ShowReport]
[ENI2Validation]
public bool? DPGClassificationIGC { get; set; }
- [ShowReport]
[ENI2Validation]
public bool? DPGClassificationIBC { get; set; }
- [ShowReport]
[ENI2Validation]
public bool? DPGClassificationIMSBC { get; set; }
- [ShowReport]
[ENI2Validation]
public bool? DPGClassificationMARPOL_ANNEX_I { get; set; }
// DK
[ENI2Validation]
+ [MaxLength(128)]
public string DPGContactFamilyName { get; set; }
// DK
[ENI2Validation]
+ [MaxLength(64)]
public string DPGContactPhone { get; set; }
public List IMDGPositions { get { return this.imdgPositions; } }
@@ -83,7 +80,6 @@ namespace bsmd.database
public List MARPOLPositions { get { return this.marpolPositions; } }
// selektor HAZA / HAZD
- [ShowReport]
[ENI2Validation]
public bool IsDeparture {
get { return this._isDeparture; }
@@ -93,7 +89,6 @@ namespace bsmd.database
///
/// No NSW field! Set to determine whether HAZ info should be reported to the NSW
///
- [ShowReport]
[ENI2Validation]
public string TransmissionType { get; set; }
@@ -341,6 +336,14 @@ namespace bsmd.database
#region IMessageParagraph implementation
+ public override string Title
+ {
+ get
+ {
+ return this.IsDeparture ? "HAZD" : "HAZA";
+ }
+ }
+
public override string Subtitle
{
get
@@ -353,20 +356,61 @@ namespace bsmd.database
{
get
{
- List result = new List();
- foreach (IMessageParagraph imp in this.IMDGPositions)
- result.Add(imp);
- foreach (IMessageParagraph imp in this.IBCPositions)
- result.Add(imp);
- foreach (IMessageParagraph imp in this.IGCPositions)
- result.Add(imp);
- foreach (IMessageParagraph imp in this.IMSBCPositions)
- result.Add(imp);
- foreach (IMessageParagraph imp in this.MARPOLPositions)
- result.Add(imp);
- return result;
+ List allChildParagraphs = new List();
+
+ if(this.IMDGPositions.Count > 0)
+ {
+ MessageParagraph containerParagraph = new MessageParagraph();
+ containerParagraph.Title = "IMDGPositions";
+ List sublist = new List();
+ foreach (IMessageParagraph imp in this.IMDGPositions)
+ containerParagraph.ChildParagraphs.Add(imp);
+ allChildParagraphs.Add(containerParagraph);
+ }
+
+ if(this.IBCPositions.Count > 0)
+ {
+ MessageParagraph containerParagraph = new MessageParagraph();
+ containerParagraph.Title = "IBCPositions";
+ List sublist = new List();
+ foreach (IMessageParagraph imp in this.IBCPositions)
+ containerParagraph.ChildParagraphs.Add(imp);
+ allChildParagraphs.Add(containerParagraph);
+ }
+
+ if(this.IGCPositions.Count > 0)
+ {
+ MessageParagraph containerParagraph = new MessageParagraph();
+ containerParagraph.Title = "IGCPositions";
+ List sublist = new List();
+ foreach (IMessageParagraph imp in this.IGCPositions)
+ containerParagraph.ChildParagraphs.Add(imp);
+ allChildParagraphs.Add(containerParagraph);
+ }
+
+ if(this.IMSBCPositions.Count > 0)
+ {
+ MessageParagraph containerParagraph = new MessageParagraph();
+ containerParagraph.Title = "IMSBCPositions";
+ List sublist = new List();
+ foreach (IMessageParagraph imp in this.IMSBCPositions)
+ containerParagraph.ChildParagraphs.Add(imp);
+ allChildParagraphs.Add(containerParagraph);
+ }
+
+ if(this.MARPOLPositions.Count > 0)
+ {
+ MessageParagraph containerParagraph = new MessageParagraph();
+ containerParagraph.Title = "MARPOLPositions";
+ List sublist = new List();
+ foreach (IMessageParagraph imp in this.MARPOLPositions)
+ containerParagraph.ChildParagraphs.Add(imp);
+ allChildParagraphs.Add(containerParagraph);
+ }
+
+ return allChildParagraphs;
}
- }
+ }
#endregion
diff --git a/nsw/Source/bsmd.database/IBCPosition.cs b/nsw/Source/bsmd.database/IBCPosition.cs
index 1993e399..a0aa4d05 100644
--- a/nsw/Source/bsmd.database/IBCPosition.cs
+++ b/nsw/Source/bsmd.database/IBCPosition.cs
@@ -11,7 +11,7 @@ using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
-
+using System.Reflection;
namespace bsmd.database
{
@@ -62,12 +62,13 @@ namespace bsmd.database
[ENI2Validation]
public string ProductName { get; set; }
-
- [ShowReport]
+
[Validation(ValidationCode.NOT_NULL)]
[ENI2Validation]
public byte? PollutionCategory { get; set; }
+ [ShowReport]
+ [ReportDisplayName("PollutionCategory")]
public string PollutionCategoryDisplay
{
get
@@ -77,11 +78,12 @@ namespace bsmd.database
return "";
}
}
-
- [ShowReport]
+
[ENI2Validation]
public byte? Hazards { get; set; }
+ [ShowReport]
+ [ReportDisplayName("Hazards")]
public string HazardsDisplay
{
get
@@ -91,12 +93,13 @@ namespace bsmd.database
return "";
}
}
-
- [ShowReport]
+
[Validation(ValidationCode.NOT_NULL)]
[ENI2Validation]
public byte? FlashpointInformation { get; set; }
-
+
+ [ShowReport]
+ [ReportDisplayName("FlashpointInformation")]
public string FlashpointInformationDisplay
{
get
@@ -148,7 +151,7 @@ namespace bsmd.database
public string SublistCollectionKey { get { return "ibc"; } }
- #endregion
+ #endregion
#region DatabaseEntity implementation
diff --git a/nsw/Source/bsmd.database/IMDGPosition.cs b/nsw/Source/bsmd.database/IMDGPosition.cs
index dcfe61f8..d6eb413f 100644
--- a/nsw/Source/bsmd.database/IMDGPosition.cs
+++ b/nsw/Source/bsmd.database/IMDGPosition.cs
@@ -50,8 +50,7 @@ namespace bsmd.database
[MaxLength(10)]
[ENI2Validation]
public string IMOClass { get; set; }
-
- [ShowReport]
+
[MaxLength(10)]
[ENI2Validation]
public string CompatibilityGroup { get; set; }
@@ -157,14 +156,17 @@ namespace bsmd.database
[ENI2Validation]
public string StowagePosition { get; set; }
+ [ShowReport]
[MaxLength(5)]
[ENI2Validation]
public string Bay { get; set; }
+ [ShowReport]
[MaxLength(5)]
[ENI2Validation]
public string Row { get; set; }
+ [ShowReport]
[MaxLength(5)]
[ENI2Validation]
public string Tier { get; set; }
diff --git a/nsw/Source/bsmd.database/IMessageParagraph.cs b/nsw/Source/bsmd.database/IMessageParagraph.cs
index ba1fdf81..308e1142 100644
--- a/nsw/Source/bsmd.database/IMessageParagraph.cs
+++ b/nsw/Source/bsmd.database/IMessageParagraph.cs
@@ -1,4 +1,7 @@
-using System;
+// Copyright (c) 2015-2017 schick Informatik
+// Description: Abstraktion für Report / Druckerzeugung..
+
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -23,4 +26,46 @@ namespace bsmd.database
List ChildParagraphs { get; }
}
+
+ ///
+ /// Dummy Container class implementation for sublist display purposes
+ ///
+ public class MessageParagraph : IMessageParagraph
+ {
+ private List childParagraphs = new List();
+ private List> messageText = new List>();
+
+ public List ChildParagraphs
+ {
+ get
+ {
+ return childParagraphs;
+ }
+ }
+
+ public List> MessageText
+ {
+ get
+ {
+ return messageText;
+ }
+ }
+
+ public bool ShowChildrenAsTable
+ {
+ get; set;
+ }
+
+ public string Subtitle
+ {
+ get; set;
+ }
+
+ public string Title
+ {
+ get; set;
+ }
+ }
+
+
}
diff --git a/nsw/Source/bsmd.database/MARPOL_Annex_I_Position.cs b/nsw/Source/bsmd.database/MARPOL_Annex_I_Position.cs
index 84a81fcb..548d5461 100644
--- a/nsw/Source/bsmd.database/MARPOL_Annex_I_Position.cs
+++ b/nsw/Source/bsmd.database/MARPOL_Annex_I_Position.cs
@@ -31,12 +31,13 @@ namespace bsmd.database
[MaxLength(255)]
[ENI2Validation]
public string Name { get; set; }
-
- [ShowReport]
+
[Validation(ValidationCode.NOT_NULL)]
[ENI2Validation]
public byte? FlashpointInformation { get; set; }
+ [ShowReport]
+ [ReportDisplayName("FlashpointInformation")]
public string FlashpointInformationDisplay
{
get
diff --git a/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs b/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs
index 78ca8c17..f16c5ac8 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.5")]
+[assembly: AssemblyInformationalVersion("3.8.7")]
[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 f5822467..a8be14fb 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.5.*")]
+[assembly: AssemblyVersion("3.8.7.*")]
diff --git a/nsw/Source/bsmd.database/ValidationCondition.cs b/nsw/Source/bsmd.database/ValidationCondition.cs
index 62e0c157..ad91f246 100644
--- a/nsw/Source/bsmd.database/ValidationCondition.cs
+++ b/nsw/Source/bsmd.database/ValidationCondition.cs
@@ -56,13 +56,7 @@ namespace bsmd.database
{
bool? result = null;
message = "";
- bool conditionResult = false;
-
- // Aus der List an Messages muss (irgendwie :-) ein Dictionary aufgebaut werden, mit dem man aus den Namen der Fieldnames auf
- // den Wert bzw. die Liste an Werten (bei Listenklassen) kommt. Das ValidationField "weiß" schon ob es eine Listenklasse ist.
-
- // das hier muss noch früher rein damit es nicht für jede Regel erneut erzeugt wird
- ValidationRule.PrepareNameLookupDict(core, messages);
+ bool conditionResult = false;
try
{
@@ -184,6 +178,7 @@ namespace bsmd.database
#endregion
+ #region field evaluation
private bool Evaluate(MessageCore core, List messages, out ValidationField failedField)
{
@@ -194,31 +189,46 @@ namespace bsmd.database
{
// den Wert aus der Nachrichtenklasse lesen
ValidationField aValField = ValidationRule.ValidationFieldDict[this.FieldName];
- // object value = aValField.PropertyInfo.GetValue()
+ if(aValField.IsInListType)
+ {
+ List