Version 3.7.4: Viele kleinere Korrekturen und Usability Verbesserungen.

This commit is contained in:
Daniel Schick 2017-10-07 11:12:03 +00:00
parent b8c99f2ec6
commit 938b760951
43 changed files with 1017 additions and 615 deletions

View File

@ -209,6 +209,8 @@ namespace ENI2
} }
} }
} }
this.DetailControl_RequestReload();
} }
private void SaveMessage(Message message) private void SaveMessage(Message message)
@ -243,6 +245,7 @@ namespace ENI2
this.buttonSaveAll.Visibility = Visibility.Hidden; this.buttonSaveAll.Visibility = Visibility.Hidden;
this.buttonSave.Visibility = Visibility.Hidden; this.buttonSave.Visibility = Visibility.Hidden;
} }
this.DetailControl_RequestReload();
} }
private void DetailControl_NotificationClassChanged(Message.NotificationClass notificationClass) private void DetailControl_NotificationClassChanged(Message.NotificationClass notificationClass)

View File

@ -142,27 +142,29 @@ namespace ENI2.DetailViewControls
private void DataGridBKRA_CreateRequested() private void DataGridBKRA_CreateRequested()
{ {
BRKA brka = new BRKA();
brka.Identifier = BRKA.GetNewIdentifier(this._bkraMessage.Elements);
EditBKRDialog ebd = new EditBKRDialog(); EditBKRDialog ebd = new EditBKRDialog();
ebd.BRKA = brka; ebd.BRKA = new BRKA();
ebd.BRKA.Identifier = BRKA.GetNewIdentifier(this._bkraMessage.Elements);
ebd.BRKA.MessageHeader = _bkraMessage;
ebd.IsDeparture = false; ebd.IsDeparture = false;
ebd.AddClicked += () => ebd.AddClicked += () =>
{ {
ebd.CopyValuesToEntity(); ebd.CopyValuesToEntity();
this._bkraMessage.Elements.Add(ebd.BRKA); if(!this._bkraMessage.Elements.Contains(ebd.BRKA))
ebd.BRKA.MessageHeader = _bkraMessage; this._bkraMessage.Elements.Add(ebd.BRKA);
this.dataGridBKRA.Items.Refresh(); this.dataGridBKRA.Items.Refresh();
ebd.BRKA = new BRKA(); ebd.BRKA = new BRKA();
ebd.BRKA.Identifier = BRKA.GetNewIdentifier(this._bkraMessage.Elements); ebd.BRKA.Identifier = BRKA.GetNewIdentifier(this._bkraMessage.Elements);
ebd.BRKA.MessageHeader = _bkraMessage;
this.SublistElementChanged(Message.NotificationClass.BKRA); this.SublistElementChanged(Message.NotificationClass.BKRA);
}; };
if (ebd.ShowDialog() ?? false) if (ebd.ShowDialog() ?? false)
{ {
brka.MessageHeader = _bkraMessage; if(!_bkraMessage.Elements.Contains(ebd.BRKA))
_bkraMessage.Elements.Add(brka); _bkraMessage.Elements.Add(ebd.BRKA);
this.dataGridBKRA.Items.Refresh(); this.dataGridBKRA.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.BKRA); this.SublistElementChanged(Message.NotificationClass.BKRA);
} }
@ -183,30 +185,30 @@ namespace ENI2.DetailViewControls
} }
private void DataGridBKRA_EditRequested(DatabaseEntity obj) private void DataGridBKRA_EditRequested(DatabaseEntity obj)
{ {
BRKA brka = obj as BRKA;
if (brka != null) EditBKRDialog eld = new EditBKRDialog();
eld.IsDeparture = false;
eld.BRKA = obj as BRKA;
eld.AddClicked += () =>
{ {
EditBKRDialog eld = new EditBKRDialog(); eld.CopyValuesToEntity();
eld.IsDeparture = false; if(!_bkraMessage.Elements.Contains(eld.BRKA))
eld.BRKA = brka;
eld.AddClicked += () =>
{
eld.CopyValuesToEntity();
_bkraMessage.Elements.Add(eld.BRKA); _bkraMessage.Elements.Add(eld.BRKA);
this.dataGridBKRA.Items.Refresh(); this.dataGridBKRA.Items.Refresh();
eld.BRKA = new BRKA(); eld.BRKA = new BRKA();
eld.BRKA.Identifier = BRKA.GetNewIdentifier(this._bkraMessage.Elements); eld.BRKA.Identifier = BRKA.GetNewIdentifier(this._bkraMessage.Elements);
eld.BRKA.MessageHeader = _bkraMessage; eld.BRKA.MessageHeader = _bkraMessage;
this.SublistElementChanged(Message.NotificationClass.BKRA); this.SublistElementChanged(Message.NotificationClass.BKRA);
}; };
if (eld.ShowDialog() ?? false) if (eld.ShowDialog() ?? false)
{ {
this.dataGridBKRA.Items.Refresh(); if (!_bkraMessage.Elements.Contains(eld.BRKA))
this.SublistElementChanged(Message.NotificationClass.BKRA); _bkraMessage.Elements.Add(eld.BRKA);
} this.dataGridBKRA.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.BKRA);
} }
} }

View File

@ -124,24 +124,27 @@ namespace ENI2.DetailViewControls
private void DataGridPortOfItinerary_CreateRequested() private void DataGridPortOfItinerary_CreateRequested()
{ {
PortOfItinerary poi = new PortOfItinerary();
EditPortOfItineraryDialog epid = new EditPortOfItineraryDialog(); EditPortOfItineraryDialog epid = new EditPortOfItineraryDialog();
epid.PortOfItinerary = poi; epid.PortOfItinerary = new PortOfItinerary();
epid.PortOfItinerary.Identifier = PortOfItinerary.GetNewIdentifier(this._bpol.PortOfItineraries);
epid.PortOfItinerary.BPOL = this._bpol;
epid.AddClicked += () => epid.AddClicked += () =>
{ {
epid.CopyValuesToEntity(); epid.CopyValuesToEntity();
epid.PortOfItinerary.BPOL = _bpol; if(!this._bpol.PortOfItineraries.Contains(epid.PortOfItinerary))
this._bpol.PortOfItineraries.Add(epid.PortOfItinerary); this._bpol.PortOfItineraries.Add(epid.PortOfItinerary);
this.dataGridPortOfItinerary.Items.Refresh(); this.dataGridPortOfItinerary.Items.Refresh();
epid.PortOfItinerary = new PortOfItinerary(); epid.PortOfItinerary = new PortOfItinerary();
epid.PortOfItinerary.BPOL = _bpol;
epid.PortOfItinerary.Identifier = PortOfItinerary.GetNewIdentifier(this._bpol.PortOfItineraries);
this.SublistElementChanged(Message.NotificationClass.BPOL); this.SublistElementChanged(Message.NotificationClass.BPOL);
}; };
if (epid.ShowDialog() ?? false) if (epid.ShowDialog() ?? false)
{ {
_bpol.PortOfItineraries.Add(epid.PortOfItinerary); if(!_bpol.PortOfItineraries.Contains(epid.PortOfItinerary))
epid.PortOfItinerary.BPOL = _bpol; _bpol.PortOfItineraries.Add(epid.PortOfItinerary);
this.dataGridPortOfItinerary.Items.Refresh(); this.dataGridPortOfItinerary.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.BPOL); this.SublistElementChanged(Message.NotificationClass.BPOL);
} }
@ -163,27 +166,27 @@ namespace ENI2.DetailViewControls
private void DataGridPortOfItinerary_EditRequested(DatabaseEntity obj) private void DataGridPortOfItinerary_EditRequested(DatabaseEntity obj)
{ {
PortOfItinerary poi = obj as PortOfItinerary; EditPortOfItineraryDialog epid = new EditPortOfItineraryDialog();
if (poi != null) epid.PortOfItinerary = obj as PortOfItinerary;
epid.AddClicked += () =>
{ {
EditPortOfItineraryDialog epid = new EditPortOfItineraryDialog(); epid.CopyValuesToEntity();
epid.PortOfItinerary = poi; if(!_bpol.PortOfItineraries.Contains(epid.PortOfItinerary))
epid.AddClicked += () =>
{
epid.CopyValuesToEntity();
_bpol.PortOfItineraries.Add(epid.PortOfItinerary); _bpol.PortOfItineraries.Add(epid.PortOfItinerary);
this.dataGridPortOfItinerary.Items.Refresh(); this.dataGridPortOfItinerary.Items.Refresh();
epid.PortOfItinerary = new PortOfItinerary(); epid.PortOfItinerary = new PortOfItinerary();
epid.PortOfItinerary.BPOL = this._bpol; epid.PortOfItinerary.BPOL = this._bpol;
this.SublistElementChanged(Message.NotificationClass.BPOL); epid.PortOfItinerary.Identifier = PortOfItinerary.GetNewIdentifier(this._bpol.PortOfItineraries);
}; this.SublistElementChanged(Message.NotificationClass.BPOL);
};
if (epid.ShowDialog() ?? false) if (epid.ShowDialog() ?? false)
{ {
this.dataGridPortOfItinerary.Items.Refresh(); if (!_bpol.PortOfItineraries.Contains(epid.PortOfItinerary))
this.SublistElementChanged(Message.NotificationClass.BPOL); this._bpol.PortOfItineraries.Add(epid.PortOfItinerary);
} this.dataGridPortOfItinerary.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.BPOL);
} }
} }
@ -198,26 +201,27 @@ namespace ENI2.DetailViewControls
private void DataGridPassengerList_CreateRequested() private void DataGridPassengerList_CreateRequested()
{ {
PAS pas = new PAS();
pas.Identifier = PAS.GetNewIdentifier(_pasMessage.Elements);
EditPASDialog epd = new EditPASDialog(); EditPASDialog epd = new EditPASDialog();
epd.PAS = pas; epd.PAS = new PAS();
epd.PAS.Identifier = PAS.GetNewIdentifier(_pasMessage.Elements);
epd.PAS.MessageHeader = this._pasMessage;
epd.AddClicked += () => epd.AddClicked += () =>
{ {
epd.CopyValuesToEntity(); epd.CopyValuesToEntity();
epd.PAS.MessageHeader = this._pasMessage; if(!this._pasMessage.Elements.Contains(epd.PAS))
this._pasMessage.Elements.Add(epd.PAS); this._pasMessage.Elements.Add(epd.PAS);
this.dataGridPassengerList.Items.Refresh(); this.dataGridPassengerList.Items.Refresh();
epd.PAS = new PAS(); epd.PAS = new PAS();
epd.PAS.MessageHeader = this._pasMessage;
epd.PAS.Identifier = PAS.GetNewIdentifier(_pasMessage.Elements); epd.PAS.Identifier = PAS.GetNewIdentifier(_pasMessage.Elements);
this.SublistElementChanged(Message.NotificationClass.PAS); this.SublistElementChanged(Message.NotificationClass.PAS);
}; };
if (epd.ShowDialog() ?? false) if (epd.ShowDialog() ?? false)
{ {
_pasMessage.Elements.Add(epd.PAS); if(!this._pasMessage.Elements.Contains(epd.PAS))
epd.PAS.MessageHeader = this._pasMessage; _pasMessage.Elements.Add(epd.PAS);
this.dataGridPassengerList.Items.Refresh(); this.dataGridPassengerList.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.PAS); this.SublistElementChanged(Message.NotificationClass.PAS);
} }
@ -239,28 +243,27 @@ namespace ENI2.DetailViewControls
private void DataGridPassengerList_EditRequested(DatabaseEntity obj) private void DataGridPassengerList_EditRequested(DatabaseEntity obj)
{ {
PAS pas = obj as PAS; EditPASDialog epd = new EditPASDialog();
if (pas != null) epd.PAS = obj as PAS;
epd.AddClicked += () =>
{ {
EditPASDialog epd = new EditPASDialog(); epd.CopyValuesToEntity();
epd.PAS = pas; if(!_pasMessage.Elements.Contains(epd.PAS))
epd.AddClicked += () =>
{
epd.CopyValuesToEntity();
_pasMessage.Elements.Add(epd.PAS); _pasMessage.Elements.Add(epd.PAS);
this.dataGridPassengerList.Items.Refresh(); this.dataGridPassengerList.Items.Refresh();
epd.PAS = new PAS(); epd.PAS = new PAS();
epd.PAS.Identifier = PAS.GetNewIdentifier(_pasMessage.Elements); epd.PAS.Identifier = PAS.GetNewIdentifier(_pasMessage.Elements);
epd.PAS.MessageHeader = _pasMessage; epd.PAS.MessageHeader = _pasMessage;
this.SublistElementChanged(Message.NotificationClass.PAS); this.SublistElementChanged(Message.NotificationClass.PAS);
}; };
if (epd.ShowDialog() ?? false) if (epd.ShowDialog() ?? false)
{ {
this.dataGridPassengerList.Items.Refresh(); if (!_pasMessage.Elements.Contains(epd.PAS))
this.SublistElementChanged(Message.NotificationClass.PAS); _pasMessage.Elements.Add(epd.PAS);
} this.dataGridPassengerList.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.PAS);
} }
} }
@ -275,26 +278,27 @@ namespace ENI2.DetailViewControls
private void DataGridCrewList_CreateRequested() private void DataGridCrewList_CreateRequested()
{ {
CREW crew = new CREW();
crew.Identifier = CREW.GetNewIdentifier(_crewMessage.Elements);
EditCREWDialog ecd = new EditCREWDialog(); EditCREWDialog ecd = new EditCREWDialog();
ecd.CREW = crew; ecd.CREW = new CREW();
ecd.CREW.Identifier = CREW.GetNewIdentifier(_crewMessage.Elements);
ecd.CREW.MessageHeader = this._crewMessage;
ecd.AddClicked += () => ecd.AddClicked += () =>
{ {
ecd.CopyValuesToEntity(); ecd.CopyValuesToEntity();
ecd.CREW.MessageHeader = this._crewMessage; if(!this._crewMessage.Elements.Contains(ecd.CREW))
this._crewMessage.Elements.Add(ecd.CREW); this._crewMessage.Elements.Add(ecd.CREW);
this.dataGridCrewList.Items.Refresh(); this.dataGridCrewList.Items.Refresh();
ecd.CREW = new CREW(); ecd.CREW = new CREW();
ecd.CREW.MessageHeader = this._crewMessage;
ecd.CREW.Identifier = CREW.GetNewIdentifier(_crewMessage.Elements); ecd.CREW.Identifier = CREW.GetNewIdentifier(_crewMessage.Elements);
this.SublistElementChanged(Message.NotificationClass.CREW); this.SublistElementChanged(Message.NotificationClass.CREW);
}; };
if (ecd.ShowDialog() ?? false) if (ecd.ShowDialog() ?? false)
{ {
_crewMessage.Elements.Add(ecd.CREW); if(!this._crewMessage.Elements.Contains(ecd.CREW))
ecd.CREW.MessageHeader = this._crewMessage; _crewMessage.Elements.Add(ecd.CREW);
this.dataGridCrewList.Items.Refresh(); this.dataGridCrewList.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.CREW); this.SublistElementChanged(Message.NotificationClass.CREW);
} }
@ -316,28 +320,27 @@ namespace ENI2.DetailViewControls
private void DataGridCrewList_EditRequested(DatabaseEntity obj) private void DataGridCrewList_EditRequested(DatabaseEntity obj)
{ {
CREW crew = obj as CREW; EditCREWDialog ecd = new EditCREWDialog();
if (crew != null) ecd.CREW = obj as CREW;
ecd.AddClicked += () =>
{ {
EditCREWDialog ecd = new EditCREWDialog(); ecd.CopyValuesToEntity();
ecd.CREW = crew; if(!_crewMessage.Elements.Contains(ecd.CREW))
ecd.AddClicked += () =>
{
ecd.CopyValuesToEntity();
_crewMessage.Elements.Add(ecd.CREW); _crewMessage.Elements.Add(ecd.CREW);
this.dataGridCrewList.Items.Refresh(); this.dataGridCrewList.Items.Refresh();
ecd.CREW = new CREW(); ecd.CREW = new CREW();
ecd.CREW.Identifier = CREW.GetNewIdentifier(_crewMessage.Elements); ecd.CREW.Identifier = CREW.GetNewIdentifier(_crewMessage.Elements);
ecd.CREW.MessageHeader = _crewMessage; ecd.CREW.MessageHeader = _crewMessage;
this.SublistElementChanged(Message.NotificationClass.CREW); this.SublistElementChanged(Message.NotificationClass.CREW);
}; };
if (ecd.ShowDialog() ?? false) if (ecd.ShowDialog() ?? false)
{ {
this.dataGridCrewList.Items.Refresh(); if (!_crewMessage.Elements.Contains(ecd.CREW))
this.SublistElementChanged(Message.NotificationClass.CREW); _crewMessage.Elements.Add(ecd.CREW);
} this.dataGridCrewList.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.CREW);
} }
} }
@ -388,6 +391,10 @@ namespace ENI2.DetailViewControls
{ {
while (reader.Read()) while (reader.Read())
{ {
if(((IExcelDataReader) reader).FieldCount < 10)
{
throw new InvalidDataException("Sheet must have 10 Columns of data");
}
CREW crew = new CREW(); CREW crew = new CREW();
if (reader.IsDBNull(0) && reader.IsDBNull(1)) continue; if (reader.IsDBNull(0) && reader.IsDBNull(1)) continue;
if (!reader.IsDBNull(0)) crew.CrewMemberLastName = reader.GetString(0); if (!reader.IsDBNull(0)) crew.CrewMemberLastName = reader.GetString(0);
@ -455,6 +462,11 @@ namespace ENI2.DetailViewControls
{ {
while (reader.Read()) while (reader.Read())
{ {
if (((IExcelDataReader)reader).FieldCount < 11)
{
throw new InvalidDataException("Sheet must have 11 Columns of data");
}
PAS pas = new PAS(); PAS pas = new PAS();
if (reader.IsDBNull(0) && reader.IsDBNull(1)) continue; if (reader.IsDBNull(0) && reader.IsDBNull(1)) continue;
if (!reader.IsDBNull(0)) pas.PassengerLastName = reader.GetString(0); if (!reader.IsDBNull(0)) pas.PassengerLastName = reader.GetString(0);

View File

@ -39,41 +39,47 @@
<enictrl:ENIDataGrid x:Name="dataGridIMDGItems" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" <enictrl:ENIDataGrid x:Name="dataGridIMDGItems" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
AutoGenerateColumns="False" Margin="0,5,0,0"> AutoGenerateColumns="False" Margin="0,5,0,0">
<DataGrid.Columns> <DataGrid.Columns>
<DataGridTextColumn Header="{x:Static p:Resources.textIdentifier}" Binding="{Binding Identifier}" IsReadOnly="True" Width="80" /> <DataGridTextColumn Header="{x:Static p:Resources.textIdentifier}" Binding="{Binding Identifier}" IsReadOnly="True" Width="auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textUNNumber}" Binding="{Binding UNNumber}" IsReadOnly="True" Width="80" /> <DataGridTextColumn Header="{x:Static p:Resources.textUNNumber}" Binding="{Binding UNNumber}" IsReadOnly="True" Width="auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textPackingGroup}" Binding="{Binding PackingGroup}" IsReadOnly="True" Width="80" /> <DataGridComboBoxColumn Header="{x:Static p:Resources.textPackingGroup}" ItemsSource="{x:Static util:GlobalStructures.PackingGroups}" IsReadOnly="True" Width="auto">
<DataGridTextColumn Header="{x:Static p:Resources.textProperShippingName}" Binding="{Binding ProperShippingName}" IsReadOnly="True" Width="80" /> <DataGridComboBoxColumn.ElementStyle>
<DataGridTextColumn Header="{x:Static p:Resources.textIMOClassDivision}" Binding="{Binding IMOClass}" IsReadOnly="True" Width="80" /> <Style TargetType="ComboBox">
<DataGridTextColumn Header="{x:Static p:Resources.textTechnicalName}" Binding="{Binding TechnicalName}" IsReadOnly="True" Width="80" /> <Setter Property="SelectedIndex" Value="{Binding PackingGroup, UpdateSourceTrigger=PropertyChanged}" />
<DataGridTextColumn Header="{x:Static p:Resources.textNetExplosiveMass}" Binding="{Binding NetExplosiveMass_KGM, StringFormat={}{0:N2}}" IsReadOnly="True" Width="80" /> </Style>
<DataGridTextColumn Header="{x:Static p:Resources.textFlashpoint}" Binding="{Binding Flashpoint_CEL}" IsReadOnly="True" Width="80" /> </DataGridComboBoxColumn.ElementStyle>
<DataGridTextColumn Header="{x:Static p:Resources.textRadioNuclideName}" Binding="{Binding Class7NuclideName}" IsReadOnly="True" Width="80" /> </DataGridComboBoxColumn>
<DataGridTextColumn Header="{x:Static p:Resources.textMaxActivity}" Binding="{Binding Class7MaxActivity_BQL, StringFormat={}{0:N2}}" IsReadOnly="True" Width="80" /> <DataGridTextColumn Header="{x:Static p:Resources.textProperShippingName}" Binding="{Binding ProperShippingName}" IsReadOnly="True" Width="auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textCategory}" Binding="{Binding Class7Category}" IsReadOnly="True" Width="80" /> <DataGridTextColumn Header="{x:Static p:Resources.textIMOClassDivision}" Binding="{Binding IMOClass}" IsReadOnly="True" Width="auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textTransportIndex}" Binding="{Binding Class7TransportIndex}" IsReadOnly="True" Width="80" /> <DataGridTextColumn Header="{x:Static p:Resources.textTechnicalName}" Binding="{Binding TechnicalName}" IsReadOnly="True" Width="auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textCriticalSafetyIndex}" Binding="{Binding Class7CSI}" IsReadOnly="True" Width="80" /> <DataGridTextColumn Header="{x:Static p:Resources.textNetExplosiveMass}" Binding="{Binding NetExplosiveMass_KGM, StringFormat={}{0:N2}}" IsReadOnly="True" Width="auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textSubsidiaryRisk}" Binding="{Binding SubsidiaryRiskText}" IsReadOnly="True" Width="80" /> <DataGridTextColumn Header="{x:Static p:Resources.textFlashpoint}" Binding="{Binding Flashpoint_CEL}" IsReadOnly="True" Width="auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textControlTemperature}" Binding="{Binding ControlTemperature_CEL, StringFormat={}{0:N2}}" IsReadOnly="True" Width="80" /> <DataGridTextColumn Header="{x:Static p:Resources.textRadioNuclideName}" Binding="{Binding Class7NuclideName}" IsReadOnly="True" Width="auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textEmergencyTemperature}" Binding="{Binding EmergencyTemperature_CEL, StringFormat={}{0:N2}}" IsReadOnly="True" Width="80" /> <DataGridTextColumn Header="{x:Static p:Resources.textMaxActivity}" Binding="{Binding Class7MaxActivity_BQL, StringFormat={}{0:N2}}" IsReadOnly="True" Width="auto" />
<DataGridCheckBoxColumn Header="{x:Static p:Resources.textMarinePollutant}" Binding="{Binding Class7Category}" IsReadOnly="True" Width="80" /> <DataGridTextColumn Header="{x:Static p:Resources.textCategory}" Binding="{Binding Class7Category}" IsReadOnly="True" Width="auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textNumberOfPackages}" Binding="{Binding NumberOfPackages}" IsReadOnly="True" Width="80" /> <DataGridTextColumn Header="{x:Static p:Resources.textTransportIndex}" Binding="{Binding Class7TransportIndex}" IsReadOnly="True" Width="auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textPackageType}" Binding="{Binding PackageType}" IsReadOnly="True" Width="80" /> <DataGridTextColumn Header="{x:Static p:Resources.textCriticalSafetyIndex}" Binding="{Binding Class7CSI}" IsReadOnly="True" Width="auto" />
<DataGridCheckBoxColumn Header="{x:Static p:Resources.textLimitedQuantity}" Binding="{Binding LimitedQuantities}" IsReadOnly="True" Width="80" /> <DataGridTextColumn Header="{x:Static p:Resources.textSubsidiaryRisk}" Binding="{Binding SubsidiaryRiskText}" IsReadOnly="True" Width="auto" />
<DataGridCheckBoxColumn Header="{x:Static p:Resources.textExceptedQuantities}" Binding="{Binding ExceptedQuantities}" IsReadOnly="True" Width="80" /> <DataGridTextColumn Header="{x:Static p:Resources.textControlTemperature}" Binding="{Binding ControlTemperature_CEL, StringFormat={}{0:N2}}" IsReadOnly="True" Width="auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textNetQuantity}" Binding="{Binding NetQuantity_KGM, StringFormat={}{0:N2}}" IsReadOnly="True" Width="80" /> <DataGridTextColumn Header="{x:Static p:Resources.textEmergencyTemperature}" Binding="{Binding EmergencyTemperature_CEL, StringFormat={}{0:N2}}" IsReadOnly="True" Width="auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textExceptedQuantities}" Binding="{Binding ExceptedQuantities, StringFormat={}{0:N2}}" IsReadOnly="True" Width="80" /> <DataGridCheckBoxColumn Header="{x:Static p:Resources.textMarinePollutant}" Binding="{Binding Class7Category}" IsReadOnly="True" Width="auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textCargoVolume}" Binding="{Binding Volume_MTQ, StringFormat={}{0:N2}}" IsReadOnly="True" Width="80" /> <DataGridTextColumn Header="{x:Static p:Resources.textNumberOfPackages}" Binding="{Binding NumberOfPackages}" IsReadOnly="True" Width="auto" />
<DataGridCheckBoxColumn Header="{x:Static p:Resources.textGeneralCargo}" Binding="{Binding GeneralCargoIBC}" IsReadOnly="True" Width="80" /> <DataGridTextColumn Header="{x:Static p:Resources.textPackageType}" Binding="{Binding PackageType}" IsReadOnly="True" Width="auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textContainerNo}" Binding="{Binding ContainerNumber}" IsReadOnly="True" Width="80" /> <DataGridCheckBoxColumn Header="{x:Static p:Resources.textLimitedQuantity}" Binding="{Binding LimitedQuantities}" IsReadOnly="True" Width="auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textVehicleLicensePlate}" Binding="{Binding VehicleLicenseNumber}" IsReadOnly="True" Width="80" /> <DataGridCheckBoxColumn Header="{x:Static p:Resources.textExceptedQuantities}" Binding="{Binding ExceptedQuantities}" IsReadOnly="True" Width="auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textStowagePosition}" Binding="{Binding StowagePosition}" IsReadOnly="True" Width="80" /> <DataGridTextColumn Header="{x:Static p:Resources.textNetQuantity}" Binding="{Binding NetQuantity_KGM, StringFormat={}{0:N2}}" IsReadOnly="True" Width="auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textSubsidiaryRisk}" Binding="{Binding SubsidiaryRiskText}" IsReadOnly="True" Width="80" /> <DataGridTextColumn Header="{x:Static p:Resources.textExceptedQuantities}" Binding="{Binding ExceptedQuantities, StringFormat={}{0:N2}}" IsReadOnly="True" Width="auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textContainerPositionBay}" Binding="{Binding Bay}" IsReadOnly="True" Width="80" /> <DataGridTextColumn Header="{x:Static p:Resources.textCargoVolume}" Binding="{Binding Volume_MTQ, StringFormat={}{0:N2}}" IsReadOnly="True" Width="auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textContainerPositionRow}" Binding="{Binding Row}" IsReadOnly="True" Width="80" /> <DataGridCheckBoxColumn Header="{x:Static p:Resources.textGeneralCargo}" Binding="{Binding GeneralCargoIBC}" IsReadOnly="True" Width="auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textContainerPositionTier}" Binding="{Binding Tier}" IsReadOnly="True" Width="80" /> <DataGridTextColumn Header="{x:Static p:Resources.textContainerNo}" Binding="{Binding ContainerNumber}" IsReadOnly="True" Width="auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textPortOfLoading}" Binding="{Binding PortOfLoading}" IsReadOnly="True" Width="80" /> <DataGridTextColumn Header="{x:Static p:Resources.textVehicleLicensePlate}" Binding="{Binding VehicleLicenseNumber}" IsReadOnly="True" Width="auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textPortOfDischarge}" Binding="{Binding PortOfDischarge}" IsReadOnly="True" Width="80" /> <DataGridTextColumn Header="{x:Static p:Resources.textStowagePosition}" Binding="{Binding StowagePosition}" IsReadOnly="True" Width="auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textRemarks}" Binding="{Binding Remarks}" IsReadOnly="True" Width="80" /> <DataGridTextColumn Header="{x:Static p:Resources.textSubsidiaryRisk}" Binding="{Binding SubsidiaryRiskText}" IsReadOnly="True" Width="auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textContainerPositionBay}" Binding="{Binding Bay}" IsReadOnly="True" Width="auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textContainerPositionRow}" Binding="{Binding Row}" IsReadOnly="True" Width="auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textContainerPositionTier}" Binding="{Binding Tier}" IsReadOnly="True" Width="auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textPortOfLoading}" Binding="{Binding PortOfLoading}" IsReadOnly="True" Width="auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textPortOfDischarge}" Binding="{Binding PortOfDischarge}" IsReadOnly="True" Width="auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textRemarks}" Binding="{Binding Remarks}" IsReadOnly="True" Width="auto" />
</DataGrid.Columns> </DataGrid.Columns>
</enictrl:ENIDataGrid> </enictrl:ENIDataGrid>

View File

@ -24,7 +24,7 @@ namespace ENI2.DetailViewControls
private HAZ hazd; // referenz auf HAZD, falls das hier HAZA ist und wir Positionen kopieren wollen private HAZ hazd; // referenz auf HAZD, falls das hier HAZA ist und wir Positionen kopieren wollen
public DangerousGoodsDetailControl() public DangerousGoodsDetailControl()
{ {
InitializeComponent(); InitializeComponent();
this.Loaded += DangerousGoodsDetailControl_Loaded; this.Loaded += DangerousGoodsDetailControl_Loaded;
} }
@ -34,8 +34,8 @@ namespace ENI2.DetailViewControls
this.RegisterCheckboxChange(this.checkBoxDangerousGoodsOnBoard, this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); this.RegisterCheckboxChange(this.checkBoxDangerousGoodsOnBoard, this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA);
this.RegisterCheckboxChange(this.checkBoxDGManifestOnBoard, this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); this.RegisterCheckboxChange(this.checkBoxDGManifestOnBoard, this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA);
this.RegisterCheckboxChange(this.checkBoxMoUBaltic, this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); this.RegisterCheckboxChange(this.checkBoxMoUBaltic, this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA);
this.RegisterComboboxIndexChange(this.comboBoxVesselClass, this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); this.RegisterComboboxIndexChange(this.comboBoxVesselClass, this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA);
} }
public bool IsDeparture { get; set; } public bool IsDeparture { get; set; }
@ -58,7 +58,7 @@ namespace ENI2.DetailViewControls
} }
if (aMessage.MessageNotificationClass == Message.NotificationClass.HAZD) if (aMessage.MessageNotificationClass == Message.NotificationClass.HAZD)
{ {
if(aMessage != null) if (aMessage != null)
{ {
if (aMessage.Elements.Count > 0) if (aMessage.Elements.Count > 0)
this.hazd = aMessage.Elements[0] as HAZ; this.hazd = aMessage.Elements[0] as HAZ;
@ -189,16 +189,15 @@ namespace ENI2.DetailViewControls
private void copyMARPOL(object sender, RoutedEventArgs e) private void copyMARPOL(object sender, RoutedEventArgs e)
{ {
// aus dem aktuell selektierten MARPOL Element ein neues MARPOL Element machen und nach HAZD kopieren // aus dem aktuell selektierten MARPOL Element ein neues MARPOL Element machen und nach HAZD kopieren
if ((this.dataGridMARPOLItems.SelectedItems != null) && (this.dataGridMARPOLItems.SelectedItems.Count == 1)) if (this.dataGridMARPOLItems.SelectedItems != null)
{ {
MARPOL_Annex_I_Position selectedMARPOL = this.dataGridMARPOLItems.SelectedItems[0] as MARPOL_Annex_I_Position; foreach (MARPOL_Annex_I_Position selectedMARPOL in this.dataGridMARPOLItems.SelectedItems)
if (selectedMARPOL != null)
{ {
MARPOL_Annex_I_Position copyMARPOL = new MARPOL_Annex_I_Position(); MARPOL_Annex_I_Position copyMARPOL = new MARPOL_Annex_I_Position();
copyMARPOL.MessageHeader = this.hazd.MessageHeader; copyMARPOL.MessageHeader = this.hazd.MessageHeader;
copyMARPOL.HAZ = this.hazd; copyMARPOL.HAZ = this.hazd;
copyMARPOL.CopyFromMARPOL(selectedMARPOL); copyMARPOL.CopyFromMARPOL(selectedMARPOL);
copyMARPOL.Identifier = DatabaseEntity.GetNewIdentifier(this.hazd.MARPOLPositions); copyMARPOL.Identifier = DatabaseEntity.GetNewIdentifier(this.hazd.MARPOLPositions, "MARPOL-");
this.hazd.MARPOLPositions.Add(copyMARPOL); this.hazd.MARPOLPositions.Add(copyMARPOL);
this.SublistElementChanged(Message.NotificationClass.HAZD); this.SublistElementChanged(Message.NotificationClass.HAZD);
this.OnControlCacheReset(Properties.Resources.textDGDeparture); this.OnControlCacheReset(Properties.Resources.textDGDeparture);
@ -209,16 +208,15 @@ namespace ENI2.DetailViewControls
private void copyIMSBC(object sender, RoutedEventArgs e) private void copyIMSBC(object sender, RoutedEventArgs e)
{ {
// aus dem aktuell selektierten IMBSC Element ein neues IMBSC Element machen und nach HAZD kopieren // aus dem aktuell selektierten IMBSC Element ein neues IMBSC Element machen und nach HAZD kopieren
if ((this.dataGridIMSBCItems.SelectedItems != null) && (this.dataGridIMSBCItems.SelectedItems.Count == 1)) if (this.dataGridIMSBCItems.SelectedItems != null)
{ {
IMSBCPosition selectedIMSBC = this.dataGridIMSBCItems.SelectedItems[0] as IMSBCPosition; foreach (IMSBCPosition selectedIMSBC in this.dataGridIMSBCItems.SelectedItems)
if (selectedIMSBC != null)
{ {
IMSBCPosition copyIMSBC = new IMSBCPosition(); IMSBCPosition copyIMSBC = new IMSBCPosition();
copyIMSBC.MessageHeader = this.hazd.MessageHeader; copyIMSBC.MessageHeader = this.hazd.MessageHeader;
copyIMSBC.HAZ = this.hazd; copyIMSBC.HAZ = this.hazd;
copyIMSBC.CopyFromIMSBC(selectedIMSBC); copyIMSBC.CopyFromIMSBC(selectedIMSBC);
copyIMSBC.Identifier = DatabaseEntity.GetNewIdentifier(this.hazd.IMSBCPositions); copyIMSBC.Identifier = DatabaseEntity.GetNewIdentifier(this.hazd.IMSBCPositions, "IMSBC-");
this.hazd.IMSBCPositions.Add(copyIMSBC); this.hazd.IMSBCPositions.Add(copyIMSBC);
this.SublistElementChanged(Message.NotificationClass.HAZD); this.SublistElementChanged(Message.NotificationClass.HAZD);
this.OnControlCacheReset(Properties.Resources.textDGDeparture); this.OnControlCacheReset(Properties.Resources.textDGDeparture);
@ -229,16 +227,15 @@ namespace ENI2.DetailViewControls
private void copyIMDG(object sender, RoutedEventArgs e) private void copyIMDG(object sender, RoutedEventArgs e)
{ {
// aus dem aktuell selektierten IMDG Element ein neues IMDG Element machen und nach HAZD kopieren // aus dem aktuell selektierten IMDG Element ein neues IMDG Element machen und nach HAZD kopieren
if ((this.dataGridIMDGItems.SelectedItems != null) && (this.dataGridIMDGItems.SelectedItems.Count == 1)) if (this.dataGridIMDGItems.SelectedItems != null)
{ {
IMDGPosition selectedIMDG = this.dataGridIMDGItems.SelectedItems[0] as IMDGPosition; foreach (IMDGPosition selectedIMDG in this.dataGridIMDGItems.SelectedItems)
if (selectedIMDG != null)
{ {
IMDGPosition copyIMDG = new IMDGPosition(); IMDGPosition copyIMDG = new IMDGPosition();
copyIMDG.MessageHeader = this.hazd.MessageHeader; copyIMDG.MessageHeader = this.hazd.MessageHeader;
copyIMDG.HAZ = this.hazd; copyIMDG.HAZ = this.hazd;
copyIMDG.CopyFromIMDG(selectedIMDG); copyIMDG.CopyFromIMDG(selectedIMDG);
copyIMDG.Identifier = DatabaseEntity.GetNewIdentifier(this.hazd.IMDGPositions); copyIMDG.Identifier = DatabaseEntity.GetNewIdentifier(this.hazd.IMDGPositions, "IMDG-");
this.hazd.IMDGPositions.Add(copyIMDG); this.hazd.IMDGPositions.Add(copyIMDG);
this.SublistElementChanged(Message.NotificationClass.HAZD); this.SublistElementChanged(Message.NotificationClass.HAZD);
this.OnControlCacheReset(Properties.Resources.textDGDeparture); this.OnControlCacheReset(Properties.Resources.textDGDeparture);
@ -249,16 +246,15 @@ namespace ENI2.DetailViewControls
private void copyIGC(object sender, RoutedEventArgs e) private void copyIGC(object sender, RoutedEventArgs e)
{ {
// aus dem aktuell selektierten IGC Element ein neues IGC Element machen und nach HAZD kopieren // aus dem aktuell selektierten IGC Element ein neues IGC Element machen und nach HAZD kopieren
if ((this.dataGridIGCItems.SelectedItems != null) && (this.dataGridIGCItems.SelectedItems.Count == 1)) if (this.dataGridIGCItems.SelectedItems != null)
{ {
IGCPosition selectedIGC = this.dataGridIGCItems.SelectedItems[0] as IGCPosition; foreach (IGCPosition selectedIGC in this.dataGridIGCItems.SelectedItems)
if (selectedIGC != null)
{ {
IGCPosition copyIGC = new IGCPosition(); IGCPosition copyIGC = new IGCPosition();
copyIGC.MessageHeader = this.hazd.MessageHeader; copyIGC.MessageHeader = this.hazd.MessageHeader;
copyIGC.HAZ = this.hazd; copyIGC.HAZ = this.hazd;
copyIGC.CopyFromIGC(selectedIGC); copyIGC.CopyFromIGC(selectedIGC);
copyIGC.Identifier = DatabaseEntity.GetNewIdentifier(this.hazd.IGCPositions); copyIGC.Identifier = DatabaseEntity.GetNewIdentifier(this.hazd.IGCPositions, "IGC-");
this.hazd.IGCPositions.Add(copyIGC); this.hazd.IGCPositions.Add(copyIGC);
this.SublistElementChanged(Message.NotificationClass.HAZD); this.SublistElementChanged(Message.NotificationClass.HAZD);
this.OnControlCacheReset(Properties.Resources.textDGDeparture); this.OnControlCacheReset(Properties.Resources.textDGDeparture);
@ -269,19 +265,21 @@ namespace ENI2.DetailViewControls
private void copyIBC(object sender, RoutedEventArgs e) private void copyIBC(object sender, RoutedEventArgs e)
{ {
// aus dem aktuell selektierten IBC Element ein neues IBC Element machen und nach HAZD kopieren // aus dem aktuell selektierten IBC Element ein neues IBC Element machen und nach HAZD kopieren
if ((this.dataGridIBCItems.SelectedItems != null) && (this.dataGridIBCItems.SelectedItems.Count == 1)) if (this.dataGridIBCItems.SelectedItems != null)
{ {
IBCPosition selectedIBC = this.dataGridIBCItems.SelectedItems[0] as IBCPosition; foreach (IBCPosition selectedIBC in this.dataGridIBCItems.SelectedItems)
if (selectedIBC != null)
{ {
IBCPosition copyIBC = new IBCPosition(); if (selectedIBC != null)
copyIBC.MessageHeader = this.hazd.MessageHeader; {
copyIBC.HAZ = this.hazd; IBCPosition copyIBC = new IBCPosition();
copyIBC.CopyFromIBC(selectedIBC); copyIBC.MessageHeader = this.hazd.MessageHeader;
copyIBC.Identifier = DatabaseEntity.GetNewIdentifier(this.hazd.IBCPositions); copyIBC.HAZ = this.hazd;
this.hazd.IBCPositions.Add(copyIBC); copyIBC.CopyFromIBC(selectedIBC);
this.SublistElementChanged(Message.NotificationClass.HAZD); copyIBC.Identifier = DatabaseEntity.GetNewIdentifier(this.hazd.IBCPositions, "IBC-");
this.OnControlCacheReset(Properties.Resources.textDGDeparture); this.hazd.IBCPositions.Add(copyIBC);
this.SublistElementChanged(Message.NotificationClass.HAZD);
this.OnControlCacheReset(Properties.Resources.textDGDeparture);
}
} }
} }
} }
@ -306,29 +304,29 @@ namespace ENI2.DetailViewControls
private void DataGridMARPOLItems_EditRequested(DatabaseEntity obj) private void DataGridMARPOLItems_EditRequested(DatabaseEntity obj)
{ {
MARPOL_Annex_I_Position marpol = obj as MARPOL_Annex_I_Position; EditMarpolDialog eld = new EditMarpolDialog();
if (marpol != null) eld.MARPOL = obj as MARPOL_Annex_I_Position;
eld.AddClicked += () =>
{ {
EditMarpolDialog eld = new EditMarpolDialog(); eld.CopyValuesToEntity();
eld.MARPOL = marpol; if (!haz.MARPOLPositions.Contains(eld.MARPOL))
eld.AddClicked += () =>
{
eld.CopyValuesToEntity();
haz.MARPOLPositions.Add(eld.MARPOL); haz.MARPOLPositions.Add(eld.MARPOL);
this.dataGridMARPOLItems.Items.Refresh(); this.dataGridMARPOLItems.Items.Refresh();
eld.MARPOL = new MARPOL_Annex_I_Position(); eld.MARPOL = new MARPOL_Annex_I_Position();
eld.MARPOL.Identifier = DatabaseEntity.GetNewIdentifier(haz.MARPOLPositions); eld.MARPOL.Identifier = DatabaseEntity.GetNewIdentifier(haz.MARPOLPositions, "MARPOL-");
eld.MARPOL.HAZ = this.haz; eld.MARPOL.HAZ = this.haz;
this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA);
}; };
if (eld.ShowDialog() ?? false) if (eld.ShowDialog() ?? false)
{ {
this.dataGridMARPOLItems.Items.Refresh(); if (!haz.MARPOLPositions.Contains(eld.MARPOL))
this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); haz.MARPOLPositions.Add(eld.MARPOL);
} this.dataGridMARPOLItems.Items.Refresh();
this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA);
} }
} }
private void DataGridMARPOLItems_AddingNewItem(object sender, System.Windows.Controls.AddingNewItemEventArgs e) private void DataGridMARPOLItems_AddingNewItem(object sender, System.Windows.Controls.AddingNewItemEventArgs e)
@ -338,26 +336,27 @@ namespace ENI2.DetailViewControls
private void DataGridMARPOLItems_CreateRequested() private void DataGridMARPOLItems_CreateRequested()
{ {
MARPOL_Annex_I_Position marpol = new MARPOL_Annex_I_Position();
marpol.Identifier = DatabaseEntity.GetNewIdentifier(this.haz.MARPOLPositions);
EditMarpolDialog ebd = new EditMarpolDialog(); EditMarpolDialog ebd = new EditMarpolDialog();
ebd.MARPOL = marpol; ebd.MARPOL = new MARPOL_Annex_I_Position();
ebd.MARPOL.Identifier = DatabaseEntity.GetNewIdentifier(this.haz.MARPOLPositions, "MARPOL-");
ebd.MARPOL.HAZ = this.haz;
ebd.AddClicked += () => ebd.AddClicked += () =>
{ {
ebd.CopyValuesToEntity(); ebd.CopyValuesToEntity();
this.haz.MARPOLPositions.Add(ebd.MARPOL); if (!haz.MARPOLPositions.Contains(ebd.MARPOL))
ebd.MARPOL.HAZ = this.haz; haz.MARPOLPositions.Add(ebd.MARPOL);
this.dataGridMARPOLItems.Items.Refresh(); this.dataGridMARPOLItems.Items.Refresh();
ebd.MARPOL = new MARPOL_Annex_I_Position(); ebd.MARPOL = new MARPOL_Annex_I_Position();
ebd.MARPOL.Identifier = DatabaseEntity.GetNewIdentifier(this.haz.MARPOLPositions); ebd.MARPOL.HAZ = this.haz;
ebd.MARPOL.Identifier = DatabaseEntity.GetNewIdentifier(this.haz.MARPOLPositions, "MARPOL-");
this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA);
}; };
if (ebd.ShowDialog() ?? false) if (ebd.ShowDialog() ?? false)
{ {
marpol.HAZ = haz; if (!haz.MARPOLPositions.Contains(ebd.MARPOL))
haz.MARPOLPositions.Add(marpol); haz.MARPOLPositions.Add(ebd.MARPOL);
this.dataGridMARPOLItems.Items.Refresh(); this.dataGridMARPOLItems.Items.Refresh();
this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA);
} }
@ -383,28 +382,27 @@ namespace ENI2.DetailViewControls
private void DataGridIMSBCItems_EditRequested(DatabaseEntity obj) private void DataGridIMSBCItems_EditRequested(DatabaseEntity obj)
{ {
IMSBCPosition imsbc = obj as IMSBCPosition; EditIMSBCDialog eld = new EditIMSBCDialog();
if (imsbc != null) eld.IMSBC = obj as IMSBCPosition;
eld.AddClicked += () =>
{ {
EditIMSBCDialog eld = new EditIMSBCDialog(); eld.CopyValuesToEntity();
eld.IMSBC = imsbc; if (!haz.IMSBCPositions.Contains(eld.IMSBC))
eld.AddClicked += () =>
{
eld.CopyValuesToEntity();
haz.IMSBCPositions.Add(eld.IMSBC); haz.IMSBCPositions.Add(eld.IMSBC);
this.dataGridIMSBCItems.Items.Refresh(); this.dataGridIMSBCItems.Items.Refresh();
eld.IMSBC = new IMSBCPosition(); eld.IMSBC = new IMSBCPosition();
eld.IMSBC.Identifier = DatabaseEntity.GetNewIdentifier(this.haz.IMSBCPositions); eld.IMSBC.Identifier = DatabaseEntity.GetNewIdentifier(this.haz.IMSBCPositions, "IMSBC-");
eld.IMSBC.HAZ = this.haz; eld.IMSBC.HAZ = this.haz;
this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA);
}; };
if (eld.ShowDialog() ?? false) if (eld.ShowDialog() ?? false)
{ {
this.dataGridIMSBCItems.Items.Refresh(); if (!haz.IMSBCPositions.Contains(eld.IMSBC))
this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); haz.IMSBCPositions.Add(eld.IMSBC);
} this.dataGridIMSBCItems.Items.Refresh();
this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA);
} }
} }
@ -415,26 +413,27 @@ namespace ENI2.DetailViewControls
private void DataGridIMSBCItems_CreateRequested() private void DataGridIMSBCItems_CreateRequested()
{ {
IMSBCPosition imsbc = new IMSBCPosition();
imsbc.Identifier = DatabaseEntity.GetNewIdentifier(this.haz.IMSBCPositions);
EditIMSBCDialog ebd = new EditIMSBCDialog(); EditIMSBCDialog ebd = new EditIMSBCDialog();
ebd.IMSBC = imsbc; ebd.IMSBC = new IMSBCPosition();
ebd.IMSBC.Identifier = DatabaseEntity.GetNewIdentifier(this.haz.IMSBCPositions, "IMSBC-");
ebd.IMSBC.HAZ = this.haz;
ebd.AddClicked += () => ebd.AddClicked += () =>
{ {
ebd.CopyValuesToEntity(); ebd.CopyValuesToEntity();
this.haz.IMSBCPositions.Add(ebd.IMSBC); if (!haz.IMSBCPositions.Contains(ebd.IMSBC))
ebd.IMSBC.HAZ = this.haz; this.haz.IMSBCPositions.Add(ebd.IMSBC);
this.dataGridIMSBCItems.Items.Refresh(); this.dataGridIMSBCItems.Items.Refresh();
ebd.IMSBC = new IMSBCPosition(); ebd.IMSBC = new IMSBCPosition();
ebd.IMSBC.Identifier = DatabaseEntity.GetNewIdentifier(this.haz.IMSBCPositions); ebd.IMSBC.HAZ = this.haz;
ebd.IMSBC.Identifier = DatabaseEntity.GetNewIdentifier(this.haz.IMSBCPositions, "IMSBC-");
this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA);
}; };
if (ebd.ShowDialog() ?? false) if (ebd.ShowDialog() ?? false)
{ {
imsbc.HAZ = haz; if (!haz.IMSBCPositions.Contains(ebd.IMSBC))
haz.IMSBCPositions.Add(imsbc); haz.IMSBCPositions.Add(ebd.IMSBC);
this.dataGridIMSBCItems.Items.Refresh(); this.dataGridIMSBCItems.Items.Refresh();
this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA);
} }
@ -460,28 +459,27 @@ namespace ENI2.DetailViewControls
private void DataGridIGCItems_EditRequested(DatabaseEntity obj) private void DataGridIGCItems_EditRequested(DatabaseEntity obj)
{ {
IGCPosition igc = obj as IGCPosition; EditIGCDialog eld = new EditIGCDialog();
if (igc != null) eld.IGC = obj as IGCPosition;
eld.AddClicked += () =>
{ {
EditIGCDialog eld = new EditIGCDialog(); eld.CopyValuesToEntity();
eld.IGC = igc; if(!haz.IGCPositions.Contains(eld.IGC))
eld.AddClicked += () =>
{
eld.CopyValuesToEntity();
haz.IGCPositions.Add(eld.IGC); haz.IGCPositions.Add(eld.IGC);
this.dataGridIGCItems.Items.Refresh(); this.dataGridIGCItems.Items.Refresh();
eld.IGC = new IGCPosition(); eld.IGC = new IGCPosition();
eld.IGC.Identifier = DatabaseEntity.GetNewIdentifier(this.haz.IGCPositions); eld.IGC.Identifier = DatabaseEntity.GetNewIdentifier(this.haz.IGCPositions, "IGC-");
eld.IGC.HAZ = this.haz; eld.IGC.HAZ = this.haz;
this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA);
}; };
if (eld.ShowDialog() ?? false) if (eld.ShowDialog() ?? false)
{ {
this.dataGridIGCItems.Items.Refresh(); if (!haz.IGCPositions.Contains(eld.IGC))
this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); haz.IGCPositions.Add(eld.IGC);
} this.dataGridIGCItems.Items.Refresh();
this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA);
} }
} }
@ -492,26 +490,27 @@ namespace ENI2.DetailViewControls
private void DataGridIGCItems_CreateRequested() private void DataGridIGCItems_CreateRequested()
{ {
IGCPosition igc = new IGCPosition();
igc.Identifier = DatabaseEntity.GetNewIdentifier(this.haz.IGCPositions);
EditIGCDialog ebd = new EditIGCDialog(); EditIGCDialog ebd = new EditIGCDialog();
ebd.IGC = igc; ebd.IGC = new IGCPosition();
ebd.IGC.Identifier = DatabaseEntity.GetNewIdentifier(this.haz.IGCPositions, "IGC-");
ebd.IGC.HAZ = this.haz;
ebd.AddClicked += () => ebd.AddClicked += () =>
{ {
ebd.CopyValuesToEntity(); ebd.CopyValuesToEntity();
this.haz.IGCPositions.Add(ebd.IGC); if(!this.haz.IGCPositions.Contains(ebd.IGC))
ebd.IGC.HAZ = this.haz; this.haz.IGCPositions.Add(ebd.IGC);
this.dataGridIGCItems.Items.Refresh(); this.dataGridIGCItems.Items.Refresh();
ebd.IGC = new IGCPosition(); ebd.IGC = new IGCPosition();
ebd.IGC.Identifier = DatabaseEntity.GetNewIdentifier(this.haz.IGCPositions); ebd.IGC.HAZ = this.haz;
ebd.IGC.Identifier = DatabaseEntity.GetNewIdentifier(this.haz.IGCPositions, "IGC-");
this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA);
}; };
if (ebd.ShowDialog() ?? false) if (ebd.ShowDialog() ?? false)
{ {
igc.HAZ = haz; if(!this.haz.IGCPositions.Contains(ebd.IGC))
haz.IGCPositions.Add(igc); haz.IGCPositions.Add(ebd.IGC);
this.dataGridIGCItems.Items.Refresh(); this.dataGridIGCItems.Items.Refresh();
this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA);
} }
@ -537,28 +536,27 @@ namespace ENI2.DetailViewControls
private void DataGridIBCItems_EditRequested(DatabaseEntity obj) private void DataGridIBCItems_EditRequested(DatabaseEntity obj)
{ {
IBCPosition ibc = obj as IBCPosition; EditIBCDialog eld = new EditIBCDialog();
if (ibc != null) eld.IBC = obj as IBCPosition;
eld.AddClicked += () =>
{ {
EditIBCDialog eld = new EditIBCDialog(); eld.CopyValuesToEntity();
eld.IBC = ibc; if(!haz.IBCPositions.Contains(eld.IBC))
eld.AddClicked += () =>
{
eld.CopyValuesToEntity();
haz.IBCPositions.Add(eld.IBC); haz.IBCPositions.Add(eld.IBC);
this.dataGridIBCItems.Items.Refresh(); this.dataGridIBCItems.Items.Refresh();
eld.IBC = new IBCPosition(); eld.IBC = new IBCPosition();
eld.IBC.Identifier = DatabaseEntity.GetNewIdentifier(this.haz.IBCPositions); eld.IBC.Identifier = DatabaseEntity.GetNewIdentifier(this.haz.IBCPositions, "IBC-");
eld.IBC.HAZ = this.haz; eld.IBC.HAZ = this.haz;
this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA);
}; };
if (eld.ShowDialog() ?? false) if (eld.ShowDialog() ?? false)
{ {
this.dataGridIBCItems.Items.Refresh(); if (!haz.IBCPositions.Contains(eld.IBC))
this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); haz.IBCPositions.Add(eld.IBC);
} this.dataGridIBCItems.Items.Refresh();
this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA);
} }
} }
@ -569,26 +567,27 @@ namespace ENI2.DetailViewControls
private void DataGridIBCItems_CreateRequested() private void DataGridIBCItems_CreateRequested()
{ {
IBCPosition ibc = new IBCPosition();
ibc.Identifier = DatabaseEntity.GetNewIdentifier(this.haz.IBCPositions);
EditIBCDialog ebd = new EditIBCDialog(); EditIBCDialog ebd = new EditIBCDialog();
ebd.IBC = ibc; ebd.IBC = new IBCPosition();
ebd.IBC.Identifier = DatabaseEntity.GetNewIdentifier(this.haz.IBCPositions, "IBC-");
ebd.IBC.HAZ = this.haz;
ebd.AddClicked += () => ebd.AddClicked += () =>
{ {
ebd.CopyValuesToEntity(); ebd.CopyValuesToEntity();
this.haz.IBCPositions.Add(ebd.IBC); if(!this.haz.IBCPositions.Contains(ebd.IBC))
ebd.IBC.HAZ = this.haz; this.haz.IBCPositions.Add(ebd.IBC);
this.dataGridIBCItems.Items.Refresh(); this.dataGridIBCItems.Items.Refresh();
ebd.IBC = new IBCPosition(); ebd.IBC = new IBCPosition();
ebd.IBC.Identifier = DatabaseEntity.GetNewIdentifier(this.haz.IBCPositions); ebd.IBC.HAZ = this.haz;
ebd.IBC.Identifier = DatabaseEntity.GetNewIdentifier(this.haz.IBCPositions, "IBC-");
this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA);
}; };
if (ebd.ShowDialog() ?? false) if (ebd.ShowDialog() ?? false)
{ {
ibc.HAZ = haz; if(!this.haz.IBCPositions.Contains(ebd.IBC))
haz.IBCPositions.Add(ibc); haz.IBCPositions.Add(ebd.IBC);
this.dataGridIBCItems.Items.Refresh(); this.dataGridIBCItems.Items.Refresh();
this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA);
} }
@ -614,28 +613,27 @@ namespace ENI2.DetailViewControls
private void DataGridIMDGItems_EditRequested(DatabaseEntity obj) private void DataGridIMDGItems_EditRequested(DatabaseEntity obj)
{ {
IMDGPosition imdg = obj as IMDGPosition; EditIMDGDialog eld = new EditIMDGDialog();
if (imdg != null) eld.IMDG = obj as IMDGPosition;
eld.AddClicked += () =>
{ {
EditIMDGDialog eld = new EditIMDGDialog(); eld.CopyValuesToEntity();
eld.IMDG = imdg; if(!haz.IMDGPositions.Contains(eld.IMDG))
eld.AddClicked += () =>
{
eld.CopyValuesToEntity();
haz.IMDGPositions.Add(eld.IMDG); haz.IMDGPositions.Add(eld.IMDG);
this.dataGridIMDGItems.Items.Refresh(); this.dataGridIMDGItems.Items.Refresh();
eld.IMDG = new IMDGPosition(); eld.IMDG = new IMDGPosition();
eld.IMDG.Identifier = DatabaseEntity.GetNewIdentifier(this.haz.IMDGPositions); eld.IMDG.Identifier = DatabaseEntity.GetNewIdentifier(this.haz.IMDGPositions, "IMDG-");
eld.IMDG.HAZ = this.haz; eld.IMDG.HAZ = this.haz;
this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA);
}; };
if (eld.ShowDialog() ?? false) if (eld.ShowDialog() ?? false)
{ {
this.dataGridIMDGItems.Items.Refresh(); if (!haz.IMDGPositions.Contains(eld.IMDG))
this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); haz.IMDGPositions.Add(eld.IMDG);
} this.dataGridIMDGItems.Items.Refresh();
this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA);
} }
} }
@ -645,27 +643,28 @@ namespace ENI2.DetailViewControls
} }
private void DataGridIMDGItems_CreateRequested() private void DataGridIMDGItems_CreateRequested()
{ {
IMDGPosition imdg = new IMDGPosition();
imdg.Identifier = DatabaseEntity.GetNewIdentifier(this.haz.IMDGPositions);
EditIMDGDialog ebd = new EditIMDGDialog(); EditIMDGDialog ebd = new EditIMDGDialog();
ebd.IMDG = imdg; ebd.IMDG = new IMDGPosition();
ebd.IMDG.Identifier = DatabaseEntity.GetNewIdentifier(this.haz.IMDGPositions, "IMDG-");
ebd.IMDG.HAZ = this.haz;
ebd.AddClicked += () => ebd.AddClicked += () =>
{ {
ebd.CopyValuesToEntity(); ebd.CopyValuesToEntity();
this.haz.IMDGPositions.Add(ebd.IMDG); if(!this.haz.IMDGPositions.Contains(ebd.IMDG))
ebd.IMDG.HAZ = this.haz; this.haz.IMDGPositions.Add(ebd.IMDG);
this.dataGridIMDGItems.Items.Refresh(); this.dataGridIMDGItems.Items.Refresh();
ebd.IMDG = new IMDGPosition(); ebd.IMDG = new IMDGPosition();
ebd.IMDG.Identifier = DatabaseEntity.GetNewIdentifier(this.haz.IMDGPositions); ebd.IMDG.HAZ = this.haz;
ebd.IMDG.Identifier = DatabaseEntity.GetNewIdentifier(this.haz.IMDGPositions, "IMDG-");
this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA);
}; };
if (ebd.ShowDialog() ?? false) if (ebd.ShowDialog() ?? false)
{ {
imdg.HAZ = haz; if(!haz.IMDGPositions.Contains(ebd.IMDG))
haz.IMDGPositions.Add(imdg); haz.IMDGPositions.Add(ebd.IMDG);
this.dataGridIMDGItems.Items.Refresh(); this.dataGridIMDGItems.Items.Refresh();
this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA);
} }

View File

@ -142,27 +142,29 @@ namespace ENI2.DetailViewControls
private void DataGridBKRD_CreateRequested() private void DataGridBKRD_CreateRequested()
{ {
BRKD brkd = new BRKD();
brkd.Identifier = BRKD.GetNewIdentifier(_bkrdMessage.Elements);
EditBKRDialog ebd = new EditBKRDialog(); EditBKRDialog ebd = new EditBKRDialog();
ebd.BRKD = brkd;
ebd.IsDeparture = true; ebd.IsDeparture = true;
ebd.BRKD = new BRKD();
ebd.BRKD.Identifier = BRKD.GetNewIdentifier(_bkrdMessage.Elements);
ebd.BRKD.MessageHeader = this._bkrdMessage;
ebd.AddClicked += () => ebd.AddClicked += () =>
{ {
ebd.CopyValuesToEntity(); ebd.CopyValuesToEntity();
this._bkrdMessage.Elements.Add(ebd.BRKD); if(!this._bkrdMessage.Elements.Contains(ebd.BRKD))
ebd.BRKD.MessageHeader = _bkrdMessage; this._bkrdMessage.Elements.Add(ebd.BRKD);
this.dataGridBKRD.Items.Refresh(); this.dataGridBKRD.Items.Refresh();
ebd.BRKD = new BRKD(); ebd.BRKD = new BRKD();
ebd.BRKD.MessageHeader = _bkrdMessage;
ebd.BRKD.Identifier = BRKD.GetNewIdentifier(_bkrdMessage.Elements); ebd.BRKD.Identifier = BRKD.GetNewIdentifier(_bkrdMessage.Elements);
this.SublistElementChanged(Message.NotificationClass.BKRD); this.SublistElementChanged(Message.NotificationClass.BKRD);
}; };
if (ebd.ShowDialog() ?? false) if (ebd.ShowDialog() ?? false)
{ {
brkd.MessageHeader = _bkrdMessage; if(!_bkrdMessage.Elements.Contains(ebd.BRKD))
_bkrdMessage.Elements.Add(brkd); _bkrdMessage.Elements.Add(ebd.BRKD);
this.dataGridBKRD.Items.Refresh(); this.dataGridBKRD.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.BKRD); this.SublistElementChanged(Message.NotificationClass.BKRD);
} }
@ -184,29 +186,28 @@ namespace ENI2.DetailViewControls
private void DataGridBKRD_EditRequested(DatabaseEntity obj) private void DataGridBKRD_EditRequested(DatabaseEntity obj)
{ {
BRKD brkd = obj as BRKD; EditBKRDialog eld = new EditBKRDialog();
if (brkd != null) eld.IsDeparture = true;
eld.BRKD = obj as BRKD;
eld.AddClicked += () =>
{ {
EditBKRDialog eld = new EditBKRDialog(); eld.CopyValuesToEntity();
eld.IsDeparture = true; if(!_bkrdMessage.Elements.Contains(eld.BRKD))
eld.BRKD = brkd;
eld.AddClicked += () =>
{
eld.CopyValuesToEntity();
_bkrdMessage.Elements.Add(eld.BRKD); _bkrdMessage.Elements.Add(eld.BRKD);
this.dataGridBKRD.Items.Refresh(); this.dataGridBKRD.Items.Refresh();
eld.BRKD = new BRKD(); eld.BRKD = new BRKD();
eld.BRKD.Identifier = BRKD.GetNewIdentifier(_bkrdMessage.Elements); eld.BRKD.Identifier = BRKD.GetNewIdentifier(_bkrdMessage.Elements);
eld.BRKD.MessageHeader = _bkrdMessage; eld.BRKD.MessageHeader = _bkrdMessage;
this.SublistElementChanged(Message.NotificationClass.BKRD); this.SublistElementChanged(Message.NotificationClass.BKRD);
}; };
if (eld.ShowDialog() ?? false) if (eld.ShowDialog() ?? false)
{ {
this.dataGridBKRD.Items.Refresh(); if (!_bkrdMessage.Elements.Contains(eld.BRKD))
this.SublistElementChanged(Message.NotificationClass.BKRD); _bkrdMessage.Elements.Add(eld.BRKD);
} this.dataGridBKRD.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.BKRD);
} }
} }

View File

@ -85,7 +85,15 @@
</GroupBox> </GroupBox>
</TabItem> </TabItem>
<TabItem Header="{x:Static p:Resources.textPortsOfCallLast30Days}" Name="tabPortsOfCallLast30Days"> <TabItem Header="{x:Static p:Resources.textPortsOfCallLast30Days}" Name="tabPortsOfCallLast30Days">
<enictrl:ENIDataGrid Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2" x:Name="dataGridPortOfCallLast30Days" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" <Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal">
<Button Name="buttonImportFromSEC" Margin="2" Content="{x:Static p:Resources.textImportFromSEC}" Width="120" VerticalAlignment="Center" Click="buttonImportFromSEC_Click" />
</StackPanel>
<enictrl:ENIDataGrid Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" x:Name="dataGridPortOfCallLast30Days" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
SelectionMode="Single" AutoGenerateColumns="False" Margin="0,5,0,0"> SelectionMode="Single" AutoGenerateColumns="False" Margin="0,5,0,0">
<DataGrid.Columns> <DataGrid.Columns>
<DataGridTextColumn Header="" Binding="{Binding Identifier}" IsReadOnly="True" /> <DataGridTextColumn Header="" Binding="{Binding Identifier}" IsReadOnly="True" />
@ -107,6 +115,7 @@
<DataGridTextColumn Header="{x:Static p:Resources.textCrewMembersJoinedGrid}" Binding="{Binding CrewMembersJoinedText, Mode=TwoWay}" IsReadOnly="True" Width="0.4*" /> <DataGridTextColumn Header="{x:Static p:Resources.textCrewMembersJoinedGrid}" Binding="{Binding CrewMembersJoinedText, Mode=TwoWay}" IsReadOnly="True" Width="0.4*" />
</DataGrid.Columns> </DataGrid.Columns>
</enictrl:ENIDataGrid> </enictrl:ENIDataGrid>
</Grid>
</TabItem> </TabItem>
<TabItem Header="{x:Static p:Resources.textVisitsInfectedAreas}" Name="tabInfectedAreas"> <TabItem Header="{x:Static p:Resources.textVisitsInfectedAreas}" Name="tabInfectedAreas">
<Grid> <Grid>

View File

@ -2,6 +2,7 @@
// Description: MDH Meldung Bearbeitungsseite // Description: MDH Meldung Bearbeitungsseite
// //
using System;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using ENI2.EditControls; using ENI2.EditControls;
@ -17,7 +18,9 @@ namespace ENI2.DetailViewControls
public partial class MaritimeHealthDeclarationDetailControl : DetailBaseControl public partial class MaritimeHealthDeclarationDetailControl : DetailBaseControl
{ {
private Message _mdhMessage; private Message _mdhMessage;
private Message _secMessage;
private MDH _mdh; private MDH _mdh;
private SEC _sec;
public MaritimeHealthDeclarationDetailControl() public MaritimeHealthDeclarationDetailControl()
{ {
@ -32,6 +35,11 @@ namespace ENI2.DetailViewControls
foreach (Message aMessage in this.Messages) foreach (Message aMessage in this.Messages)
{ {
if (aMessage.MessageNotificationClass == Message.NotificationClass.MDH) { this._mdhMessage = aMessage; this.ControlMessages.Add(aMessage); } if (aMessage.MessageNotificationClass == Message.NotificationClass.MDH) { this._mdhMessage = aMessage; this.ControlMessages.Add(aMessage); }
if (aMessage.MessageNotificationClass == Message.NotificationClass.SEC)
{
this._secMessage = aMessage;
if (this._secMessage.Elements.Count > 0) this._sec = this._secMessage.Elements[0] as SEC;
}
} }
#region init MDH #region init MDH
@ -208,30 +216,64 @@ namespace ENI2.DetailViewControls
} }
private void buttonImportFromSEC_Click(object sender, RoutedEventArgs e)
{
if(this._mdh.PortOfCallLast30Days.Count > 0)
{
MessageBox.Show(Properties.Resources.textOnlyIfGridIsEmpty, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Warning);
}
else
{
if(this._sec != null)
{
foreach(LastTenPortFacilitiesCalled l10fc in _sec.LastTenPortFacilitesCalled)
{
if(l10fc.PortFacilityDateOfDeparture.HasValue &&
((DateTime.Now - l10fc.PortFacilityDateOfDeparture.Value).TotalDays < 31))
{
PortOfCallLast30Days poc30 = new PortOfCallLast30Days();
poc30.PortOfCallLast30DaysCrewMembersJoined = false;
poc30.PortOfCallLast30DaysDateOfDeparture = l10fc.PortFacilityDateOfDeparture;
poc30.PortOfCallLast30DaysLocode = l10fc.PortFacilityPortLoCode;
poc30.MDH = this._mdh;
this._mdh.PortOfCallLast30Days.Add(poc30);
}
}
if (this._mdh.PortOfCallLast30Days.Count > 0)
{
this.dataGridPortOfCallLast30Days.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.MDH);
}
}
}
}
#region SanitaryMeasures Grid #region SanitaryMeasures Grid
private void DataGridSanitaryMeasures_CreateRequested() private void DataGridSanitaryMeasures_CreateRequested()
{ {
SanitaryMeasuresDetail smDetail = new SanitaryMeasuresDetail();
smDetail.Identifier = SanitaryMeasuresDetail.GetNewIdentifier(_mdh.SanitaryMeasuresDetails);
EditSanitaryMeasureDialog epd = new EditSanitaryMeasureDialog(); EditSanitaryMeasureDialog epd = new EditSanitaryMeasureDialog();
epd.SanitaryMeasureDetail = smDetail; epd.SanitaryMeasureDetail = new SanitaryMeasuresDetail();
epd.SanitaryMeasureDetail.Identifier = SanitaryMeasuresDetail.GetNewIdentifier(_mdh.SanitaryMeasuresDetails);
epd.SanitaryMeasureDetail.MDH = this._mdh;
epd.AddClicked += () => epd.AddClicked += () =>
{ {
epd.CopyValuesToEntity(); epd.CopyValuesToEntity();
epd.SanitaryMeasureDetail.MDH = this._mdh; if(!this._mdh.SanitaryMeasuresDetails.Contains(epd.SanitaryMeasureDetail))
this._mdh.SanitaryMeasuresDetails.Add(epd.SanitaryMeasureDetail); this._mdh.SanitaryMeasuresDetails.Add(epd.SanitaryMeasureDetail);
this.dataGridSanitaryMeasures.Items.Refresh(); this.dataGridSanitaryMeasures.Items.Refresh();
epd.SanitaryMeasureDetail = new SanitaryMeasuresDetail(); epd.SanitaryMeasureDetail = new SanitaryMeasuresDetail();
epd.SanitaryMeasureDetail.Identifier = SanitaryMeasuresDetail.GetNewIdentifier(_mdh.SanitaryMeasuresDetails); epd.SanitaryMeasureDetail.Identifier = SanitaryMeasuresDetail.GetNewIdentifier(_mdh.SanitaryMeasuresDetails);
epd.SanitaryMeasureDetail.MDH = this._mdh;
this.SublistElementChanged(Message.NotificationClass.MDH); this.SublistElementChanged(Message.NotificationClass.MDH);
}; };
if (epd.ShowDialog() ?? false) if (epd.ShowDialog() ?? false)
{ {
_mdh.SanitaryMeasuresDetails.Add(epd.SanitaryMeasureDetail); if(!_mdh.SanitaryMeasuresDetails.Contains(epd.SanitaryMeasureDetail))
epd.SanitaryMeasureDetail.MDH = this._mdh; _mdh.SanitaryMeasuresDetails.Add(epd.SanitaryMeasureDetail);
this.dataGridSanitaryMeasures.Items.Refresh(); this.dataGridSanitaryMeasures.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.MDH); this.SublistElementChanged(Message.NotificationClass.MDH);
} }
@ -263,13 +305,14 @@ namespace ENI2.DetailViewControls
this.dataGridSanitaryMeasures.Items.Refresh(); this.dataGridSanitaryMeasures.Items.Refresh();
ecpd.SanitaryMeasureDetail = new SanitaryMeasuresDetail(); ecpd.SanitaryMeasureDetail = new SanitaryMeasuresDetail();
ecpd.SanitaryMeasureDetail.Identifier = SanitaryMeasuresDetail.GetNewIdentifier(_mdh.SanitaryMeasuresDetails); ecpd.SanitaryMeasureDetail.Identifier = SanitaryMeasuresDetail.GetNewIdentifier(_mdh.SanitaryMeasuresDetails);
ecpd.SanitaryMeasureDetail.MDH = this._mdh;
this.SublistElementChanged(Message.NotificationClass.MDH);
}; };
if (ecpd.ShowDialog() ?? false) if (ecpd.ShowDialog() ?? false)
{ {
if (!_mdh.SanitaryMeasuresDetails.Contains(ecpd.SanitaryMeasureDetail)) if (!_mdh.SanitaryMeasuresDetails.Contains(ecpd.SanitaryMeasureDetail))
_mdh.SanitaryMeasuresDetails.Add(ecpd.SanitaryMeasureDetail); _mdh.SanitaryMeasuresDetails.Add(ecpd.SanitaryMeasureDetail);
this.dataGridSanitaryMeasures.Items.Refresh(); this.dataGridSanitaryMeasures.Items.Refresh();
// signal up
this.SublistElementChanged(Message.NotificationClass.MDH); this.SublistElementChanged(Message.NotificationClass.MDH);
} }
} }
@ -285,26 +328,27 @@ namespace ENI2.DetailViewControls
private void DataGridInfectedAreas_CreateRequested() private void DataGridInfectedAreas_CreateRequested()
{ {
InfectedArea ia = new InfectedArea();
ia.Identifier = InfectedArea.GetNewIdentifier(_mdh.InfectedAreas);
EditInfectedAreaDialog epd = new EditInfectedAreaDialog(); EditInfectedAreaDialog epd = new EditInfectedAreaDialog();
epd.InfectedArea = ia; epd.InfectedArea = new InfectedArea();
epd.InfectedArea.Identifier = InfectedArea.GetNewIdentifier(_mdh.InfectedAreas);
epd.InfectedArea.MDH = this._mdh;
epd.AddClicked += () => epd.AddClicked += () =>
{ {
epd.CopyValuesToEntity(); epd.CopyValuesToEntity();
epd.InfectedArea.MDH = this._mdh; if(!this._mdh.InfectedAreas.Contains(epd.InfectedArea))
this._mdh.InfectedAreas.Add(epd.InfectedArea); this._mdh.InfectedAreas.Add(epd.InfectedArea);
this.dataGridInfectedAreas.Items.Refresh(); this.dataGridInfectedAreas.Items.Refresh();
epd.InfectedArea = new InfectedArea(); epd.InfectedArea = new InfectedArea();
epd.InfectedArea.MDH = this._mdh;
epd.InfectedArea.Identifier = InfectedArea.GetNewIdentifier(_mdh.InfectedAreas); epd.InfectedArea.Identifier = InfectedArea.GetNewIdentifier(_mdh.InfectedAreas);
this.SublistElementChanged(Message.NotificationClass.MDH); this.SublistElementChanged(Message.NotificationClass.MDH);
}; };
if (epd.ShowDialog() ?? false) if (epd.ShowDialog() ?? false)
{ {
_mdh.InfectedAreas.Add(epd.InfectedArea); if(!this._mdh.InfectedAreas.Contains(epd.InfectedArea))
epd.InfectedArea.MDH = this._mdh; _mdh.InfectedAreas.Add(epd.InfectedArea);
this.dataGridInfectedAreas.Items.Refresh(); this.dataGridInfectedAreas.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.MDH); this.SublistElementChanged(Message.NotificationClass.MDH);
} }
@ -335,14 +379,15 @@ namespace ENI2.DetailViewControls
_mdh.InfectedAreas.Add(ecpd.InfectedArea); _mdh.InfectedAreas.Add(ecpd.InfectedArea);
this.dataGridInfectedAreas.Items.Refresh(); this.dataGridInfectedAreas.Items.Refresh();
ecpd.InfectedArea= new InfectedArea(); ecpd.InfectedArea= new InfectedArea();
ecpd.InfectedArea.MDH = this._mdh;
ecpd.InfectedArea.Identifier = InfectedArea.GetNewIdentifier(_mdh.InfectedAreas); ecpd.InfectedArea.Identifier = InfectedArea.GetNewIdentifier(_mdh.InfectedAreas);
this.SublistElementChanged(Message.NotificationClass.MDH);
}; };
if (ecpd.ShowDialog() ?? false) if (ecpd.ShowDialog() ?? false)
{ {
if (!_mdh.InfectedAreas.Contains(ecpd.InfectedArea)) if (!_mdh.InfectedAreas.Contains(ecpd.InfectedArea))
_mdh.InfectedAreas.Add(ecpd.InfectedArea); _mdh.InfectedAreas.Add(ecpd.InfectedArea);
this.dataGridInfectedAreas.Items.Refresh(); this.dataGridInfectedAreas.Items.Refresh();
// signal up
this.SublistElementChanged(Message.NotificationClass.MDH); this.SublistElementChanged(Message.NotificationClass.MDH);
} }
} }
@ -358,26 +403,27 @@ namespace ENI2.DetailViewControls
private void DataGridPortOfCallLast30Days_CreateRequested() private void DataGridPortOfCallLast30Days_CreateRequested()
{ {
PortOfCallLast30Days poc30 = new PortOfCallLast30Days();
poc30.Identifier = PortOfCallLast30Days.GetNewIdentifier(_mdh.PortOfCallLast30Days);
EditPortOfCallLast30DaysDialog epd = new EditPortOfCallLast30DaysDialog(); EditPortOfCallLast30DaysDialog epd = new EditPortOfCallLast30DaysDialog();
epd.PocLast30Days = poc30; epd.PocLast30Days = new PortOfCallLast30Days();
epd.PocLast30Days.Identifier = PortOfCallLast30Days.GetNewIdentifier(_mdh.PortOfCallLast30Days);
epd.PocLast30Days.MDH = this._mdh;
epd.AddClicked += () => epd.AddClicked += () =>
{ {
epd.CopyValuesToEntity(); epd.CopyValuesToEntity();
epd.PocLast30Days.MDH = this._mdh; if(!this._mdh.PortOfCallLast30Days.Contains(epd.PocLast30Days))
this._mdh.PortOfCallLast30Days.Add(epd.PocLast30Days); this._mdh.PortOfCallLast30Days.Add(epd.PocLast30Days);
this.dataGridPortOfCallLast30Days.Items.Refresh(); this.dataGridPortOfCallLast30Days.Items.Refresh();
epd.PocLast30Days = new PortOfCallLast30Days(); epd.PocLast30Days = new PortOfCallLast30Days();
epd.PocLast30Days.MDH = this._mdh;
epd.PocLast30Days.Identifier = PortOfCallLast30Days.GetNewIdentifier(_mdh.PortOfCallLast30Days); epd.PocLast30Days.Identifier = PortOfCallLast30Days.GetNewIdentifier(_mdh.PortOfCallLast30Days);
this.SublistElementChanged(Message.NotificationClass.MDH); this.SublistElementChanged(Message.NotificationClass.MDH);
}; };
if (epd.ShowDialog() ?? false) if (epd.ShowDialog() ?? false)
{ {
_mdh.PortOfCallLast30Days.Add(epd.PocLast30Days); if(!_mdh.PortOfCallLast30Days.Contains(epd.PocLast30Days))
epd.PocLast30Days.MDH = this._mdh; _mdh.PortOfCallLast30Days.Add(epd.PocLast30Days);
this.dataGridPortOfCallLast30Days.Items.Refresh(); this.dataGridPortOfCallLast30Days.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.MDH); this.SublistElementChanged(Message.NotificationClass.MDH);
} }
@ -408,14 +454,15 @@ namespace ENI2.DetailViewControls
_mdh.PortOfCallLast30Days.Add(ecpd.PocLast30Days); _mdh.PortOfCallLast30Days.Add(ecpd.PocLast30Days);
this.dataGridPortOfCallLast30Days.Items.Refresh(); this.dataGridPortOfCallLast30Days.Items.Refresh();
ecpd.PocLast30Days = new PortOfCallLast30Days(); ecpd.PocLast30Days = new PortOfCallLast30Days();
ecpd.PocLast30Days.MDH = this._mdh;
ecpd.PocLast30Days.Identifier = PortOfCallLast30Days.GetNewIdentifier(_mdh.PortOfCallLast30Days); ecpd.PocLast30Days.Identifier = PortOfCallLast30Days.GetNewIdentifier(_mdh.PortOfCallLast30Days);
this.SublistElementChanged(Message.NotificationClass.MDH);
}; };
if (ecpd.ShowDialog() ?? false) if (ecpd.ShowDialog() ?? false)
{ {
if (!_mdh.PortOfCallLast30Days.Contains(ecpd.PocLast30Days)) if (!_mdh.PortOfCallLast30Days.Contains(ecpd.PocLast30Days))
_mdh.PortOfCallLast30Days.Add(ecpd.PocLast30Days); _mdh.PortOfCallLast30Days.Add(ecpd.PocLast30Days);
this.dataGridPortOfCallLast30Days.Items.Refresh(); this.dataGridPortOfCallLast30Days.Items.Refresh();
// signal up
this.SublistElementChanged(Message.NotificationClass.MDH); this.SublistElementChanged(Message.NotificationClass.MDH);
} }
} }
@ -444,6 +491,6 @@ namespace ENI2.DetailViewControls
} }
#endregion #endregion
} }
} }

View File

@ -172,7 +172,7 @@
</DataTemplate> </DataTemplate>
</DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn> </DataGridTemplateColumn>
<DataGridTemplateColumn Header="" Width="SizeToCells" IsReadOnly="True"> <!--DataGridTemplateColumn Header="" Width="SizeToCells" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate> <DataGridTemplateColumn.CellTemplate>
<DataTemplate> <DataTemplate>
<Image x:Name="imageHasUpdate"/> <Image x:Name="imageHasUpdate"/>
@ -183,8 +183,8 @@
</DataTemplate.Triggers> </DataTemplate.Triggers>
</DataTemplate> </DataTemplate>
</DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn> </-->
<DataGridTemplateColumn Header="" Width="SizeToCells" IsReadOnly="True"> <!--DataGridTemplateColumn Header="" Width="SizeToCells" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate> <DataGridTemplateColumn.CellTemplate>
<DataTemplate> <DataTemplate>
<Image x:Name="imageHasReminder"/> <Image x:Name="imageHasReminder"/>
@ -195,7 +195,7 @@
</DataTemplate.Triggers> </DataTemplate.Triggers>
</DataTemplate> </DataTemplate>
</DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn> </-->
<DataGridTemplateColumn Header="" Width="SizeToCells" IsReadOnly="True"> <DataGridTemplateColumn Header="" Width="SizeToCells" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate> <DataGridTemplateColumn.CellTemplate>
<DataTemplate> <DataTemplate>
@ -208,6 +208,18 @@
</DataTemplate> </DataTemplate>
</DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn> </DataGridTemplateColumn>
<DataGridTemplateColumn Header="" Width="SizeToCells" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image x:Name="imageSendSuccess"/>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding Path=SuccessfullySent}" Value="True">
<Setter Property="Source" Value="/Resources/bullet_ball_green.png" TargetName="imageSendSuccess"/>
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="{x:Static p:Resources.textChanged}" Binding="{Binding Changed}" IsReadOnly="True" Width="0.15*"> <DataGridTextColumn Header="{x:Static p:Resources.textChanged}" Binding="{Binding Changed}" IsReadOnly="True" Width="0.15*">
<DataGridTextColumn.ElementStyle> <DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock"> <Style TargetType="TextBlock">

View File

@ -394,6 +394,7 @@ namespace ENI2.DetailViewControls
{ {
foreach (Message selectedMessage in this.dataGridMessages.SelectedItems) foreach (Message selectedMessage in this.dataGridMessages.SelectedItems)
{ {
if (selectedMessage.Reset) selectedMessage.Reset = false; // "nochmal" Versenden ist möglich
selectedMessage.InternalStatus = Message.BSMDStatus.TOSEND; selectedMessage.InternalStatus = Message.BSMDStatus.TOSEND;
selectedMessage.StatusInfo = string.Format(Properties.Resources.textMessageSentAt, DateTime.Now); selectedMessage.StatusInfo = string.Format(Properties.Resources.textMessageSentAt, DateTime.Now);
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(selectedMessage); DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(selectedMessage);

View File

@ -14,7 +14,7 @@
<GroupBox Name="portCallGroupBox" Header="{x:Static p:Resources.textPortCall}"> <GroupBox Name="portCallGroupBox" Header="{x:Static p:Resources.textPortCall}">
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="280" /> <RowDefinition Height="300" />
<RowDefinition Height="250" /> <RowDefinition Height="250" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<GroupBox Name="noaNodGroupBox" Header="{x:Static p:Resources.textArrivalDeparture}" Margin="5, 20, 5, 0"> <GroupBox Name="noaNodGroupBox" Header="{x:Static p:Resources.textArrivalDeparture}" Margin="5, 20, 5, 0">
@ -94,11 +94,13 @@
<Label HorizontalContentAlignment="Right" Grid.Row="2" Grid.Column="2" Content="{x:Static p:Resources.textCity}" Name="label_AgentCity" Margin="0,0,10,0" /> <Label HorizontalContentAlignment="Right" Grid.Row="2" Grid.Column="2" Content="{x:Static p:Resources.textCity}" Name="label_AgentCity" Margin="0,0,10,0" />
<Label HorizontalContentAlignment="Right" Grid.Row="5" Grid.Column="2" Content="{x:Static p:Resources.textFirstName}" Name="label_AgentFirstName" Margin="0,0,10,0"/> <Label HorizontalContentAlignment="Right" Grid.Row="5" Grid.Column="2" Content="{x:Static p:Resources.textFirstName}" Name="label_AgentFirstName" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="6" Grid.Column="2" Content="{x:Static p:Resources.textFax}" Name="label_AgentFax" Margin="0,0,10,0"/> <Label HorizontalContentAlignment="Right" Grid.Row="6" Grid.Column="2" Content="{x:Static p:Resources.textFax}" Name="label_AgentFax" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="3" Grid.Column="0" Content="{x:Static p:Resources.textCountry}" Name="label_AgentCountry" Margin="0,0,10,0"/>
<TextBox Grid.Row="0" Grid.Column="1" Name="textBox_AgentCompanyName" MaxLength="100" Margin="2" Text="{Binding AgentCompanyName}" VerticalContentAlignment="Center"/> <TextBox Grid.Row="0" Grid.Column="1" Name="textBox_AgentCompanyName" MaxLength="100" Margin="2" Text="{Binding AgentCompanyName}" VerticalContentAlignment="Center"/>
<TextBox Grid.Row="1" Grid.Column="1" Name="textBox_AgentStreetAndNumber" MaxLength="100" Margin="2" Text="{Binding AgentStreetAndNumber}" VerticalContentAlignment="Center"/> <TextBox Grid.Row="1" Grid.Column="1" Name="textBox_AgentStreetAndNumber" MaxLength="100" Margin="2" Text="{Binding AgentStreetAndNumber}" VerticalContentAlignment="Center"/>
<TextBox Grid.Row="2" Grid.Column="1" Name="textBox_AgentPostalCode" MaxLength="100" Margin="2" Text="{Binding AgentPostalCode}" VerticalContentAlignment="Center"/> <TextBox Grid.Row="2" Grid.Column="1" Name="textBox_AgentPostalCode" MaxLength="100" Margin="2" Text="{Binding AgentPostalCode}" VerticalContentAlignment="Center"/>
<TextBox Grid.Row="2" Grid.Column="3" Name="textBox_AgentCity" MaxLength="100" Margin="2" Text="{Binding AgentCity}" VerticalContentAlignment="Center"/> <TextBox Grid.Row="2" Grid.Column="3" Name="textBox_AgentCity" MaxLength="100" Margin="2" Text="{Binding AgentCity}" VerticalContentAlignment="Center"/>
<TextBox Grid.Row="3" Grid.Column="1" Name="textBox_AgentCountry" MaxLength="100" Margin="2" Text="{Binding AgentCountry}" VerticalContentAlignment="Center" />
<TextBox Grid.Row="5" Grid.Column="1" Name="textBox_AgentLastName" MaxLength="100" Margin="2" Text="{Binding AgentLastName}" VerticalContentAlignment="Center"/> <TextBox Grid.Row="5" Grid.Column="1" Name="textBox_AgentLastName" MaxLength="100" Margin="2" Text="{Binding AgentLastName}" VerticalContentAlignment="Center"/>
<TextBox Grid.Row="6" Grid.Column="1" Name="textBox_AgentPhone" MaxLength="100" Margin="2" Text="{Binding AgentPhone}" VerticalContentAlignment="Center"/> <TextBox Grid.Row="6" Grid.Column="1" Name="textBox_AgentPhone" MaxLength="100" Margin="2" Text="{Binding AgentPhone}" VerticalContentAlignment="Center"/>
<TextBox Grid.Row="7" Grid.Column="1" Name="textBox_AgentEMail" MaxLength="100" Margin="2" Text="{Binding AgentEMail}" VerticalContentAlignment="Center"/> <TextBox Grid.Row="7" Grid.Column="1" Name="textBox_AgentEMail" MaxLength="100" Margin="2" Text="{Binding AgentEMail}" VerticalContentAlignment="Center"/>

View File

@ -48,6 +48,7 @@ namespace ENI2.DetailViewControls
this.RegisterTextboxChange(this.textBox_AgentPhone, Message.NotificationClass.AGNT); this.RegisterTextboxChange(this.textBox_AgentPhone, Message.NotificationClass.AGNT);
this.RegisterTextboxChange(this.textBox_AgentPostalCode, Message.NotificationClass.AGNT); this.RegisterTextboxChange(this.textBox_AgentPostalCode, Message.NotificationClass.AGNT);
this.RegisterTextboxChange(this.textBox_AgentStreetAndNumber, Message.NotificationClass.AGNT); this.RegisterTextboxChange(this.textBox_AgentStreetAndNumber, Message.NotificationClass.AGNT);
this.RegisterTextboxChange(this.textBox_AgentCountry, Message.NotificationClass.AGNT);
} }
public override void Initialize() public override void Initialize()

View File

@ -157,24 +157,27 @@ namespace ENI2.DetailViewControls
{ {
EditLADGDialog eld = new EditLADGDialog(); EditLADGDialog eld = new EditLADGDialog();
eld.LADG = new LADG(); eld.LADG = new LADG();
eld.LADG.MessageHeader = _ladgMessage;
eld.LADG.Identifier = LADG.GetNewIdentifier(_ladgMessage.Elements); eld.LADG.Identifier = LADG.GetNewIdentifier(_ladgMessage.Elements);
eld.Core = this.Core; eld.Core = this.Core;
eld.AddClicked += () => eld.AddClicked += () =>
{ {
eld.CopyValuesToEntity(); eld.CopyValuesToEntity();
this._ladgMessage.Elements.Add(eld.LADG); if (!this._ladgMessage.Elements.Contains(eld.LADG))
eld.LADG.MessageHeader = _ladgMessage; this._ladgMessage.Elements.Add(eld.LADG);
this.dataGridLADG.Items.Refresh(); this.dataGridLADG.Items.Refresh();
eld.LADG = new LADG(); eld.LADG = new LADG();
eld.LADG.MessageHeader = _ladgMessage;
eld.LADG.Identifier = LADG.GetNewIdentifier(_ladgMessage.Elements); eld.LADG.Identifier = LADG.GetNewIdentifier(_ladgMessage.Elements);
this.SublistElementChanged(Message.NotificationClass.LADG); this.SublistElementChanged(Message.NotificationClass.LADG);
}; };
if (eld.ShowDialog() ?? false) if (eld.ShowDialog() ?? false)
{ {
eld.LADG.MessageHeader = _ladgMessage; if(!_ladgMessage.Elements.Contains(eld.LADG))
_ladgMessage.Elements.Add(eld.LADG); _ladgMessage.Elements.Add(eld.LADG);
this.dataGridLADG.Items.Refresh(); this.dataGridLADG.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.LADG); this.SublistElementChanged(Message.NotificationClass.LADG);
} }
@ -197,28 +200,32 @@ namespace ENI2.DetailViewControls
private void DataGridLADG_EditRequested(DatabaseEntity obj) private void DataGridLADG_EditRequested(DatabaseEntity obj)
{ {
LADG ladg = obj as LADG; LADG ladg = obj as LADG;
if(ladg != null)
EditLADGDialog eld = new EditLADGDialog();
eld.Core = this.Core;
eld.LADG = ladg;
eld.AddClicked += () =>
{ {
EditLADGDialog eld = new EditLADGDialog(); eld.CopyValuesToEntity();
eld.Core = this.Core; if(!_ladgMessage.Elements.Contains(eld.LADG))
eld.LADG = ladg;
eld.AddClicked += () =>
{
eld.CopyValuesToEntity();
eld.LADG = new LADG();
eld.LADG.Identifier = LADG.GetNewIdentifier(_ladgMessage.Elements);
_ladgMessage.Elements.Add(eld.LADG); _ladgMessage.Elements.Add(eld.LADG);
eld.LADG.MessageHeader = _ladgMessage; this.dataGridLADG.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.LADG);
};
if (eld.ShowDialog() ?? false) eld.LADG = new LADG();
{ eld.LADG.Identifier = LADG.GetNewIdentifier(_ladgMessage.Elements);
this.dataGridLADG.Items.Refresh(); eld.LADG.MessageHeader = _ladgMessage;
this.SublistElementChanged(Message.NotificationClass.LADG); this.SublistElementChanged(Message.NotificationClass.LADG);
} };
if (eld.ShowDialog() ?? false)
{
if (!_ladgMessage.Elements.Contains(eld.LADG))
_ladgMessage.Elements.Add(eld.LADG);
this.dataGridLADG.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.LADG);
} }
} }
private void DataGridLADG_AddingNewItem(object sender, AddingNewItemEventArgs e) private void DataGridLADG_AddingNewItem(object sender, AddingNewItemEventArgs e)
@ -235,22 +242,24 @@ namespace ENI2.DetailViewControls
EditSERVDialog esd = new EditSERVDialog(); EditSERVDialog esd = new EditSERVDialog();
esd.SERV = new SERV(); esd.SERV = new SERV();
esd.SERV.Identifier = SERV.GetNewIdentifier(_servMessage.Elements); esd.SERV.Identifier = SERV.GetNewIdentifier(_servMessage.Elements);
esd.SERV.MessageHeader = _servMessage;
esd.AddClicked += () => esd.AddClicked += () =>
{ {
esd.CopyValuesToEntity(); esd.CopyValuesToEntity();
_servMessage.Elements.Add(esd.SERV); if(!_servMessage.Elements.Contains(esd.SERV))
esd.SERV.MessageHeader = _servMessage; _servMessage.Elements.Add(esd.SERV);
this.dataGridSERV.Items.Refresh(); this.dataGridSERV.Items.Refresh();
esd.SERV = new SERV(); esd.SERV = new SERV();
esd.SERV.MessageHeader = _servMessage;
esd.SERV.Identifier = SERV.GetNewIdentifier(_servMessage.Elements); esd.SERV.Identifier = SERV.GetNewIdentifier(_servMessage.Elements);
this.SublistElementChanged(Message.NotificationClass.SERV); this.SublistElementChanged(Message.NotificationClass.SERV);
}; };
if(esd.ShowDialog() ?? false) if(esd.ShowDialog() ?? false)
{ {
esd.SERV.MessageHeader = _servMessage; if(!_servMessage.Elements.Contains(esd.SERV))
_servMessage.Elements.Add(esd.SERV); _servMessage.Elements.Add(esd.SERV);
this.dataGridSERV.Items.Refresh(); this.dataGridSERV.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.SERV); this.SublistElementChanged(Message.NotificationClass.SERV);
} }
@ -271,28 +280,29 @@ namespace ENI2.DetailViewControls
} }
private void DataGridSERV_EditRequested(DatabaseEntity obj) private void DataGridSERV_EditRequested(DatabaseEntity obj)
{ {
SERV serv = obj as SERV; EditSERVDialog esd = new EditSERVDialog();
if(serv != null) esd.SERV = obj as SERV;
esd.AddClicked += () =>
{ {
EditSERVDialog esd = new EditSERVDialog(); esd.CopyValuesToEntity();
esd.SERV = serv; if(!_servMessage.Elements.Contains(esd.SERV))
esd.AddClicked += () =>
{
esd.CopyValuesToEntity();
esd.SERV = new SERV();
esd.SERV.Identifier = SERV.GetNewIdentifier(_servMessage.Elements);
_servMessage.Elements.Add(esd.SERV); _servMessage.Elements.Add(esd.SERV);
esd.SERV.MessageHeader = _servMessage; this.dataGridSERV.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.SERV);
};
if (esd.ShowDialog() ?? false) esd.SERV = new SERV();
{ esd.SERV.Identifier = SERV.GetNewIdentifier(_servMessage.Elements);
this.dataGridSERV.Items.Refresh(); esd.SERV.MessageHeader = _servMessage;
this.SublistElementChanged(Message.NotificationClass.SERV); this.SublistElementChanged(Message.NotificationClass.SERV);
} };
if (esd.ShowDialog() ?? false)
{
if (!_servMessage.Elements.Contains(esd.SERV))
_servMessage.Elements.Add(esd.SERV);
this.dataGridSERV.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.SERV);
} }
} }

View File

@ -101,26 +101,27 @@ namespace ENI2.DetailViewControls
private void DataGridShip2ShipActivities_CreateRequested() private void DataGridShip2ShipActivities_CreateRequested()
{ {
ShipToShipActivitiesDuringLastTenPortFacilitiesCalled s2s = new ShipToShipActivitiesDuringLastTenPortFacilitiesCalled();
s2s.Identifier = ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.GetNewIdentifier(_sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled);
EditShip2ShipActivitiesDialog epd = new EditShip2ShipActivitiesDialog(); EditShip2ShipActivitiesDialog epd = new EditShip2ShipActivitiesDialog();
epd.ShipToShipActivity = s2s; epd.ShipToShipActivity = new ShipToShipActivitiesDuringLastTenPortFacilitiesCalled();
epd.ShipToShipActivity.Identifier = ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.GetNewIdentifier(_sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled);
epd.ShipToShipActivity.SEC = this._sec;
epd.AddClicked += () => epd.AddClicked += () =>
{ {
epd.CopyValuesToEntity(); epd.CopyValuesToEntity();
epd.ShipToShipActivity.SEC = this._sec; if(!this._sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Contains(epd.ShipToShipActivity))
this._sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Add(epd.ShipToShipActivity); this._sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Add(epd.ShipToShipActivity);
this.dataGridShip2ShipActivities.Items.Refresh(); this.dataGridShip2ShipActivities.Items.Refresh();
epd.ShipToShipActivity = new ShipToShipActivitiesDuringLastTenPortFacilitiesCalled(); epd.ShipToShipActivity = new ShipToShipActivitiesDuringLastTenPortFacilitiesCalled();
epd.ShipToShipActivity.SEC = this._sec;
epd.ShipToShipActivity.Identifier = ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.GetNewIdentifier(_sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled); epd.ShipToShipActivity.Identifier = ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.GetNewIdentifier(_sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled);
this.SublistElementChanged(Message.NotificationClass.SEC); this.SublistElementChanged(Message.NotificationClass.SEC);
}; };
if (epd.ShowDialog() ?? false) if (epd.ShowDialog() ?? false)
{ {
_sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Add(epd.ShipToShipActivity); if(!_sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Contains(epd.ShipToShipActivity))
epd.ShipToShipActivity.SEC = this._sec; _sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Add(epd.ShipToShipActivity);
this.dataGridShip2ShipActivities.Items.Refresh(); this.dataGridShip2ShipActivities.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.SEC); this.SublistElementChanged(Message.NotificationClass.SEC);
} }
@ -151,14 +152,15 @@ namespace ENI2.DetailViewControls
_sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Add(ecpd.ShipToShipActivity); _sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Add(ecpd.ShipToShipActivity);
this.dataGridShip2ShipActivities.Items.Refresh(); this.dataGridShip2ShipActivities.Items.Refresh();
ecpd.ShipToShipActivity = new ShipToShipActivitiesDuringLastTenPortFacilitiesCalled(); ecpd.ShipToShipActivity = new ShipToShipActivitiesDuringLastTenPortFacilitiesCalled();
ecpd.ShipToShipActivity.SEC = this._sec;
ecpd.ShipToShipActivity.Identifier = ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.GetNewIdentifier(_sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled); ecpd.ShipToShipActivity.Identifier = ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.GetNewIdentifier(_sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled);
this.SublistElementChanged(Message.NotificationClass.SEC);
}; };
if (ecpd.ShowDialog() ?? false) if (ecpd.ShowDialog() ?? false)
{ {
if (!_sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Contains(ecpd.ShipToShipActivity)) if (!_sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Contains(ecpd.ShipToShipActivity))
_sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Add(ecpd.ShipToShipActivity); _sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Add(ecpd.ShipToShipActivity);
this.dataGridShip2ShipActivities.Items.Refresh(); this.dataGridShip2ShipActivities.Items.Refresh();
// signal up
this.SublistElementChanged(Message.NotificationClass.SEC); this.SublistElementChanged(Message.NotificationClass.SEC);
} }
} }
@ -174,26 +176,28 @@ namespace ENI2.DetailViewControls
private void DataGridLast10PortFacilities_CreateRequested() private void DataGridLast10PortFacilities_CreateRequested()
{ {
LastTenPortFacilitiesCalled l10c = new LastTenPortFacilitiesCalled();
l10c.Identifier = LastTenPortFacilitiesCalled.GetNewIdentifier(_sec.LastTenPortFacilitesCalled);
EditLast10PortFacilitiesDialog epd = new EditLast10PortFacilitiesDialog(); EditLast10PortFacilitiesDialog epd = new EditLast10PortFacilitiesDialog();
epd.LastTenPortFacilitiesCalled = l10c; epd.LastTenPortFacilitiesCalled = new LastTenPortFacilitiesCalled();
epd.LastTenPortFacilitiesCalled.Identifier = LastTenPortFacilitiesCalled.GetNewIdentifier(_sec.LastTenPortFacilitesCalled);
epd.LastTenPortFacilitiesCalled.SEC = this._sec;
epd.AddClicked += () => epd.AddClicked += () =>
{ {
epd.CopyValuesToEntity(); epd.CopyValuesToEntity();
epd.LastTenPortFacilitiesCalled.SEC = this._sec; if(!this._sec.LastTenPortFacilitesCalled.Contains(epd.LastTenPortFacilitiesCalled))
this._sec.LastTenPortFacilitesCalled.Add(epd.LastTenPortFacilitiesCalled); this._sec.LastTenPortFacilitesCalled.Add(epd.LastTenPortFacilitiesCalled);
this.dataGridLast10PortFacilities.Items.Refresh(); this.dataGridLast10PortFacilities.Items.Refresh();
epd.LastTenPortFacilitiesCalled = new LastTenPortFacilitiesCalled(); epd.LastTenPortFacilitiesCalled = new LastTenPortFacilitiesCalled();
epd.LastTenPortFacilitiesCalled.SEC = this._sec;
epd.LastTenPortFacilitiesCalled.Identifier = LastTenPortFacilitiesCalled.GetNewIdentifier(_sec.LastTenPortFacilitesCalled); epd.LastTenPortFacilitiesCalled.Identifier = LastTenPortFacilitiesCalled.GetNewIdentifier(_sec.LastTenPortFacilitesCalled);
this.SublistElementChanged(Message.NotificationClass.SEC); this.SublistElementChanged(Message.NotificationClass.SEC);
}; };
if (epd.ShowDialog() ?? false) if (epd.ShowDialog() ?? false)
{ {
_sec.LastTenPortFacilitesCalled.Add(epd.LastTenPortFacilitiesCalled); if(!_sec.LastTenPortFacilitesCalled.Contains(epd.LastTenPortFacilitiesCalled))
epd.LastTenPortFacilitiesCalled.SEC = this._sec; _sec.LastTenPortFacilitesCalled.Add(epd.LastTenPortFacilitiesCalled);
this.dataGridLast10PortFacilities.Items.Refresh(); this.dataGridLast10PortFacilities.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.SEC); this.SublistElementChanged(Message.NotificationClass.SEC);
} }
@ -224,14 +228,15 @@ namespace ENI2.DetailViewControls
_sec.LastTenPortFacilitesCalled.Add(ecpd.LastTenPortFacilitiesCalled); _sec.LastTenPortFacilitesCalled.Add(ecpd.LastTenPortFacilitiesCalled);
this.dataGridLast10PortFacilities.Items.Refresh(); this.dataGridLast10PortFacilities.Items.Refresh();
ecpd.LastTenPortFacilitiesCalled = new LastTenPortFacilitiesCalled(); ecpd.LastTenPortFacilitiesCalled = new LastTenPortFacilitiesCalled();
ecpd.LastTenPortFacilitiesCalled.SEC = this._sec;
ecpd.LastTenPortFacilitiesCalled.Identifier = LastTenPortFacilitiesCalled.GetNewIdentifier(_sec.LastTenPortFacilitesCalled); ecpd.LastTenPortFacilitiesCalled.Identifier = LastTenPortFacilitiesCalled.GetNewIdentifier(_sec.LastTenPortFacilitesCalled);
this.SublistElementChanged(Message.NotificationClass.SEC);
}; };
if (ecpd.ShowDialog() ?? false) if (ecpd.ShowDialog() ?? false)
{ {
if (!_sec.LastTenPortFacilitesCalled.Contains(ecpd.LastTenPortFacilitiesCalled)) if (!_sec.LastTenPortFacilitesCalled.Contains(ecpd.LastTenPortFacilitiesCalled))
_sec.LastTenPortFacilitesCalled.Add(ecpd.LastTenPortFacilitiesCalled); _sec.LastTenPortFacilitesCalled.Add(ecpd.LastTenPortFacilitiesCalled);
this.dataGridLast10PortFacilities.Items.Refresh(); this.dataGridLast10PortFacilities.Items.Refresh();
// signal up
this.SublistElementChanged(Message.NotificationClass.SEC); this.SublistElementChanged(Message.NotificationClass.SEC);
} }
} }
@ -243,6 +248,8 @@ namespace ENI2.DetailViewControls
#endregion #endregion
#region event handler
private void SecurityDetailControl_Loaded(object sender, RoutedEventArgs e) private void SecurityDetailControl_Loaded(object sender, RoutedEventArgs e)
{ {
@ -276,6 +283,8 @@ namespace ENI2.DetailViewControls
this.checkBoxKielCanalPassagePlanned.Checked += CheckBoxKielCanalPassagePlanned_Checked; this.checkBoxKielCanalPassagePlanned.Checked += CheckBoxKielCanalPassagePlanned_Checked;
} }
#endregion
#region enable / disable controls #region enable / disable controls
private void CheckBoxKielCanalPassagePlanned_Checked(object sender, RoutedEventArgs e) private void CheckBoxKielCanalPassagePlanned_Checked(object sender, RoutedEventArgs e)

View File

@ -53,7 +53,7 @@
<TextBox Name="textBoxCallsign" Grid.Column="4" Grid.Row="1" Text="{Binding CallSign}" Margin="2" 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="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" /> <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}" /> <enictrl:LocodeControl x:Name="locodePortOfRegistry" Grid.Column="4" Grid.Row="3" Grid.ColumnSpan="2" LocodeValue="{Binding PortOfRegistry, Mode=TwoWay}" />
<xctk:IntegerUpDown Name="integerUpDownGrossTonnage" Grid.Column="1" Grid.Row="4" Margin="2" Value="{Binding GrossTonnage}" ShowButtonSpinner="False" TextAlignment="Left"/> <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" /> <Label Content="t" Grid.Column="2" Grid.Row="4" />

View File

@ -17,7 +17,7 @@
</Grid.RowDefinitions> </Grid.RowDefinitions>
<GroupBox Name="groupBoxTowageOnArrival" Grid.Row="0" Header="{x:Static p:Resources.textTowageOnArrival}"> <GroupBox Name="groupBoxTowageOnArrival" Grid.Row="0" Header="{x:Static p:Resources.textTowageOnArrival}">
<enictrl:ENIDataGrid x:Name="dataGridTowageOnArrival" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" <enictrl:ENIDataGrid x:Name="dataGridTowageOnArrival" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
SelectionMode="Single" AutoGenerateColumns="False" Margin="0,5,0,0"> AutoGenerateColumns="False" Margin="0,5,0,0">
<DataGrid.Columns> <DataGrid.Columns>
<DataGridTextColumn Header="" Binding="{Binding Identifier}" IsReadOnly="True" /> <DataGridTextColumn Header="" Binding="{Binding Identifier}" IsReadOnly="True" />
<DataGridTextColumn Header="{x:Static p:Resources.textName}" Binding="{Binding TowageOnArrivalName}" IsReadOnly="True" Width="Auto" /> <DataGridTextColumn Header="{x:Static p:Resources.textName}" Binding="{Binding TowageOnArrivalName}" IsReadOnly="True" Width="Auto" />
@ -42,7 +42,7 @@
</GroupBox> </GroupBox>
<GroupBox Name="groupBoxTowageOnDeparture" Grid.Row="1" Header="{x:Static p:Resources.textTowageOnDeparture}"> <GroupBox Name="groupBoxTowageOnDeparture" Grid.Row="1" Header="{x:Static p:Resources.textTowageOnDeparture}">
<enictrl:ENIDataGrid x:Name="dataGridTowageOnDeparture" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" <enictrl:ENIDataGrid x:Name="dataGridTowageOnDeparture" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
SelectionMode="Single" AutoGenerateColumns="False" Margin="0,5,0,0"> AutoGenerateColumns="False" Margin="0,5,0,0">
<DataGrid.Columns> <DataGrid.Columns>
<DataGridTextColumn Header="" Binding="{Binding Identifier}" IsReadOnly="True" /> <DataGridTextColumn Header="" Binding="{Binding Identifier}" IsReadOnly="True" />
<DataGridTextColumn Header="{x:Static p:Resources.textName}" Binding="{Binding TowageOnDepartureName}" IsReadOnly="True" Width="Auto" /> <DataGridTextColumn Header="{x:Static p:Resources.textName}" Binding="{Binding TowageOnDepartureName}" IsReadOnly="True" Width="Auto" />

View File

@ -46,10 +46,9 @@ namespace ENI2.DetailViewControls
private void copyItem(object sender, RoutedEventArgs e) private void copyItem(object sender, RoutedEventArgs e)
{ {
// aus dem aktuell selektierten TOWA Element ein neues TOWD Element machen // aus dem aktuell selektierten TOWA Element ein neues TOWD Element machen
if ((this.dataGridTowageOnArrival.SelectedItems != null) && (this.dataGridTowageOnArrival.SelectedItems.Count == 1)) if (this.dataGridTowageOnArrival.SelectedItems != null)
{ {
TOWA selectedTOWA = this.dataGridTowageOnArrival.SelectedItems[0] as TOWA; foreach(TOWA selectedTOWA in this.dataGridTowageOnArrival.SelectedItems)
if (selectedTOWA != null)
{ {
TOWD copyTOWD = new TOWD(); TOWD copyTOWD = new TOWD();
copyTOWD.MessageHeader = _towdMessage; copyTOWD.MessageHeader = _towdMessage;
@ -112,28 +111,28 @@ namespace ENI2.DetailViewControls
private void DataGridTowageOnDeparture_CreateRequested() private void DataGridTowageOnDeparture_CreateRequested()
{ {
TOWD towd = new TOWD();
towd.Identifier = TOWD.GetNewIdentifier(this._towdMessage.Elements);
EditTOWDialog ebd = new EditTOWDialog(); EditTOWDialog ebd = new EditTOWDialog();
ebd.TOWD = towd;
ebd.IsDeparture = true; ebd.IsDeparture = true;
ebd.TOWD = new TOWD();
ebd.TOWD.Identifier = TOWD.GetNewIdentifier(this._towdMessage.Elements);
ebd.TOWD.MessageHeader = this._towdMessage;
ebd.AddClicked += () => ebd.AddClicked += () =>
{ {
ebd.CopyValuesToEntity(); ebd.CopyValuesToEntity();
this._towdMessage.Elements.Add(ebd.TOWD); if(!this._towdMessage.Elements.Contains(ebd.TOWD))
ebd.TOWD.MessageHeader = _towdMessage; this._towdMessage.Elements.Add(ebd.TOWD);
this.dataGridTowageOnDeparture.Items.Refresh(); this.dataGridTowageOnDeparture.Items.Refresh();
ebd.TOWD = new TOWD(); ebd.TOWD = new TOWD();
ebd.TOWD.MessageHeader = _towdMessage;
ebd.TOWD.Identifier = TOWD.GetNewIdentifier(this._towdMessage.Elements); ebd.TOWD.Identifier = TOWD.GetNewIdentifier(this._towdMessage.Elements);
this.SublistElementChanged(Message.NotificationClass.TOWD); this.SublistElementChanged(Message.NotificationClass.TOWD);
}; };
if (ebd.ShowDialog() ?? false) if (ebd.ShowDialog() ?? false)
{ {
ebd.CopyValuesToEntity(); if(!this._towdMessage.Elements.Contains(ebd.TOWD))
ebd.TOWD.MessageHeader = _towdMessage; _towdMessage.Elements.Add(ebd.TOWD);
_towdMessage.Elements.Add(ebd.TOWD);
this.dataGridTowageOnDeparture.Items.Refresh(); this.dataGridTowageOnDeparture.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.TOWD); this.SublistElementChanged(Message.NotificationClass.TOWD);
} }
@ -155,29 +154,28 @@ namespace ENI2.DetailViewControls
private void DataGridTowageOnDeparture_EditRequested(DatabaseEntity obj) private void DataGridTowageOnDeparture_EditRequested(DatabaseEntity obj)
{ {
TOWD towd = obj as TOWD; EditTOWDialog eld = new EditTOWDialog();
if (towd != null) eld.IsDeparture = true;
eld.TOWD = obj as TOWD;
eld.AddClicked += () =>
{ {
EditTOWDialog eld = new EditTOWDialog(); eld.CopyValuesToEntity();
eld.IsDeparture = true; if(!_towdMessage.Elements.Contains(eld.TOWD))
eld.TOWD = towd;
eld.AddClicked += () =>
{
eld.CopyValuesToEntity();
eld.TOWD = new TOWD();
eld.TOWD.Identifier = TOWD.GetNewIdentifier(this._towdMessage.Elements);
_towdMessage.Elements.Add(eld.TOWD); _towdMessage.Elements.Add(eld.TOWD);
eld.TOWD.MessageHeader = _towdMessage; this.dataGridTowageOnDeparture.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.TOWD); eld.TOWD = new TOWD();
}; eld.TOWD.Identifier = TOWD.GetNewIdentifier(this._towdMessage.Elements);
eld.TOWD.MessageHeader = _towdMessage;
this.SublistElementChanged(Message.NotificationClass.TOWD);
};
if (eld.ShowDialog() ?? false) if (eld.ShowDialog() ?? false)
{ {
eld.CopyValuesToEntity(); if (!this._towdMessage.Elements.Contains(eld.TOWD))
this.dataGridTowageOnDeparture.Items.Refresh(); this._towdMessage.Elements.Add(eld.TOWD);
this.SublistElementChanged(Message.NotificationClass.TOWD); this.dataGridTowageOnDeparture.Items.Refresh();
} this.SublistElementChanged(Message.NotificationClass.TOWD);
} }
} }
@ -192,28 +190,28 @@ namespace ENI2.DetailViewControls
private void DataGridTowageOnArrival_CreateRequested() private void DataGridTowageOnArrival_CreateRequested()
{ {
TOWA towa = new TOWA();
towa.Identifier = TOWA.GetNewIdentifier(this._towaMessage.Elements);
EditTOWDialog ebd = new EditTOWDialog(); EditTOWDialog ebd = new EditTOWDialog();
ebd.TOWA = towa;
ebd.IsDeparture = false; ebd.IsDeparture = false;
ebd.TOWA = new TOWA();
ebd.TOWA.Identifier = TOWA.GetNewIdentifier(this._towaMessage.Elements);
ebd.TOWA.MessageHeader = this._towaMessage;
ebd.AddClicked += () => ebd.AddClicked += () =>
{ {
ebd.CopyValuesToEntity(); ebd.CopyValuesToEntity();
this._towaMessage.Elements.Add(ebd.TOWA); if(!this._towaMessage.Elements.Contains(ebd.TOWA))
ebd.TOWA.MessageHeader = _towaMessage; this._towaMessage.Elements.Add(ebd.TOWA);
this.dataGridTowageOnArrival.Items.Refresh(); this.dataGridTowageOnArrival.Items.Refresh();
ebd.TOWA = new TOWA(); ebd.TOWA = new TOWA();
ebd.TOWA.MessageHeader = _towaMessage;
ebd.TOWA.Identifier = TOWA.GetNewIdentifier(this._towaMessage.Elements); ebd.TOWA.Identifier = TOWA.GetNewIdentifier(this._towaMessage.Elements);
this.SublistElementChanged(Message.NotificationClass.TOWA); this.SublistElementChanged(Message.NotificationClass.TOWA);
}; };
if (ebd.ShowDialog() ?? false) if (ebd.ShowDialog() ?? false)
{ {
ebd.CopyValuesToEntity(); if(!this._towaMessage.Elements.Contains(ebd.TOWA))
ebd.TOWA.MessageHeader = _towaMessage; _towaMessage.Elements.Add(ebd.TOWA);
_towaMessage.Elements.Add(ebd.TOWA);
this.dataGridTowageOnArrival.Items.Refresh(); this.dataGridTowageOnArrival.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.TOWA); this.SublistElementChanged(Message.NotificationClass.TOWA);
} }
@ -235,29 +233,29 @@ namespace ENI2.DetailViewControls
private void DataGridTowageOnArrival_EditRequested(DatabaseEntity obj) private void DataGridTowageOnArrival_EditRequested(DatabaseEntity obj)
{ {
TOWA towa = obj as TOWA; EditTOWDialog eld = new EditTOWDialog();
if (towa != null) eld.IsDeparture = false;
eld.TOWA = obj as TOWA;
eld.AddClicked += () =>
{ {
EditTOWDialog eld = new EditTOWDialog(); eld.CopyValuesToEntity();
eld.IsDeparture = false; if(!_towaMessage.Elements.Contains(eld.TOWA))
eld.TOWA = towa;
eld.AddClicked += () =>
{
eld.CopyValuesToEntity();
eld.TOWA = new TOWA();
eld.TOWA.Identifier = TOWA.GetNewIdentifier(this._towaMessage.Elements);
_towaMessage.Elements.Add(eld.TOWA); _towaMessage.Elements.Add(eld.TOWA);
eld.TOWA.MessageHeader = _towaMessage; this.dataGridTowageOnArrival.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.TOWA);
};
if (eld.ShowDialog() ?? false) eld.TOWA = new TOWA();
{ eld.TOWA.Identifier = TOWA.GetNewIdentifier(this._towaMessage.Elements);
eld.CopyValuesToEntity(); eld.TOWA.MessageHeader = _towaMessage;
this.dataGridTowageOnArrival.Items.Refresh(); this.SublistElementChanged(Message.NotificationClass.TOWA);
this.SublistElementChanged(Message.NotificationClass.TOWA); };
}
if (eld.ShowDialog() ?? false)
{
if (!this._towaMessage.Elements.Contains(eld.TOWA))
this._towaMessage.Elements.Add(eld.TOWA);
this.dataGridTowageOnArrival.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.TOWA);
} }
} }

View File

@ -14,8 +14,8 @@
<GroupBox Name="wasGroupBox" Header="{x:Static p:Resources.textWaste}"> <GroupBox Name="wasGroupBox" Header="{x:Static p:Resources.textWaste}">
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="220" /> <RowDefinition Height="250" />
<RowDefinition Height="360" /> <RowDefinition Height="330*" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid Grid.Row="0"> <Grid Grid.Row="0">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
@ -31,6 +31,7 @@
<RowDefinition Height="28" /> <RowDefinition Height="28" />
<RowDefinition Height="28" /> <RowDefinition Height="28" />
<RowDefinition Height="*" /> <RowDefinition Height="*" />
<RowDefinition Height="28" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Label HorizontalContentAlignment="Right" Grid.Row="0" Grid.Column="0" Content="{x:Static p:Resources.textAccurateDetailsGiven}" Name="label_AccurateDetailsGiven" Margin="0,0,10,0"/> <Label HorizontalContentAlignment="Right" Grid.Row="0" Grid.Column="0" Content="{x:Static p:Resources.textAccurateDetailsGiven}" Name="label_AccurateDetailsGiven" Margin="0,0,10,0"/>
<!--TextBlock Grid.Row="0" Grid.Column="0" Text="{x:Static p:Resources.textAccurateDetailsGiven}" Name="label_ETAToPortOfCall" Margin="0,0,10,0" TextWrapping="Wrap" FontSize="10"/--> <!--TextBlock Grid.Row="0" Grid.Column="0" Text="{x:Static p:Resources.textAccurateDetailsGiven}" Name="label_ETAToPortOfCall" Margin="0,0,10,0" TextWrapping="Wrap" FontSize="10"/-->
@ -39,12 +40,13 @@
<Label HorizontalContentAlignment="Right" Grid.Row="3" Grid.Column="0" Content="{x:Static p:Resources.textLastPortWasteDischarge}" Name="label_WasteLastPortDischarged" Margin="0,0,10,0"/> <Label HorizontalContentAlignment="Right" Grid.Row="3" Grid.Column="0" Content="{x:Static p:Resources.textLastPortWasteDischarge}" Name="label_WasteLastPortDischarged" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="4" Grid.Column="0" Content="{x:Static p:Resources.textWasteDisposalServiceProviders}" Name="label_WasteDisposalServiceProviders" Margin="0,0,10,0"/> <Label HorizontalContentAlignment="Right" Grid.Row="4" Grid.Column="0" Content="{x:Static p:Resources.textWasteDisposalServiceProviders}" Name="label_WasteDisposalServiceProviders" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="0" Grid.Column="2" Content="{x:Static p:Resources.textValidExemption}" Name="label_ValidExemption" Margin="0,0,10,0"/> <Label HorizontalContentAlignment="Right" Grid.Row="0" Grid.Column="2" Content="{x:Static p:Resources.textValidExemption}" Name="label_ValidExemption" Margin="0,0,10,0"/>
<CheckBox Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" Name="checkBoxAccurateCorrectDetails" IsChecked="{Binding ConfirmationOfCorrectness}" /> <CheckBox Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" Name="checkBoxAccurateCorrectDetails" IsChecked="{Binding ConfirmationOfCorrectness, Mode=TwoWay}" />
<CheckBox Grid.Row="0" Grid.Column="3" VerticalAlignment="Center" Name="checkBoxValidExemption" IsChecked="{Binding WasteDisposalValidExemption}" /> <CheckBox Grid.Row="0" Grid.Column="3" VerticalAlignment="Center" Name="checkBoxValidExemption" IsChecked="{Binding WasteDisposalValidExemption, Mode=TwoWay}" />
<ComboBox Grid.Row="1" Grid.Column="1" Name="comboBoxWasteDisposal" Margin="2" SelectedIndex="{Binding WasteDisposalDelivery}"/> <ComboBox Grid.Row="1" Grid.Column="1" Name="comboBoxWasteDisposal" Margin="2" SelectedIndex="{Binding WasteDisposalDelivery, Mode=TwoWay}"/>
<DatePicker Grid.Row="2" Grid.Column="1" Name="datePickerDateLastDisposal" Margin="2" SelectedDate="{Binding LastWasteDisposalDate}" /> <DatePicker Grid.Row="2" Grid.Column="1" Name="datePickerDateLastDisposal" Margin="2" SelectedDate="{Binding LastWasteDisposalDate, Mode=TwoWay}" />
<enictrl:LocodeControl Grid.Row="3" Grid.Column="1" x:Name="locodeCtrlLastWastePort" LocodeValue="{Binding LastWasteDisposalPort}" /> <enictrl:LocodeControl Grid.Row="3" Grid.Column="1" x:Name="locodeCtrlLastWastePort" LocodeValue="{Binding LastWasteDisposalPort, Mode=TwoWay}" />
<TextBox Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="3" Grid.RowSpan="2" Name="textBoxWasteDisposalServiceProviders" Text="{Binding WasteDisposalServiceProviderText}" Margin="2" /> <TextBox Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="3" Grid.RowSpan="2" Name="textBoxWasteDisposalServiceProviders" Text="{Binding WasteDisposalServiceProviderText}" Margin="2" />
<Button Grid.Row="6" Grid.Column="1" Grid.ColumnSpan="2" Name="buttonAddMissingEntries" Content="{x:Static p:Resources.textAddMissingEntries}" Margin="2" Click="buttonAddMissingEntries_Click"/>
</Grid> </Grid>
<enictrl:ENIDataGrid x:Name="dataGridWaste" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" <enictrl:ENIDataGrid x:Name="dataGridWaste" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
SelectionMode="Single" AutoGenerateColumns="False" Margin="0,5,0,0" Grid.Row="1"> SelectionMode="Single" AutoGenerateColumns="False" Margin="0,5,0,0" Grid.Row="1">

View File

@ -56,6 +56,46 @@ namespace ENI2.DetailViewControls
this.datePickerDateLastDisposal.IsEnabled = on; this.datePickerDateLastDisposal.IsEnabled = on;
} }
private void buttonAddMissingEntries_Click(object sender, RoutedEventArgs e)
{
bool changedWaste = false;
// Convenience Methode, die fehlende Waste Einträge ergänzt (interessant bei "manuellen" Anmeldungen)
foreach(int wasteCode in WAS.DKWasteCodes)
{
bool codeFound = false;
foreach(Waste waste in this._was.Waste)
{
if(waste.WasteType.HasValue && waste.WasteType.Value == wasteCode)
{
codeFound = true;
break;
}
}
if(!codeFound)
{
Waste newWaste = new Waste();
newWaste.Identifier = DatabaseEntity.GetNewIdentifier(this._was.Waste);
newWaste.WAS = _was;
newWaste.WasteAmountGeneratedTillNextPort_MTQ = 0;
newWaste.WasteAmountRetained_MTQ = 0;
newWaste.WasteCapacity_MTQ = 0;
newWaste.WasteDescription = "";
newWaste.WasteDisposalAmount_MTQ = 0;
newWaste.WasteDisposalPort = "ZZUKN";
newWaste.WasteDisposedAtLastPort_MTQ = 0;
newWaste.WasteType = wasteCode;
this._was.Waste.Add(newWaste);
changedWaste = true;
}
}
if(changedWaste)
{
this.SublistElementChanged(Message.NotificationClass.WAS);
this.dataGridWaste.Items.Refresh();
}
}
public override void Initialize() public override void Initialize()
{ {
base.Initialize(); base.Initialize();
@ -104,26 +144,27 @@ namespace ENI2.DetailViewControls
private void DataGridWaste_CreateRequested() private void DataGridWaste_CreateRequested()
{ {
Waste waste = new Waste();
waste.Identifier = Waste.GetNewIdentifier(_was.Waste);
EditWasteDialog epd = new EditWasteDialog(); EditWasteDialog epd = new EditWasteDialog();
epd.Waste = waste; epd.Waste = new Waste();
epd.Waste.Identifier = Waste.GetNewIdentifier(_was.Waste);
epd.Waste.WAS = this._was;
epd.AddClicked += () => epd.AddClicked += () =>
{ {
epd.CopyValuesToEntity(); epd.CopyValuesToEntity();
epd.Waste.WAS = this._was; if(!this._was.Waste.Contains(epd.Waste))
this._was.Waste.Add(epd.Waste); this._was.Waste.Add(epd.Waste);
this.dataGridWaste.Items.Refresh(); this.dataGridWaste.Items.Refresh();
epd.Waste = new Waste(); epd.Waste = new Waste();
epd.Waste.WAS = this._was;
epd.Waste.Identifier = Waste.GetNewIdentifier(_was.Waste); epd.Waste.Identifier = Waste.GetNewIdentifier(_was.Waste);
this.SublistElementChanged(Message.NotificationClass.WAS); this.SublistElementChanged(Message.NotificationClass.WAS);
}; };
if (epd.ShowDialog() ?? false) if (epd.ShowDialog() ?? false)
{ {
_was.Waste.Add(epd.Waste); if(!this._was.Waste.Contains(epd.Waste))
epd.Waste.WAS = this._was; _was.Waste.Add(epd.Waste);
this.dataGridWaste.Items.Refresh(); this.dataGridWaste.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.WAS); this.SublistElementChanged(Message.NotificationClass.WAS);
} }
@ -145,28 +186,27 @@ namespace ENI2.DetailViewControls
private void DataGridWaste_EditRequested(DatabaseEntity obj) private void DataGridWaste_EditRequested(DatabaseEntity obj)
{ {
Waste waste = obj as Waste; EditWasteDialog epd = new EditWasteDialog();
if (waste != null) epd.Waste = obj as Waste;
epd.AddClicked += () =>
{ {
EditWasteDialog epd = new EditWasteDialog(); epd.CopyValuesToEntity();
epd.Waste = waste; if(!_was.Waste.Contains(epd.Waste))
epd.AddClicked += () =>
{
epd.CopyValuesToEntity();
_was.Waste.Add(epd.Waste); _was.Waste.Add(epd.Waste);
this.dataGridWaste.Items.Refresh(); this.dataGridWaste.Items.Refresh();
epd.Waste = new Waste(); epd.Waste = new Waste();
epd.Waste.Identifier = Waste.GetNewIdentifier(_was.Waste); epd.Waste.Identifier = Waste.GetNewIdentifier(_was.Waste);
epd.Waste.WAS = _was; epd.Waste.WAS = _was;
this.SublistElementChanged(Message.NotificationClass.WAS); this.SublistElementChanged(Message.NotificationClass.WAS);
}; };
if (epd.ShowDialog() ?? false) if (epd.ShowDialog() ?? false)
{ {
this.dataGridWaste.Items.Refresh(); if (!_was.Waste.Contains(epd.Waste))
this.SublistElementChanged(Message.NotificationClass.WAS); _was.Waste.Add(epd.Waste);
} this.dataGridWaste.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.WAS);
} }
} }
@ -194,6 +234,6 @@ namespace ENI2.DetailViewControls
} }
#endregion #endregion
} }
} }

View File

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

View File

@ -19,7 +19,7 @@
<ColumnDefinition Width="3*" /> <ColumnDefinition Width="3*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Label Content="{x:Static p:Resources.textBunkerType}" Grid.Row="0" Grid.Column="0" /> <Label Content="{x:Static p:Resources.textBunkerType}" Grid.Row="0" Grid.Column="0" />
<TextBox Grid.Row="0" Grid.Column="1" Width="auto" Name="textBoxBunkerType" Margin="2" MinLines="2" MaxLength="100" VerticalContentAlignment="Center"/> <TextBox Grid.Row="0" Grid.Column="1" Width="auto" Name="textBoxBunkerType" Margin="2" MaxLength="100" VerticalContentAlignment="Center"/>
<Label Content="{x:Static p:Resources.textBunkerQuantity}" Grid.Row="1" Grid.Column="0" /> <Label Content="{x:Static p:Resources.textBunkerQuantity}" Grid.Row="1" Grid.Column="0" />
<xctk:DoubleUpDown Grid.Row="1" Grid.Column="1" Name="doubleUpDownBunkerQuantity" ShowButtonSpinner="False" ParsingNumberStyle="Any" Margin="2,2,2,2" FormatString="N1" TextAlignment="Left" /> <xctk:DoubleUpDown Grid.Row="1" Grid.Column="1" Name="doubleUpDownBunkerQuantity" ShowButtonSpinner="False" ParsingNumberStyle="Any" Margin="2,2,2,2" FormatString="N1" TextAlignment="Left" />
</Grid> </Grid>

View File

@ -99,7 +99,8 @@ Copyright (c) 2017 schick Informatik
<xctk:DoubleUpDown Grid.Row="6" Grid.Column="4" Name="decimalUpDownEmergencyTemperature" Margin="2" FormatString="N2" ShowButtonSpinner="False" TextAlignment="Left"/> <xctk:DoubleUpDown Grid.Row="6" Grid.Column="4" Name="decimalUpDownEmergencyTemperature" Margin="2" FormatString="N2" ShowButtonSpinner="False" TextAlignment="Left"/>
<Label Grid.Row="6" Grid.Column="5" Content="°C" /> <Label Grid.Row="6" Grid.Column="5" Content="°C" />
<xctk:IntegerUpDown Grid.Row="7" Grid.Column="1" Name="integerUpDownNumberOfPackages" Margin="2" ShowButtonSpinner="False" Minimum="0" TextAlignment="Left"/> <xctk:IntegerUpDown Grid.Row="7" Grid.Column="1" Name="integerUpDownNumberOfPackages" Margin="2" ShowButtonSpinner="False" Minimum="0" TextAlignment="Left"/>
<ComboBox Name="comboBoxPackageType" Grid.Column="4" Grid.Row="7" Grid.ColumnSpan="2" Margin="2" SelectedValuePath="Key" DisplayMemberPath="Value" IsEditable="True" StaysOpenOnEdit="True" IsTextSearchEnabled="True" /> <ComboBox Name="comboBoxPackageType" Grid.Column="4" Grid.Row="7" Grid.ColumnSpan="2" Margin="2" SelectedValuePath="Key" DisplayMemberPath="Value" SelectionChanged="comboBoxPackageType_SelectionChanged" />
<TextBox Grid.Row="7" Grid.Column="6" Grid.ColumnSpan="3" Margin="2" Name="textBoxPackageType" VerticalContentAlignment="Center" TextChanged="textBoxPackageType_TextChanged"/>
<CheckBox Grid.Row="8" Grid.Column="1" Name="checkBoxLimitedQuantities" VerticalAlignment="Center" Margin="2"/> <CheckBox Grid.Row="8" Grid.Column="1" Name="checkBoxLimitedQuantities" VerticalAlignment="Center" Margin="2"/>
<CheckBox Grid.Row="8" Grid.Column="4" Name="checkBoxExceptedQuantities" VerticalAlignment="Center" Margin="2" /> <CheckBox Grid.Row="8" Grid.Column="4" Name="checkBoxExceptedQuantities" VerticalAlignment="Center" Margin="2" />
<xctk:DoubleUpDown Grid.Row="8" Grid.Column="7" Name="doubleUpDownCargoVolume" Margin="2" Minimum="0" ShowButtonSpinner="False" FormatString="N3" TextAlignment="Left"/> <xctk:DoubleUpDown Grid.Row="8" Grid.Column="7" Name="doubleUpDownCargoVolume" Margin="2" Minimum="0" ShowButtonSpinner="False" FormatString="N3" TextAlignment="Left"/>

View File

@ -60,10 +60,12 @@ namespace ENI2.EditControls
this.checkBoxMarinePollutant.IsChecked = this.IMDG.MarinePollutant; this.checkBoxMarinePollutant.IsChecked = this.IMDG.MarinePollutant;
this.comboBoxPackageType.ItemsSource = HAZ.PackageTypes; this.comboBoxPackageType.ItemsSource = HAZ.PackageTypes;
//this.comboBoxPackageType.KeyUp += ComboBox_KeyUp;
this.comboBoxPackageType.SelectedValue = this.IMDG.PackageType; //if((this.IMDG.PackageType != null) && HAZ.PackageTypes.ContainsKey(this.IMDG.PackageType))
this.comboBoxPackingGroup.ItemsSource = GlobalStructures.packingGroups; // this.comboBoxPackageType.SelectedValue = this.IMDG.PackageType;
//this.comboBoxPackingGroup.KeyUp += ComboBox_KeyUp; this.textBoxPackageType.Text = this.IMDG.PackageType;
this.comboBoxPackingGroup.ItemsSource = GlobalStructures.packingGroups;
this.comboBoxPackingGroup.SelectedIndex = (int) (this.IMDG.PackingGroup ?? -1); this.comboBoxPackingGroup.SelectedIndex = (int) (this.IMDG.PackingGroup ?? -1);
this.locodeControlPortOfDischarge.LocodeValue = this.IMDG.PortOfDischarge; this.locodeControlPortOfDischarge.LocodeValue = this.IMDG.PortOfDischarge;
@ -84,7 +86,7 @@ namespace ENI2.EditControls
this.IMDG.Flashpoint_CEL = this.textBoxFlashpoint.Text.Trim(); this.IMDG.Flashpoint_CEL = this.textBoxFlashpoint.Text.Trim();
this.IMDG.Identifier = this.textBoxIdentifier.Text.Trim(); this.IMDG.Identifier = this.textBoxIdentifier.Text.Trim();
this.IMDG.IMOClass = this.textBoxIMOClass.Text.Trim(); this.IMDG.IMOClass = this.textBoxIMOClass.Text.Trim();
this.IMDG.PackageType = this.comboBoxPackageType.SelectedValue as string; this.IMDG.PackageType = this.textBoxPackageType.Text.Trim();
this.IMDG.ProperShippingName = this.textBoxProperShippingName.Text.Trim(); this.IMDG.ProperShippingName = this.textBoxProperShippingName.Text.Trim();
this.IMDG.Remarks = this.textBoxRemarks.Text.Trim(); this.IMDG.Remarks = this.textBoxRemarks.Text.Trim();
this.IMDG.StowagePosition = this.textBoxStowagePosition.Text.Trim(); this.IMDG.StowagePosition = this.textBoxStowagePosition.Text.Trim();
@ -121,5 +123,20 @@ namespace ENI2.EditControls
{ {
this.CopyValuesToEntity(); this.CopyValuesToEntity();
} }
private void comboBoxPackageType_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
{
if(this.comboBoxPackageType.SelectedValue != null)
this.textBoxPackageType.Text = this.comboBoxPackageType.SelectedValue as string;
}
private void textBoxPackageType_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
{
string pText = this.textBoxPackageType.Text;
if (pText.IsNullOrEmpty() || !HAZ.PackageTypes.ContainsKey(pText))
this.comboBoxPackageType.SelectedIndex = -1;
else
this.comboBoxPackageType.SelectedValue = pText;
}
} }
} }

View File

@ -28,28 +28,27 @@
<Label Name="labelCode" Grid.Row="0" Grid.Column="0" Content="{x:Static p:Resources.textCode}" /> <Label Name="labelCode" Grid.Row="0" Grid.Column="0" Content="{x:Static p:Resources.textCode}" />
<Label Name="labelDescription" Grid.Row="1" Grid.Column="0" Content="{x:Static p:Resources.textDescription}" /> <Label Name="labelDescription" Grid.Row="1" Grid.Column="0" Content="{x:Static p:Resources.textDescription}" />
<Label Name="labelAmountWasteDischarged" Grid.Row="2" Grid.Column="0" Content="{x:Static p:Resources.textWasteAmountDischargedLastPort}" /> <Label Name="labelAmountDisposed" Grid.Row="2" Grid.Column="0" Content="{x:Static p:Resources.textWasteAmountToBeDisposed}" />
<Label Name="labelAmountDisposed" Grid.Row="3" Grid.Column="0" Content="{x:Static p:Resources.textWasteAmountToBeDisposed}" /> <Label Name="labelMaxWasteCapacity" Grid.Row="3" Grid.Column="0" Content="{x:Static p:Resources.textWasteMaxCapacity}" />
<Label Name="labelMaxWasteCapacity" Grid.Row="4" Grid.Column="0" Content="{x:Static p:Resources.textWasteMaxCapacity}" /> <Label Name="labelWasteAmountRetained" Grid.Row="4" Grid.Column="0" Content="{x:Static p:Resources.textWasteRetained}" />
<Label Name="labelWasteAmountRetained" Grid.Row="5" Grid.Column="0" Content="{x:Static p:Resources.textWasteRetained}" /> <Label Name="labelPortOfDeliver" Grid.Row="5" Grid.Column="0" Content="{x:Static p:Resources.textWastePortOfDelivery}" />
<Label Name="labelPortOfDeliver" Grid.Row="6" Grid.Column="0" Content="{x:Static p:Resources.textWastePortOfDelivery}" /> <Label Name="labelEstimatedWasteGenerated" Grid.Row="6" Grid.Column="0" Content="{x:Static p:Resources.textWasteGeneratedUntilNextPort}" />
<Label Name="labelEstimatedWasteGenerated" Grid.Row="7" Grid.Column="0" Content="{x:Static p:Resources.textWasteGeneratedUntilNextPort}" /> <Label Name="labelAmountWasteDischarged" Grid.Row="7" Grid.Column="0" Content="{x:Static p:Resources.textWasteAmountDischargedLastPort}" />
<ComboBox Name="comboBoxWasteCode" Grid.Row="0" Grid.Column="1" Margin="2" SelectedValuePath="Key" DisplayMemberPath="Value" /> <ComboBox Name="comboBoxWasteCode" Grid.Row="0" Grid.Column="1" Margin="2" SelectedValuePath="Key" DisplayMemberPath="Value" />
<Label Name="labelWasteCodeText" Grid.Row="0" Grid.Column="2" /> <Label Name="labelWasteCodeText" Grid.Row="0" Grid.Column="2" />
<TextBox Name="textBoxDescription" Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" Width="auto" MaxLength="100" /> <TextBox Name="textBoxDescription" Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" Width="auto" MaxLength="100" />
<xctk:DoubleUpDown Grid.Row="2" Grid.Column="1" Name="doubleUpDownAmountWasteDischargedLastPort" ShowButtonSpinner="False" ParsingNumberStyle="Any" Margin="2" FormatString="N3" TextAlignment="Left"/> <xctk:DoubleUpDown Grid.Row="2" Grid.Column="1" Name="doubleUpDownAmountDisposed" ShowButtonSpinner="False" ParsingNumberStyle="Any" Margin="2" FormatString="N3" TextAlignment="Left"/>
<xctk:DoubleUpDown Grid.Row="3" Grid.Column="1" Name="doubleUpDownAmountDisposed" ShowButtonSpinner="False" ParsingNumberStyle="Any" Margin="2" FormatString="N3" TextAlignment="Left"/> <xctk:DoubleUpDown Grid.Row="3" Grid.Column="1" Name="doubleUpDownMaxCapacity" ShowButtonSpinner="False" ParsingNumberStyle="Any" Margin="2" FormatString="N3" TextAlignment="Left"/>
<xctk:DoubleUpDown Grid.Row="4" Grid.Column="1" Name="doubleUpDownMaxCapacity" ShowButtonSpinner="False" ParsingNumberStyle="Any" Margin="2" FormatString="N3" TextAlignment="Left"/> <xctk:DoubleUpDown Grid.Row="4" Grid.Column="1" Name="doubleUpDownAmountRetained" ShowButtonSpinner="False" ParsingNumberStyle="Any" Margin="2" FormatString="N3" TextAlignment="Left"/>
<xctk:DoubleUpDown Grid.Row="5" Grid.Column="1" Name="doubleUpDownAmountRetained" ShowButtonSpinner="False" ParsingNumberStyle="Any" Margin="2" FormatString="N3" TextAlignment="Left"/> <enictrl:LocodeControl Grid.Row="5" Grid.Column="1" x:Name="locodePortOfDeliveryRemainingWaste" />
<enictrl:LocodeControl Grid.Row="6" Grid.Column="1" x:Name="locodePortOfDeliveryRemainingWaste" /> <xctk:DoubleUpDown Grid.Row="6" Grid.Column="1" Name="doubleUpDownAmountGeneratedTilNextPort" ShowButtonSpinner="False" ParsingNumberStyle="Any" Margin="2" FormatString="N3" TextAlignment="Left"/>
<xctk:DoubleUpDown Grid.Row="7" Grid.Column="1" Name="doubleUpDownAmountGeneratedTilNextPort" ShowButtonSpinner="False" ParsingNumberStyle="Any" Margin="2" FormatString="N3" TextAlignment="Left"/> <xctk:DoubleUpDown Grid.Row="7" Grid.Column="1" Name="doubleUpDownAmountWasteDischargedLastPort" ShowButtonSpinner="False" ParsingNumberStyle="Any" Margin="2" FormatString="N3" TextAlignment="Left"/>
<Label Content="{x:Static p:Resources.textCubicMeters}" Grid.Row = "2" Grid.Column="2" /> <Label Content="{x:Static p:Resources.textCubicMeters}" Grid.Row = "2" Grid.Column="2" />
<Label Content="{x:Static p:Resources.textCubicMeters}" Grid.Row = "3" Grid.Column="2" /> <Label Content="{x:Static p:Resources.textCubicMeters}" Grid.Row = "3" Grid.Column="2" />
<Label Content="{x:Static p:Resources.textCubicMeters}" Grid.Row = "4" Grid.Column="2" /> <Label Content="{x:Static p:Resources.textCubicMeters}" Grid.Row = "4" Grid.Column="2" />
<Label Content="{x:Static p:Resources.textCubicMeters}" Grid.Row = "5" Grid.Column="2" /> <Label Content="{x:Static p:Resources.textCubicMeters}" Grid.Row = "6" Grid.Column="2" />
<Label Content="{x:Static p:Resources.textCubicMeters}" Grid.Row = "7" Grid.Column="2" /> <Label Content="{x:Static p:Resources.textCubicMeters}" Grid.Row = "7" Grid.Column="2" />
</Grid> </Grid>

View File

@ -647,6 +647,15 @@ namespace ENI2.Properties {
} }
} }
/// <summary>
/// Looks up a localized string similar to Add missing entries.
/// </summary>
public static string textAddMissingEntries {
get {
return ResourceManager.GetString("textAddMissingEntries", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Administrator. /// Looks up a localized string similar to Administrator.
/// </summary> /// </summary>
@ -2078,6 +2087,15 @@ namespace ENI2.Properties {
} }
} }
/// <summary>
/// Looks up a localized string similar to Import from SEC.
/// </summary>
public static string textImportFromSEC {
get {
return ResourceManager.GetString("textImportFromSEC", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to IMSBC item. /// Looks up a localized string similar to IMSBC item.
/// </summary> /// </summary>
@ -2780,6 +2798,15 @@ namespace ENI2.Properties {
} }
} }
/// <summary>
/// Looks up a localized string similar to This only works if the grid is empty!.
/// </summary>
public static string textOnlyIfGridIsEmpty {
get {
return ResourceManager.GetString("textOnlyIfGridIsEmpty", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Operations. /// Looks up a localized string similar to Operations.
/// </summary> /// </summary>

View File

@ -1513,4 +1513,13 @@
<data name="textPassengerImported" xml:space="preserve"> <data name="textPassengerImported" xml:space="preserve">
<value>{0} passengers imported</value> <value>{0} passengers imported</value>
</data> </data>
<data name="textAddMissingEntries" xml:space="preserve">
<value>Add missing entries</value>
</data>
<data name="textImportFromSEC" xml:space="preserve">
<value>Import from SEC</value>
</data>
<data name="textOnlyIfGridIsEmpty" xml:space="preserve">
<value>This only works if the grid is empty!</value>
</data>
</root> </root>

View File

@ -76,6 +76,10 @@ namespace ENI2.Util
"III" "III"
}; };
public static string[] PackingGroups
{
get { return packingGroups; }
}
public static List<string> EdiCodes public static List<string> EdiCodes
{ {

Binary file not shown.

View File

@ -77,8 +77,7 @@ namespace SendNSWMessageService
if (this.processRunning) return; if (this.processRunning) return;
else this.processRunning = true; else this.processRunning = true;
} }
bool sendSucceeded;
if (DBManager.Instance.Connect(Properties.Settings.Default.ConnectionString)) if (DBManager.Instance.Connect(Properties.Settings.Default.ConnectionString))
{ {
@ -96,16 +95,47 @@ namespace SendNSWMessageService
if ((core.InitialHIS == Message.NSWProvider.DUDR) || (core.InitialHIS == Message.NSWProvider.DUDR_TEST)) if ((core.InitialHIS == Message.NSWProvider.DUDR) || (core.InitialHIS == Message.NSWProvider.DUDR_TEST))
{ {
// HIS-NORD: alles auf einmal // HIS-NORD: alles auf einmal
sendSucceeded = bsmd.hisnord.Request.CreateSendFile(core, messages, (core.InitialHIS == Message.NSWProvider.DUDR_TEST));
// Um Fehlern vorzubeugen wird jetzt nicht eine Datei erzeugt sondern für jede Meldeklasse eine einzelne
// (Wunsch CH vom 6.10.17).
bool sendSucceeded = true;
bool didSendSomething = false;
// Fall: keine Meldeklasse aber trotzdem auf TO_SEND. Entweder beim Beantragen von Visit-Id's oder beim Storno der gesamten
// Anmeldung
if ((core.DisplayId.Length == 0) || (core.Cancelled ?? false))
{
sendSucceeded = bsmd.hisnord.Request.CreateSendFile(core, messages, (core.InitialHIS == Message.NSWProvider.DUDR_TEST)) ?? false;
}
else
{
foreach (Message message in messages)
{
bool? sendResult = bsmd.hisnord.Request.CreateSendFile(core, messages, (core.InitialHIS == Message.NSWProvider.DUDR_TEST));
if (sendResult.HasValue)
{
didSendSomething = true;
if (!sendResult.Value) sendSucceeded = false;
}
}
}
if (!didSendSomething) core.BSMDStatusInternal = MessageCore.BSMDStatus.PREPARE; // zurück zu neutral
else
{
if (!sendSucceeded) core.BSMDStatusInternal = MessageCore.BSMDStatus.FAILURE;
else core.BSMDStatusInternal = MessageCore.BSMDStatus.SENT;
}
_log.InfoFormat("HIS-Nord Send: Core {0} [{1}] new Status {2}", core.Id, core.IMO, core.BSMDStatusInternal.ToString());
if (!sendSucceeded) core.BSMDStatusInternal = MessageCore.BSMDStatus.FAILURE;
else core.BSMDStatusInternal = MessageCore.BSMDStatus.SENT;
DBManager.Instance.Save(core); DBManager.Instance.Save(core);
} }
else else
{ {
bool sendSucceeded;
#region DBH / Dakosy Logik #region DBH / Dakosy Logik
@ -146,7 +176,9 @@ namespace SendNSWMessageService
{ {
// Eine Nachricht mit dem Status "Suspended / Zurückgestellt" wird so lange nicht // Eine Nachricht mit dem Status "Suspended / Zurückgestellt" wird so lange nicht
// versendet, bis im ENI der Status wieder explizit zurückgesetzt wird (16.4.16) // versendet, bis im ENI der Status wieder explizit zurückgesetzt wird (16.4.16)
if (message.InternalStatus == Message.BSMDStatus.SUSPENDED) continue;
// Update 5.10.17: Alles was nicht explizit auf "TOSEND" steht wird nicht verschickt!
if (message.InternalStatus != Message.BSMDStatus.TOSEND) continue;
// "virtuelle" Messages nicht versenden (DK, EU) // "virtuelle" Messages nicht versenden (DK, EU)
if ((message.MessageNotificationClass == Message.NotificationClass.STO) || if ((message.MessageNotificationClass == Message.NotificationClass.STO) ||
@ -176,9 +208,9 @@ namespace SendNSWMessageService
(message.MessageNotificationClass == Message.NotificationClass.TRANSIT)) (message.MessageNotificationClass == Message.NotificationClass.TRANSIT))
continue; continue;
if ((message.InternalStatus != Message.BSMDStatus.CONFIRMED) && //if ((message.InternalStatus != Message.BSMDStatus.CONFIRMED) &&
(message.InternalStatus != Message.BSMDStatus.SENT)) //(message.InternalStatus != Message.BSMDStatus.SENT))
{ //{
// 28.12.2015: Das über "Overview" eingestellte HIS ist immer "führend" (zumindest aktuell zum Testen) // 28.12.2015: Das über "Overview" eingestellte HIS ist immer "führend" (zumindest aktuell zum Testen)
// if (message.HIS == Message.NSWProvider.UNDEFINED) // if (message.HIS == Message.NSWProvider.UNDEFINED)
@ -190,7 +222,7 @@ namespace SendNSWMessageService
message.ReportingParty = DBManager.Instance.GetReportingPartyDict()[core.DefaultReportingPartyId.Value]; message.ReportingParty = DBManager.Instance.GetReportingPartyDict()[core.DefaultReportingPartyId.Value];
} }
toSendMessageList.Add(message); toSendMessageList.Add(message);
} //}
} }
} }
@ -208,9 +240,17 @@ namespace SendNSWMessageService
{ {
case Message.NSWProvider.DBH: case Message.NSWProvider.DBH:
case Message.NSWProvider.DBH_TEST: case Message.NSWProvider.DBH_TEST:
sendSucceeded = bsmd.dbh.Request.SendMessage(message, (message.HIS == Message.NSWProvider.DBH_TEST)); if (!XtraSendLogic.ShouldSendMessage(message))
if (!sendSucceeded) {
message.InternalStatus = Message.BSMDStatus.SEND_FAILED; message.InternalStatus = Message.BSMDStatus.SUSPENDED;
}
else
{
sendSucceeded = bsmd.dbh.Request.SendMessage(message, (message.HIS == Message.NSWProvider.DBH_TEST));
if (!sendSucceeded)
message.InternalStatus = Message.BSMDStatus.SEND_FAILED;
}
break; break;
case Message.NSWProvider.DAKOSY: case Message.NSWProvider.DAKOSY:
@ -264,7 +304,7 @@ namespace SendNSWMessageService
} }
bsmd.hisnord.transmitter.CallTransmitter(true); bsmd.hisnord.transmitter.CallTransmitter(true);
bsmd.hisnord.transmitter.CallTransmitter(false); // bsmd.hisnord.transmitter.CallTransmitter(false); // wird aktuell nicht funktionieren
// ob test oder nicht ist in stat. dict gespeicher // ob test oder nicht ist in stat. dict gespeicher
bsmd.hisnord.Request.ReadResponseFiles(); bsmd.hisnord.Request.ReadResponseFiles();

View File

@ -1081,14 +1081,23 @@ namespace bsmd.ExcelReadService
} }
NOA_NOD noa_nod = noa_nodMessage.Elements[0] as NOA_NOD; NOA_NOD noa_nod = noa_nodMessage.Elements[0] as NOA_NOD;
DateTime? eta = reader.ReadDateTime("NOA_NOD.ETADateToPortOfCall", "NOA_NOD.ETATimeToPortOfCall");
if (messageCore.IsTransit) if (messageCore.IsTransit)
{ {
noa_nod.ETAToKielCanal = messageCore.ETAKielCanal; if (eta.HasValue)
noa_nod.ETAToKielCanal = eta;
else
noa_nod.ETAToKielCanal = messageCore.ETAKielCanal;
} }
else else
{ {
if (eta.HasValue)
noa_nod.ETAToPortOfCall = eta;
else
noa_nod.ETAToPortOfCall = messageCore.ETA;
noa_nod.ETAToPortOfCall = messageCore.ETA;
// Zeit muss zurückkonvertiert werden, da toUniversalTime() kodiert // Zeit muss zurückkonvertiert werden, da toUniversalTime() kodiert
if(noa_nod.ETAToPortOfCall.HasValue) if(noa_nod.ETAToPortOfCall.HasValue)
reader.Conf.ConfirmDate("NOA_NOD.ETAToPortOfCall", noa_nod.ETAToPortOfCall.Value.ToLocalTime(), ExcelReader.ReadState.OK); reader.Conf.ConfirmDate("NOA_NOD.ETAToPortOfCall", noa_nod.ETAToPortOfCall.Value.ToLocalTime(), ExcelReader.ReadState.OK);

View File

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

@ -166,7 +166,7 @@ namespace bsmd.database
/// </summary> /// </summary>
/// <param name="sublist">Vorhandene Position</param> /// <param name="sublist">Vorhandene Position</param>
/// <returns>Name des neuen Identifiers, der so nicht in der Liste vorkommt</returns> /// <returns>Name des neuen Identifiers, der so nicht in der Liste vorkommt</returns>
public static string GetNewIdentifier(IEnumerable<DatabaseEntity> sublist) public static string GetNewIdentifier(IEnumerable<DatabaseEntity> sublist, string prefix=null)
{ {
int maxVal = -1; int maxVal = -1;
string maxString = null; string maxString = null;
@ -199,12 +199,8 @@ namespace bsmd.database
// Spezialbalkone // Spezialbalkone
try try
{ {
Type type = sublist.GetType().GetGenericArguments()[0]; if (prefix != null)
if (type == typeof(IMDGPosition)) return "IMDG-1"; return string.Format("{0}1", prefix);
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 catch
{ {

View File

@ -250,6 +250,27 @@ namespace bsmd.database
#endregion #endregion
#region public helper
internal void SetBoolsToFalse()
{
this.AwareOfFurtherInfections = false;
this.InfectedAreaVisited = false;
this.MDHSimplification = false;
this.MedicalConsulted = false;
this.NonAccidentalDeathsDuringVoyage = false;
this.NumberOfIllPersonsHigherThanExpected = false;
this.SanitaryControlReinspectionRequired = false;
this.SanitaryMeasuresApplied = false;
this.SickAnimalOrPetOnBoard = false;
this.SickPersonsOnBoard = false;
this.StowawaysDetected = false;
this.SuspisionInfectiousNature = false;
this.ValidSanitaryControlExemptionOrCertificateOnBoard = false;
}
#endregion
#region abstract method implementation #region abstract method implementation
public override void PrepareSave(System.Data.IDbCommand cmd) public override void PrepareSave(System.Data.IDbCommand cmd)

View File

@ -343,6 +343,22 @@ namespace bsmd.database
/// </summary> /// </summary>
public bool HasReminder { get; set; } public bool HasReminder { get; set; }
/// <summary>
/// ENI display flag: send complete
/// </summary>
public bool SuccessfullySent
{
get
{
return this.SystemErrorList.IsNullOrEmpty() &&
this.ViolationList.IsNullOrEmpty() &&
this.ErrorList.IsNullOrEmpty() &&
this.Status.HasValue &&
!(this.Reset) &&
(this.Status.Value == MessageStatus.ACCEPTED);
}
}
#endregion #endregion
#region IDatabaseEntity implementation #region IDatabaseEntity implementation
@ -590,7 +606,7 @@ namespace bsmd.database
public void SaveElements() public void SaveElements()
{ {
foreach (DatabaseEntity dbEntity in this.Elements) foreach (DatabaseEntity dbEntity in this.Elements)
{ {
DBManager.Instance.Save(dbEntity); DBManager.Instance.Save(dbEntity);
if (dbEntity is ISublistContainer) if (dbEntity is ISublistContainer)
{ {

View File

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

View File

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

View File

@ -159,8 +159,17 @@ namespace bsmd.database
// abgesehen von "Listen" für die Nachrichtenklassen auch untergeordnete Elemente erzeugen // abgesehen von "Listen" für die Nachrichtenklassen auch untergeordnete Elemente erzeugen
DatabaseEntity classElement = null; DatabaseEntity classElement = null;
if (!Message.IsListClass(notificationClass)) if (!Message.IsListClass(notificationClass))
{
classElement = DBManager.CreateMessage(notificationClass); classElement = DBManager.CreateMessage(notificationClass);
// CH: 6.10.17: Für die manuelle Eingabe (wird leider nicht ganz auszuschließen sein) wäre es hilfreich, wenn alle Checkboxen nicht leer sind, sondern False beinhalten.
if(notificationClass == Message.NotificationClass.MDH)
{
((MDH)classElement).SetBoolsToFalse();
}
}
DBManager.Instance.Save(message); DBManager.Instance.Save(message);
if (classElement != null) // null für Visit/Transit/List if (classElement != null) // null für Visit/Transit/List

View File

@ -51,7 +51,8 @@ namespace bsmd.database
#region static methods #region static methods
public static bool? CheckConditions(MessageCore core, List<Message> messages, ConditionGroup cGroup, List<ValidationField> failedFieldList, out string message) public static bool? CheckConditions(MessageCore core, List<Message> messages, ConditionGroup cGroup, List<ValidationField> failedFieldList,
out string message)
{ {
bool? result = null; bool? result = null;
message = ""; message = "";
@ -59,12 +60,57 @@ namespace bsmd.database
try try
{ {
// Bedingungen validieren
foreach (ValidationCondition condition in cGroup.Conditions) foreach (ValidationCondition condition in cGroup.Conditions)
{ {
object[] otherargs = null; object[] otherargs = null;
// switch case type // den aktuellen Wert bestimmen
if(!ValidationRule.ValidationFieldDict.ContainsKey(condition.FieldName))
{
// TODO: Warnung absetzen
continue;
}
ValidationField vf = ValidationRule.ValidationFieldDict[condition.FieldName];
// Wert aus den Daten auslesen
// Dabei muss unterschieden werden: 1. skalarer Wert
// 2. Wert eines Listenelements
//
// als Rückgabe würde dann benötigt der Name des Property, die beteiligte Klasse und natürlich der Identifier (Index) wenn es eine Listenposition war
//if(vf.)
//object value = vf.PropertyInfo.GetValue()
switch(condition.ConditionOperator)
{
case ConditionOperatorEnum.EQUAL:
break;
case ConditionOperatorEnum.NOT_EQUAL:
break;
case ConditionOperatorEnum.LESS:
break;
case ConditionOperatorEnum.GREATER:
break;
case ConditionOperatorEnum.NULL:
break;
case ConditionOperatorEnum.NOT_NULL:
break;
}

View File

@ -13,6 +13,7 @@ namespace bsmd.database
public class ValidationRule : DatabaseEntity public class ValidationRule : DatabaseEntity
{ {
private static List<ValidationField> _validationFields = null; private static List<ValidationField> _validationFields = null;
private static Dictionary<string, ValidationField> _validationFieldDict = null;
public ValidationRule() public ValidationRule()
{ {
@ -51,6 +52,7 @@ namespace bsmd.database
if(_validationFields == null) if(_validationFields == null)
{ {
_validationFields = new List<ValidationField>(); _validationFields = new List<ValidationField>();
_validationFieldDict = new Dictionary<string, ValidationField>();
_validationFields.AddRange(GetFieldsForClass(typeof(AGNT), false, Message.NotificationClass.AGNT)); _validationFields.AddRange(GetFieldsForClass(typeof(AGNT), false, Message.NotificationClass.AGNT));
_validationFields.AddRange(GetFieldsForClass(typeof(ATA), false, Message.NotificationClass.ATA)); _validationFields.AddRange(GetFieldsForClass(typeof(ATA), false, Message.NotificationClass.ATA));
_validationFields.AddRange(GetFieldsForClass(typeof(ATD), false, Message.NotificationClass.ATD)); _validationFields.AddRange(GetFieldsForClass(typeof(ATD), false, Message.NotificationClass.ATD));
@ -97,6 +99,7 @@ namespace bsmd.database
_validationFields.AddRange(GetFieldsForClass(typeof(WAS), false, Message.NotificationClass.WAS)); _validationFields.AddRange(GetFieldsForClass(typeof(WAS), false, Message.NotificationClass.WAS));
_validationFields.AddRange(GetFieldsForClass(typeof(Waste), true, null)); _validationFields.AddRange(GetFieldsForClass(typeof(Waste), true, null));
_validationFields.AddRange(GetFieldsForClass(typeof(WasteDisposalServiceProvider), true, null)); _validationFields.AddRange(GetFieldsForClass(typeof(WasteDisposalServiceProvider), true, null));
_validationFields.AddRange(GetFieldsForClass(typeof(MessageCore), false, null));
// Ergebnis sortiert nach Klassenname - Propertyname // Ergebnis sortiert nach Klassenname - Propertyname
_validationFields.Sort(delegate (ValidationField c1, ValidationField c2) { _validationFields.Sort(delegate (ValidationField c1, ValidationField c2) {
@ -106,11 +109,17 @@ namespace bsmd.database
return result; return result;
}); });
// Dictionary aufladen
foreach (ValidationField vf in _validationFields)
_validationFieldDict[vf.FullName] = vf;
} }
return _validationFields; return _validationFields;
} }
} }
public static Dictionary<string, ValidationField> ValidationFieldDict { get { return _validationFieldDict; } }
private static List<ValidationField> GetFieldsForClass(Type objType, bool isList, Message.NotificationClass? notificationClass) private static List<ValidationField> GetFieldsForClass(Type objType, bool isList, Message.NotificationClass? notificationClass)
{ {
List<ValidationField> result = new List<ValidationField>(); List<ValidationField> result = new List<ValidationField>();

View File

@ -21,8 +21,8 @@ namespace bsmd.database
private List<DatabaseEntity> waste = new List<DatabaseEntity>(); 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 int[] dkWasteCodes = { 1100, 1200, 1300, 2100, 2200, 2300, 2311, 2308, 2600, 2300, 2309, 3000, 5100, 5200, 5300, 2300 };
private static readonly string[] dkWasteTypes = { "Waste oils - Sludge", "Waste oils - Bilge water", "Waste oils - Other", "Garbage - Food waste", "Garbage - Plastic", "Garbage - Other", "Garbage - Other - Cooking oil", "Garbage - Other - Incinerator ashes and clinkers", "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" }; private static readonly string[] dkWasteTypes = { "Waste oils - Sludge", "Waste oils - Bilge water", "Waste oils - Other", "Garbage - Food waste", "Garbage - Plastic", "Garbage - Other", "Garbage - Other - Cooking oil", "Garbage - Other - Incinerator ashes and clinkers", "Operational wastes", "Garbage - Other", "Garbage - Other - Animal carcasses", "Sewage", "Cargo residues - Marpol Annex I - Other", "Cargo residues - Marpol Annex II - Other", "Cargo residues - Marpol Annex V - Other", "Garbage - Other" };
public WAS() public WAS()
{ {

View File

@ -42,7 +42,8 @@ namespace bsmd.dbh
return false; return false;
} }
if (!XtraSendLogic.ShouldSendMessage(message)) return false; message.StatusInfo = ""; // zurücksetzen analog zu HIS-Nord (5.10.17)
message.ChangedBy = "";
// map message to dbh NSWRequest object // map message to dbh NSWRequest object
Dbh_Osis_Answ_Ws client = new Dbh_Osis_Answ_Ws(); Dbh_Osis_Answ_Ws client = new Dbh_Osis_Answ_Ws();

View File

@ -114,7 +114,7 @@ namespace bsmd.hisnord
noteMessageDict[notificationClass].StatusInfo = ""; 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].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].InternalStatus = Message.BSMDStatus.SENT;
noteMessageDict[notificationClass].SentAt = DateTime.Now; noteMessageDict[notificationClass].SentAt = DateTime.Now;
DBManager.Instance.DeleteSystemErrors(noteMessageDict[notificationClass]); DBManager.Instance.DeleteSystemErrors(noteMessageDict[notificationClass]);
result = noteMessageDict[notificationClass]; result = noteMessageDict[notificationClass];
} }
@ -125,10 +125,10 @@ namespace bsmd.hisnord
return result; return result;
} }
public static bool CreateSendFile(MessageCore core, List<Message> messages, bool useTest) public static bool? CreateSendFile(MessageCore core, List<Message> messages, bool useTest)
{ {
bool retval = true; bool? retval = null;
bool containsData = false;
// dieses Dict wird benötigt, da die Meldeklassen in der richtigen Reihenfolge hinzugefügt werden müssen // dieses Dict wird benötigt, da die Meldeklassen in der richtigen Reihenfolge hinzugefügt werden müssen
Request.noteMessageDict.Clear(); Request.noteMessageDict.Clear();
@ -192,6 +192,7 @@ namespace bsmd.hisnord
} }
else // liegt noch nichts vor, Id muss beantragt werden else // liegt noch nichts vor, Id muss beantragt werden
{ {
retval = true;
_nsw.conveyance.Items = new object[4]; _nsw.conveyance.Items = new object[4];
_nsw.conveyance.ItemsElementName = new ItemsChoiceType[4]; _nsw.conveyance.ItemsElementName = new ItemsChoiceType[4];
_nsw.conveyance.Items[0] = core.Shipname; _nsw.conveyance.Items[0] = core.Shipname;
@ -202,6 +203,7 @@ namespace bsmd.hisnord
_nsw.conveyance.ItemsElementName[2] = ItemsChoiceType.PortOfCall; _nsw.conveyance.ItemsElementName[2] = ItemsChoiceType.PortOfCall;
_nsw.conveyance.Items[3] = core.IsTransit ? core.ETAKielCanal : core.ETA; // TODO Datum konvertieren? _nsw.conveyance.Items[3] = core.IsTransit ? core.ETAKielCanal : core.ETA; // TODO Datum konvertieren?
_nsw.conveyance.ItemsElementName[3] = ItemsChoiceType.ETAPortOfCall; _nsw.conveyance.ItemsElementName[3] = ItemsChoiceType.ETAPortOfCall;
containsData = true;
} }
#endregion #endregion
@ -209,6 +211,7 @@ namespace bsmd.hisnord
#region NSW message area #region NSW message area
Message visitTransitHeader = null; Message visitTransitHeader = null;
Message message = null;
// wir wissen noch nicht wieviele es werden, von daher erstmal eine Liste! // wir wissen noch nicht wieviele es werden, von daher erstmal eine Liste!
List<Items1ChoiceType> items1ChoiceType = new List<Items1ChoiceType>(); List<Items1ChoiceType> items1ChoiceType = new List<Items1ChoiceType>();
@ -219,12 +222,11 @@ namespace bsmd.hisnord
// nur das "STORNO" Element hinzufügen // nur das "STORNO" Element hinzufügen
items1ChoiceType.Add(Items1ChoiceType.STORNO); items1ChoiceType.Add(Items1ChoiceType.STORNO);
items1.Add(ytype.Y); items1.Add(ytype.Y);
containsData = true;
} }
else else
{ {
Message message = null;
if(!core.IsTransit) if(!core.IsTransit)
{ {
@ -245,6 +247,7 @@ namespace bsmd.hisnord
message = GetSendMessage(Message.NotificationClass.STAT); message = GetSendMessage(Message.NotificationClass.STAT);
if (message != null) if (message != null)
{ {
containsData = true;
if (message.Reset) if (message.Reset)
{ {
items1ChoiceType.Add(Items1ChoiceType.RESET_STAT); items1ChoiceType.Add(Items1ChoiceType.RESET_STAT);
@ -290,6 +293,7 @@ namespace bsmd.hisnord
message = GetSendMessage(Message.NotificationClass.NOA_NOD); message = GetSendMessage(Message.NotificationClass.NOA_NOD);
if (message != null) if (message != null)
{ {
containsData = true;
if (message.Reset) if (message.Reset)
{ {
items1ChoiceType.Add(Items1ChoiceType.RESET_NOANOD); items1ChoiceType.Add(Items1ChoiceType.RESET_NOANOD);
@ -347,6 +351,7 @@ namespace bsmd.hisnord
if (message != null) if (message != null)
{ {
containsData = true;
if (message.Reset) if (message.Reset)
{ {
items1ChoiceType.Add(Items1ChoiceType.RESET_ATA); items1ChoiceType.Add(Items1ChoiceType.RESET_ATA);
@ -367,6 +372,7 @@ namespace bsmd.hisnord
if (message != null) if (message != null)
{ {
containsData = true;
if (message.Reset) if (message.Reset)
{ {
items1ChoiceType.Add(Items1ChoiceType.RESET_ATD); items1ChoiceType.Add(Items1ChoiceType.RESET_ATD);
@ -389,6 +395,7 @@ namespace bsmd.hisnord
message = GetSendMessage(Message.NotificationClass.POBA); message = GetSendMessage(Message.NotificationClass.POBA);
if (message != null) if (message != null)
{ {
containsData = true;
if (message.Reset) if (message.Reset)
{ {
items1ChoiceType.Add(Items1ChoiceType.RESET_POBA); items1ChoiceType.Add(Items1ChoiceType.RESET_POBA);
@ -417,6 +424,7 @@ namespace bsmd.hisnord
message = GetSendMessage(Message.NotificationClass.POBD); message = GetSendMessage(Message.NotificationClass.POBD);
if (message != null) if (message != null)
{ {
containsData = true;
if (message.Reset) if (message.Reset)
{ {
items1ChoiceType.Add(Items1ChoiceType.RESET_POBD); items1ChoiceType.Add(Items1ChoiceType.RESET_POBD);
@ -445,6 +453,7 @@ namespace bsmd.hisnord
message = GetSendMessage(Message.NotificationClass.NAME); message = GetSendMessage(Message.NotificationClass.NAME);
if (message != null) if (message != null)
{ {
containsData = true;
if (message.Reset) if (message.Reset)
{ {
items1ChoiceType.Add(Items1ChoiceType.RESET_NameOfMaster); items1ChoiceType.Add(Items1ChoiceType.RESET_NameOfMaster);
@ -466,6 +475,7 @@ namespace bsmd.hisnord
message = GetSendMessage(Message.NotificationClass.TIEFA); message = GetSendMessage(Message.NotificationClass.TIEFA);
if (message != null) if (message != null)
{ {
containsData = true;
if (message.Reset) if (message.Reset)
{ {
items1ChoiceType.Add(Items1ChoiceType.RESET_TIEFA); items1ChoiceType.Add(Items1ChoiceType.RESET_TIEFA);
@ -489,6 +499,7 @@ namespace bsmd.hisnord
message = GetSendMessage(Message.NotificationClass.TIEFD); message = GetSendMessage(Message.NotificationClass.TIEFD);
if (message != null) if (message != null)
{ {
containsData = true;
if (message.Reset) if (message.Reset)
{ {
items1ChoiceType.Add(Items1ChoiceType.RESET_TIEFD); items1ChoiceType.Add(Items1ChoiceType.RESET_TIEFD);
@ -514,6 +525,7 @@ namespace bsmd.hisnord
message = GetSendMessage(Message.NotificationClass.INFO); message = GetSendMessage(Message.NotificationClass.INFO);
if (message != null) if (message != null)
{ {
containsData = true;
if (message.Reset) if (message.Reset)
{ {
items1ChoiceType.Add(Items1ChoiceType.RESET_INFO); items1ChoiceType.Add(Items1ChoiceType.RESET_INFO);
@ -555,6 +567,7 @@ namespace bsmd.hisnord
message = GetSendMessage(Message.NotificationClass.BKRA); message = GetSendMessage(Message.NotificationClass.BKRA);
if (message != null) { if (message != null) {
containsData = true;
if (message.Reset) if (message.Reset)
{ {
items1ChoiceType.Add(Items1ChoiceType.RESET_BKRA); items1ChoiceType.Add(Items1ChoiceType.RESET_BKRA);
@ -582,6 +595,7 @@ namespace bsmd.hisnord
message = GetSendMessage(Message.NotificationClass.BKRD); message = GetSendMessage(Message.NotificationClass.BKRD);
if (message != null) { if (message != null) {
containsData = true;
if (message.Reset) if (message.Reset)
{ {
items1ChoiceType.Add(Items1ChoiceType.RESET_BKRD); items1ChoiceType.Add(Items1ChoiceType.RESET_BKRD);
@ -613,6 +627,7 @@ namespace bsmd.hisnord
message = GetSendMessage(Message.NotificationClass.HAZA); message = GetSendMessage(Message.NotificationClass.HAZA);
if (message != null) if (message != null)
{ {
containsData = true;
if (message.Reset) if (message.Reset)
{ {
items1ChoiceType.Add(Items1ChoiceType.RESET_HAZA); items1ChoiceType.Add(Items1ChoiceType.RESET_HAZA);
@ -676,6 +691,7 @@ namespace bsmd.hisnord
message = GetSendMessage(Message.NotificationClass.HAZD); message = GetSendMessage(Message.NotificationClass.HAZD);
if (message != null) if (message != null)
{ {
containsData = true;
if (message.Reset) if (message.Reset)
{ {
items1ChoiceType.Add(Items1ChoiceType.RESET_HAZD); items1ChoiceType.Add(Items1ChoiceType.RESET_HAZD);
@ -741,6 +757,7 @@ namespace bsmd.hisnord
message = GetSendMessage(Message.NotificationClass.LADG); message = GetSendMessage(Message.NotificationClass.LADG);
if (message != null) if (message != null)
{ {
containsData = true;
if (message.Reset) if (message.Reset)
{ {
items1ChoiceType.Add(Items1ChoiceType.RESET_LADG); items1ChoiceType.Add(Items1ChoiceType.RESET_LADG);
@ -783,6 +800,7 @@ namespace bsmd.hisnord
message = GetSendMessage(Message.NotificationClass.SERV); message = GetSendMessage(Message.NotificationClass.SERV);
if (message != null) if (message != null)
{ {
containsData = true;
if (message.Reset) if (message.Reset)
{ {
items1ChoiceType.Add(Items1ChoiceType.RESET_SERV); items1ChoiceType.Add(Items1ChoiceType.RESET_SERV);
@ -815,6 +833,7 @@ namespace bsmd.hisnord
message = GetSendMessage(Message.NotificationClass.PRE72H); message = GetSendMessage(Message.NotificationClass.PRE72H);
if (message != null) if (message != null)
{ {
containsData = true;
if (message.Reset) if (message.Reset)
{ {
items1ChoiceType.Add(Items1ChoiceType.RESET_PRE72H); items1ChoiceType.Add(Items1ChoiceType.RESET_PRE72H);
@ -863,6 +882,7 @@ namespace bsmd.hisnord
message = GetSendMessage(Message.NotificationClass.SEC); message = GetSendMessage(Message.NotificationClass.SEC);
if (message != null) if (message != null)
{ {
containsData = true;
if (message.Reset) if (message.Reset)
{ {
items1ChoiceType.Add(Items1ChoiceType.RESET_SEC); items1ChoiceType.Add(Items1ChoiceType.RESET_SEC);
@ -1026,6 +1046,7 @@ namespace bsmd.hisnord
message = GetSendMessage(Message.NotificationClass.MDH); message = GetSendMessage(Message.NotificationClass.MDH);
if (message != null) if (message != null)
{ {
containsData = true;
if (message.Reset) if (message.Reset)
{ {
items1ChoiceType.Add(Items1ChoiceType.RESET_MDH); items1ChoiceType.Add(Items1ChoiceType.RESET_MDH);
@ -1086,18 +1107,19 @@ namespace bsmd.hisnord
if (sanitaryMeasuresApplied) if (sanitaryMeasuresApplied)
{ {
sanitarydetail[] sanitaryDetails = new sanitarydetail[mdh.SanitaryMeasuresDetails.Count]; //sanitarydetail[] sanitaryDetails = new sanitarydetail[mdh.SanitaryMeasuresDetails.Count];
for (int j = 0; j < mdh.SanitaryMeasuresDetails.Count; j++) for (int j = 0; j < mdh.SanitaryMeasuresDetails.Count; j++)
{ {
SanitaryMeasuresDetail detail = mdh.SanitaryMeasuresDetails[j] as SanitaryMeasuresDetail; SanitaryMeasuresDetail detail = mdh.SanitaryMeasuresDetails[j] as SanitaryMeasuresDetail;
sanitaryDetails[j] = new sanitarydetail(); sanitarydetail aSanitaryDetail = new sanitarydetail();
//sanitaryDetails[j] = new sanitarydetail();
if (detail.SanitaryMeasuresDate.HasValue) if (detail.SanitaryMeasuresDate.HasValue)
sanitaryDetails[j].SanitaryMeasuresDate = detail.SanitaryMeasuresDate.Value; aSanitaryDetail.SanitaryMeasuresDate = detail.SanitaryMeasuresDate.Value;
sanitaryDetails[j].SanitaryMeasuresLocation = detail.SanitaryMeasuresLocation; aSanitaryDetail.SanitaryMeasuresLocation = detail.SanitaryMeasuresLocation;
sanitaryDetails[j].SanitaryMeasuresType = detail.SanitaryMeasuresType; aSanitaryDetail.SanitaryMeasuresType = detail.SanitaryMeasuresType;
} mdh_items.Add(aSanitaryDetail);
mdh_items.Add(sanitaryDetails); mdh_types.Add(ItemsChoiceType5.SanitaryMeasuresDetails);
mdh_types.Add(ItemsChoiceType5.SanitaryMeasuresDetails); }
} }
mdh_items.Add((mdh.StowawaysDetected ?? false) ? yorntype.Y : yorntype.N); mdh_items.Add((mdh.StowawaysDetected ?? false) ? yorntype.Y : yorntype.N);
@ -1188,6 +1210,7 @@ namespace bsmd.hisnord
message = GetSendMessage(Message.NotificationClass.WAS); message = GetSendMessage(Message.NotificationClass.WAS);
if (message != null) if (message != null)
{ {
containsData = true;
if (message.Reset) if (message.Reset)
{ {
items1ChoiceType.Add(Items1ChoiceType.RESET_WAS); items1ChoiceType.Add(Items1ChoiceType.RESET_WAS);
@ -1289,6 +1312,7 @@ namespace bsmd.hisnord
message = GetSendMessage(Message.NotificationClass.BPOL); message = GetSendMessage(Message.NotificationClass.BPOL);
if (message != null) if (message != null)
{ {
containsData = true;
if (message.Reset) if (message.Reset)
{ {
items1ChoiceType.Add(Items1ChoiceType.RESET_BPOL); items1ChoiceType.Add(Items1ChoiceType.RESET_BPOL);
@ -1327,6 +1351,7 @@ namespace bsmd.hisnord
message = GetSendMessage(Message.NotificationClass.PAS); message = GetSendMessage(Message.NotificationClass.PAS);
if (message != null) if (message != null)
{ {
containsData = true;
if (message.Reset) if (message.Reset)
{ {
items1ChoiceType.Add(Items1ChoiceType.RESET_PAS); items1ChoiceType.Add(Items1ChoiceType.RESET_PAS);
@ -1374,6 +1399,7 @@ namespace bsmd.hisnord
#region CREW #region CREW
message = GetSendMessage(Message.NotificationClass.CREW); message = GetSendMessage(Message.NotificationClass.CREW);
if (message != null) { if (message != null) {
containsData = true;
if (message.Reset) if (message.Reset)
{ {
items1ChoiceType.Add(Items1ChoiceType.RESET_CREW); items1ChoiceType.Add(Items1ChoiceType.RESET_CREW);
@ -1416,6 +1442,7 @@ namespace bsmd.hisnord
message = GetSendMessage(Message.NotificationClass.TOWA); message = GetSendMessage(Message.NotificationClass.TOWA);
if (message != null) if (message != null)
{ {
containsData = true;
if (message.Reset) if (message.Reset)
{ {
items1ChoiceType.Add(Items1ChoiceType.RESET_TOWA); items1ChoiceType.Add(Items1ChoiceType.RESET_TOWA);
@ -1480,6 +1507,7 @@ namespace bsmd.hisnord
message = GetSendMessage(Message.NotificationClass.TOWD); message = GetSendMessage(Message.NotificationClass.TOWD);
if (message != null) if (message != null)
{ {
containsData = true;
if (message.Reset) if (message.Reset)
{ {
items1ChoiceType.Add(Items1ChoiceType.RESET_TOWD); items1ChoiceType.Add(Items1ChoiceType.RESET_TOWD);
@ -1545,6 +1573,7 @@ namespace bsmd.hisnord
if (message != null) if (message != null)
{ {
containsData = true;
if (message.Reset) if (message.Reset)
{ {
items1ChoiceType.Add(Items1ChoiceType.RESET_AGNT); items1ChoiceType.Add(Items1ChoiceType.RESET_AGNT);
@ -1581,23 +1610,30 @@ namespace bsmd.hisnord
#endregion #endregion
#region serialize and save message #region serialize and save message
string outputDir = Path.Combine(useTest ? Properties.Settings.Default.TestTransmitterRoot : Properties.Settings.Default.LiveTransmitterRoot, if (containsData)
Properties.Settings.Default.OutputDir); {
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); string filename = string.Format("BSMD_{0}-{1}.xml", DateTime.Now.ToString("yyyyMMddHHmmss"), core.Id.Value);
_log.InfoFormat("saving {0} to output directory", filename); _log.InfoFormat("saving {0} to output directory", filename);
string filePath = Path.Combine(outputDir, filename); string filePath = Path.Combine(outputDir, filename);
XmlSerializer serializer = new XmlSerializer(typeof(nsw)); XmlSerializer serializer = new XmlSerializer(typeof(nsw));
using(TextWriter tw = new StreamWriter(filePath)) { using (TextWriter tw = new StreamWriter(filePath))
serializer.Serialize(tw, _nsw); {
serializer.Serialize(tw, _nsw);
}
coreFilenameDict[core] = filename;
coreUseTestDict[core] = useTest;
retval = true;
} }
coreFilenameDict[core] = filename;
coreUseTestDict[core] = useTest;
#endregion #endregion
} }
@ -1679,7 +1715,7 @@ namespace bsmd.hisnord
pi.GeneralCargoIBC = imdgPosition.GeneralCargoIBC.Value ? yorntype.Y : yorntype.N; pi.GeneralCargoIBC = imdgPosition.GeneralCargoIBC.Value ? yorntype.Y : yorntype.N;
pi.ContainerNumber = imdgPosition.ContainerNumber; pi.ContainerNumber = imdgPosition.ContainerNumber;
pi.VehicleLicenseNumber = imdgPosition.VehicleLicenseNumber; pi.VehicleLicenseNumber = imdgPosition.VehicleLicenseNumber;
if(imdgPosition.StowagePosition.IsNullOrEmpty()) if(!imdgPosition.StowagePosition.IsNullOrEmpty())
{ {
pi.Item = imdgPosition.StowagePosition; pi.Item = imdgPosition.StowagePosition;
} }

View File

@ -26,9 +26,12 @@ namespace bsmd.hisnord
public static void CallTransmitter(bool useTest) public static void CallTransmitter(bool useTest)
{ {
string rootDir = useTest ? Properties.Settings.Default.TestTransmitterRoot : Properties.Settings.Default.LiveTransmitterRoot;
Process process = new Process(); Process process = new Process();
process.StartInfo.FileName = Properties.Settings.Default.Transmitter; process.StartInfo.WorkingDirectory = rootDir;
process.StartInfo.WorkingDirectory = Path.GetDirectoryName(useTest ? Properties.Settings.Default.TestTransmitterRoot : Properties.Settings.Default.LiveTransmitterRoot); process.StartInfo.FileName = Path.Combine(rootDir, Properties.Settings.Default.Transmitter);
//_log.Debug(process.StartInfo.FileName);
process.StartInfo.RedirectStandardError = true; process.StartInfo.RedirectStandardError = true;
process.StartInfo.RedirectStandardOutput = true; process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardInput = false; process.StartInfo.RedirectStandardInput = false;
@ -38,7 +41,12 @@ namespace bsmd.hisnord
// Ergebnis ab // Ergebnis ab
process.Start(); process.Start();
int timeout = Properties.Settings.Default.BatchTimeoutMins * 1000 * 60; // convert to ms int timeout = Properties.Settings.Default.BatchTimeoutMins * 1000 * 60; // convert to ms
process.WaitForExit((timeout == 0) ? int.MaxValue : timeout); if(!process.WaitForExit((timeout == 0) ? int.MaxValue : timeout))
{
_log.WarnFormat("Transmitter process not exited within {0} minute", Properties.Settings.Default.BatchTimeoutMins);
// kill Kill KILLLL!!!
process.Kill();
}
string errorString = process.StandardError.ReadToEnd(); string errorString = process.StandardError.ReadToEnd();
if(!errorString.IsNullOrEmpty()) if(!errorString.IsNullOrEmpty())
_log.ErrorFormat("HIS-Nord transmitter error: {0}", errorString); _log.ErrorFormat("HIS-Nord transmitter error: {0}", errorString);