3.7.3 Zwischenstand - einiges an Änderungen durch Korrekturen für Christin / Schnittstelle / Excel

This commit is contained in:
Daniel Schick 2017-10-04 17:53:44 +00:00
parent 4edb616a04
commit b8c99f2ec6
75 changed files with 774 additions and 393 deletions

View File

@ -4,6 +4,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:ENI2.Controls"
xmlns:p="clr-namespace:ENI2.Properties"
xmlns:db="clr-namespace:bsmd.database;assembly=bsmd.database"
xmlns:util="clr-namespace:ENI2.Util"
mc:Ignorable="d"
@ -15,9 +16,15 @@
<RowDefinition Height="32" />
<RowDefinition Height="32" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.3*" />
<ColumnDefinition Width="0.7*" />
</Grid.ColumnDefinitions>
<RadioButton Grid.Row="0" Name="radioButtonOR" VerticalContentAlignment="Center" Content="OR" Margin="2" IsChecked="{Binding GroupOperator, Converter={util:EnumToBooleanConverter}, ConverterParameter={x:Static db:ConditionGroup+GroupOperatorEnum.OR}}"/>
<RadioButton Grid.Row="1" Name="radioButtonAND" VerticalContentAlignment="Center" Content="AND" Margin="2" IsChecked="{Binding GroupOperator, Converter={util:EnumToBooleanConverter}, ConverterParameter={x:Static db:ConditionGroup+GroupOperatorEnum.AND}}"/>
<RadioButton Grid.Row="2" Name="radioButtonNOT" VerticalContentAlignment="Center" Content="NOT" Margin="2" IsChecked="{Binding GroupOperator, Converter={util:EnumToBooleanConverter}, ConverterParameter={x:Static db:ConditionGroup+GroupOperatorEnum.NOT}}"/>
<RadioButton Grid.Row="3" Name="radioButtonXOR" VerticalContentAlignment="Center" Content="XOR" Margin="2" IsChecked="{Binding GroupOperator, Converter={util:EnumToBooleanConverter}, ConverterParameter={x:Static db:ConditionGroup+GroupOperatorEnum.XOR}}"/>
<Label Grid.Row="0" Grid.Column="1" Content="{x:Static p:Resources.textFailureMessage}" VerticalContentAlignment="Center" />
<TextBox Name="textBoxFailureMessage" Grid.Row="1" Grid.Column="1" Grid.RowSpan="3" Margin="2" Text="{Binding ErrorMessage}"/>
</Grid>
</UserControl>

View File

@ -11,9 +11,8 @@
d:DesignHeight="150" d:DesignWidth="300">
<Grid Name="gridContent">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*" />
<ColumnDefinition Width="0.25*" />
<ColumnDefinition Width="0.25*" />
<ColumnDefinition Width="0.75*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="32" />
@ -22,13 +21,10 @@
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0" Content="{x:Static p:Resources.textFieldName}" VerticalContentAlignment="Center"/>
<Label Grid.Row="0" Grid.Column="1" Content="{x:Static p:Resources.textOperator}" VerticalContentAlignment="Center"/>
<Label Grid.Row="0" Grid.Column="2" Content="{x:Static p:Resources.textValue}" VerticalContentAlignment="Center"/>
<ComboBox Name="comboBoxFieldName" Grid.Row="1" Grid.Column="0" Margin="2" SelectedValuePath="FullName" SelectedValue="{Binding FieldName}" />
<ComboBox Name="comboBoxOperator" Grid.Row="1" Grid.Column="1" Margin="2" SelectedValuePath="Key" DisplayMemberPath="Value" SelectedValue="{Binding ConditionOperator}"/>
<TextBox Name="textBoxValue" Grid.Row="1" Grid.Column="2" Margin="2" Text="{Binding Value}" VerticalContentAlignment="Center" />
<Label Grid.Row="2" Grid.Column="0" Content="{x:Static p:Resources.textFailureMessage}" VerticalContentAlignment="Center" />
<TextBox Name="textBoxFailureMessage" Grid.Row="2" Grid.Column="1" Grid.RowSpan="2" Grid.ColumnSpan="2" Margin="2" Text="{Binding ErrorMessage}"/>
<Label Grid.Row="1" Grid.Column="0" Content="{x:Static p:Resources.textOperator}" VerticalContentAlignment="Center"/>
<Label Grid.Row="2" Grid.Column="0" Content="{x:Static p:Resources.textValue}" VerticalContentAlignment="Center"/>
<ComboBox Name="comboBoxFieldName" Grid.Row="0" Grid.Column="1" Margin="2" SelectedValuePath="FullName" SelectedValue="{Binding FieldName}" />
<ComboBox Name="comboBoxOperator" Grid.Row="1" Grid.Column="1" Margin="2" SelectedValuePath="Key" DisplayMemberPath="Value" SelectedValue="{Binding ConditionOperator}" SelectionChanged="comboBoxOperator_SelectionChanged" />
<TextBox Name="textBoxValue" Grid.Row="2" Grid.Column="2" Margin="2" Text="{Binding Value}" VerticalContentAlignment="Center" />
</Grid>
</UserControl>

View File

@ -2,20 +2,8 @@
// Description: Plugin Control für eine Validierungsbedingung
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using bsmd.database;
@ -46,5 +34,15 @@ namespace ENI2.Controls
set { this.gridContent.DataContext = value; this._validationCondition = value; }
}
private void comboBoxOperator_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
ValidationCondition.ConditionOperatorEnum selectedVal = (ValidationCondition.ConditionOperatorEnum)this.comboBoxOperator.SelectedValue;
bool isUnary = false;
if ((selectedVal == ValidationCondition.ConditionOperatorEnum.NOT_NULL) ||
(selectedVal == ValidationCondition.ConditionOperatorEnum.NULL))
isUnary = true;
this.textBoxValue.IsEnabled = !isUnary;
if (isUnary) this.textBoxValue.Clear();
}
}
}

View File

@ -66,6 +66,11 @@ namespace ENI2
/// </summary>
public event Action RequestValidate;
/// <summary>
/// Damit kann signalisiert werden, dass die Anmeldung readonly wird (z.B. bei Storno)
/// </summary>
public event Action RequestDisable;
/// <summary>
/// Eine in der Detailansicht enthaltene Meldeklasse hat sich geändert
/// </summary>
@ -96,8 +101,6 @@ namespace ENI2
/// </summary>
public List<Message> ControlMessages { get { return this._controlMessages; } }
public Guid UserId { get; set; } // TODO: Ersetzen mit der User-Entity
public bool LockedByOtherUser { get; set; }
#endregion
@ -143,6 +146,11 @@ namespace ENI2
this.RequestValidate?.Invoke();
}
protected virtual void OnRequestDisable()
{
this.RequestDisable?.Invoke();
}
protected virtual void OnControlCacheReset(string messageGroupName)
{
this.ResetControlCache?.Invoke(messageGroupName);

View File

@ -134,6 +134,7 @@ namespace ENI2
detailControl.NotificationClassChanged += DetailControl_NotificationClassChanged;
detailControl.ResetControlCache += DetailControl_ResetControlCache;
detailControl.RequestValidate += DetailControl_RequestValidate;
detailControl.RequestDisable += DetailControl_RequestDisable;
detailControl.Initialize();
detailControl.IsEnabled = !this.LockedByOtherUser;
@ -167,6 +168,18 @@ namespace ENI2
}
}
private void DetailControl_RequestDisable()
{
this.LockedByOtherUser = true; // fake flag
// clear existing controls
this.detailView.Children.Clear();
this.controlCache.Clear();
// return to "new" overview
Dispatcher.BeginInvoke((Action)(() => this.listBoxMessages_SelectionChanged(this, null)));
}
private void DetailControl_ResetControlCache(string messageGroupName)
{
if (messageGroupName.IsNullOrEmpty()) return;
@ -206,8 +219,10 @@ namespace ENI2
((message.InternalStatus == Message.BSMDStatus.CONFIRMED) || (message.InternalStatus == Message.BSMDStatus.VIOLATION)))
message.InternalStatus = Message.BSMDStatus.UPDATED;
string userName = "?";
if (this.LockedBy != null)
userName = this.LockedBy.Logon;
if(App.UserId.HasValue && DBManager.Instance.GetReportingPartyDict().ContainsKey(App.UserId.Value))
{
userName = DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].Logon;
}
message.ChangedBy = string.Format("{0} at {1}", userName, DateTime.Now);
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(message);
message.SaveElements();
@ -319,16 +334,40 @@ namespace ENI2
this._vViolations.AddRange(violations);
}
foreach (MessageError me in this._vErrors)
{
this.highlightService.HighlightError(me, this.GetContainerForMessageGroupName(me.MessageGroupName));
}
foreach (MessageViolation mv in this._vViolations)
{
this.highlightService.HighlightViolation(mv, this.GetContainerForMessageGroupName(mv.MessageGroupName));
}
// "neue" regelbasierte Validierung: Hier werden die einzelnen Regeln geprüft.
List<bsmd.database.ValidationRule> validationRules = DBManager.Instance.GetValidationRules();
foreach (bsmd.database.ValidationRule validationRule in validationRules) {
if (!validationRule.IsActive ?? false) continue;
// Regel auspacken
ConditionGroup cg = ValidationCondition.LoadFromString(validationRule.Rule);
// außer der Nachricht müssten noch die "gescheiterten" Felder zurückgeliefert werden, damit ein Highlighting stattfinden kann!
List<ValidationField> failedFieldList = new List<ValidationField>();
string resultMessage = string.Empty;
if (cg != null) {
if (ValidationCondition.CheckConditions(this.Core, this._messages, cg, failedFieldList, out resultMessage) ?? false)
{
// Regel hat zugeschlagen -> reporting
Trace.WriteLine(string.Format("Rule {0} resulted in {1}", validationRule.Name, resultMessage));
} else
{
Trace.WriteLine(string.Format("Rule {0} passed", validationRule.Name));
}
}
}
}
#endregion

View File

@ -143,6 +143,7 @@ namespace ENI2.DetailViewControls
private void DataGridBKRA_CreateRequested()
{
BRKA brka = new BRKA();
brka.Identifier = BRKA.GetNewIdentifier(this._bkraMessage.Elements);
EditBKRDialog ebd = new EditBKRDialog();
ebd.BRKA = brka;
ebd.IsDeparture = false;
@ -154,6 +155,7 @@ namespace ENI2.DetailViewControls
ebd.BRKA.MessageHeader = _bkraMessage;
this.dataGridBKRA.Items.Refresh();
ebd.BRKA = new BRKA();
ebd.BRKA.Identifier = BRKA.GetNewIdentifier(this._bkraMessage.Elements);
this.SublistElementChanged(Message.NotificationClass.BKRA);
};
@ -174,6 +176,8 @@ namespace ENI2.DetailViewControls
// are you sure dialog is in base class
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(brka);
this._bkraMessage.Elements.Remove(brka);
DatabaseEntity.ResetIdentifiers(this._bkraMessage.Elements);
this.SublistElementChanged(Message.NotificationClass.BKRA);
this.dataGridBKRA.Items.Refresh();
}
}
@ -193,6 +197,7 @@ namespace ENI2.DetailViewControls
_bkraMessage.Elements.Add(eld.BRKA);
this.dataGridBKRA.Items.Refresh();
eld.BRKA = new BRKA();
eld.BRKA.Identifier = BRKA.GetNewIdentifier(this._bkraMessage.Elements);
eld.BRKA.MessageHeader = _bkraMessage;
this.SublistElementChanged(Message.NotificationClass.BKRA);
};

View File

@ -155,6 +155,8 @@ namespace ENI2.DetailViewControls
// are you sure dialog is in base class
_bpol.PortOfItineraries.Remove(poi);
DBManager.Instance.Delete(poi);
DatabaseEntity.ResetIdentifiers(_bpol.PortOfItineraries);
this.SublistElementChanged(Message.NotificationClass.BPOL);
this.dataGridPortOfItinerary.Items.Refresh();
}
}
@ -197,6 +199,7 @@ namespace ENI2.DetailViewControls
private void DataGridPassengerList_CreateRequested()
{
PAS pas = new PAS();
pas.Identifier = PAS.GetNewIdentifier(_pasMessage.Elements);
EditPASDialog epd = new EditPASDialog();
epd.PAS = pas;
@ -207,6 +210,7 @@ namespace ENI2.DetailViewControls
this._pasMessage.Elements.Add(epd.PAS);
this.dataGridPassengerList.Items.Refresh();
epd.PAS = new PAS();
epd.PAS.Identifier = PAS.GetNewIdentifier(_pasMessage.Elements);
this.SublistElementChanged(Message.NotificationClass.PAS);
};
@ -227,6 +231,8 @@ namespace ENI2.DetailViewControls
// are you sure dialog is in base class
_pasMessage.Elements.Remove(pas);
DBManager.Instance.Delete(pas);
DatabaseEntity.ResetIdentifiers(_pasMessage.Elements);
this.SublistElementChanged(Message.NotificationClass.PAS);
this.dataGridPassengerList.Items.Refresh();
}
}
@ -245,6 +251,7 @@ namespace ENI2.DetailViewControls
_pasMessage.Elements.Add(epd.PAS);
this.dataGridPassengerList.Items.Refresh();
epd.PAS = new PAS();
epd.PAS.Identifier = PAS.GetNewIdentifier(_pasMessage.Elements);
epd.PAS.MessageHeader = _pasMessage;
this.SublistElementChanged(Message.NotificationClass.PAS);
};
@ -269,6 +276,7 @@ namespace ENI2.DetailViewControls
private void DataGridCrewList_CreateRequested()
{
CREW crew = new CREW();
crew.Identifier = CREW.GetNewIdentifier(_crewMessage.Elements);
EditCREWDialog ecd = new EditCREWDialog();
ecd.CREW = crew;
@ -279,6 +287,7 @@ namespace ENI2.DetailViewControls
this._crewMessage.Elements.Add(ecd.CREW);
this.dataGridCrewList.Items.Refresh();
ecd.CREW = new CREW();
ecd.CREW.Identifier = CREW.GetNewIdentifier(_crewMessage.Elements);
this.SublistElementChanged(Message.NotificationClass.CREW);
};
@ -299,6 +308,8 @@ namespace ENI2.DetailViewControls
// are you sure dialog is in base class
_crewMessage.Elements.Remove(crew);
DBManager.Instance.Delete(crew);
DatabaseEntity.ResetIdentifiers(_crewMessage.Elements);
this.SublistElementChanged(Message.NotificationClass.CREW);
this.dataGridCrewList.Items.Refresh();
}
}
@ -317,6 +328,7 @@ namespace ENI2.DetailViewControls
_crewMessage.Elements.Add(ecd.CREW);
this.dataGridCrewList.Items.Refresh();
ecd.CREW = new CREW();
ecd.CREW.Identifier = CREW.GetNewIdentifier(_crewMessage.Elements);
ecd.CREW.MessageHeader = _crewMessage;
this.SublistElementChanged(Message.NotificationClass.CREW);
};
@ -394,6 +406,7 @@ namespace ENI2.DetailViewControls
crew.MessageHeader = this._crewMessage;
crew.Identifier = CREW.GetNewIdentifier(this._crewMessage.Elements);
this._crewMessage.Elements.Add(crew);
importCrew.Add(crew);
}
} while (reader.NextResult());
@ -405,9 +418,9 @@ namespace ENI2.DetailViewControls
if (importCrew.Count > 0)
{
this._crewMessage.Elements.AddRange(importCrew);
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);
}
}
@ -466,6 +479,7 @@ namespace ENI2.DetailViewControls
pas.MessageHeader = this._pasMessage;
pas.Identifier = PAS.GetNewIdentifier(this._pasMessage.Elements);
this._pasMessage.Elements.Add(pas);
importPassenger.Add(pas);
}
} while (reader.NextResult());
@ -477,9 +491,9 @@ namespace ENI2.DetailViewControls
if (importPassenger.Count > 0)
{
this._pasMessage.Elements.AddRange(importPassenger);
this.dataGridPassengerList.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.PAS);
MessageBox.Show(String.Format(Properties.Resources.textPassengerImported, importPassenger.Count), Properties.Resources.textCaptionInformation, MessageBoxButton.OK, MessageBoxImage.Information);
}
}
stream.Close();

View File

@ -137,7 +137,7 @@
<DataGridTextColumn Header="{x:Static p:Resources.textIdentifier}" Binding="{Binding Identifier}" IsReadOnly="True" Width="auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textName}" Binding="{Binding Name}" IsReadOnly="True" Width="auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textFlashpointInformation}" Binding="{Binding FlashpointInformationDisplay}" IsReadOnly="True" Width="auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textFlashpoint}" Binding="{Binding Flashpoint}" IsReadOnly="True" Width="auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textFlashpoint}" Binding="{Binding Flashpoint_CEL}" IsReadOnly="True" Width="auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textQuantity}" Binding="{Binding Quantity_KGM, StringFormat={}{0:N3}}" IsReadOnly="True" Width="auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textStowagePosition}" Binding="{Binding StowagePosition}" IsReadOnly="True" Width="auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textPortOfLoading}" Binding="{Binding PortOfLoading}" IsReadOnly="True" Width="auto" />

View File

@ -298,6 +298,8 @@ namespace ENI2.DetailViewControls
// are you sure dialog is in base class
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(marpol);
this.haz.MARPOLPositions.Remove(marpol);
DatabaseEntity.ResetIdentifiers(haz.MARPOLPositions);
this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA);
this.dataGridMARPOLItems.Items.Refresh();
}
}
@ -373,6 +375,8 @@ namespace ENI2.DetailViewControls
// are you sure dialog is in base class
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(imsbc);
this.haz.IMSBCPositions.Remove(imsbc);
DatabaseEntity.ResetIdentifiers(haz.IMSBCPositions);
this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA);
this.dataGridIMSBCItems.Items.Refresh();
}
}
@ -448,6 +452,8 @@ namespace ENI2.DetailViewControls
// are you sure dialog is in base class
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(igc);
this.haz.IGCPositions.Remove(igc);
DatabaseEntity.ResetIdentifiers(haz.IGCPositions);
this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA);
this.dataGridIGCItems.Items.Refresh();
}
}
@ -523,6 +529,8 @@ namespace ENI2.DetailViewControls
// are you sure dialog is in base class
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(ibc);
this.haz.IBCPositions.Remove(ibc);
DatabaseEntity.ResetIdentifiers(haz.IBCPositions);
this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA);
this.dataGridIBCItems.Items.Refresh();
}
}
@ -598,6 +606,8 @@ namespace ENI2.DetailViewControls
// are you sure dialog is in base class
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(imdg);
this.haz.IMDGPositions.Remove(imdg);
DatabaseEntity.ResetIdentifiers(haz.IMDGPositions);
this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA);
this.dataGridIMDGItems.Items.Refresh();
}
}

View File

@ -143,6 +143,7 @@ namespace ENI2.DetailViewControls
private void DataGridBKRD_CreateRequested()
{
BRKD brkd = new BRKD();
brkd.Identifier = BRKD.GetNewIdentifier(_bkrdMessage.Elements);
EditBKRDialog ebd = new EditBKRDialog();
ebd.BRKD = brkd;
ebd.IsDeparture = true;
@ -154,6 +155,7 @@ namespace ENI2.DetailViewControls
ebd.BRKD.MessageHeader = _bkrdMessage;
this.dataGridBKRD.Items.Refresh();
ebd.BRKD = new BRKD();
ebd.BRKD.Identifier = BRKD.GetNewIdentifier(_bkrdMessage.Elements);
this.SublistElementChanged(Message.NotificationClass.BKRD);
};
@ -173,6 +175,9 @@ namespace ENI2.DetailViewControls
{
// are you sure dialog is in base class
this._bkrdMessage.Elements.Remove(brkd);
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(brkd);
DatabaseEntity.ResetIdentifiers(this._bkrdMessage.Elements);
this.SublistElementChanged(Message.NotificationClass.BKRD);
this.dataGridBKRD.Items.Refresh();
}
}
@ -192,6 +197,7 @@ namespace ENI2.DetailViewControls
_bkrdMessage.Elements.Add(eld.BRKD);
this.dataGridBKRD.Items.Refresh();
eld.BRKD = new BRKD();
eld.BRKD.Identifier = BRKD.GetNewIdentifier(_bkrdMessage.Elements);
eld.BRKD.MessageHeader = _bkrdMessage;
this.SublistElementChanged(Message.NotificationClass.BKRD);
};

View File

@ -111,19 +111,16 @@
<TabItem Header="{x:Static p:Resources.textVisitsInfectedAreas}" Name="tabInfectedAreas">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="60*" />
<ColumnDefinition Width="190*"/>
<ColumnDefinition Width="430*" />
<ColumnDefinition Width="17*"/>
<ColumnDefinition Width="301*"/>
<ColumnDefinition Width="28" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="28"/>
<RowDefinition Height="200"/>
</Grid.RowDefinitions>
<Label HorizontalContentAlignment="Right" Grid.Row="0" Grid.Column="0" Content="{x:Static p:Resources.textShipVisitedInfectedArea}" Name="labelHasShipVisited" Margin="0,0,10,0" Grid.ColumnSpan="2"/>
<CheckBox Name="checkBoxHasShipVisited" IsChecked="{Binding MDHSimplification}" Grid.Row="0" Grid.Column="2" VerticalAlignment="Center" Margin="0,8,0,7" Grid.ColumnSpan="3"/>
<enictrl:ENIDataGrid Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="5" x:Name="dataGridInfectedAreas" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
<CheckBox Name="checkBoxHasShipVisited" IsChecked="{Binding InfectedAreaVisited}" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" Margin="6,0,0,0"/>
<Label HorizontalContentAlignment="Left" Grid.Row="0" Grid.Column="1" Content="{x:Static p:Resources.textShipVisitedInfectedArea}" Name="labelHasShipVisited" Margin="0,0,10,0" />
<enictrl:ENIDataGrid Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" x:Name="dataGridInfectedAreas" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
SelectionMode="Single" AutoGenerateColumns="False" Margin="0,5,0,0">
<DataGrid.Columns>
<DataGridTextColumn Header="" Binding="{Binding Identifier}" IsReadOnly="True" />
@ -136,15 +133,15 @@
<TabItem Header="{x:Static p:Resources.textSanitaryMeasuresApplied}" Name="tabSanitaryMeasuresApplied">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="28" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="28"/>
<RowDefinition Height="200"/>
</Grid.RowDefinitions>
<Label HorizontalContentAlignment="Right" Grid.Row="0" Grid.Column="0" Content="{x:Static p:Resources.textAnySanitaryMeasures}" Name="labelSanitaryMeasuresApplied" Margin="0,0,10,0"/>
<CheckBox Name="checkBoxSanitaryMeasuresApplied" IsChecked="{Binding SanitaryMeasuresApplied}" Grid.Row="0" Grid.Column="1" VerticalAlignment="Center"/>
<CheckBox Name="checkBoxSanitaryMeasuresApplied" IsChecked="{Binding SanitaryMeasuresApplied}" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" Margin="6,0,0,0 "/>
<Label HorizontalContentAlignment="Left" Grid.Row="0" Grid.Column="1" Content="{x:Static p:Resources.textAnySanitaryMeasures}" Name="labelSanitaryMeasuresApplied" Margin="0,0,10,0"/>
<enictrl:ENIDataGrid Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" x:Name="dataGridSanitaryMeasures" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
SelectionMode="Single" AutoGenerateColumns="False" Margin="0,5,0,0">
<DataGrid.Columns>

View File

@ -90,6 +90,7 @@ namespace ENI2.DetailViewControls
this.dataGridInfectedAreas.Initialize();
this.dataGridInfectedAreas.IsReadOnly = !(mdh.InfectedAreaVisited ?? false);
this.dataGridInfectedAreas.ItemsSource = mdh.InfectedAreas;
this.dataGridInfectedAreas.AddingNewItem += DataGridInfectedAreas_AddingNewItem;
this.dataGridInfectedAreas.EditRequested += DataGridInfectedAreas_EditRequested;
@ -98,6 +99,9 @@ namespace ENI2.DetailViewControls
this.dataGridSanitaryMeasures.Initialize();
this.dataGridSanitaryMeasures.IsReadOnly = !(mdh.SanitaryMeasuresApplied ?? false);
this.checkBoxHasShipVisited.DataContext = mdh;
this.checkBoxSanitaryMeasuresApplied.DataContext = mdh;
this.checkBoxSanitaryMeasuresApplied.Checked += CheckBoxSanitaryMeasuresApplied_Checked;
this.checkBoxSanitaryMeasuresApplied.Unchecked += CheckBoxSanitaryMeasuresApplied_Checked;
this.dataGridSanitaryMeasures.ItemsSource = mdh.SanitaryMeasuresDetails;
@ -113,11 +117,6 @@ namespace ENI2.DetailViewControls
}
private void CheckBoxHasShipVisited_Checked1(object sender, RoutedEventArgs e)
{
throw new System.NotImplementedException();
}
private void CheckBoxSanitaryControlExemption_Checked(object sender, RoutedEventArgs e)
{
this.textBoxPlaceOfIssue.IsEnabled = this.checkBoxSanitaryControlExemption.IsChecked ?? false;
@ -214,6 +213,7 @@ namespace ENI2.DetailViewControls
private void DataGridSanitaryMeasures_CreateRequested()
{
SanitaryMeasuresDetail smDetail = new SanitaryMeasuresDetail();
smDetail.Identifier = SanitaryMeasuresDetail.GetNewIdentifier(_mdh.SanitaryMeasuresDetails);
EditSanitaryMeasureDialog epd = new EditSanitaryMeasureDialog();
epd.SanitaryMeasureDetail = smDetail;
@ -224,6 +224,7 @@ namespace ENI2.DetailViewControls
this._mdh.SanitaryMeasuresDetails.Add(epd.SanitaryMeasureDetail);
this.dataGridSanitaryMeasures.Items.Refresh();
epd.SanitaryMeasureDetail = new SanitaryMeasuresDetail();
epd.SanitaryMeasureDetail.Identifier = SanitaryMeasuresDetail.GetNewIdentifier(_mdh.SanitaryMeasuresDetails);
this.SublistElementChanged(Message.NotificationClass.MDH);
};
@ -244,6 +245,8 @@ namespace ENI2.DetailViewControls
// are you sure dialog is in base class
_mdh.SanitaryMeasuresDetails.Remove(smd);
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(smd);
DatabaseEntity.ResetIdentifiers(_mdh.SanitaryMeasuresDetails);
this.SublistElementChanged(Message.NotificationClass.MDH);
this.dataGridSanitaryMeasures.Items.Refresh();
}
}
@ -259,6 +262,7 @@ namespace ENI2.DetailViewControls
_mdh.SanitaryMeasuresDetails.Add(ecpd.SanitaryMeasureDetail);
this.dataGridSanitaryMeasures.Items.Refresh();
ecpd.SanitaryMeasureDetail = new SanitaryMeasuresDetail();
ecpd.SanitaryMeasureDetail.Identifier = SanitaryMeasuresDetail.GetNewIdentifier(_mdh.SanitaryMeasuresDetails);
};
if (ecpd.ShowDialog() ?? false)
{
@ -282,6 +286,7 @@ namespace ENI2.DetailViewControls
private void DataGridInfectedAreas_CreateRequested()
{
InfectedArea ia = new InfectedArea();
ia.Identifier = InfectedArea.GetNewIdentifier(_mdh.InfectedAreas);
EditInfectedAreaDialog epd = new EditInfectedAreaDialog();
epd.InfectedArea = ia;
@ -292,6 +297,7 @@ namespace ENI2.DetailViewControls
this._mdh.InfectedAreas.Add(epd.InfectedArea);
this.dataGridInfectedAreas.Items.Refresh();
epd.InfectedArea = new InfectedArea();
epd.InfectedArea.Identifier = InfectedArea.GetNewIdentifier(_mdh.InfectedAreas);
this.SublistElementChanged(Message.NotificationClass.MDH);
};
@ -312,6 +318,8 @@ namespace ENI2.DetailViewControls
// are you sure dialog is in base class
_mdh.InfectedAreas.Remove(ia);
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(ia);
DatabaseEntity.ResetIdentifiers(_mdh.InfectedAreas);
this.SublistElementChanged(Message.NotificationClass.MDH);
this.dataGridInfectedAreas.Items.Refresh();
}
}
@ -327,6 +335,7 @@ namespace ENI2.DetailViewControls
_mdh.InfectedAreas.Add(ecpd.InfectedArea);
this.dataGridInfectedAreas.Items.Refresh();
ecpd.InfectedArea= new InfectedArea();
ecpd.InfectedArea.Identifier = InfectedArea.GetNewIdentifier(_mdh.InfectedAreas);
};
if (ecpd.ShowDialog() ?? false)
{
@ -350,6 +359,7 @@ namespace ENI2.DetailViewControls
private void DataGridPortOfCallLast30Days_CreateRequested()
{
PortOfCallLast30Days poc30 = new PortOfCallLast30Days();
poc30.Identifier = PortOfCallLast30Days.GetNewIdentifier(_mdh.PortOfCallLast30Days);
EditPortOfCallLast30DaysDialog epd = new EditPortOfCallLast30DaysDialog();
epd.PocLast30Days = poc30;
@ -360,6 +370,7 @@ namespace ENI2.DetailViewControls
this._mdh.PortOfCallLast30Days.Add(epd.PocLast30Days);
this.dataGridPortOfCallLast30Days.Items.Refresh();
epd.PocLast30Days = new PortOfCallLast30Days();
epd.PocLast30Days.Identifier = PortOfCallLast30Days.GetNewIdentifier(_mdh.PortOfCallLast30Days);
this.SublistElementChanged(Message.NotificationClass.MDH);
};
@ -380,6 +391,8 @@ namespace ENI2.DetailViewControls
// are you sure dialog is in base class
_mdh.PortOfCallLast30Days.Remove(poc30d);
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(poc30d);
DatabaseEntity.ResetIdentifiers(_mdh.PortOfCallLast30Days);
this.SublistElementChanged(Message.NotificationClass.MDH);
this.dataGridPortOfCallLast30Days.Items.Refresh();
}
}
@ -395,6 +408,7 @@ namespace ENI2.DetailViewControls
_mdh.PortOfCallLast30Days.Add(ecpd.PocLast30Days);
this.dataGridPortOfCallLast30Days.Items.Refresh();
ecpd.PocLast30Days = new PortOfCallLast30Days();
ecpd.PocLast30Days.Identifier = PortOfCallLast30Days.GetNewIdentifier(_mdh.PortOfCallLast30Days);
};
if (ecpd.ShowDialog() ?? false)
{

View File

@ -197,6 +197,7 @@ 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
@ -388,7 +389,6 @@ namespace ENI2.DetailViewControls
private void contextSendMessage(object sender, RoutedEventArgs e)
{
//MessageBox.Show("not yet..");
MessageBoxResult result = MessageBox.Show(Properties.Resources.textConfirmSend, Properties.Resources.textConfirm, MessageBoxButton.YesNo, MessageBoxImage.Question);
if (result == MessageBoxResult.Yes)
{
@ -401,6 +401,8 @@ namespace ENI2.DetailViewControls
// komplette Anmeldung auf "zu versenden" stellen
this.Core.BSMDStatusInternal = MessageCore.BSMDStatus.TOSEND;
this.Core.DefaultReportingPartyId = App.UserId;
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(this.Core);
this.dataGridMessages.Items.Refresh();
}
@ -421,6 +423,8 @@ namespace ENI2.DetailViewControls
// komplette Anmeldung auf "zu versenden" stellen
this.Core.BSMDStatusInternal = MessageCore.BSMDStatus.TOSEND;
this.Core.DefaultReportingPartyId = App.UserId;
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(this.Core);
this.dataGridMessages.Items.Refresh();
}
@ -439,8 +443,11 @@ namespace ENI2.DetailViewControls
{
this.Core.Cancelled = true;
this.Core.BSMDStatusInternal = MessageCore.BSMDStatus.TOSEND;
this.Core.DefaultReportingPartyId = App.UserId;
this.ShowCancelledLabel();
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(this.Core);
this.OnRequestDisable();
}
}
}

View File

@ -104,6 +104,8 @@ namespace ENI2.DetailViewControls
this.checkBox_IsAnchored.IsEnabled = this.Core.IsDK;
}
#region datagrid call purposes
private void DataGridCallPurposes_DeleteRequested(DatabaseEntity obj)
{
CallPurpose cp = obj as CallPurpose;
@ -112,6 +114,8 @@ namespace ENI2.DetailViewControls
// are you sure dialog is in base class
_noa_nod.CallPurposes.Remove(cp);
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(cp);
DatabaseEntity.ResetIdentifiers(_noa_nod.CallPurposes);
this.SublistElementChanged(Message.NotificationClass.NOA_NOD);
this.dataGridCallPurposes.Items.Refresh();
}
}
@ -126,10 +130,12 @@ namespace ENI2.DetailViewControls
_noa_nod.CallPurposes.Add(ecpd.CallPurpose);
this.dataGridCallPurposes.Items.Refresh();
ecpd.CallPurpose = new CallPurpose();
ecpd.CallPurpose.Identifier = CallPurpose.GetNewIdentifier(_noa_nod.CallPurposes);
ecpd.CallPurpose.NOA_NOD = this._noa_nod;
this.SublistElementChanged(Message.NotificationClass.NOA_NOD);
};
ecpd.CallPurpose = new CallPurpose();
ecpd.CallPurpose.Identifier = CallPurpose.GetNewIdentifier(_noa_nod.CallPurposes);
ecpd.CallPurpose.NOA_NOD = this._noa_nod;
if(ecpd.ShowDialog() ?? false)
@ -158,6 +164,7 @@ namespace ENI2.DetailViewControls
_noa_nod.CallPurposes.Add(ecpd.CallPurpose);
this.dataGridCallPurposes.Items.Refresh();
ecpd.CallPurpose = new CallPurpose();
ecpd.CallPurpose.Identifier = CallPurpose.GetNewIdentifier(_noa_nod.CallPurposes);
ecpd.CallPurpose.NOA_NOD = this._noa_nod;
this.SublistElementChanged(Message.NotificationClass.NOA_NOD);
};
@ -171,6 +178,8 @@ namespace ENI2.DetailViewControls
}
}
#endregion
#region Highlighting
public override void HighlightErrorMessageContainer()

View File

@ -151,10 +151,13 @@ namespace ENI2.DetailViewControls
}
#region datagrid LADG
private void DataGridLADG_CreateRequested()
{
EditLADGDialog eld = new EditLADGDialog();
eld.LADG = new LADG();
eld.LADG.Identifier = LADG.GetNewIdentifier(_ladgMessage.Elements);
eld.Core = this.Core;
eld.AddClicked += () =>
@ -164,6 +167,7 @@ namespace ENI2.DetailViewControls
eld.LADG.MessageHeader = _ladgMessage;
this.dataGridLADG.Items.Refresh();
eld.LADG = new LADG();
eld.LADG.Identifier = LADG.GetNewIdentifier(_ladgMessage.Elements);
this.SublistElementChanged(Message.NotificationClass.LADG);
};
@ -184,6 +188,8 @@ namespace ENI2.DetailViewControls
// are you sure dialog is in base class
this._ladgMessage.Elements.Remove(ladg);
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(ladg);
DatabaseEntity.ResetIdentifiers(_ladgMessage.Elements);
this.SublistElementChanged(Message.NotificationClass.LADG);
this.dataGridLADG.Items.Refresh();
}
}
@ -201,6 +207,7 @@ namespace ENI2.DetailViewControls
{
eld.CopyValuesToEntity();
eld.LADG = new LADG();
eld.LADG.Identifier = LADG.GetNewIdentifier(_ladgMessage.Elements);
_ladgMessage.Elements.Add(eld.LADG);
eld.LADG.MessageHeader = _ladgMessage;
this.SublistElementChanged(Message.NotificationClass.LADG);
@ -219,10 +226,15 @@ namespace ENI2.DetailViewControls
this.DataGridLADG_CreateRequested();
}
#endregion
#region datagrid SERV
private void DataGridSERV_CreateRequested()
{
EditSERVDialog esd = new EditSERVDialog();
esd.SERV = new SERV();
esd.SERV.Identifier = SERV.GetNewIdentifier(_servMessage.Elements);
esd.AddClicked += () =>
{
@ -231,6 +243,7 @@ namespace ENI2.DetailViewControls
esd.SERV.MessageHeader = _servMessage;
this.dataGridSERV.Items.Refresh();
esd.SERV = new SERV();
esd.SERV.Identifier = SERV.GetNewIdentifier(_servMessage.Elements);
this.SublistElementChanged(Message.NotificationClass.SERV);
};
@ -251,6 +264,8 @@ namespace ENI2.DetailViewControls
// are you sure dialog is in base class
_servMessage.Elements.Remove(serv);
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(serv);
DatabaseEntity.ResetIdentifiers(_servMessage.Elements);
this.SublistElementChanged(Message.NotificationClass.SERV);
this.dataGridSERV.Items.Refresh();
}
}
@ -267,6 +282,7 @@ namespace ENI2.DetailViewControls
{
esd.CopyValuesToEntity();
esd.SERV = new SERV();
esd.SERV.Identifier = SERV.GetNewIdentifier(_servMessage.Elements);
_servMessage.Elements.Add(esd.SERV);
esd.SERV.MessageHeader = _servMessage;
this.SublistElementChanged(Message.NotificationClass.SERV);
@ -285,6 +301,8 @@ namespace ENI2.DetailViewControls
this.DataGridSERV_CreateRequested();
}
#endregion
#region Highlighting
public override void HighlightErrorMessageContainer()

View File

@ -68,8 +68,8 @@
<Label HorizontalContentAlignment="Right" Grid.Row="18" Grid.Column="2" Content="{x:Static p:Resources.textGeneralCargoDescription}" Name="label_GeneralCargoDescription" Margin="0,0,10,0"/>
<CheckBox Name="checkBoxKielCanalPassagePlanned" IsChecked="{Binding KielCanalPassagePlanned}" Grid.Row="0" Grid.Column="1" VerticalAlignment="Center"/>
<xctk:DateTimePicker Name="dateTimePickerKielCanalPassagePlannedIncomming" Grid.Row="1" Grid.Column="1" Value="{Binding KielCanalPassagePlannedIncomming}" Margin="2" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left"/>
<xctk:DateTimePicker Name="dateTimePickerKielCanalPassagePlannedOutgoing" Grid.Row="1" Grid.Column="3" Value="{Binding KielCanalPassagePlannedOutgoing}" Margin="2" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left"/>
<xctk:DateTimePicker Name="dateTimePickerKielCanalPassagePlannedIncomming" Grid.Row="1" Grid.Column="1" Value="{Binding KielCanalPassagePlannedIncomming, Converter={util:UtcToLocalDateTimeConverter}}" Margin="2" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left"/>
<xctk:DateTimePicker Name="dateTimePickerKielCanalPassagePlannedOutgoing" Grid.Row="1" Grid.Column="3" Value="{Binding KielCanalPassagePlannedOutgoing, Converter={util:UtcToLocalDateTimeConverter}}" Margin="2" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left"/>
<ComboBox Name="comboBoxCurrentShipSecurityLevel" Grid.Row="3" Grid.Column="1" SelectedValue="{Binding CurrentShipSecurityLevel}" Margin="2" IsEditable="True" StaysOpenOnEdit="True" IsTextSearchEnabled="True" />
<CheckBox Name="checkBoxSECSimplification" IsChecked="{Binding SECSimplification}" Grid.Row="5" Grid.Column="1" VerticalAlignment="Center"/>
<enictrl:LocodeControl x:Name="locodePortOfCallWhereCompleteSECNotified" Grid.Row="6" Grid.Column="1" LocodeValue="{Binding PortOfCallWhereCompleteSECNotified}" />

View File

@ -102,6 +102,7 @@ namespace ENI2.DetailViewControls
private void DataGridShip2ShipActivities_CreateRequested()
{
ShipToShipActivitiesDuringLastTenPortFacilitiesCalled s2s = new ShipToShipActivitiesDuringLastTenPortFacilitiesCalled();
s2s.Identifier = ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.GetNewIdentifier(_sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled);
EditShip2ShipActivitiesDialog epd = new EditShip2ShipActivitiesDialog();
epd.ShipToShipActivity = s2s;
@ -112,6 +113,7 @@ namespace ENI2.DetailViewControls
this._sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Add(epd.ShipToShipActivity);
this.dataGridShip2ShipActivities.Items.Refresh();
epd.ShipToShipActivity = new ShipToShipActivitiesDuringLastTenPortFacilitiesCalled();
epd.ShipToShipActivity.Identifier = ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.GetNewIdentifier(_sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled);
this.SublistElementChanged(Message.NotificationClass.SEC);
};
@ -132,6 +134,8 @@ namespace ENI2.DetailViewControls
// are you sure dialog is in base class
_sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Remove(s2s);
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(s2s);
DatabaseEntity.ResetIdentifiers(_sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled);
this.SublistElementChanged(Message.NotificationClass.SEC);
this.dataGridShip2ShipActivities.Items.Refresh();
}
}
@ -147,6 +151,7 @@ namespace ENI2.DetailViewControls
_sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Add(ecpd.ShipToShipActivity);
this.dataGridShip2ShipActivities.Items.Refresh();
ecpd.ShipToShipActivity = new ShipToShipActivitiesDuringLastTenPortFacilitiesCalled();
ecpd.ShipToShipActivity.Identifier = ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.GetNewIdentifier(_sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled);
};
if (ecpd.ShowDialog() ?? false)
{
@ -170,6 +175,7 @@ namespace ENI2.DetailViewControls
private void DataGridLast10PortFacilities_CreateRequested()
{
LastTenPortFacilitiesCalled l10c = new LastTenPortFacilitiesCalled();
l10c.Identifier = LastTenPortFacilitiesCalled.GetNewIdentifier(_sec.LastTenPortFacilitesCalled);
EditLast10PortFacilitiesDialog epd = new EditLast10PortFacilitiesDialog();
epd.LastTenPortFacilitiesCalled = l10c;
@ -180,6 +186,7 @@ namespace ENI2.DetailViewControls
this._sec.LastTenPortFacilitesCalled.Add(epd.LastTenPortFacilitiesCalled);
this.dataGridLast10PortFacilities.Items.Refresh();
epd.LastTenPortFacilitiesCalled = new LastTenPortFacilitiesCalled();
epd.LastTenPortFacilitiesCalled.Identifier = LastTenPortFacilitiesCalled.GetNewIdentifier(_sec.LastTenPortFacilitesCalled);
this.SublistElementChanged(Message.NotificationClass.SEC);
};
@ -200,6 +207,8 @@ namespace ENI2.DetailViewControls
// are you sure dialog is in base class
_sec.LastTenPortFacilitesCalled.Remove(l10c);
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(l10c);
DatabaseEntity.ResetIdentifiers(_sec.LastTenPortFacilitesCalled);
this.SublistElementChanged(Message.NotificationClass.SEC);
this.dataGridLast10PortFacilities.Items.Refresh();
}
}
@ -215,6 +224,7 @@ namespace ENI2.DetailViewControls
_sec.LastTenPortFacilitesCalled.Add(ecpd.LastTenPortFacilitiesCalled);
this.dataGridLast10PortFacilities.Items.Refresh();
ecpd.LastTenPortFacilitiesCalled = new LastTenPortFacilitiesCalled();
ecpd.LastTenPortFacilitiesCalled.Identifier = LastTenPortFacilitiesCalled.GetNewIdentifier(_sec.LastTenPortFacilitesCalled);
};
if (ecpd.ShowDialog() ?? false)
{

View File

@ -48,21 +48,21 @@
<Label HorizontalContentAlignment="Right" Grid.Row="5" Grid.Column="3" Content="{x:Static p:Resources.textBeamOverAll}" Margin="0,0,10,0" />
<Label HorizontalContentAlignment="Right" Grid.Row="6" Grid.Column="3" Content="{x:Static p:Resources.textInmarsatCallNumber}" Margin="0,0,10,0" />
<TextBox Name="textBoxVesselName" Grid.Column="1" Grid.Row="0" Grid.ColumnSpan="2" Text="{Binding ShipName}" Margin="2" VerticalAlignment="Center" VerticalContentAlignment="Center"/>
<TextBox Name="textBoxVesselName" Grid.Column="1" Grid.Row="0" Grid.ColumnSpan="2" Text="{Binding ShipName}" Margin="2" VerticalContentAlignment="Center"/>
<ComboBox Name="comboBoxVesselType" Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="2" SelectedValue="{Binding ShipType}" Margin="2" SelectedValuePath="Key" DisplayMemberPath="Value" IsEditable="True" StaysOpenOnEdit="True" IsTextSearchEnabled="True" />
<TextBox Name="textBoxCallsign" Grid.Column="4" Grid.Row="1" Text="{Binding CallSign}" Margin="2" VerticalAlignment="Center" VerticalContentAlignment="Center"/>
<TextBox Name="textBoxCallsign" Grid.Column="4" Grid.Row="1" Text="{Binding CallSign}" Margin="2" VerticalContentAlignment="Center"/>
<ComboBox Name="comboBoxTransportMode" Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="2" Margin="2" SelectedValue="{Binding TransportMode}" SelectedValuePath="Key" DisplayMemberPath="Value" IsEditable="True" StaysOpenOnEdit="True" IsTextSearchEnabled="True" />
<ComboBox Name="comboBoxFlag" Grid.Column="1" Grid.Row="3" Grid.ColumnSpan="2" Margin="2" SelectedValue="{Binding Flag}" SelectedValuePath="Key" DisplayMemberPath="Value" IsEditable="True" StaysOpenOnEdit="True" IsTextSearchEnabled="True" />
<enictrl:LocodeControl x:Name="locodePortOfRegistry" Grid.Column="4" Grid.Row="3" Grid.ColumnSpan="2" LocodeValue="{Binding PortOfRegistry}" />
<xctk:IntegerUpDown Name="integerUpDownGrossTonnage" Grid.Column="1" Grid.Row="4" Margin="2" Value="{Binding GrossTonnage}" ShowButtonSpinner="False" TextAlignment="Left"/>
<Label Content="t" Grid.Column="2" Grid.Row="4" />
<xctk:DoubleUpDown Name="doubleUpDownLength" Grid.Column="1" Grid.Row="5" Margin="2" Value="{Binding LengthOverall_MTR}" ShowButtonSpinner="False" TextAlignment="Left"/>
<xctk:DoubleUpDown Name="doubleUpDownLength" Grid.Column="1" Grid.Row="5" Margin="2" Value="{Binding LengthOverall_MTR}" ShowButtonSpinner="False" TextAlignment="Left" ParsingNumberStyle="Any" FormatString="N2" />
<Label Content="m" Grid.Column="2" Grid.Row="5" />
<xctk:DoubleUpDown Name="doubleUpDownBeam" Grid.Column="4" Grid.Row="5" Margin="2" Value="{Binding Beam_MTR}" ShowButtonSpinner="False" TextAlignment="Left" />
<xctk:DoubleUpDown Name="doubleUpDownBeam" Grid.Column="4" Grid.Row="5" Margin="2" Value="{Binding Beam_MTR}" ShowButtonSpinner="False" TextAlignment="Left" ParsingNumberStyle="Any" FormatString="N2" />
<Label Content="m" Grid.Column="5" Grid.Row="5" />
<TextBox Name="textBoxMMSI" Grid.Column="1" Grid.Row="6" Margin="2" Text="{Binding MMSINumber}" VerticalAlignment="Center" VerticalContentAlignment="Center"/>
<TextBox Name="textBoxInmarsatCallNumber" Grid.Column="4" Grid.ColumnSpan="2" Grid.Row="6" VerticalAlignment="Center" Margin="2" Text="{Binding InmarsatCallNumber}" VerticalContentAlignment="Center" />
<TextBox Name="textBoxMMSI" Grid.Column="1" Grid.Row="6" Margin="2" Text="{Binding MMSINumber}" VerticalContentAlignment="Center"/>
<TextBox Name="textBoxInmarsatCallNumber" Grid.Column="4" Grid.ColumnSpan="2" Grid.Row="6" Margin="2" Text="{Binding InmarsatCallNumber}" VerticalContentAlignment="Center" />
</Grid>
<GroupBox Name="groupBoxISMCompany" Header="{x:Static p:Resources.textISMCompany}" Grid.Row="1">
@ -89,12 +89,12 @@
<Label HorizontalContentAlignment="Right" Grid.Row="0" Grid.Column="3" Content="{x:Static p:Resources.textCompanyId}" Margin="0,0,10,0" />
<Label HorizontalContentAlignment="Right" Grid.Row="1" Grid.Column="3" Content="{x:Static p:Resources.textCity}" Margin="0,0,10,0" />
<TextBox VerticalAlignment="Center" Name="textBoxCompanyName" Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2" Margin="2" Text="{Binding ISMCompanyName}" MaxLength="100" VerticalContentAlignment="Center"/>
<TextBox VerticalAlignment="Center" Name="textBoxCompanyId" Grid.Row="0" Grid.Column="4" Grid.ColumnSpan="2" Margin="2" Text="{Binding ISMCompanyId}" MaxLength="100" VerticalContentAlignment="Center"/>
<TextBox VerticalAlignment="Center" Name="textBoxStreetNumber" Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" Margin="2" Text="{Binding ISMCompanyStreetAndNumber}" MaxLength="100" VerticalContentAlignment="Center"/>
<TextBox VerticalAlignment="Center" Name="textBoxCity" Grid.Row="1" Grid.Column="4" Grid.ColumnSpan="2" Margin="2" Text="{Binding ISMCompanyCity}" MaxLength="100" VerticalContentAlignment="Center"/>
<TextBox VerticalAlignment="Center" Name="textBoxPostalCode" Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="1" Margin="2" Text="{Binding ISMCompanyPostalCode}" MaxLength="24" VerticalContentAlignment="Center"/>
<TextBox VerticalAlignment="Center" Name="textBoxCountry" Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="2" Margin="2" Text="{Binding ISMCompanyCountry}" MaxLength="100" VerticalContentAlignment="Center"/>
<TextBox Name="textBoxCompanyName" Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2" Margin="2" Text="{Binding ISMCompanyName}" MaxLength="100" VerticalContentAlignment="Center"/>
<TextBox Name="textBoxCompanyId" Grid.Row="0" Grid.Column="4" Grid.ColumnSpan="2" Margin="2" Text="{Binding ISMCompanyId}" MaxLength="100" VerticalContentAlignment="Center"/>
<TextBox Name="textBoxStreetNumber" Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" Margin="2" Text="{Binding ISMCompanyStreetAndNumber}" MaxLength="100" VerticalContentAlignment="Center"/>
<TextBox Name="textBoxCity" Grid.Row="1" Grid.Column="4" Grid.ColumnSpan="2" Margin="2" Text="{Binding ISMCompanyCity}" MaxLength="100" VerticalContentAlignment="Center"/>
<TextBox Name="textBoxPostalCode" Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="1" Margin="2" Text="{Binding ISMCompanyPostalCode}" MaxLength="24" VerticalContentAlignment="Center"/>
<TextBox Name="textBoxCountry" Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="2" Margin="2" Text="{Binding ISMCompanyCountry}" MaxLength="100" VerticalContentAlignment="Center"/>
</Grid>
</GroupBox>

View File

@ -29,7 +29,6 @@
<DataGridTextColumn Header="{x:Static p:Resources.textBeamOverAll}" Binding="{Binding TowageOnArrivalBeam_MTR}" IsReadOnly="True" Width="Auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textRemarks}" Binding="{Binding TowageOnArrivalRemarks}" IsReadOnly="True" Width="Auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textCompanyName}" Binding="{Binding TowageOnArrivalOperatorCompanyName}" IsReadOnly="True" Width="Auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textPurposeOfCall}" Binding="{Binding TowageOnArrivalPurposeOfCall}" IsReadOnly="True" Width="Auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textStreetNumber}" Binding="{Binding TowageOnArrivalOperatorStreetNameAndNumber}" IsReadOnly="True" Width="Auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textPostalCode}" Binding="{Binding TowageOnArrivalOperatorPostalCode}" IsReadOnly="True" Width="Auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textCity}" Binding="{Binding TowageOnArrivalOperatorCity}" IsReadOnly="True" Width="Auto" />

View File

@ -21,6 +21,7 @@ namespace ENI2.DetailViewControls
private Message _towaMessage;
private Message _towdMessage;
private bool _ctxInitialized = false;
public TowageDetailControl()
{
@ -29,6 +30,8 @@ namespace ENI2.DetailViewControls
}
private void TowageDetailControl_Loaded(object sender, RoutedEventArgs e)
{
if (!_ctxInitialized)
{
this.dataGridTowageOnArrival.ContextMenu.Items.Add(new Separator());
MenuItem copyItem = new MenuItem();
@ -36,6 +39,8 @@ namespace ENI2.DetailViewControls
copyItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/documents.png")) };
copyItem.Click += new RoutedEventHandler(this.copyItem);
this.dataGridTowageOnArrival.ContextMenu.Items.Add(copyItem);
_ctxInitialized = true;
}
}
private void copyItem(object sender, RoutedEventArgs e)
@ -49,6 +54,7 @@ namespace ENI2.DetailViewControls
TOWD copyTOWD = new TOWD();
copyTOWD.MessageHeader = _towdMessage;
copyTOWD.CopyFromTOWA(selectedTOWA);
copyTOWD.Identifier = TOWD.GetNewIdentifier(this._towdMessage.Elements);
this._towdMessage.Elements.Add(copyTOWD);
this.dataGridTowageOnDeparture.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.TOWD);
@ -102,9 +108,12 @@ namespace ENI2.DetailViewControls
}
#region TOWD grid
private void DataGridTowageOnDeparture_CreateRequested()
{
TOWD towd = new TOWD();
towd.Identifier = TOWD.GetNewIdentifier(this._towdMessage.Elements);
EditTOWDialog ebd = new EditTOWDialog();
ebd.TOWD = towd;
ebd.IsDeparture = true;
@ -116,6 +125,7 @@ namespace ENI2.DetailViewControls
ebd.TOWD.MessageHeader = _towdMessage;
this.dataGridTowageOnDeparture.Items.Refresh();
ebd.TOWD = new TOWD();
ebd.TOWD.Identifier = TOWD.GetNewIdentifier(this._towdMessage.Elements);
this.SublistElementChanged(Message.NotificationClass.TOWD);
};
@ -137,6 +147,8 @@ namespace ENI2.DetailViewControls
// are you sure dialog is in base class
this._towdMessage.Elements.Remove(towd);
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(towd);
DatabaseEntity.ResetIdentifiers(this._towdMessage.Elements);
this.SublistElementChanged(Message.NotificationClass.TOWD);
this.dataGridTowageOnDeparture.Items.Refresh();
}
}
@ -154,6 +166,7 @@ namespace ENI2.DetailViewControls
{
eld.CopyValuesToEntity();
eld.TOWD = new TOWD();
eld.TOWD.Identifier = TOWD.GetNewIdentifier(this._towdMessage.Elements);
_towdMessage.Elements.Add(eld.TOWD);
eld.TOWD.MessageHeader = _towdMessage;
this.SublistElementChanged(Message.NotificationClass.TOWD);
@ -173,11 +186,14 @@ namespace ENI2.DetailViewControls
this.DataGridTowageOnDeparture_CreateRequested();
}
#endregion
#region TOWA grid
private void DataGridTowageOnArrival_CreateRequested()
{
TOWA towa = new TOWA();
towa.Identifier = TOWA.GetNewIdentifier(this._towaMessage.Elements);
EditTOWDialog ebd = new EditTOWDialog();
ebd.TOWA = towa;
ebd.IsDeparture = false;
@ -189,6 +205,7 @@ namespace ENI2.DetailViewControls
ebd.TOWA.MessageHeader = _towaMessage;
this.dataGridTowageOnArrival.Items.Refresh();
ebd.TOWA = new TOWA();
ebd.TOWA.Identifier = TOWA.GetNewIdentifier(this._towaMessage.Elements);
this.SublistElementChanged(Message.NotificationClass.TOWA);
};
@ -210,6 +227,8 @@ namespace ENI2.DetailViewControls
// are you sure dialog is in base class
this._towaMessage.Elements.Remove(towa);
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(towa);
DatabaseEntity.ResetIdentifiers(this._towaMessage.Elements);
this.SublistElementChanged(Message.NotificationClass.TOWA);
this.dataGridTowageOnArrival.Items.Refresh();
}
}
@ -227,6 +246,7 @@ namespace ENI2.DetailViewControls
{
eld.CopyValuesToEntity();
eld.TOWA = new TOWA();
eld.TOWA.Identifier = TOWA.GetNewIdentifier(this._towaMessage.Elements);
_towaMessage.Elements.Add(eld.TOWA);
eld.TOWA.MessageHeader = _towaMessage;
this.SublistElementChanged(Message.NotificationClass.TOWA);
@ -246,6 +266,8 @@ namespace ENI2.DetailViewControls
this.DataGridTowageOnArrival_CreateRequested();
}
#endregion
#region Highlighting
public override void HighlightErrorMessageContainer()

View File

@ -42,7 +42,7 @@
<CheckBox Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" Name="checkBoxAccurateCorrectDetails" IsChecked="{Binding ConfirmationOfCorrectness}" />
<CheckBox Grid.Row="0" Grid.Column="3" VerticalAlignment="Center" Name="checkBoxValidExemption" IsChecked="{Binding WasteDisposalValidExemption}" />
<ComboBox Grid.Row="1" Grid.Column="1" Name="comboBoxWasteDisposal" Margin="2" SelectedIndex="{Binding WasteDisposalDelivery}"/>
<DatePicker Grid.Row="2" Grid.Column="1" Name="datePickerDateLastDisposal" Margin="2" SelectedDate="{Binding LastWasteDisposalDate, Converter={util:ByteConverter}}" />
<DatePicker Grid.Row="2" Grid.Column="1" Name="datePickerDateLastDisposal" Margin="2" SelectedDate="{Binding LastWasteDisposalDate}" />
<enictrl:LocodeControl Grid.Row="3" Grid.Column="1" x:Name="locodeCtrlLastWastePort" LocodeValue="{Binding LastWasteDisposalPort}" />
<TextBox Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="3" Grid.RowSpan="2" Name="textBoxWasteDisposalServiceProviders" Text="{Binding WasteDisposalServiceProviderText}" Margin="2" />
</Grid>

View File

@ -105,6 +105,7 @@ namespace ENI2.DetailViewControls
private void DataGridWaste_CreateRequested()
{
Waste waste = new Waste();
waste.Identifier = Waste.GetNewIdentifier(_was.Waste);
EditWasteDialog epd = new EditWasteDialog();
epd.Waste = waste;
@ -115,6 +116,7 @@ namespace ENI2.DetailViewControls
this._was.Waste.Add(epd.Waste);
this.dataGridWaste.Items.Refresh();
epd.Waste = new Waste();
epd.Waste.Identifier = Waste.GetNewIdentifier(_was.Waste);
this.SublistElementChanged(Message.NotificationClass.WAS);
};
@ -135,6 +137,8 @@ namespace ENI2.DetailViewControls
// are you sure dialog is in base class
_was.Waste.Remove(waste);
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(waste);
DatabaseEntity.ResetIdentifiers(_was.Waste);
this.SublistElementChanged(Message.NotificationClass.WAS);
this.dataGridWaste.Items.Refresh();
}
}
@ -153,6 +157,7 @@ namespace ENI2.DetailViewControls
_was.Waste.Add(epd.Waste);
this.dataGridWaste.Items.Refresh();
epd.Waste = new Waste();
epd.Waste.Identifier = Waste.GetNewIdentifier(_was.Waste);
epd.Waste.WAS = _was;
this.SublistElementChanged(Message.NotificationClass.WAS);
};

View File

@ -35,7 +35,7 @@
<MinimumRequiredVersion>3.5.1.0</MinimumRequiredVersion>
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>publish.html</WebPage>
<ApplicationRevision>1</ApplicationRevision>
<ApplicationRevision>4</ApplicationRevision>
<ApplicationVersion>3.7.2.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut>

View File

@ -8,7 +8,7 @@
xmlns:p="clr-namespace:ENI2.Properties"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d"
Title="{x:Static p:Resources.textNewWithId}" Height="192" Width="350" WindowStyle="SingleBorderWindow" Background="AliceBlue" ResizeMode="NoResize">
Title="{x:Static p:Resources.textNewWithId}" Height="220" Width="350" WindowStyle="SingleBorderWindow" Background="AliceBlue" ResizeMode="NoResize">
<Grid Margin="4">
<Grid.RowDefinitions>
@ -16,6 +16,7 @@
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
@ -28,6 +29,7 @@
<Label Name="labelIMO" Grid.Row="1" Grid.Column="0" Content="{x:Static p:Resources.textIMO}" />
<Label Name="labelENI" Grid.Row="2" Grid.Column="0" Content="{x:Static p:Resources.textENI}" />
<Label Name="labelETA" Grid.Row="3" Grid.Column="0" Content="ETA" />
<Label Name="labelHIS" Grid.Row="4" Grid.Column="0" Content="HIS" />
<xctk:DoubleUpDown x:Name="doubleUpDownIMO" Margin="2" Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2"
ClipValueToMinMax="True"
ShowButtonSpinner="False"
@ -57,6 +59,6 @@
Watermark="Enter ENI" ValueChanged="doubleUpDownENI_ValueChanged" TextAlignment="Left"/>
<DatePicker Name="datePickerETA" Grid.Row="3" Grid.Column="1" Margin="2" Grid.ColumnSpan="2"
SelectedDateChanged="datePickerETA_SelectedDateChanged" />
<ComboBox Name="comboBoxInitialHIS" Grid.Row="4" Grid.Column="1" Margin="2" Grid.ColumnSpan="2" DisplayMemberPath="Value" SelectedValuePath="Key" />
</Grid>
</enictrl:EditWindowBase>

View File

@ -3,10 +3,13 @@
//
//
using System.Windows;
using System.Windows.Controls;
using ENI2.Controls;
using bsmd.database;
using System;
using System.Collections.Generic;
namespace ENI2.EditControls
{
@ -24,6 +27,16 @@ namespace ENI2.EditControls
private void NewWithIdDialog_Loaded(object sender, RoutedEventArgs e)
{
this.EnableOK(false);
List<KeyValuePair<Message.NSWProvider, string>> comboDataSource = new List<KeyValuePair<Message.NSWProvider, string>>()
{
new KeyValuePair<Message.NSWProvider, string>( Message.NSWProvider.DUDR, "HIS-Nord live" ),
new KeyValuePair<Message.NSWProvider, string>( Message.NSWProvider.DUDR_TEST, "HIS-Nord Testsystem" ),
new KeyValuePair<Message.NSWProvider, string>(Message.NSWProvider.DBH, "DBH")
};
this.comboBoxInitialHIS.ItemsSource = comboDataSource;
}
public bool ValidId { get; set; }
@ -36,6 +49,8 @@ namespace ENI2.EditControls
public DateTime? ETA { get { return this.datePickerETA.SelectedDate; } }
public Message.NSWProvider SelectedHIS { get { return (Message.NSWProvider) this.comboBoxInitialHIS.SelectedValue; } }
private void textBoxVisitTransitId_TextChanged(object sender, TextChangedEventArgs e)
{
this.CheckComplete();

View File

@ -16,11 +16,22 @@
<enictrl:ENIDataGrid Grid.Row="0" Grid.Column="0" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
SelectionMode="Single" AutoGenerateColumns="False" Margin="0,5,0,0" x:Name="dataGridSystemErrors">
<DataGrid.Columns>
<DataGridTextColumn Header="At" Binding="{Binding ErrorAt}" IsReadOnly="True" Width="0.15*" />
<DataGridTextColumn Header="{x:Static p:Resources.textSendDate}" Binding="{Binding SendDate}" IsReadOnly="True" Width="0.15*" />
<DataGridTextColumn Header="At" Binding="{Binding Created}" IsReadOnly="True" Width="0.15*" />
<DataGridTextColumn Header="{x:Static p:Resources.textCode}" Binding="{Binding ErrorCode}" IsReadOnly="True" Width="0.1*" />
<DataGridTextColumn Header="{x:Static p:Resources.textMessage}" Binding="{Binding ErrorMessage}" IsReadOnly="True" Width="0.2*" />
<DataGridTextColumn Header="{x:Static p:Resources.textDescription}" Binding="{Binding ErrorDescription}" IsReadOnly="True" Width="0.3*" />
<DataGridTextColumn Header="{x:Static p:Resources.textMessage}" Binding="{Binding ErrorMessage}" IsReadOnly="True" Width="0.25*">
<DataGridTextColumn.ElementStyle>
<Style>
<Setter Property="TextBlock.TextWrapping" Value="Wrap" />
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="{x:Static p:Resources.textDescription}" Binding="{Binding ErrorDescription}" IsReadOnly="True" Width="0.5*">
<DataGridTextColumn.ElementStyle>
<Style>
<Setter Property="TextBlock.TextWrapping" Value="Wrap" />
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
</DataGrid.Columns>
</enictrl:ENIDataGrid>
</Grid>

View File

@ -8,13 +8,14 @@
xmlns:p="clr-namespace:ENI2.Properties"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d"
Title="{x:Static p:Resources.textNewVisitTransitId}" Height="192" Width="350" WindowStyle="SingleBorderWindow" Background="AliceBlue" ResizeMode="NoResize">
Title="{x:Static p:Resources.textNewVisitTransitId}" Height="220" Width="350" WindowStyle="SingleBorderWindow" Background="AliceBlue" ResizeMode="NoResize">
<Grid Margin="4">
<Grid.RowDefinitions>
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
@ -24,6 +25,7 @@
<Label Name="labelENI" Grid.Row="1" Grid.Column="0" Content="{x:Static p:Resources.textENI}" />
<Label Name="labelPoC" Grid.Row="2" Grid.Column="0" Content="{x:Static p:Resources.textPortCall}" />
<Label Name="labelETA" Grid.Row="3" Grid.Column="0" Content="ETA" />
<Label Name="labelHIS" Grid.Row="4" Grid.Column="0" Content="HIS" />
<xctk:DoubleUpDown x:Name="doubleUpDownIMO" Margin="2" Grid.Row="0" Grid.Column="1"
ClipValueToMinMax="True"
ShowButtonSpinner="False"
@ -52,5 +54,6 @@
Watermark="Enter ENI" ValueChanged="doubleUpDownENI_ValueChanged" TextAlignment="Left"/>
<enictrl:LocodeControl Grid.Column="1" Grid.Row="2" Width="Auto" x:Name="locodePoC" LocodeValue="{Binding PoC, Mode=TwoWay}" />
<DatePicker Name="datePickerETA" Grid.Row="3" Grid.Column="1" Margin="2" SelectedDateChanged="datePickerETA_SelectedDateChanged" />
<ComboBox Name="comboBoxInitialHIS" Grid.Row="4" Grid.Column="1" Margin="2" Grid.ColumnSpan="2" DisplayMemberPath="Value" SelectedValuePath="Key" SelectionChanged="comboBoxInitialHIS_SelectionChanged"/>
</Grid>
</enictrl:EditWindowBase>

View File

@ -2,6 +2,7 @@
// Description: Mit diesem Dialog können neue Visit/Transit-Id's beantragt werden (DE only)
//
using System.Collections.Generic;
using System.Windows;
using ENI2.Controls;
@ -26,6 +27,13 @@ namespace ENI2.EditControls
private void VisitIdDialog_Loaded(object sender, RoutedEventArgs e)
{
this.OKClicked += VisitIdDialog_OKClicked;
List<KeyValuePair<bsmd.database.Message.NSWProvider, string>> comboDataSource = new List<KeyValuePair<bsmd.database.Message.NSWProvider, string>>()
{
new KeyValuePair<bsmd.database.Message.NSWProvider, string>( Message.NSWProvider.DUDR, "HIS-Nord live" ),
new KeyValuePair<bsmd.database.Message.NSWProvider, string>( Message.NSWProvider.DUDR_TEST, "HIS-Nord Testsystem" )
};
this.comboBoxInitialHIS.ItemsSource = comboDataSource;
this.EnableOK(false);
this.locodePoC.PropertyChanged += LocodePoC_PropertyChanged;
}
@ -54,6 +62,8 @@ namespace ENI2.EditControls
this.Core.PoC = this.locodePoC.LocodeValue;
this.Core.Portname = LocodeDB.PortNameFromLocode(this.Core.PoC);
this.Core.InitialHIS = (Message.NSWProvider) this.comboBoxInitialHIS.SelectedValue;
this._isOK = true;
}
@ -87,6 +97,11 @@ namespace ENI2.EditControls
this.CheckComplete();
}
private void comboBoxInitialHIS_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
{
this.CheckComplete();
}
#endregion
#region input validation
@ -107,6 +122,8 @@ namespace ENI2.EditControls
isComplete &= validLocode;
isComplete &= (comboBoxInitialHIS.SelectedValue != null);
this.EnableOK(isComplete);
}

View File

@ -108,10 +108,10 @@ 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];
//}
}
searchResultItem.Content = drc;
this.mainFrame.Items.Add(searchResultItem);
@ -375,6 +375,7 @@ namespace ENI2
newCore.Portname = LocodeDB.PortNameFromLocode(newCore.PoC);
newCore.IMO = newWithIdDialog.IMO;
newCore.ENI = newWithIdDialog.ENI;
newCore.InitialHIS = newWithIdDialog.SelectedHIS;
if (newCore.IsTransit)
newCore.ETAKielCanal = newWithIdDialog.ETA;
else

View File

@ -1313,6 +1313,15 @@ namespace ENI2.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to {0} crew members imported.
/// </summary>
public static string textCrewImported {
get {
return ResourceManager.GetString("textCrewImported", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Crew member.
/// </summary>
@ -2852,6 +2861,15 @@ namespace ENI2.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to {0} passengers imported.
/// </summary>
public static string textPassengerImported {
get {
return ResourceManager.GetString("textPassengerImported", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Number of passengers on board.
/// </summary>

View File

@ -1507,4 +1507,10 @@
<data name="textValue" xml:space="preserve">
<value>Value</value>
</data>
<data name="textCrewImported" xml:space="preserve">
<value>{0} crew members imported</value>
</data>
<data name="textPassengerImported" xml:space="preserve">
<value>{0} passengers imported</value>
</data>
</root>

Binary file not shown.

View File

@ -263,10 +263,15 @@ namespace SendNSWMessageService
}
}
bsmd.hisnord.transmitter.CallTransmitter();
bsmd.hisnord.transmitter.CallTransmitter(true);
bsmd.hisnord.transmitter.CallTransmitter(false);
// ob test oder nicht ist in stat. dict gespeicher
bsmd.hisnord.Request.ReadResponseFiles();
bsmd.hisnord.Request.Clear();
bsmd.hisnord.Response.ReadAnswers();
bsmd.hisnord.Response.ReadAnswers(true);
bsmd.hisnord.Response.ReadAnswers(false);
List<MessageCore> coresMarkedForStatusQuery = DBManager.Instance.GetMessageCoresWithNSWStatusFlag();

View File

@ -498,7 +498,7 @@ namespace bsmd.ExcelReadService
result = new DateTime(etaDate.Value.Year, etaDate.Value.Month, etaDate.Value.Day);
if (etaTime != null)
{
result = new DateTime(etaDate.Value.Year, etaDate.Value.Month, etaDate.Value.Day, etaTime.Value.Hour, etaTime.Value.Minute, etaTime.Value.Second);
result = new DateTime(etaDate.Value.Year, etaDate.Value.Month, etaDate.Value.Day, etaTime.Value.Hour, etaTime.Value.Minute, etaTime.Value.Second, DateTimeKind.Local);
}
}
if(result.HasValue)

View File

@ -299,7 +299,9 @@ namespace bsmd.ExcelReadService
string bpolETATime = string.Format("BPOL.PortOfItineraryETATime_{0}", i);
string bpolNameValue = reader.ReadText(bpolName)?.Trim();
if (!bpolNameValue.IsNullOrEmpty())
string bpolLocodeValue = reader.ReadLoCode(bpolLocode);
if (!bpolNameValue.IsNullOrEmpty() || !bpolLocodeValue.IsNullOrEmpty())
{
PortOfItinerary poi = bpol.GetSublistElementWithIdentifier(i.ToString()) as PortOfItinerary;
if (poi == null)
@ -309,13 +311,11 @@ namespace bsmd.ExcelReadService
poi.Identifier = i.ToString();
bpol.PortOfItineraries.Add(poi);
}
poi.PortOfItineraryName = bpolNameValue;
reader.Conf.ConfirmText(bpolName, bpolNameValue, ExcelReader.ReadState.OK);
poi.PortOfItineraryLocode = reader.ReadLoCode(bpolLocode);
if (!poi.PortOfItineraryLocode.IsNullOrEmpty() && (poi.PortOfItineraryLocode.Length > 5))
{
reader.Conf.ConfirmText(bpolLocode, poi.PortOfItineraryLocode, ExcelReader.ReadState.WARN);
}
poi.PortOfItineraryLocode = bpolLocodeValue;
// falls nur Locode angegeben wurde, Portname aus Locode ermitteln
if(poi.PortOfItineraryName.IsNullOrEmpty() && !poi.PortOfItineraryLocode.IsNullOrEmpty() && (poi.PortOfItineraryLocode.Length == 5))
{
poi.PortOfItineraryName = LocodeDB.PortNameFromLocode(poi.PortOfItineraryLocode);
@ -412,10 +412,10 @@ namespace bsmd.ExcelReadService
}
else
{
if (shipClass.Contains('1')) haza.INFShipClass = 1;
if (shipClass.Contains('2')) haza.INFShipClass = 2;
if (shipClass.Contains('3')) haza.INFShipClass = 3;
if (shipClass.Equals("none", StringComparison.OrdinalIgnoreCase)) haza.INFShipClass = 0;
if (shipClass.Contains('1')) haza.INFShipClass = 0;
if (shipClass.Contains('2')) haza.INFShipClass = 1;
if (shipClass.Contains('3')) haza.INFShipClass = 2;
// if (shipClass.Equals("none", StringComparison.OrdinalIgnoreCase)) haza.INFShipClass = 0; // "NONE" existiert nicht in der Enumeration!!
reader.Conf.ConfirmText("HAZA.INFShipClass", shipClass, haza.INFShipClass.HasValue ? ExcelReader.ReadState.OK : ExcelReader.ReadState.WARN);
}
@ -717,10 +717,10 @@ namespace bsmd.ExcelReadService
}
else
{
if (shipClass.Contains('1')) hazd.INFShipClass = 1;
if (shipClass.Contains('2')) hazd.INFShipClass = 2;
if (shipClass.Contains('3')) hazd.INFShipClass = 3;
if (shipClass.Equals("none", StringComparison.OrdinalIgnoreCase)) hazd.INFShipClass = 0;
if (shipClass.Contains('1')) hazd.INFShipClass = 0;
if (shipClass.Contains('2')) hazd.INFShipClass = 1;
if (shipClass.Contains('3')) hazd.INFShipClass = 2;
// if (shipClass.Equals("none", StringComparison.OrdinalIgnoreCase)) hazd.INFShipClass = 0;
reader.Conf.ConfirmText("HAZD.INFShipClass", shipClass, hazd.INFShipClass.HasValue ? ExcelReader.ReadState.OK : ExcelReader.ReadState.WARN);
}
@ -2028,6 +2028,7 @@ namespace bsmd.ExcelReadService
{
SERV newSERV = new SERV();
newSERV.MessageHeader = servMessage;
newSERV.Identifier = "1";
servMessage.Elements.Add(newSERV);
}
SERV serv = servMessage.Elements[0] as SERV;

View File

@ -180,8 +180,9 @@ namespace bsmd.dakosy
for (int i = 0; i < numCallPurpose; i++)
{
vList.Visit[0].NOA_NOD.CallPurpose[i] = new CallPurpose();
vList.Visit[0].NOA_NOD.CallPurpose[i].CallPurposeCode = noa_nod.CallPurposes[i].CallPurposeCode;
vList.Visit[0].NOA_NOD.CallPurpose[i].CallPurposeDescription = noa_nod.CallPurposes[i].CallPurposeDescription;
bsmd.database.CallPurpose callPurpose = noa_nod.CallPurposes[i] as bsmd.database.CallPurpose;
vList.Visit[0].NOA_NOD.CallPurpose[i].CallPurposeCode = callPurpose.CallPurposeCode;
vList.Visit[0].NOA_NOD.CallPurpose[i].CallPurposeDescription = callPurpose.CallPurposeDescription;
}
}
break;
@ -206,9 +207,10 @@ namespace bsmd.dakosy
for (int i = 0; i < bpol.PortOfItineraries.Count; i++)
{
vList.Visit[0].BPOL.PortOfItinerary[i] = new PortOfItinerary();
if (bpol.PortOfItineraries[i].PortOfItineraryETA.HasValue)
vList.Visit[0].BPOL.PortOfItinerary[i].PortOfItineraryETA = bpol.PortOfItineraries[i].PortOfItineraryETA.Value;
vList.Visit[0].BPOL.PortOfItinerary[i].PortOfItineraryName = bpol.PortOfItineraries[i].PortOfItineraryName;
bsmd.database.PortOfItinerary portOfItinerary = bpol.PortOfItineraries[i] as bsmd.database.PortOfItinerary;
if (portOfItinerary.PortOfItineraryETA.HasValue)
vList.Visit[0].BPOL.PortOfItinerary[i].PortOfItineraryETA = portOfItinerary.PortOfItineraryETA.Value;
vList.Visit[0].BPOL.PortOfItinerary[i].PortOfItineraryName = portOfItinerary.PortOfItineraryName;
}
}
vList.Visit[0].BPOL.StowawayOnBoard = bpol.StowawaysOnBoard ?? false;
@ -358,10 +360,11 @@ namespace bsmd.dakosy
vList.Visit[0].MDH.SanitaryMeasuresDetails = new SanitaryMeasuresDetails[mdh.SanitaryMeasuresDetails.Count];
for (int smIndex = 0; smIndex < mdh.SanitaryMeasuresDetails.Count; smIndex++) {
SanitaryMeasuresDetails smDetails = new SanitaryMeasuresDetails();
if (mdh.SanitaryMeasuresDetails[smIndex].SanitaryMeasuresDate.HasValue)
smDetails.SanitaryMeasuresDate = mdh.SanitaryMeasuresDetails[smIndex].SanitaryMeasuresDate.Value;
smDetails.SanitaryMeasuresLocation = mdh.SanitaryMeasuresDetails[smIndex].SanitaryMeasuresLocation;
smDetails.SanitaryMeasuresType = mdh.SanitaryMeasuresDetails[smIndex].SanitaryMeasuresType;
bsmd.database.SanitaryMeasuresDetail sanitaryMeasuresDetail = mdh.SanitaryMeasuresDetails[smIndex] as bsmd.database.SanitaryMeasuresDetail;
if (sanitaryMeasuresDetail.SanitaryMeasuresDate.HasValue)
smDetails.SanitaryMeasuresDate = sanitaryMeasuresDetail.SanitaryMeasuresDate.Value;
smDetails.SanitaryMeasuresLocation = sanitaryMeasuresDetail.SanitaryMeasuresLocation;
smDetails.SanitaryMeasuresType = sanitaryMeasuresDetail.SanitaryMeasuresType;
vList.Visit[0].MDH.SanitaryMeasuresDetails[smIndex] = smDetails;
}
}
@ -386,9 +389,10 @@ namespace bsmd.dakosy
for (int iaIndex = 0; iaIndex < mdh.InfectedAreas.Count; iaIndex++)
{
InfectedArea infectedArea = new InfectedArea();
if (mdh.InfectedAreas[iaIndex].InfectedAreaDate.HasValue)
infectedArea.InfectedAreaDate = mdh.InfectedAreas[iaIndex].InfectedAreaDate.Value;
infectedArea.InfectedAreaPort = mdh.InfectedAreas[iaIndex].InfectedAreaPort;
bsmd.database.InfectedArea ia = mdh.InfectedAreas[iaIndex] as bsmd.database.InfectedArea;
if (ia.InfectedAreaDate.HasValue)
infectedArea.InfectedAreaDate = ia.InfectedAreaDate.Value;
infectedArea.InfectedAreaPort = ia.InfectedAreaPort;
vList.Visit[0].MDH.InfectedArea[iaIndex] = infectedArea;
}
}
@ -397,19 +401,20 @@ namespace bsmd.dakosy
vList.Visit[0].MDH.PortsOfCallLast30Days = new PortOfCallLast30Days[mdh.PortOfCallLast30Days.Count];
for (int i = 0; i < mdh.PortOfCallLast30Days.Count; i++)
{
bsmd.database.PortOfCallLast30Days poc30d = mdh.PortOfCallLast30Days[i] as bsmd.database.PortOfCallLast30Days;
vList.Visit[0].MDH.PortsOfCallLast30Days[i] = new PortOfCallLast30Days();
vList.Visit[0].MDH.PortsOfCallLast30Days[i].Locode = mdh.PortOfCallLast30Days[i].PortOfCallLast30DaysLocode;
if (mdh.PortOfCallLast30Days[i].PortOfCallLast30DaysDateOfDeparture.HasValue)
vList.Visit[0].MDH.PortsOfCallLast30Days[i].DateOfDeparture = mdh.PortOfCallLast30Days[i].PortOfCallLast30DaysDateOfDeparture.Value;
if (mdh.PortOfCallLast30Days[i].PortOfCallLast30DaysCrewMembersJoined.HasValue)
vList.Visit[0].MDH.PortsOfCallLast30Days[i].Locode = poc30d.PortOfCallLast30DaysLocode;
if (poc30d.PortOfCallLast30DaysDateOfDeparture.HasValue)
vList.Visit[0].MDH.PortsOfCallLast30Days[i].DateOfDeparture = poc30d.PortOfCallLast30DaysDateOfDeparture.Value;
if (poc30d.PortOfCallLast30DaysCrewMembersJoined.HasValue)
{
vList.Visit[0].MDH.PortsOfCallLast30Days[i].CrewMembersJoined = mdh.PortOfCallLast30Days[i].PortOfCallLast30DaysCrewMembersJoined.Value;
if(mdh.PortOfCallLast30Days[i].CrewJoinedShip.Count > 0) {
vList.Visit[0].MDH.PortsOfCallLast30Days[i].CrewJoinedShipName = new CrewJoinedShipName[mdh.PortOfCallLast30Days[i].CrewJoinedShip.Count];
vList.Visit[0].MDH.PortsOfCallLast30Days[i].CrewMembersJoined = poc30d.PortOfCallLast30DaysCrewMembersJoined.Value;
if(poc30d.CrewJoinedShip.Count > 0) {
vList.Visit[0].MDH.PortsOfCallLast30Days[i].CrewJoinedShipName = new CrewJoinedShipName[poc30d.CrewJoinedShip.Count];
for (int j = 0; j < vList.Visit[0].MDH.PortsOfCallLast30Days[i].CrewJoinedShipName.Length; j++)
{
vList.Visit[0].MDH.PortsOfCallLast30Days[i].CrewJoinedShipName[j] = new CrewJoinedShipName();
vList.Visit[0].MDH.PortsOfCallLast30Days[i].CrewJoinedShipName[j].Name = mdh.PortOfCallLast30Days[i].CrewJoinedShip[j].PortOfCallLast30DaysCrewJoinedShipName;
vList.Visit[0].MDH.PortsOfCallLast30Days[i].CrewJoinedShipName[j].Name = poc30d.CrewJoinedShip[j].PortOfCallLast30DaysCrewJoinedShipName;
}
}
}
@ -539,25 +544,28 @@ namespace bsmd.dakosy
vList.Visit[0].SEC.PortFacilityOfArrival = sec.PortFacilityOfArrival;
vList.Visit[0].SEC.GeneralDescriptionOfCargoSpecified = sec.GeneralDescriptionOfCargo.HasValue;
byte gdc = sec.GeneralDescriptionOfCargo ?? 0;
vList.Visit[0].SEC.GeneralDescriptionOfCargo = CargoTypeFromNSWEnumeration(gdc); if (sec.LastTenPortFacilitesCalled.Count > 0)
vList.Visit[0].SEC.GeneralDescriptionOfCargo = CargoTypeFromNSWEnumeration(gdc);
if (sec.LastTenPortFacilitesCalled.Count > 0)
{
vList.Visit[0].SEC.LastTenPortFacilitiesCalled = new LastTenPortFacilitiesCalled[sec.LastTenPortFacilitesCalled.Count];
for (int i = 0; i < sec.LastTenPortFacilitesCalled.Count; i++)
{
vList.Visit[0].SEC.LastTenPortFacilitiesCalled[i] = new LastTenPortFacilitiesCalled();
vList.Visit[0].SEC.LastTenPortFacilitiesCalled[i].PortName = sec.LastTenPortFacilitesCalled[i].PortFacilityPortName;
vList.Visit[0].SEC.LastTenPortFacilitiesCalled[i].PortCountry = sec.LastTenPortFacilitesCalled[i].PortFacilityPortCountry;
vList.Visit[0].SEC.LastTenPortFacilitiesCalled[i].PortLoCode = sec.LastTenPortFacilitesCalled[i].PortFacilityPortLoCode;
vList.Visit[0].SEC.LastTenPortFacilitiesCalled[i].DateOfArrivalSpecified = sec.LastTenPortFacilitesCalled[i].PortFacilityDateOfArrival.HasValue;
if (sec.LastTenPortFacilitesCalled[i].PortFacilityDateOfArrival.HasValue)
vList.Visit[0].SEC.LastTenPortFacilitiesCalled[i].DateOfArrival = sec.LastTenPortFacilitesCalled[i].PortFacilityDateOfArrival.Value;
vList.Visit[0].SEC.LastTenPortFacilitiesCalled[i].DateOfDepartureSpecified = sec.LastTenPortFacilitesCalled[i].PortFacilityDateOfDeparture.HasValue;
if (sec.LastTenPortFacilitesCalled[i].PortFacilityDateOfDeparture.HasValue)
vList.Visit[0].SEC.LastTenPortFacilitiesCalled[i].DateOfDeparture = sec.LastTenPortFacilitesCalled[i].PortFacilityDateOfDeparture.Value;
vList.Visit[0].SEC.LastTenPortFacilitiesCalled[i].ShipSecurityLevelSpecified = sec.LastTenPortFacilitesCalled[i].PortFacilityShipSecurityLevel.HasValue;
vList.Visit[0].SEC.LastTenPortFacilitiesCalled[i].ShipSecurityLevel = sec.LastTenPortFacilitesCalled[i].PortFacilityShipSecurityLevel ?? 0;
vList.Visit[0].SEC.LastTenPortFacilitiesCalled[i].SecurityMattersToReport = sec.LastTenPortFacilitesCalled[i].PortFacilitySecurityMattersToReport;
vList.Visit[0].SEC.LastTenPortFacilitiesCalled[i].GISISCode = sec.LastTenPortFacilitesCalled[i].PortFacilityGISISCode;
bsmd.database.LastTenPortFacilitiesCalled l10c = sec.LastTenPortFacilitesCalled[i] as bsmd.database.LastTenPortFacilitiesCalled;
vList.Visit[0].SEC.LastTenPortFacilitiesCalled[i].PortName = l10c.PortFacilityPortName;
vList.Visit[0].SEC.LastTenPortFacilitiesCalled[i].PortCountry = l10c.PortFacilityPortCountry;
vList.Visit[0].SEC.LastTenPortFacilitiesCalled[i].PortLoCode = l10c.PortFacilityPortLoCode;
vList.Visit[0].SEC.LastTenPortFacilitiesCalled[i].DateOfArrivalSpecified = l10c.PortFacilityDateOfArrival.HasValue;
if (l10c.PortFacilityDateOfArrival.HasValue)
vList.Visit[0].SEC.LastTenPortFacilitiesCalled[i].DateOfArrival = l10c.PortFacilityDateOfArrival.Value;
vList.Visit[0].SEC.LastTenPortFacilitiesCalled[i].DateOfDepartureSpecified = l10c.PortFacilityDateOfDeparture.HasValue;
if (l10c.PortFacilityDateOfDeparture.HasValue)
vList.Visit[0].SEC.LastTenPortFacilitiesCalled[i].DateOfDeparture = l10c.PortFacilityDateOfDeparture.Value;
vList.Visit[0].SEC.LastTenPortFacilitiesCalled[i].ShipSecurityLevelSpecified = l10c.PortFacilityShipSecurityLevel.HasValue;
vList.Visit[0].SEC.LastTenPortFacilitiesCalled[i].ShipSecurityLevel = l10c.PortFacilityShipSecurityLevel ?? 0;
vList.Visit[0].SEC.LastTenPortFacilitiesCalled[i].SecurityMattersToReport = l10c.PortFacilitySecurityMattersToReport;
vList.Visit[0].SEC.LastTenPortFacilitiesCalled[i].GISISCode = l10c.PortFacilityGISISCode;
}
}
if (sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Count > 0)
@ -565,21 +573,22 @@ namespace bsmd.dakosy
vList.Visit[0].SEC.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled = new ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Count];
for(int i=0;i<sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Count;i++)
{
bsmd.database.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled s2sl = sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i] as bsmd.database.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled;
vList.Visit[0].SEC.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i] = new ShipToShipActivitiesDuringLastTenPortFacilitiesCalled();
vList.Visit[0].SEC.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].LocationName = sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].ShipToShipActivityLocationName;
vList.Visit[0].SEC.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].LocationCode = sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].ShipToShipActivityLocationLoCode;
vList.Visit[0].SEC.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].LocationCoordinatesLatitudeSpecified = sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].ShipToShipActivityLocationCoordinatesLatitude.HasValue;
vList.Visit[0].SEC.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].LocationCoordinatesLatitude = sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].ShipToShipActivityLocationCoordinatesLatitude ?? 0;
vList.Visit[0].SEC.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].LocationCoordinatesLongitudeSpecified = sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].ShipToShipActivityLocationCoordinatesLongitude.HasValue;
vList.Visit[0].SEC.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].LocationCoordinatesLongitude = sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].ShipToShipActivityLocationCoordinatesLongitude ?? 0;
vList.Visit[0].SEC.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].DateFromSpecified = sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].ShipToShipActivityDateFrom.HasValue;
if (sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].ShipToShipActivityDateFrom.HasValue)
vList.Visit[0].SEC.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].DateFrom = sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].ShipToShipActivityDateFrom.Value;
vList.Visit[0].SEC.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].DateToSpecified = sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].ShipToShipActivityDateTo.HasValue;
if (sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].ShipToShipActivityDateTo.HasValue)
vList.Visit[0].SEC.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].DateTo = sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].ShipToShipActivityDateTo.Value;
vList.Visit[0].SEC.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].ActivityType = sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].ShipToShipActivityType;
vList.Visit[0].SEC.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].SecurityMattersToReport = sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].ShipToShipActivitySecurityMattersToReport;
vList.Visit[0].SEC.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].LocationName = s2sl.ShipToShipActivityLocationName;
vList.Visit[0].SEC.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].LocationCode = s2sl.ShipToShipActivityLocationLoCode;
vList.Visit[0].SEC.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].LocationCoordinatesLatitudeSpecified = s2sl.ShipToShipActivityLocationCoordinatesLatitude.HasValue;
vList.Visit[0].SEC.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].LocationCoordinatesLatitude = s2sl.ShipToShipActivityLocationCoordinatesLatitude ?? 0;
vList.Visit[0].SEC.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].LocationCoordinatesLongitudeSpecified = s2sl.ShipToShipActivityLocationCoordinatesLongitude.HasValue;
vList.Visit[0].SEC.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].LocationCoordinatesLongitude = s2sl.ShipToShipActivityLocationCoordinatesLongitude ?? 0;
vList.Visit[0].SEC.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].DateFromSpecified = s2sl.ShipToShipActivityDateFrom.HasValue;
if (s2sl.ShipToShipActivityDateFrom.HasValue)
vList.Visit[0].SEC.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].DateFrom = s2sl.ShipToShipActivityDateFrom.Value;
vList.Visit[0].SEC.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].DateToSpecified = s2sl.ShipToShipActivityDateTo.HasValue;
if (s2sl.ShipToShipActivityDateTo.HasValue)
vList.Visit[0].SEC.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].DateTo = s2sl.ShipToShipActivityDateTo.Value;
vList.Visit[0].SEC.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].ActivityType = s2sl.ShipToShipActivityType;
vList.Visit[0].SEC.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].SecurityMattersToReport = s2sl.ShipToShipActivitySecurityMattersToReport;
}
}
}
@ -739,19 +748,20 @@ namespace bsmd.dakosy
vList.Visit[0].WAS.Waste = new Waste[was.Waste.Count];
for (int i = 0; i < was.Waste.Count; i++)
{
byte wt = (byte) (was.Waste[i].WasteType ?? 0);
bsmd.database.Waste waste = was.Waste[i] as bsmd.database.Waste;
byte wt = (byte) (waste.WasteType ?? 0);
vList.Visit[0].WAS.Waste[i] = new Waste();
vList.Visit[0].WAS.Waste[i].WasteType = Request.setWasteType(wt);
vList.Visit[0].WAS.Waste[i].Description = was.Waste[i].WasteDescription;
vList.Visit[0].WAS.Waste[i].DisposalAmountMTQSpecified = was.Waste[i].WasteDisposalAmount_MTQ.HasValue;
vList.Visit[0].WAS.Waste[i].DisposalAmountMTQ = was.Waste[i].WasteDisposalAmount_MTQ ?? 0;
vList.Visit[0].WAS.Waste[i].CapacityMTQSpecified = was.Waste[i].WasteCapacity_MTQ.HasValue;
vList.Visit[0].WAS.Waste[i].CapacityMTQ = was.Waste[i].WasteCapacity_MTQ ?? 0;
vList.Visit[0].WAS.Waste[i].AmountRetainedMTQSpecified = was.Waste[i].WasteAmountRetained_MTQ.HasValue;
vList.Visit[0].WAS.Waste[i].AmountRetainedMTQ = was.Waste[i].WasteAmountRetained_MTQ ?? 0;
vList.Visit[0].WAS.Waste[i].DisposalPort = was.Waste[i].WasteDisposalPort;
vList.Visit[0].WAS.Waste[i].AmountGeneratedTillNextPortMTQSpecified = was.Waste[i].WasteAmountGeneratedTillNextPort_MTQ.HasValue;
vList.Visit[0].WAS.Waste[i].AmountGeneratedTillNextPortMTQ = was.Waste[i].WasteAmountGeneratedTillNextPort_MTQ ?? 0;
vList.Visit[0].WAS.Waste[i].Description = waste.WasteDescription;
vList.Visit[0].WAS.Waste[i].DisposalAmountMTQSpecified = waste.WasteDisposalAmount_MTQ.HasValue;
vList.Visit[0].WAS.Waste[i].DisposalAmountMTQ = waste.WasteDisposalAmount_MTQ ?? 0;
vList.Visit[0].WAS.Waste[i].CapacityMTQSpecified = waste.WasteCapacity_MTQ.HasValue;
vList.Visit[0].WAS.Waste[i].CapacityMTQ = waste.WasteCapacity_MTQ ?? 0;
vList.Visit[0].WAS.Waste[i].AmountRetainedMTQSpecified = waste.WasteAmountRetained_MTQ.HasValue;
vList.Visit[0].WAS.Waste[i].AmountRetainedMTQ = waste.WasteAmountRetained_MTQ ?? 0;
vList.Visit[0].WAS.Waste[i].DisposalPort = waste.WasteDisposalPort;
vList.Visit[0].WAS.Waste[i].AmountGeneratedTillNextPortMTQSpecified = waste.WasteAmountGeneratedTillNextPort_MTQ.HasValue;
vList.Visit[0].WAS.Waste[i].AmountGeneratedTillNextPortMTQ = waste.WasteAmountGeneratedTillNextPort_MTQ ?? 0;
}
}
}

View File

@ -67,7 +67,7 @@ namespace bsmd.database
else
{
scmd.Parameters.AddWithValue(@"ID", this.Id);
scmd.CommandText = string.Format("UPDATE {0} SET BunkerFuelType = @P2, BunkerFuelQuantity_TNE = @P3 WHERE Id = @ID", this.Tablename);
scmd.CommandText = string.Format("UPDATE {0} SET BunkerFuelType = @P2, BunkerFuelQuantity_TNE = @P3, Identifiery = @P4 WHERE Id = @ID", this.Tablename);
}
}

View File

@ -17,7 +17,7 @@ namespace bsmd.database
public class BPOL : DatabaseEntity, ISublistContainer
{
private List<PortOfItinerary> poi = new List<PortOfItinerary>();
private List<DatabaseEntity> poi = new List<DatabaseEntity>();
public BPOL()
{
@ -36,7 +36,7 @@ namespace bsmd.database
[ENI2Validation]
public bool? CruiseShip { get; set; }
public List<PortOfItinerary> PortOfItineraries { get { return this.poi; } }
public List<DatabaseEntity> PortOfItineraries { get { return this.poi; } }
#endregion

View File

@ -67,7 +67,7 @@ namespace bsmd.database
else
{
scmd.Parameters.AddWithValue(@"ID", this.Id);
scmd.CommandText = string.Format("UPDATE {0} SET BunkerFuelType = @P2, BunkerFuelQuantity_TNE = @P3 WHERE Id = @ID", this.Tablename);
scmd.CommandText = string.Format("UPDATE {0} SET BunkerFuelType = @P2, BunkerFuelQuantity_TNE = @P3, Identifier = @P4 WHERE Id = @ID", this.Tablename);
}
}

View File

@ -155,7 +155,7 @@ namespace bsmd.database
scmd.CommandText = string.Format("UPDATE {0} SET CrewMemberLastName = @P2, CrewMemberFirstName = @P3, " +
"CrewMemberPlaceOfBirth = @P4, CrewMemberDateOfBirth = @P5, CrewMemberGender = @P6, CrewMemberNationality = @P7, "+
"CrewMemberIdentityDocumentType = @P8, CrewMemberIdentityDocumentId = @P9, CrewMemberVisaNumber = @P10, " +
"CrewMemberDuty = @P11, IsDeparture = @P13 WHERE Id = @ID", this.Tablename);
"CrewMemberDuty = @P11, Identifier = @P12, IsDeparture = @P13 WHERE Id = @ID", this.Tablename);
}
}

View File

@ -58,7 +58,7 @@ namespace bsmd.database
else
{
scmd.Parameters.AddWithValue(@"ID", this.Id);
scmd.CommandText = string.Format("UPDATE {0} SET CallPurposeCode = @P2, CallPurposeDescription = @P3 " +
scmd.CommandText = string.Format("UPDATE {0} SET CallPurposeCode = @P2, CallPurposeDescription = @P3, Identifier = @P4 " +
"WHERE Id = @ID", this.Tablename);
}
}

View File

@ -556,6 +556,9 @@ namespace bsmd.database
_log.WarnFormat("Entity {0} save: Field truncated: {1}", entity.GetType(), truncatedField);
}
SqlCommand cmd = new SqlCommand();
entity.PrepareSave(cmd);
int queryResult = this.PerformNonQuery(cmd);
@ -633,6 +636,13 @@ namespace bsmd.database
#region internal/private funcs
private void CheckConnection()
{
if ((this._con == null) ||
(this._con.State == ConnectionState.Closed))
this.Connect(this.ConnectionString);
}
private void LogNonQueryResult(string query, int queryResult)
{
switch (queryResult)
@ -1112,6 +1122,9 @@ namespace bsmd.database
{
try
{
this.CheckConnection();
cmd.Connection = this._con;
// Stopwatch sw = new Stopwatch();
// sw.Start();
@ -1142,6 +1155,8 @@ namespace bsmd.database
{
try
{
this.CheckConnection();
cmd.Connection = this._con;
result = cmd.ExecuteNonQuery();
}
@ -1168,6 +1183,7 @@ namespace bsmd.database
{
try
{
this.CheckConnection();
cmd.Connection = this._con;
result = (bool?)cmd.ExecuteScalar();
}
@ -1193,6 +1209,7 @@ namespace bsmd.database
{
try
{
this.CheckConnection();
cmd.Connection = this._con;
result = (int?)cmd.ExecuteScalar();
}
@ -1215,6 +1232,8 @@ namespace bsmd.database
{
lock (this._lock)
{
this.CheckConnection();
using (SqlBulkCopy bulkCopy = new SqlBulkCopy(this._con, SqlBulkCopyOptions.UseInternalTransaction | SqlBulkCopyOptions.TableLock, null))
{
bulkCopy.BulkCopyTimeout = 180;

View File

@ -194,10 +194,39 @@ namespace bsmd.database
}
}
if (maxVal == -1) return 1.ToString();
if (maxVal == -1)
{
// Spezialbalkone
try
{
Type type = sublist.GetType().GetGenericArguments()[0];
if (type == typeof(IMDGPosition)) return "IMDG-1";
if (type == typeof(IBCPosition)) return "IBC-1";
if (type == typeof(IGCPosition)) return "IGC-1";
if (type == typeof(IMSBCPosition)) return "IMSBC-1";
if (type == typeof(MARPOL_Annex_I_Position)) return "MARPOL-1";
}
catch
{
}
return 1.ToString();
}
return maxString;
}
public static void ResetIdentifiers(IList<DatabaseEntity> sublist)
{
List<DatabaseEntity> tmpList = new List<DatabaseEntity>(sublist);
sublist.Clear();
foreach(ISublistElement element in tmpList)
{
element.Identifier = DatabaseEntity.GetNewIdentifier(sublist);
sublist.Add(element as DatabaseEntity);
}
}
#endregion
#region IEquatable<T> implementation

View File

@ -15,11 +15,11 @@ namespace bsmd.database
public class HAZ : DatabaseEntity, ISublistContainer
{
private List<IMDGPosition> imdgPositions = new List<IMDGPosition>();
private List<IBCPosition> ibcPositions = new List<IBCPosition>();
private List<IGCPosition> igcPositions = new List<IGCPosition>();
private List<IMSBCPosition> imsbcPositions = new List<IMSBCPosition>();
private List<MARPOL_Annex_I_Position> marpolPositions = new List<MARPOL_Annex_I_Position>();
private List<DatabaseEntity> imdgPositions = new List<DatabaseEntity>();
private List<DatabaseEntity> ibcPositions = new List<DatabaseEntity>();
private List<DatabaseEntity> igcPositions = new List<DatabaseEntity>();
private List<DatabaseEntity> imsbcPositions = new List<DatabaseEntity>();
private List<DatabaseEntity> marpolPositions = new List<DatabaseEntity>();
private bool _isDeparture;
public HAZ()
@ -72,15 +72,15 @@ namespace bsmd.database
[ENI2Validation]
public string DPGContactPhone { get; set; }
public List<IMDGPosition> IMDGPositions { get { return this.imdgPositions; } }
public List<DatabaseEntity> IMDGPositions { get { return this.imdgPositions; } }
public List<IBCPosition> IBCPositions { get { return this.ibcPositions; } }
public List<DatabaseEntity> IBCPositions { get { return this.ibcPositions; } }
public List<IGCPosition> IGCPositions { get { return this.igcPositions; } }
public List<DatabaseEntity> IGCPositions { get { return this.igcPositions; } }
public List<IMSBCPosition> IMSBCPositions { get { return this.imsbcPositions; } }
public List<DatabaseEntity> IMSBCPositions { get { return this.imsbcPositions; } }
public List<MARPOL_Annex_I_Position> MARPOLPositions { get { return this.marpolPositions; } }
public List<DatabaseEntity> MARPOLPositions { get { return this.marpolPositions; } }
// selektor HAZA / HAZD
[ShowReport]

View File

@ -100,7 +100,7 @@ namespace bsmd.database
}
else
{
scmd.CommandText = string.Format("UPDATE {0} SET InfectedAreaPort = @P2, InfectedAreaDate = @P3 " +
scmd.CommandText = string.Format("UPDATE {0} SET InfectedAreaPort = @P2, InfectedAreaDate = @P3, Identifier = @P4 " +
"WHERE Id = @ID", this.Tablename);
scmd.Parameters.AddWithNullableValue("@ID", this.Id);
}

View File

@ -160,7 +160,8 @@ namespace bsmd.database
{
scmd.Parameters.AddWithValue(@"ID", this.Id);
scmd.CommandText = string.Format("UPDATE {0} SET CargoHandlingType = @P2, CargoCodeNST = @P3, CargoNumberOfItems = @P4, " +
"CargoGrossQuantity_TNE = @P5, PortOfLoading = @P6, PortOfDischarge = @P7, CargoLACode = @P9, CargoCodeNST_3 = @P10 WHERE Id = @ID", this.Tablename);
"CargoGrossQuantity_TNE = @P5, PortOfLoading = @P6, PortOfDischarge = @P7, CargoLACode = @P9, CargoCodeNST_3 = @P10, " +
"Identifier = @P8 WHERE Id = @ID", this.Tablename);
}
}

View File

@ -101,8 +101,8 @@ namespace bsmd.database
scmd.Parameters.AddWithValue(@"ID", this.Id);
scmd.CommandText = string.Format("UPDATE {0} SET PortFacilityPortName = @P2, PortFacilityPortCountry = @P3, " +
"PortFacilityPortLoCode = @P4, PortFacilityDateOfArrival = @P5, PortFacilityDateOfDeparture = @P6," +
"PortFacilityShipSecurityLevel = @P7, PortFacilitySecurityMattersToReport = @P8, PortFacilityGISISCode = @P9 " +
" WHERE Id = @ID", this.Tablename);
"PortFacilityShipSecurityLevel = @P7, PortFacilitySecurityMattersToReport = @P8, PortFacilityGISISCode = @P9, " +
"Identifier = @P10 WHERE Id = @ID", this.Tablename);
}
}

View File

@ -18,28 +18,29 @@ namespace bsmd.database
public class MDH : DatabaseEntity, ISublistContainer
{
private List<PortOfCallLast30Days> portOfCallLast30Days = new List<PortOfCallLast30Days>();
private List<DatabaseEntity> portOfCallLast30Days = new List<DatabaseEntity>();
private List<SanitaryMeasuresDetail> sanitaryMeasuresDetails = new List<SanitaryMeasuresDetail>();
private List<DatabaseEntity> sanitaryMeasuresDetails = new List<DatabaseEntity>();
private List<StowawaysJoiningLocation> stowawaysJoiningLocations = new List<database.StowawaysJoiningLocation>();
private List<DatabaseEntity> stowawaysJoiningLocations = new List<DatabaseEntity>();
private List<InfectedArea> infectedAreas = new List<InfectedArea>();
private List<DatabaseEntity> infectedAreas = new List<DatabaseEntity>();
public MDH()
{
this.tablename = "[dbo].[MDH]";
this.MDHSimplification = false;
}
#region Properties
public List<PortOfCallLast30Days> PortOfCallLast30Days { get { return this.portOfCallLast30Days; } }
public List<DatabaseEntity> PortOfCallLast30Days { get { return this.portOfCallLast30Days; } }
public List<SanitaryMeasuresDetail> SanitaryMeasuresDetails { get { return this.sanitaryMeasuresDetails; } }
public List<DatabaseEntity> SanitaryMeasuresDetails { get { return this.sanitaryMeasuresDetails; } }
public List<StowawaysJoiningLocation> StowawaysJoiningLocations { get { return this.stowawaysJoiningLocations; } }
public List<DatabaseEntity> StowawaysJoiningLocations { get { return this.stowawaysJoiningLocations; } }
public List<InfectedArea> InfectedAreas { get { return this.infectedAreas; } }
public List<DatabaseEntity> InfectedAreas { get { return this.infectedAreas; } }
[ShowReport]
[Validation1(ValidationCode.NOT_NULL)]
@ -191,7 +192,7 @@ namespace bsmd.database
{
if (i > 0)
sb.Append(", ");
sb.Append(this.StowawaysJoiningLocations[i].StowawayJoiningLocation);
sb.Append(((StowawaysJoiningLocation)this.StowawaysJoiningLocations[i]).StowawayJoiningLocation);
}
return sb.ToString();
}

View File

@ -17,7 +17,7 @@ namespace bsmd.database
public class NOA_NOD : DatabaseEntity, ISublistContainer
{
List<CallPurpose> callPurposes = new List<CallPurpose>();
List<DatabaseEntity> callPurposes = new List<DatabaseEntity>();
public NOA_NOD()
{
@ -37,7 +37,7 @@ namespace bsmd.database
public DateTime? ETDFromPortOfCall { get; set; }
[Validation1(ValidationCode.NOT_NULL)]
public List<CallPurpose> CallPurposes { get { return this.callPurposes; } }
public List<DatabaseEntity> CallPurposes { get { return this.callPurposes; } }
[ShowReport]
[Validation2(ValidationCode.NOT_NULL)]

View File

@ -170,7 +170,7 @@ namespace bsmd.database
"PassengerPlaceOfBirth = @P4, PassengerDateOfBirth = @P5, PassengerGender = @P6," +
"PassengerNationality = @P7, PassengerIdentityDocumentType = @P8, PassengerIdentityDocumentId = @P9, " +
"PassengerVisaNumber = @P10, PassengerPortOfEmbarkation = @P11, PassengerPortOfDisembarkation = @P12, " +
"PassengerInTransit = @P13, IsDeparture = @P15 WHERE Id = @ID", this.Tablename);
"PassengerInTransit = @P13, IsDeparture = @P15, Identifier = @P14 WHERE Id = @ID", this.Tablename);
}
}

View File

@ -141,7 +141,7 @@ namespace bsmd.database
else
{
scmd.CommandText = string.Format("UPDATE {0} SET PortOfCallLast30DaysLocode = @P2, PortOfCallLast30DaysDateOfDeparture = @P3, " +
"PortOfCallLast30DaysCrewMembersJoined = @P4 WHERE Id = @ID", this.Tablename);
"PortOfCallLast30DaysCrewMembersJoined = @P4, Identifier = @P5 WHERE Id = @ID", this.Tablename);
scmd.Parameters.AddWithNullableValue("@ID", this.Id);
}
}

View File

@ -53,7 +53,7 @@ namespace bsmd.database
}
else
{
cmd.CommandText = string.Format("UPDATE {0} SET PortOfCallLast30DaysCrewJoinedShipName = @P2 WHERE Id = @ID", this.Tablename);
cmd.CommandText = string.Format("UPDATE {0} SET PortOfCallLast30DaysCrewJoinedShipName = @P2, Identifier = @P3 WHERE Id = @ID", this.Tablename);
scmd.Parameters.AddWithValue("@ID", this.Id);
}

View File

@ -67,7 +67,7 @@ namespace bsmd.database
{
scmd.Parameters.AddWithValue(@"ID", this.Id);
scmd.CommandText = string.Format("UPDATE {0} SET PortOfItineraryName = @P2, PortOfItineraryETA = @P3, " +
"PortOfItineraryLocode = @P5 WHERE Id = @ID", this.Tablename);
"PortOfItineraryLocode = @P5, Identifier = @P4 WHERE Id = @ID", this.Tablename);
}
}

View File

@ -2,6 +2,6 @@
[assembly: AssemblyCompany("Informatikbüro Daniel Schick")]
[assembly: AssemblyProduct("BSMD NSW interface")]
[assembly: AssemblyInformationalVersion("3.7.2")]
[assembly: AssemblyInformationalVersion("3.7.3")]
[assembly: AssemblyCopyright("Copyright © 2014-2017 Informatikbüro Daniel Schick. All rights reserved.")]
[assembly: AssemblyTrademark("")]

View File

@ -1,4 +1,4 @@
using System.Reflection;
[assembly: AssemblyVersion("3.7.2.*")]
[assembly: AssemblyVersion("3.7.3.*")]

View File

@ -17,13 +17,14 @@ namespace bsmd.database
public class SEC : DatabaseEntity, ISublistContainer
{
private List<LastTenPortFacilitiesCalled> ltpfc = new List<LastTenPortFacilitiesCalled>();
private List<DatabaseEntity> ltpfc = new List<DatabaseEntity>();
private List<ShipToShipActivitiesDuringLastTenPortFacilitiesCalled> lsts = new List<ShipToShipActivitiesDuringLastTenPortFacilitiesCalled>();
private List<DatabaseEntity> lsts = new List<DatabaseEntity>();
public SEC()
{
this.tablename = "[dbo].[SEC]";
this.SECSimplification = false;
}
#region Properties
@ -151,9 +152,9 @@ namespace bsmd.database
[ENI2Validation]
public DateTime? KielCanalPassagePlannedOutgoing { get; set; }
public List<LastTenPortFacilitiesCalled> LastTenPortFacilitesCalled { get { return this.ltpfc; } }
public List<DatabaseEntity> LastTenPortFacilitesCalled { get { return this.ltpfc; } }
public List<ShipToShipActivitiesDuringLastTenPortFacilitiesCalled> ShipToShipActivitiesDuringLastTenPortFacilitiesCalled { get { return this.lsts; } }
public List<DatabaseEntity> ShipToShipActivitiesDuringLastTenPortFacilitiesCalled { get { return this.lsts; } }
#endregion

View File

@ -76,8 +76,8 @@ namespace bsmd.database
else
{
scmd.Parameters.AddWithValue(@"ID", this.Id);
scmd.CommandText = string.Format("UPDATE {0} SET ServiceName = @P2, ServiceBeneficiary = @P3, ServiceInvoiceRecipient = @P4 " +
"WHERE Id = @ID", this.Tablename);
scmd.CommandText = string.Format("UPDATE {0} SET ServiceName = @P2, ServiceBeneficiary = @P3, ServiceInvoiceRecipient = @P4, " +
"Identifier = @P5 WHERE Id = @ID", this.Tablename);
}
}

View File

@ -134,7 +134,7 @@ namespace bsmd.database
{
scmd.Parameters.AddWithValue(@"ID", this.Id);
scmd.CommandText = string.Format("UPDATE {0} SET Name = @P2, Quantity = @P3, QuantityUnit = @P4, " +
"LocationOnBoard = @P5, OfficialUse = @P6 WHERE Id = @ID", this.Tablename);
"LocationOnBoard = @P5, OfficialUse = @P6, Identifier = @P7 WHERE Id = @ID", this.Tablename);
}
}

View File

@ -67,7 +67,7 @@ namespace bsmd.database
else
{
scmd.CommandText = string.Format("UPDATE {0} SET SanitaryMeasuresType = @P2, SanitaryMeasuresLocation = @P3, " +
"SanitaryMeasuresDate = @P4 WHERE Id = @ID", this.Tablename);
"SanitaryMeasuresDate = @P4, Identifier = @P5 WHERE Id = @ID", this.Tablename);
scmd.Parameters.AddWithNullableValue("@ID", this.Id);
}
}

View File

@ -99,7 +99,7 @@ namespace bsmd.database
scmd.Parameters.AddWithValue(@"ID", this.Id);
scmd.CommandText = string.Format("UPDATE {0} SET ShipToShipActivityLocationName = @P2, ShipToShipActivityLocationLoCode = @P3, " +
"ShipToShipActivityLocationCoordinatesLatitude = @P4, ShipToShipActivityLocationCoordinatesLongitude = @P5, ShipToShipActivityDateFrom = @P6," +
"ShipToShipActivityDateTo = @P7, ShipToShipActivityType = @P8, ShipToShipActivitySecurityMattersToReport = @P9 " +
"ShipToShipActivityDateTo = @P7, ShipToShipActivityType = @P8, ShipToShipActivitySecurityMattersToReport = @P9, Identifier = @P10 " +
" WHERE Id = @ID", this.Tablename);
}
}

View File

@ -55,7 +55,7 @@ namespace bsmd.database
}
else
{
scmd.CommandText = string.Format("UPDATE {0} SET StowawaysJoiningLocation = @P2 WHERE Id = @ID", this.Tablename);
scmd.CommandText = string.Format("UPDATE {0} SET StowawaysJoiningLocation = @P2, Identifier = @P3 WHERE Id = @ID", this.Tablename);
scmd.Parameters.AddWithNullableValue("@ID", this.Id);
}
}

View File

@ -52,7 +52,7 @@ namespace bsmd.database
}
else
{
cmd.CommandText = string.Format("UPDATE {0} SET SubsidiaryRisk = @P2 WHERE Id = @ID", this.Tablename);
cmd.CommandText = string.Format("UPDATE {0} SET SubsidiaryRisk = @P2, Identifier = @P3 WHERE Id = @ID", this.Tablename);
scmd.Parameters.AddWithValue("@ID", this.Id);
}
}

View File

@ -164,7 +164,7 @@ namespace bsmd.database
"TowageOnArrivalOperatorPhone = @P9, TowageOnArrivalOperatorFax = @P10, TowageOnArrivalOperatorEmail = @P11, " +
"TowageOnArrivalGrossTonnage = @P12, TowageOnArrivalLengthOverall_MTR = @P13, " +
"TowageOnArrivalBeam_MTR = @P14, TowageOnArrivalPurposeOfCall = @P15, TowageOnArrivalDraught_DMT = @P16, " +
"TowageOnArrivalRemarks = @P17 WHERE Id = @ID", this.Tablename);
"TowageOnArrivalRemarks = @P17, Identifier = @P18 WHERE Id = @ID", this.Tablename);
}
}

View File

@ -148,7 +148,7 @@ namespace bsmd.database
"TowageOnDepartureOperatorPhone = @P9, TowageOnDepartureOperatorFax = @P10, TowageOnDepartureOperatorEmail = @P11, " +
"TowageOnDepartureLengthOverall_MTR = @P12, " +
"TowageOnDepartureBeam_MTR = @P13, TowageOnDepartureDraught_DMT = @P14, " +
"TowageOnDepartureRemarks = @P15 WHERE Id = @ID", this.Tablename);
"TowageOnDepartureRemarks = @P15, Identifier = @P16 WHERE Id = @ID", this.Tablename);
}
}

View File

@ -46,14 +46,12 @@ namespace bsmd.database
public string Value { get; set; }
public string ErrorMessage { get; set; }
#endregion
#region static methods
public static bool? CheckConditions(MessageCore core, List<Message> messages, ConditionGroup cGroup, out string message)
public static bool? CheckConditions(MessageCore core, List<Message> messages, ConditionGroup cGroup, List<ValidationField> failedFieldList, out string message)
{
bool? result = null;
message = "";
@ -70,7 +68,7 @@ namespace bsmd.database
string errorMessage = condition.ErrorMessage;
string errorMessage = cGroup.ErrorMessage;
if (otherargs != null)
errorMessage = string.Format(errorMessage, otherargs);
@ -89,7 +87,7 @@ namespace bsmd.database
foreach (ConditionGroup subGroup in cGroup.SubGroups)
{
string subMessage = "";
bool? subResult = ValidationCondition.CheckConditions(core, messages, subGroup, out subMessage);
bool? subResult = ValidationCondition.CheckConditions(core, messages, subGroup, failedFieldList, out subMessage);
if (!subResult.HasValue) // an error occurred evaluating this element
{
return subResult;
@ -316,6 +314,8 @@ namespace bsmd.database
set;
}
public string ErrorMessage { get; set; }
[XmlIgnore]
public ObservableCollection<ConditionGroup> SubGroups
{

View File

@ -19,7 +19,7 @@ namespace bsmd.database
private List<WasteDisposalServiceProvider> wdsp = new List<WasteDisposalServiceProvider>();
private List<Waste> waste = new List<Waste>();
private List<DatabaseEntity> waste = new List<DatabaseEntity>();
private static readonly int[] dkWasteCodes = { 1100, 1200, 1300, 2100, 2200, 2300, 2311, 2308, 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", "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" };
@ -27,6 +27,7 @@ namespace bsmd.database
public WAS()
{
this.tablename = "[dbo].[WAS]";
this.WasteDisposalValidExemption = false;
}
#region Properties
@ -67,7 +68,7 @@ namespace bsmd.database
[ENI2Validation]
public bool? ConfirmationOfSufficiency { get; set; }
public List<Waste> Waste { get { return this.waste; } }
public List<DatabaseEntity> Waste { get { return this.waste; } }
public List<WasteDisposalServiceProvider> WasteDisposalServiceProvider { get { return this.wdsp; } }

View File

@ -152,8 +152,8 @@ namespace bsmd.database
scmd.Parameters.AddWithValue(@"ID", this.Id);
scmd.CommandText = string.Format("UPDATE {0} SET WasteType = @P2, WasteDescription = @P3, " +
"WasteDisposalAmount_MTQ = @P4, WasteCapacity_MTQ = @P5, WasteAmountRetained_MTQ = @P6," +
"WasteDisposalPort = @P7, WasteAmountGeneratedTillNextPort_MTQ = @P8, WasteDisposedAtLastPort_MTQ = @P9 " +
"WHERE Id = @ID", this.Tablename);
"WasteDisposalPort = @P7, WasteAmountGeneratedTillNextPort_MTQ = @P8, WasteDisposedAtLastPort_MTQ = @P9, " +
"Identifier = @P10 WHERE Id = @ID", this.Tablename);
}
}

View File

@ -185,8 +185,9 @@ namespace bsmd.dbh
{
choiceList.Add(ItemsChoiceType.CallPurpose);
RootNOA_NODCallPurpose rnncp = new RootNOA_NODCallPurpose();
rnncp.CallPurposeCode = noa_nod.CallPurposes[i].CallPurposeCode;
rnncp.CallPurposeDescription = noa_nod.CallPurposes[i].CallPurposeDescription;
CallPurpose callPurpose = noa_nod.CallPurposes[i] as CallPurpose;
rnncp.CallPurposeCode = callPurpose.CallPurposeCode;
rnncp.CallPurposeDescription = callPurpose.CallPurposeDescription;
choices.Add(rnncp);
}
}
@ -328,17 +329,18 @@ namespace bsmd.dbh
choiceType1s.Add(ItemsChoiceType1.LastTenPortFacilitiesCalled);
RootSECLastTenPortFacilitiesCalled lastTen = new RootSECLastTenPortFacilitiesCalled();
secItems.Add(lastTen);
lastTen.PortFacilityPortName = sec.LastTenPortFacilitesCalled[i].PortFacilityPortName;
lastTen.PortFacilityPortCountry = sec.LastTenPortFacilitesCalled[i].PortFacilityPortCountry;
lastTen.PortFacilityPortLoCode = sec.LastTenPortFacilitesCalled[i].PortFacilityPortLoCode;
if (sec.LastTenPortFacilitesCalled[i].PortFacilityDateOfArrival.HasValue)
lastTen.PortFacilityDateOfArrival = sec.LastTenPortFacilitesCalled[i].PortFacilityDateOfArrival.Value;
if (sec.LastTenPortFacilitesCalled[i].PortFacilityDateOfDeparture.HasValue)
lastTen.PortFacilityDateOfDeparture = sec.LastTenPortFacilitesCalled[i].PortFacilityDateOfDeparture.Value;
if (sec.LastTenPortFacilitesCalled[i].PortFacilityShipSecurityLevel.HasValue)
lastTen.PortFacilityShipSecurityLevel = sec.LastTenPortFacilitesCalled[i].PortFacilityShipSecurityLevel.Value;
lastTen.PortFacilitySecurityMattersToReport = sec.LastTenPortFacilitesCalled[i].PortFacilitySecurityMattersToReport;
lastTen.PortFacilityGISISCode = sec.LastTenPortFacilitesCalled[i].PortFacilityGISISCode;
LastTenPortFacilitiesCalled lastTenPortFacilitiesCalled = sec.LastTenPortFacilitesCalled[i] as LastTenPortFacilitiesCalled;
lastTen.PortFacilityPortName = lastTenPortFacilitiesCalled.PortFacilityPortName;
lastTen.PortFacilityPortCountry = lastTenPortFacilitiesCalled.PortFacilityPortCountry;
lastTen.PortFacilityPortLoCode = lastTenPortFacilitiesCalled.PortFacilityPortLoCode;
if (lastTenPortFacilitiesCalled.PortFacilityDateOfArrival.HasValue)
lastTen.PortFacilityDateOfArrival = lastTenPortFacilitiesCalled.PortFacilityDateOfArrival.Value;
if (lastTenPortFacilitiesCalled.PortFacilityDateOfDeparture.HasValue)
lastTen.PortFacilityDateOfDeparture = lastTenPortFacilitiesCalled.PortFacilityDateOfDeparture.Value;
if (lastTenPortFacilitiesCalled.PortFacilityShipSecurityLevel.HasValue)
lastTen.PortFacilityShipSecurityLevel = lastTenPortFacilitiesCalled.PortFacilityShipSecurityLevel.Value;
lastTen.PortFacilitySecurityMattersToReport = lastTenPortFacilitiesCalled.PortFacilitySecurityMattersToReport;
lastTen.PortFacilityGISISCode = lastTenPortFacilitiesCalled.PortFacilityGISISCode;
}
for (int i = 0; i < sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Count; i++)
@ -346,24 +348,25 @@ namespace bsmd.dbh
choiceType1s.Add(ItemsChoiceType1.ShipToShipActivities);
RootSECShipToShipActivities s2s = new RootSECShipToShipActivities();
secItems.Add(s2s);
ShipToShipActivitiesDuringLastTenPortFacilitiesCalled shipToShip = sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i] as ShipToShipActivitiesDuringLastTenPortFacilitiesCalled;
s2s.ShipToShipActivityLocation = new RootSECShipToShipActivitiesShipToShipActivityLocation();
s2s.ShipToShipActivityLocation.ShipToShipActivityLocationName = sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].ShipToShipActivityLocationName;
s2s.ShipToShipActivityLocation.ShipToShipActivityLocationLoCode = sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].ShipToShipActivityLocationLoCode;
s2s.ShipToShipActivityLocation.ShipToShipActivityLocationName = shipToShip.ShipToShipActivityLocationName;
s2s.ShipToShipActivityLocation.ShipToShipActivityLocationLoCode = shipToShip.ShipToShipActivityLocationLoCode;
s2s.ShipToShipActivityLocation.ShipToShipActivityLocationCoordinates = new RootSECShipToShipActivitiesShipToShipActivityLocationShipToShipActivityLocationCoordinates();
if (sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].ShipToShipActivityLocationCoordinatesLatitude.HasValue)
s2s.ShipToShipActivityLocation.ShipToShipActivityLocationCoordinates.ShipToShipActivityLocationCoordinatesLatitude = sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].ShipToShipActivityLocationCoordinatesLatitude.Value;
if (sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].ShipToShipActivityLocationCoordinatesLongitude.HasValue)
s2s.ShipToShipActivityLocation.ShipToShipActivityLocationCoordinates.ShipToShipActivityLocationCoordinatesLongitude = sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].ShipToShipActivityLocationCoordinatesLongitude.Value;
if (sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].ShipToShipActivityDateFrom.HasValue)
s2s.ShipToShipActivityDateFrom = sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].ShipToShipActivityDateFrom.Value;
if (sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].ShipToShipActivityDateTo.HasValue)
s2s.ShipToShipActivityDateTo = sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].ShipToShipActivityDateTo.Value;
if (shipToShip.ShipToShipActivityLocationCoordinatesLatitude.HasValue)
s2s.ShipToShipActivityLocation.ShipToShipActivityLocationCoordinates.ShipToShipActivityLocationCoordinatesLatitude = shipToShip.ShipToShipActivityLocationCoordinatesLatitude.Value;
if (shipToShip.ShipToShipActivityLocationCoordinatesLongitude.HasValue)
s2s.ShipToShipActivityLocation.ShipToShipActivityLocationCoordinates.ShipToShipActivityLocationCoordinatesLongitude = shipToShip.ShipToShipActivityLocationCoordinatesLongitude.Value;
if (shipToShip.ShipToShipActivityDateFrom.HasValue)
s2s.ShipToShipActivityDateFrom = shipToShip.ShipToShipActivityDateFrom.Value;
if (shipToShip.ShipToShipActivityDateTo.HasValue)
s2s.ShipToShipActivityDateTo = shipToShip.ShipToShipActivityDateTo.Value;
int activityType;
if (!Int32.TryParse(sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].ShipToShipActivityType, out activityType))
activityType = NOA_NOD.getCallPurposeCodeFromDescription(sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].ShipToShipActivityType) ?? 0;
if (!Int32.TryParse(shipToShip.ShipToShipActivityType, out activityType))
activityType = NOA_NOD.getCallPurposeCodeFromDescription(shipToShip.ShipToShipActivityType) ?? 0;
s2s.ShipToShipActivityType = activityType;
s2s.ShipToShipActivitySecurityMattersToReport = sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].ShipToShipActivitySecurityMattersToReport;
s2s.ShipToShipActivitySecurityMattersToReport = shipToShip.ShipToShipActivitySecurityMattersToReport;
}
}
@ -388,9 +391,10 @@ namespace bsmd.dbh
for (int i = 0; i < bpol.PortOfItineraries.Count; i++)
{
RootBPOLPortOfItinerary port = new RootBPOLPortOfItinerary();
if (bpol.PortOfItineraries[i].PortOfItineraryETA.HasValue)
port.PortOfItineraryETA = bpol.PortOfItineraries[i].PortOfItineraryETA.Value.ToDBHDateString();
port.PortOfItineraryName = bpol.PortOfItineraries[i].PortOfItineraryName;
PortOfItinerary portOfItinerary = bpol.PortOfItineraries[i] as PortOfItinerary;
if (portOfItinerary.PortOfItineraryETA.HasValue)
port.PortOfItineraryETA = portOfItinerary.PortOfItineraryETA.Value.ToDBHDateString();
port.PortOfItineraryName = portOfItinerary.PortOfItineraryName;
poiArray[i] = port;
}
@ -868,19 +872,20 @@ namespace bsmd.dbh
for (int i = 0; i < mdh.PortOfCallLast30Days.Count; i++)
{
l30d.PortOfCallLast30Days[i] = new RootMDHPortsOfCallLast30DaysPortOfCallLast30Days();
PortOfCallLast30Days portOfCallLast30Days = mdh.PortOfCallLast30Days[i] as PortOfCallLast30Days;
l30d.PortOfCallLast30Days[i].PortOfCallLast30DaysCrewJoinedShip = new RootMDHPortsOfCallLast30DaysPortOfCallLast30DaysPortOfCallLast30DaysCrewJoinedShip();
if (mdh.PortOfCallLast30Days[i].CrewJoinedShip.Count > 0)
if (portOfCallLast30Days.CrewJoinedShip.Count > 0)
{
l30d.PortOfCallLast30Days[i].PortOfCallLast30DaysCrewJoinedShip.PortOfCallLast30DaysCrewJoinedShipName = new string[mdh.PortOfCallLast30Days[i].CrewJoinedShip.Count];
for (int j = 0; j < mdh.PortOfCallLast30Days[i].CrewJoinedShip.Count; j++)
l30d.PortOfCallLast30Days[i].PortOfCallLast30DaysCrewJoinedShip.PortOfCallLast30DaysCrewJoinedShipName = new string[portOfCallLast30Days.CrewJoinedShip.Count];
for (int j = 0; j < portOfCallLast30Days.CrewJoinedShip.Count; j++)
{
l30d.PortOfCallLast30Days[i].PortOfCallLast30DaysCrewJoinedShip.PortOfCallLast30DaysCrewJoinedShipName[j] = mdh.PortOfCallLast30Days[i].CrewJoinedShip[j].PortOfCallLast30DaysCrewJoinedShipName;
l30d.PortOfCallLast30Days[i].PortOfCallLast30DaysCrewJoinedShip.PortOfCallLast30DaysCrewJoinedShipName[j] = portOfCallLast30Days.CrewJoinedShip[j].PortOfCallLast30DaysCrewJoinedShipName;
}
}
l30d.PortOfCallLast30Days[i].PortOfCallLast30DaysCrewMembersJoined = mdh.PortOfCallLast30Days[i].PortOfCallLast30DaysCrewMembersJoined ?? false ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N;
if (mdh.PortOfCallLast30Days[i].PortOfCallLast30DaysDateOfDeparture.HasValue)
l30d.PortOfCallLast30Days[i].PortOfCallLast30DaysDateOfDeparture = mdh.PortOfCallLast30Days[i].PortOfCallLast30DaysDateOfDeparture.Value;
l30d.PortOfCallLast30Days[i].PortOfCallLast30DaysLocode = mdh.PortOfCallLast30Days[i].PortOfCallLast30DaysLocode;
l30d.PortOfCallLast30Days[i].PortOfCallLast30DaysCrewMembersJoined = portOfCallLast30Days.PortOfCallLast30DaysCrewMembersJoined ?? false ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N;
if (portOfCallLast30Days.PortOfCallLast30DaysDateOfDeparture.HasValue)
l30d.PortOfCallLast30Days[i].PortOfCallLast30DaysDateOfDeparture = portOfCallLast30Days.PortOfCallLast30DaysDateOfDeparture.Value;
l30d.PortOfCallLast30Days[i].PortOfCallLast30DaysLocode = portOfCallLast30Days.PortOfCallLast30DaysLocode;
}
}
@ -946,7 +951,7 @@ namespace bsmd.dbh
{
choiceType3s.Add(ItemsChoiceType3.Waste);
RootWASWaste rww = new RootWASWaste();
Waste waste = was.Waste[j];
Waste waste = was.Waste[j] as Waste;
if ((waste.WasteType ?? 0) == 0) continue; // not a valid waste type
rww.WasteType = new RootWASWasteWasteType();
rww.WasteType.WasteCode = waste.WasteType ?? 0;
@ -1080,7 +1085,7 @@ namespace bsmd.dbh
dpgOnArrival.DPGItemIMDG = new bsmd.dbh.DBHWebReference.IMDGPosition[haz.IMDGPositions.Count];
for (int i = 0; i < haz.IMDGPositions.Count; i++)
{
bsmd.database.IMDGPosition imdgPos = haz.IMDGPositions[i];
bsmd.database.IMDGPosition imdgPos = haz.IMDGPositions[i] as bsmd.database.IMDGPosition;
bsmd.dbh.DBHWebReference.IMDGPosition rootIMDG = new bsmd.dbh.DBHWebReference.IMDGPosition();
rootIMDG.UNNumber = imdgPos.UNNumber;
@ -1159,7 +1164,7 @@ namespace bsmd.dbh
for (int i = 0; i < haz.IBCPositions.Count; i++)
{
bsmd.dbh.DBHWebReference.IBCPosition rootIBC = new bsmd.dbh.DBHWebReference.IBCPosition();
bsmd.database.IBCPosition ibcPos = haz.IBCPositions[i];
bsmd.database.IBCPosition ibcPos = haz.IBCPositions[i] as bsmd.database.IBCPosition;
rootIBC.ProductName = ibcPos.ProductName;
if (ibcPos.PollutionCategory.HasValue)
@ -1192,7 +1197,7 @@ namespace bsmd.dbh
for (int i = 0; i < haz.IGCPositions.Count; i++)
{
bsmd.dbh.DBHWebReference.IGCPosition rootIGC = new bsmd.dbh.DBHWebReference.IGCPosition();
bsmd.database.IGCPosition igcPos = haz.IGCPositions[i];
bsmd.database.IGCPosition igcPos = haz.IGCPositions[i] as bsmd.database.IGCPosition;
rootIGC.UNNumber = igcPos.UNNumber;
rootIGC.IMOClass = igcPos.IMOClass;
@ -1216,7 +1221,7 @@ namespace bsmd.dbh
for (int i = 0; i < haz.IMSBCPositions.Count; i++)
{
bsmd.dbh.DBHWebReference.IMSBCPosition rootIMSBC = new bsmd.dbh.DBHWebReference.IMSBCPosition();
bsmd.database.IMSBCPosition imsbcPos = haz.IMSBCPositions[i];
bsmd.database.IMSBCPosition imsbcPos = haz.IMSBCPositions[i] as bsmd.database.IMSBCPosition;
rootIMSBC.BulkCargoShippingName = imsbcPos.BulkCargoShippingName;
if (imsbcPos.MHB.HasValue)
@ -1242,7 +1247,7 @@ namespace bsmd.dbh
for (int i = 0; i < haz.MARPOLPositions.Count; i++)
{
DBHWebReference.MARPOLPosition rootMarpol = new DBHWebReference.MARPOLPosition();
MARPOL_Annex_I_Position marpolPos = haz.MARPOLPositions[i];
MARPOL_Annex_I_Position marpolPos = haz.MARPOLPositions[i] as MARPOL_Annex_I_Position;
rootMarpol.Name = marpolPos.Name;
if (marpolPos.FlashpointInformation.HasValue)
@ -1313,7 +1318,7 @@ namespace bsmd.dbh
dpgOnDeparture.DPGItemIMDG = new bsmd.dbh.DBHWebReference.IMDGPosition[haz.IMDGPositions.Count];
for (int i = 0; i < haz.IMDGPositions.Count; i++)
{
bsmd.database.IMDGPosition imdgPos = haz.IMDGPositions[i];
bsmd.database.IMDGPosition imdgPos = haz.IMDGPositions[i] as bsmd.database.IMDGPosition;
bsmd.dbh.DBHWebReference.IMDGPosition rootIMDG = new bsmd.dbh.DBHWebReference.IMDGPosition();
rootIMDG.UNNumber = imdgPos.UNNumber;
@ -1392,7 +1397,7 @@ namespace bsmd.dbh
for (int i = 0; i < haz.IBCPositions.Count; i++)
{
bsmd.dbh.DBHWebReference.IBCPosition rootIBC = new bsmd.dbh.DBHWebReference.IBCPosition();
bsmd.database.IBCPosition ibcPos = haz.IBCPositions[i];
bsmd.database.IBCPosition ibcPos = haz.IBCPositions[i] as bsmd.database.IBCPosition;
rootIBC.ProductName = ibcPos.ProductName;
if (ibcPos.PollutionCategory.HasValue)
@ -1425,7 +1430,7 @@ namespace bsmd.dbh
for (int i = 0; i < haz.IGCPositions.Count; i++)
{
bsmd.dbh.DBHWebReference.IGCPosition rootIGC = new bsmd.dbh.DBHWebReference.IGCPosition();
bsmd.database.IGCPosition igcPos = haz.IGCPositions[i];
bsmd.database.IGCPosition igcPos = haz.IGCPositions[i] as bsmd.database.IGCPosition;
rootIGC.UNNumber = igcPos.UNNumber;
rootIGC.IMOClass = igcPos.IMOClass;
@ -1449,7 +1454,7 @@ namespace bsmd.dbh
for (int i = 0; i < haz.IMSBCPositions.Count; i++)
{
bsmd.dbh.DBHWebReference.IMSBCPosition rootIMSBC = new bsmd.dbh.DBHWebReference.IMSBCPosition();
bsmd.database.IMSBCPosition imsbcPos = haz.IMSBCPositions[i];
bsmd.database.IMSBCPosition imsbcPos = haz.IMSBCPositions[i] as bsmd.database.IMSBCPosition;
rootIMSBC.BulkCargoShippingName = imsbcPos.BulkCargoShippingName;
if (imsbcPos.MHB.HasValue)
@ -1475,7 +1480,7 @@ namespace bsmd.dbh
for (int i = 0; i < haz.MARPOLPositions.Count; i++)
{
MARPOLPosition rootMarpol = new MARPOLPosition();
MARPOL_Annex_I_Position marpolPos = haz.MARPOLPositions[i];
MARPOL_Annex_I_Position marpolPos = haz.MARPOLPositions[i] as MARPOL_Annex_I_Position;
rootMarpol.Name = marpolPos.Name;
if (marpolPos.FlashpointInformation.HasValue)

View File

@ -36,6 +36,7 @@ namespace bsmd.hisnord
XNamespace soap = "http://schemas.xmlsoap.org/soap/envelope/";
XNamespace ns15 = "http://api.national-single-window.de/visitIdResponse";
XNamespace ns16 = "http://api.national-single-window.de/transitIdResponse";
XNamespace resetNS = "http://api.national-single-window.de/reset";
XNamespace ladgNS = "http://api.national-single-window.de/ladg";
XNamespace hazaNS = "http://api.national-single-window.de/haza";
XNamespace hazdNS = "http://api.national-single-window.de/hazd";
@ -74,143 +75,148 @@ namespace bsmd.hisnord
_messageCoreId = aGuid;
else
_log.WarnFormat("cannot parse ConveyanceCode {0}", elem.FirstOrDefault());
}else
}
else
{
_log.Warn("NSWResponse does not contain ConveyanceCode!!");
}
XName meldeTypeName = "Meldetype";
var mElem = xml.Descendants(meldeTypeName);
Message.NotificationClass? notificationClass = null;
if(mElem.Count() > 0)
{
Message.NotificationClass tmpClass;
if (Enum.TryParse<Message.NotificationClass>(mElem.FirstOrDefault()?.Value, out tmpClass))
notificationClass = tmpClass;
else
{
// könnte VISIT/TRANSIT Id Beantragung sein
XName test = ns15 + "VisitIdResponse";
if (xml.Descendants(test).Count() > 0)
{
notificationClass = Message.NotificationClass.VISIT;
}
else
{
test = ns16 + "TransitIdResponse";
if (xml.Descendants(test).Count() > 0) notificationClass = Message.NotificationClass.TRANSIT;
}
if(!notificationClass.HasValue)
_log.WarnFormat("NSWResponse does not contain Notification class");
}
}
// detect response type
foreach (Message.NotificationClass messageClassType in Enum.GetValues(typeof(Message.NotificationClass)))
if(notificationClass.HasValue)
{
XName lookupName;
XName resetLookup;
XName resetLookup = resetNS + "ResetResponse";
switch (messageClassType)
switch (notificationClass.Value)
{
// we won't get answers for these message types
case Message.NotificationClass.STO: continue;
case Message.NotificationClass.CREWD: continue;
case Message.NotificationClass.PASD: continue;
case Message.NotificationClass.VISIT:
lookupName = ns15 + "VisitIdResponse";
resetLookup = ns15 + "ResetResponse";
break;
case Message.NotificationClass.TRANSIT:
lookupName = ns16 + "TransitIdResponse";
resetLookup = ns16 + "ResetResponse";
break;
case Message.NotificationClass.LADG:
lookupName = ladgNS + "LADGResponse";
resetLookup = ladgNS + "ResetResponse";
break;
case Message.NotificationClass.HAZA:
lookupName = hazaNS + "HAZAResponse";
resetLookup = hazaNS + "ResetResponse";
break;
case Message.NotificationClass.HAZD:
lookupName = hazdNS + "HAZDResponse";
resetLookup = hazdNS + "ResetResponse";
break;
case Message.NotificationClass.MDH:
lookupName = mdhNS + "MDHResponse";
resetLookup = mdhNS + "ResetResponse";
break;
case Message.NotificationClass.AGNT:
lookupName = agntNS + "AGNTResponse";
resetLookup = agntNS + "ResetResponse";
break;
case Message.NotificationClass.SEC:
lookupName = secNS + "SECResponse";
resetLookup = secNS + "ResetResponse";
break;
case Message.NotificationClass.STAT:
lookupName = statNS + "STATResponse";
resetLookup = statNS + "ResetResponse";
break;
case Message.NotificationClass.NOA_NOD:
lookupName = noa_nodNS + "NOA_NODResponse";
resetLookup = noa_nodNS + "ResetResponse";
break;
case Message.NotificationClass.ATA:
lookupName = ataNS + "ATAResponse";
resetLookup = ataNS + "ResetResponse";
break;
case Message.NotificationClass.ATD:
lookupName = atdNS + "ATDResponse";
resetLookup = atdNS + "ResetResponse";
break;
case Message.NotificationClass.POBA:
lookupName = pobaNS + "POBAResponse";
resetLookup = pobaNS + "ResetResponse";
break;
case Message.NotificationClass.POBD:
lookupName = pobdNS + "POBDResponse";
resetLookup = pobdNS + "ResetResponse";
break;
case Message.NotificationClass.NAME:
lookupName = nameNS + "NAMEResponse";
resetLookup = nameNS + "ResetResponse";
break;
case Message.NotificationClass.TIEFA:
lookupName = tiefaNS + "TIEFAResponse";
resetLookup = tiefaNS + "ResetResponse";
break;
case Message.NotificationClass.TIEFD:
lookupName = tiefdNS + "TIEFDResponse";
resetLookup = tiefdNS + "ResetResponse";
break;
case Message.NotificationClass.BKRA:
lookupName = bkraNS + "BKRAResponse";
resetLookup = bkraNS + "ResetResponse";
break;
case Message.NotificationClass.BKRD:
lookupName = bkrdNS + "BKRDResponse";
resetLookup = bkrdNS + "ResetResponse";
break;
case Message.NotificationClass.INFO:
lookupName = infoNS + "INFOResponse";
resetLookup = infoNS + "ResetResponse";
break;
case Message.NotificationClass.SERV:
lookupName = servNS + "SERVResponse";
resetLookup = servNS + "ResetResponse";
break;
case Message.NotificationClass.PRE72H:
lookupName = pre72hNS + "PRE72HResponse";
resetLookup = pre72hNS + "ResetResponse";
break;
case Message.NotificationClass.WAS:
lookupName = wasNS + "WASResponse";
resetLookup = wasNS + "ResetResponse";
break;
case Message.NotificationClass.CREW:
lookupName = crewNS + "CREWResponse";
resetLookup = crewNS + "ResetResponse";
break;
case Message.NotificationClass.PAS:
lookupName = pasNS + "PASResponse";
resetLookup = pasNS + "ResetResponse";
break;
case Message.NotificationClass.BPOL:
lookupName = bpolNS + "BPOLResponse";
resetLookup = bpolNS + "ResetResponse";
break;
case Message.NotificationClass.TOWA:
lookupName = towaNS + "TOWAResponse";
resetLookup = towaNS + "ResetResponse";
break;
case Message.NotificationClass.TOWD:
lookupName = towdNS + "TOWDResponse";
resetLookup = towdNS + "ResetResponse";
break;
default:
// we won't get answers for these message types
case Message.NotificationClass.STO:
case Message.NotificationClass.CREWD:
case Message.NotificationClass.PASD:
lookupName = "dontmatchmeplease";
resetLookup = "dontmatchmeplease";
break;
}
bool lookupMatch = (xml.Descendants(lookupName).Count() > 0);
bool resetMatch = (xml.Descendants(resetLookup).Count() > 0);
@ -219,7 +225,7 @@ namespace bsmd.hisnord
_isReset = resetMatch;
_notificationClass = messageClassType;
_notificationClass = notificationClass.Value;
// match found
XName xname = ns6 + "ClientRequestId";
@ -297,7 +303,6 @@ namespace bsmd.hisnord
_errors.Add(me);
}
break;
}
}
}

View File

@ -25,7 +25,7 @@ namespace bsmd.hisnord.Properties {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("5")]
[global::System.Configuration.DefaultSettingValueAttribute("1")]
public int BatchTimeoutMins {
get {
return ((int)(this["BatchTimeoutMins"]));
@ -106,5 +106,29 @@ namespace bsmd.hisnord.Properties {
this["AnswerCorruptDir"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("E:\\svnlager\\BSMD\\nsw\\HIS-NORD\\")]
public string TestTransmitterRoot {
get {
return ((string)(this["TestTransmitterRoot"]));
}
set {
this["TestTransmitterRoot"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string LiveTransmitterRoot {
get {
return ((string)(this["LiveTransmitterRoot"]));
}
set {
this["LiveTransmitterRoot"] = value;
}
}
}
}

View File

@ -3,7 +3,7 @@
<Profiles />
<Settings>
<Setting Name="BatchTimeoutMins" Type="System.Int32" Scope="User">
<Value Profile="(Default)">5</Value>
<Value Profile="(Default)">1</Value>
</Setting>
<Setting Name="OutputDir" Type="System.String" Scope="User">
<Value Profile="(Default)">E:\svnlager\BSMD\nsw\HIS-NORD\Transmitter-Tool\IMP</Value>
@ -23,5 +23,11 @@
<Setting Name="AnswerCorruptDir" Type="System.String" Scope="User">
<Value Profile="(Default)">E:\svnlager\BSMD\nsw\HIS-NORD\Transmitter-Tool\ANSWERS_CORRUPT</Value>
</Setting>
<Setting Name="TestTransmitterRoot" Type="System.String" Scope="User">
<Value Profile="(Default)">E:\svnlager\BSMD\nsw\HIS-NORD\</Value>
</Setting>
<Setting Name="LiveTransmitterRoot" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>

View File

@ -22,6 +22,7 @@ namespace bsmd.hisnord
private static ILog _log = LogManager.GetLogger(typeof(Request));
private static Dictionary<Guid, ReportingParty> _reportingPartyDict = null;
private static Dictionary<MessageCore, string> coreFilenameDict = new Dictionary<MessageCore, string>();
private static Dictionary<MessageCore, bool> coreUseTestDict = new Dictionary<MessageCore, bool>();
private static Dictionary<Message.NotificationClass, Message> noteMessageDict = new Dictionary<Message.NotificationClass, Message>();
internal static Dictionary<Guid, ReportingParty> ReportingPartyDict
@ -39,13 +40,14 @@ namespace bsmd.hisnord
public static void Clear()
{
coreFilenameDict.Clear();
coreUseTestDict.Clear();
}
public static void ReadResponseFiles()
{
foreach (MessageCore core in coreFilenameDict.Keys)
{
transmitter.result theResult = transmitter.GetResult(coreFilenameDict[core]);
transmitter.result theResult = transmitter.GetResult(coreFilenameDict[core], coreUseTestDict[core]);
if (theResult != null)
{
_log.InfoFormat("Result: Code {0} Detail {1} Message {2}", theResult.code, theResult.detail, theResult.message);
@ -110,6 +112,7 @@ namespace bsmd.hisnord
{
_log.DebugFormat("preparing {0}", noteMessageDict[notificationClass].MessageNotificationClassDisplay);
noteMessageDict[notificationClass].StatusInfo = "";
noteMessageDict[notificationClass].ChangedBy = ""; // Leeren nach RS mit CH: Sie möchte das Feld als Indikator "zu versenden" verwenden (ich war dagegen ;-)
noteMessageDict[notificationClass].InternalStatus = Message.BSMDStatus.SENT;
noteMessageDict[notificationClass].SentAt = DateTime.Now;
DBManager.Instance.DeleteSystemErrors(noteMessageDict[notificationClass]);
@ -316,8 +319,9 @@ namespace bsmd.hisnord
for (int i = 0; i < noa_nod.CallPurposes.Count; i++)
{
hn_noanod.CallPurposes[i] = new callpurpose();
hn_noanod.CallPurposes[i].CallPurposeCode = noa_nod.CallPurposes[i].CallPurposeCode.ToString();
hn_noanod.CallPurposes[i].CallPurposeDescription = noa_nod.CallPurposes[i].CallPurposeDescription;
CallPurpose callPurpose = noa_nod.CallPurposes[i] as CallPurpose;
hn_noanod.CallPurposes[i].CallPurposeCode = callPurpose.CallPurposeCode.ToString();
hn_noanod.CallPurposes[i].CallPurposeDescription = callPurpose.CallPurposeDescription;
}
}
@ -1085,7 +1089,7 @@ namespace bsmd.hisnord
sanitarydetail[] sanitaryDetails = new sanitarydetail[mdh.SanitaryMeasuresDetails.Count];
for (int j = 0; j < mdh.SanitaryMeasuresDetails.Count; j++)
{
SanitaryMeasuresDetail detail = mdh.SanitaryMeasuresDetails[j];
SanitaryMeasuresDetail detail = mdh.SanitaryMeasuresDetails[j] as SanitaryMeasuresDetail;
sanitaryDetails[j] = new sanitarydetail();
if (detail.SanitaryMeasuresDate.HasValue)
sanitaryDetails[j].SanitaryMeasuresDate = detail.SanitaryMeasuresDate.Value;
@ -1148,18 +1152,19 @@ namespace bsmd.hisnord
for (int j = 0; j < mdh.PortOfCallLast30Days.Count; j++)
{
pocs.PortOfCallLast30Days[j] = new portofcallmdh();
pocs.PortOfCallLast30Days[j].PortOfCallLast30DaysLocode = mdh.PortOfCallLast30Days[j].PortOfCallLast30DaysLocode;
if (mdh.PortOfCallLast30Days[j].PortOfCallLast30DaysDateOfDeparture.HasValue)
pocs.PortOfCallLast30Days[j].PortOfCallLast30DaysDateOfDeparture = mdh.PortOfCallLast30Days[j].PortOfCallLast30DaysDateOfDeparture.Value;
pocs.PortOfCallLast30Days[j].PortOfCallLast30DaysCrewMembersJoined = (mdh.PortOfCallLast30Days[j].PortOfCallLast30DaysCrewMembersJoined ?? false) ? yorntype.Y : yorntype.N;
PortOfCallLast30Days portOfCallLast30Days = mdh.PortOfCallLast30Days[j] as PortOfCallLast30Days;
pocs.PortOfCallLast30Days[j].PortOfCallLast30DaysLocode = portOfCallLast30Days.PortOfCallLast30DaysLocode;
if (portOfCallLast30Days.PortOfCallLast30DaysDateOfDeparture.HasValue)
pocs.PortOfCallLast30Days[j].PortOfCallLast30DaysDateOfDeparture = portOfCallLast30Days.PortOfCallLast30DaysDateOfDeparture.Value;
pocs.PortOfCallLast30Days[j].PortOfCallLast30DaysCrewMembersJoined = (portOfCallLast30Days.PortOfCallLast30DaysCrewMembersJoined ?? false) ? yorntype.Y : yorntype.N;
if (mdh.PortOfCallLast30Days[j].CrewJoinedShip.Count > 0)
if (portOfCallLast30Days.CrewJoinedShip.Count > 0)
{
List<string> crewJoinedShipList = new List<string>();
for (int k = 0; k < mdh.PortOfCallLast30Days[j].CrewJoinedShip.Count; k++)
for (int k = 0; k < portOfCallLast30Days.CrewJoinedShip.Count; k++)
{
if (!mdh.PortOfCallLast30Days[j].CrewJoinedShip[k].PortOfCallLast30DaysCrewJoinedShipName.IsNullOrEmpty())
crewJoinedShipList.Add(mdh.PortOfCallLast30Days[j].CrewJoinedShip[k].PortOfCallLast30DaysCrewJoinedShipName);
if (!portOfCallLast30Days.CrewJoinedShip[k].PortOfCallLast30DaysCrewJoinedShipName.IsNullOrEmpty())
crewJoinedShipList.Add(portOfCallLast30Days.CrewJoinedShip[k].PortOfCallLast30DaysCrewJoinedShipName);
}
pocs.PortOfCallLast30Days[j].PortOfCallLast30DaysCrewJoinedShip = crewJoinedShipList.ToArray();
}
@ -1228,7 +1233,7 @@ namespace bsmd.hisnord
for (int i = 0; i < was.Waste.Count; i++)
{
waste hn_waste = new waste();
Waste waste = was.Waste[i];
Waste waste = was.Waste[i] as Waste;
if (waste.WasteDisposalAmount_MTQ.HasValue)
hn_waste.WasteDisposalAmount_MTQ = (float)waste.WasteDisposalAmount_MTQ.Value;
@ -1304,9 +1309,10 @@ namespace bsmd.hisnord
for (int i = 0; i < bpol.PortOfItineraries.Count; i++)
{
hn_bpol.PortOfItinerary[i] = new portofitinery();
hn_bpol.PortOfItinerary[i].PortOfItineryName = bpol.PortOfItineraries[i].PortOfItineraryName;
if (bpol.PortOfItineraries[i].PortOfItineraryETA.HasValue)
hn_bpol.PortOfItinerary[i].PortOfItineryETA = bpol.PortOfItineraries[i].PortOfItineraryETA.Value;
PortOfItinerary portOfItinerary = bpol.PortOfItineraries[i] as PortOfItinerary;
hn_bpol.PortOfItinerary[i].PortOfItineryName = portOfItinerary.PortOfItineraryName;
if (portOfItinerary.PortOfItineraryETA.HasValue)
hn_bpol.PortOfItinerary[i].PortOfItineryETA = portOfItinerary.PortOfItineraryETA.Value;
}
}
@ -1577,16 +1583,20 @@ namespace bsmd.hisnord
#region serialize and save message
string outputDir = Path.Combine(useTest ? Properties.Settings.Default.TestTransmitterRoot : Properties.Settings.Default.LiveTransmitterRoot,
Properties.Settings.Default.OutputDir);
string filename = string.Format("BSMD_{0}-{1}.xml", DateTime.Now.ToString("yyyyMMddHHmmss"), core.Id.Value);
_log.InfoFormat("saving {0} to output directory", filename);
string filePath = Path.Combine(Properties.Settings.Default.OutputDir, filename);
string filePath = Path.Combine(outputDir, filename);
XmlSerializer serializer = new XmlSerializer(typeof(nsw));
using(TextWriter tw = new StreamWriter(filePath)) {
serializer.Serialize(tw, _nsw);
}
coreFilenameDict[core] = filename;
coreUseTestDict[core] = useTest;
#endregion
@ -1612,7 +1622,7 @@ namespace bsmd.hisnord
{
for (int i = 0; i < haz.IMDGPositions.Count; i++)
{
IMDGPosition imdgPosition = haz.IMDGPositions[i];
IMDGPosition imdgPosition = haz.IMDGPositions[i] as IMDGPosition;
positionimdg pi = new positionimdg();
pi.UNNumber = imdgPosition.UNNumber;
@ -1683,6 +1693,7 @@ namespace bsmd.hisnord
}
pi.PortOfLoading = imdgPosition.PortOfLoading;
pi.PortOfDischarge = imdgPosition.PortOfDischarge;
if(!imdgPosition.Remarks.IsNullOrEmpty())
pi.Remarks = imdgPosition.Remarks;
dgList.Add(pi);
@ -1699,7 +1710,7 @@ namespace bsmd.hisnord
for (int i = 0; i < haz.IBCPositions.Count; i++)
{
positionibc pi = new positionibc();
IBCPosition ibcPosition = haz.IBCPositions[i];
IBCPosition ibcPosition = haz.IBCPositions[i] as IBCPosition;
pi.ProductName = ibcPosition.ProductName;
if (ibcPosition.PollutionCategory.HasValue)
@ -1718,6 +1729,7 @@ namespace bsmd.hisnord
pi.SpecRef15_19Specified = ibcPosition.SpecRef15_19.HasValue;
if (pi.SpecRef15_19Specified)
pi.SpecRef15_19 = ibcPosition.SpecRef15_19.Value ? yorntype.Y : yorntype.N;
if(!ibcPosition.Remarks.IsNullOrEmpty())
pi.Remarks = ibcPosition.Remarks;
dgList.Add(pi);
@ -1733,7 +1745,7 @@ namespace bsmd.hisnord
for (int i = 0; i < haz.IGCPositions.Count; i++)
{
positionigc pi = new positionigc();
IGCPosition igcPosition = haz.IGCPositions[i];
IGCPosition igcPosition = haz.IGCPositions[i] as IGCPosition;
pi.UNNumber = igcPosition.UNNumber;
pi.IMOClass = igcPosition.IMOClass;
@ -1743,6 +1755,7 @@ namespace bsmd.hisnord
pi.StowagePosition = igcPosition.StowagePosition;
pi.PortOfLoading = igcPosition.PortOfLoading;
pi.PortOfDischarge = igcPosition.PortOfDischarge;
if(!igcPosition.Remarks.IsNullOrEmpty())
pi.Remarks = igcPosition.Remarks;
dgList.Add(pi);
@ -1758,7 +1771,7 @@ namespace bsmd.hisnord
for (int i = 0; i < haz.IMSBCPositions.Count; i++)
{
positionimsbc pi = new positionimsbc();
IMSBCPosition imsbcPosition = haz.IMSBCPositions[i];
IMSBCPosition imsbcPosition = haz.IMSBCPositions[i] as IMSBCPosition;
pi.BulkCargoShippingName = imsbcPosition.BulkCargoShippingName;
pi.MHB = (imsbcPosition.MHB ?? false) ? yorntype.Y : yorntype.N;
@ -1769,6 +1782,7 @@ namespace bsmd.hisnord
pi.StowagePosition = imsbcPosition.StowagePosition;
pi.PortOfLoading = imsbcPosition.PortOfLoading;
pi.PortOfDischarge = imsbcPosition.PortOfDischarge;
if(!imsbcPosition.Remarks.IsNullOrEmpty())
pi.Remarks = imsbcPosition.Remarks;
dgList.Add(pi);
@ -1785,7 +1799,7 @@ namespace bsmd.hisnord
for (int i = 0; i < haz.MARPOLPositions.Count; i++)
{
positionmarpol pi = new positionmarpol();
MARPOL_Annex_I_Position marpolPosition = haz.MARPOLPositions[i];
MARPOL_Annex_I_Position marpolPosition = haz.MARPOLPositions[i] as MARPOL_Annex_I_Position;
pi.Name = marpolPosition.Name;
if (marpolPosition.FlashpointInformation.HasValue)
@ -1796,6 +1810,7 @@ namespace bsmd.hisnord
pi.StowagePosition = marpolPosition.StowagePosition;
pi.PortOfLoading = marpolPosition.PortOfLoading;
pi.PortOfDischarge = marpolPosition.PortOfDischarge;
if(!marpolPosition.Remarks.IsNullOrEmpty())
pi.Remarks = marpolPosition.Remarks;
dgList.Add(pi);

View File

@ -16,9 +16,12 @@ namespace bsmd.hisnord
private static ILog _log = LogManager.GetLogger(typeof(Response));
public static void ReadAnswers()
public static void ReadAnswers(bool useTest)
{
foreach (string answerFile in Directory.GetFiles(Properties.Settings.Default.AnswerDir))
string answerDir = Path.Combine(useTest ? Properties.Settings.Default.TestTransmitterRoot : Properties.Settings.Default.LiveTransmitterRoot,
Properties.Settings.Default.AnswerDir);
foreach (string answerFile in Directory.GetFiles(answerDir))
{
bool isOK = true;
@ -91,6 +94,10 @@ namespace bsmd.hisnord
}
_log.WarnFormat("SystemError received for Core [{0}], IMO {1} ETA {2}: {3} Class {4}", aCore.Id, aCore.IMO, aCore.ETADisplay, systemError.ErrorMessage, Enum.GetName(typeof(Message.NotificationClass), notificationClass));
// Nach einiger Diskussion (vs. "SENT" und "FAILURE" geht das hier jetzt auf RESPONDED)
aCore.BSMDStatusInternal = MessageCore.BSMDStatus.RESPONDED;
DBManager.Instance.Save(aCore);
}
else
{
@ -227,12 +234,16 @@ namespace bsmd.hisnord
if(isOK)
{
// archive file
File.Move(answerFile, Path.Combine(Properties.Settings.Default.AnswerArchiveDir, Path.GetFileName(answerFile)));
string answerArchiveDir = Path.Combine(useTest ? Properties.Settings.Default.TestTransmitterRoot : Properties.Settings.Default.LiveTransmitterRoot,
Properties.Settings.Default.AnswerArchiveDir);
File.Move(answerFile, Path.Combine(answerArchiveDir, Path.GetFileName(answerFile)));
}
else
{
// save in separate folder (to look at it later?)
File.Move(answerFile, Path.Combine(Properties.Settings.Default.AnswerCorruptDir, Path.GetFileName(answerFile)));
string answerCorruptDir = Path.Combine(useTest ? Properties.Settings.Default.TestTransmitterRoot : Properties.Settings.Default.LiveTransmitterRoot,
Properties.Settings.Default.AnswerCorruptDir);
File.Move(answerFile, Path.Combine(answerCorruptDir, Path.GetFileName(answerFile)));
}
}
}

View File

@ -8,7 +8,7 @@
<userSettings>
<bsmd.hisnord.Properties.Settings>
<setting name="BatchTimeoutMins" serializeAs="String">
<value>5</value>
<value>1</value>
</setting>
<setting name="OutputDir" serializeAs="String">
<value>E:\svnlager\BSMD\nsw\HIS-NORD\Transmitter-Tool\IMP</value>
@ -28,6 +28,12 @@
<setting name="AnswerCorruptDir" serializeAs="String">
<value>E:\svnlager\BSMD\nsw\HIS-NORD\Transmitter-Tool\ANSWERS_CORRUPT</value>
</setting>
<setting name="TestTransmitterRoot" serializeAs="String">
<value>E:\svnlager\BSMD\nsw\HIS-NORD\</value>
</setting>
<setting name="LiveTransmitterRoot" serializeAs="String">
<value />
</setting>
</bsmd.hisnord.Properties.Settings>
</userSettings>
</configuration>

View File

@ -24,11 +24,11 @@ namespace bsmd.hisnord
private static ILog _log = LogManager.GetLogger(typeof(transmitter));
public static void CallTransmitter()
public static void CallTransmitter(bool useTest)
{
Process process = new Process();
process.StartInfo.FileName = Properties.Settings.Default.Transmitter;
process.StartInfo.WorkingDirectory = Path.GetDirectoryName(Properties.Settings.Default.Transmitter);
process.StartInfo.WorkingDirectory = Path.GetDirectoryName(useTest ? Properties.Settings.Default.TestTransmitterRoot : Properties.Settings.Default.LiveTransmitterRoot);
process.StartInfo.RedirectStandardError = true;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardInput = false;
@ -50,11 +50,15 @@ namespace bsmd.hisnord
// process.WaitForExit();
}
public static result GetResult(string filenameFullPath)
public static result GetResult(string filenameFullPath, bool useTest)
{
// now we should read the response message...
string resultFilename = string.Format("{0}.result.xml", Path.GetFileName(filenameFullPath));
string resultFullPath = Path.Combine(Properties.Settings.Default.ResultDir, resultFilename);
string resultDir = Path.Combine(useTest ? Properties.Settings.Default.TestTransmitterRoot : Properties.Settings.Default.LiveTransmitterRoot,
Properties.Settings.Default.ResultDir);
string resultFullPath = Path.Combine(resultDir, resultFilename);
return result.ReadResult(resultFullPath);
}