Merge branch 'release/eni_7.0.2'

This commit is contained in:
Daniel Schick 2022-04-08 10:49:41 +02:00
commit 8c9e415459
14 changed files with 131 additions and 91 deletions

View File

@ -145,8 +145,8 @@
<DataGridTextColumn Header="{x:Static p:Resources.textPortReceptionFacilityName}" Binding="{Binding PortReceptionFacilityName}" IsReadOnly="True" Width="Auto" /> <DataGridTextColumn Header="{x:Static p:Resources.textPortReceptionFacilityName}" Binding="{Binding PortReceptionFacilityName}" IsReadOnly="True" Width="Auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textPortReceptionFacilityProviderName}" Binding="{Binding PortReceptionFacilityProviderName}" IsReadOnly="True" Width="Auto" /> <DataGridTextColumn Header="{x:Static p:Resources.textPortReceptionFacilityProviderName}" Binding="{Binding PortReceptionFacilityProviderName}" IsReadOnly="True" Width="Auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textTreatmentFacilityProviderName}" Binding="{Binding TreatmentFacilityProviderText}" IsReadOnly="True" Width="Auto" /> <DataGridTextColumn Header="{x:Static p:Resources.textTreatmentFacilityProviderName}" Binding="{Binding TreatmentFacilityProviderText}" IsReadOnly="True" Width="Auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textWasteDeliveryDateFrom}" Binding="{Binding WasteDeliveryDateFrom}" IsReadOnly="True" Width="Auto" /> <DataGridTextColumn Header="{x:Static p:Resources.textWasteDeliveryDateFrom}" Binding="{Binding WasteDeliveryDateFrom, Converter={util:UtcToLocalDateTimeConverter}}" IsReadOnly="True" Width="Auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textWasteDeliveryDateTo}" Binding="{Binding WasteDeliveryDateTo}" IsReadOnly="True" Width="Auto" /> <DataGridTextColumn Header="{x:Static p:Resources.textWasteDeliveryDateTo}" Binding="{Binding WasteDeliveryDateTo, Converter={util:UtcToLocalDateTimeConverter}}" IsReadOnly="True" Width="Auto" />
</DataGrid.Columns> </DataGrid.Columns>
</enictrl:ENIDataGrid> </enictrl:ENIDataGrid>
<Grid Grid.Row="1"> <Grid Grid.Row="1">

View File

@ -170,6 +170,12 @@ namespace ENI2.DetailViewControls
this.dataGridWasteReceived.DeleteRequested += DataGridWasteReceived_DeleteRequested; this.dataGridWasteReceived.DeleteRequested += DataGridWasteReceived_DeleteRequested;
this.dataGridWasteReceived.CreateRequested += DataGridWasteReceived_CreateRequested; this.dataGridWasteReceived.CreateRequested += DataGridWasteReceived_CreateRequested;
if(this._wasRcptMessage.Elements.Count > 0)
{
this.dataGridWasteReceipt.SelectedItem = this._wasRcptMessage.Elements[0];
this.dataGridWasteReceipt_SelectionChanged(null, null);
}
#endregion #endregion
} }
@ -181,7 +187,8 @@ namespace ENI2.DetailViewControls
EditWasteReceiptDialog epd = new EditWasteReceiptDialog(); EditWasteReceiptDialog epd = new EditWasteReceiptDialog();
epd.WAS_RCPT = new WAS_RCPT(); epd.WAS_RCPT = new WAS_RCPT();
epd.WAS_RCPT.MessageHeader = _wasRcptMessage; epd.WAS_RCPT.MessageHeader = _wasRcptMessage;
epd.WAS_RCPT.Identifier = WAS_RCPT.GetNewIdentifier(_wasRcptMessage.Elements); epd.WAS_RCPT.Identifier = WAS_RCPT.GetNewIdentifier(_wasRcptMessage.Elements);
epd.WAS_RCPT.AddMissingWasteReceived();
epd.AddClicked += () => epd.AddClicked += () =>
{ {
@ -192,6 +199,7 @@ namespace ENI2.DetailViewControls
epd.WAS_RCPT = new WAS_RCPT(); epd.WAS_RCPT = new WAS_RCPT();
epd.WAS_RCPT.MessageHeader = _wasRcptMessage; epd.WAS_RCPT.MessageHeader = _wasRcptMessage;
epd.WAS_RCPT.Identifier = WAS_RCPT.GetNewIdentifier(_wasRcptMessage.Elements); epd.WAS_RCPT.Identifier = WAS_RCPT.GetNewIdentifier(_wasRcptMessage.Elements);
epd.WAS_RCPT.AddMissingWasteReceived();
this.SublistElementChanged(Message.NotificationClass.WAS_RCPT); this.SublistElementChanged(Message.NotificationClass.WAS_RCPT);
}; };
@ -200,9 +208,10 @@ namespace ENI2.DetailViewControls
if (!this._wasRcptMessage.Elements.Contains(epd.WAS_RCPT)) if (!this._wasRcptMessage.Elements.Contains(epd.WAS_RCPT))
_wasRcptMessage.Elements.Add(epd.WAS_RCPT); _wasRcptMessage.Elements.Add(epd.WAS_RCPT);
this.dataGridWasteReceipt.Items.Refresh(); this.dataGridWasteReceipt.Items.Refresh();
this.dataGridWasteReceipt.SelectedItem = epd.WAS_RCPT;
this.SublistElementChanged(Message.NotificationClass.WAS_RCPT); this.SublistElementChanged(Message.NotificationClass.WAS_RCPT);
this.dataGridWasteReceived.ItemsSource = null; this.dataGridWasteReceived.ItemsSource = null;
this._selectedWAS_RCPT = null; dataGridWasteReceipt_SelectionChanged(this, null);
} }
} }
@ -212,6 +221,7 @@ namespace ENI2.DetailViewControls
{ {
// are you sure dialog is in base class // are you sure dialog is in base class
_wasRcptMessage.Elements.Remove(wasRCPT); _wasRcptMessage.Elements.Remove(wasRCPT);
wasRCPT.DeleteElements();
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(wasRCPT); DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(wasRCPT);
DatabaseEntity.ResetIdentifiers(new List<DatabaseEntity>(_wasRcptMessage.Elements)); DatabaseEntity.ResetIdentifiers(new List<DatabaseEntity>(_wasRcptMessage.Elements));
this.SublistElementChanged(Message.NotificationClass.WAS_RCPT); this.SublistElementChanged(Message.NotificationClass.WAS_RCPT);
@ -235,6 +245,7 @@ namespace ENI2.DetailViewControls
epd.WAS_RCPT = new WAS_RCPT(); epd.WAS_RCPT = new WAS_RCPT();
epd.WAS_RCPT.Identifier = WAS_RCPT.GetNewIdentifier(_wasRcptMessage.Elements); epd.WAS_RCPT.Identifier = WAS_RCPT.GetNewIdentifier(_wasRcptMessage.Elements);
epd.WAS_RCPT.MessageHeader = _wasRcptMessage; epd.WAS_RCPT.MessageHeader = _wasRcptMessage;
epd.WAS_RCPT.AddMissingWasteReceived();
this.SublistElementChanged(Message.NotificationClass.WAS_RCPT); this.SublistElementChanged(Message.NotificationClass.WAS_RCPT);
}; };
@ -242,9 +253,11 @@ namespace ENI2.DetailViewControls
{ {
if (!_wasRcptMessage.Elements.Contains(epd.WAS_RCPT)) if (!_wasRcptMessage.Elements.Contains(epd.WAS_RCPT))
_wasRcptMessage.Elements.Add(epd.WAS_RCPT); _wasRcptMessage.Elements.Add(epd.WAS_RCPT);
this.dataGridWasteReceipt.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.WAS_RCPT);
} }
this.dataGridWasteReceipt.SelectedItem = epd.WAS_RCPT;
this.dataGridWasteReceipt.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.WAS_RCPT);
dataGridWasteReceipt_SelectionChanged(this, null);
} }
private void DataGridWasteReceipt_AddingNewItem(object sender, AddingNewItemEventArgs e) private void DataGridWasteReceipt_AddingNewItem(object sender, AddingNewItemEventArgs e)
@ -335,10 +348,10 @@ namespace ENI2.DetailViewControls
{ {
if (!_selectedWAS_RCPT.WasteReceived.Any(wr => wr.WasteCode == ewrd.WasteReceived.WasteCode)) if (!_selectedWAS_RCPT.WasteReceived.Any(wr => wr.WasteCode == ewrd.WasteReceived.WasteCode))
{ {
_selectedWAS_RCPT.WasteReceived.Add(ewrd.WasteReceived); _selectedWAS_RCPT.WasteReceived.Add(ewrd.WasteReceived);
this.dataGridWasteReceived.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.WAS_RCPT);
} }
this.dataGridWasteReceived.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.WAS_RCPT);
} }
} }

View File

@ -36,8 +36,8 @@
<MinimumRequiredVersion>5.4.0.0</MinimumRequiredVersion> <MinimumRequiredVersion>5.4.0.0</MinimumRequiredVersion>
<CreateWebPageOnPublish>true</CreateWebPageOnPublish> <CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>publish.html</WebPage> <WebPage>publish.html</WebPage>
<ApplicationRevision>0</ApplicationRevision> <ApplicationRevision>3</ApplicationRevision>
<ApplicationVersion>7.0.1.0</ApplicationVersion> <ApplicationVersion>7.0.2.3</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust> <UseApplicationTrust>false</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut> <CreateDesktopShortcut>true</CreateDesktopShortcut>
<PublishWizardCompleted>true</PublishWizardCompleted> <PublishWizardCompleted>true</PublishWizardCompleted>

View File

@ -17,7 +17,9 @@
<RowDefinition Height="56" /> <RowDefinition Height="56" />
<RowDefinition Height="28" /> <RowDefinition Height="28" />
<RowDefinition Height="28" /> <RowDefinition Height="28" />
<RowDefinition Height="10" />
<RowDefinition Height="28" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" /> <ColumnDefinition Width="1*" />
@ -39,5 +41,7 @@
<xctk:DateTimePicker Grid.Row="4" Grid.Column="1" Name="dateTimePickerWasteDeliveryDateFrom" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="True" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left" Minimum="1899.12.31 00:00" Maximum="2100.12.31 00:00" PreviewKeyUp="DateTimePicker_PreviewKeyUp"/> <xctk:DateTimePicker Grid.Row="4" Grid.Column="1" Name="dateTimePickerWasteDeliveryDateFrom" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="True" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left" Minimum="1899.12.31 00:00" Maximum="2100.12.31 00:00" PreviewKeyUp="DateTimePicker_PreviewKeyUp"/>
<xctk:DateTimePicker Grid.Row="5" Grid.Column="1" Name="dateTimePickerWasteDeliveryDateTo" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="True" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left" Minimum="1899.12.31 00:00" Maximum="2100.12.31 00:00" PreviewKeyUp="DateTimePicker_PreviewKeyUp"/> <xctk:DateTimePicker Grid.Row="5" Grid.Column="1" Name="dateTimePickerWasteDeliveryDateTo" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="True" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left" Minimum="1899.12.31 00:00" Maximum="2100.12.31 00:00" PreviewKeyUp="DateTimePicker_PreviewKeyUp"/>
<!--Button x:Name="buttonAddEntries" Grid.Column="1" Grid.Row="7" Margin="2" Click="buttonAddEntries_Click" Width="170" Content="Add waste received entries" HorizontalAlignment="Left"/-->
</Grid> </Grid>
</enictrl:EditWindowBase> </enictrl:EditWindowBase>

View File

@ -52,5 +52,10 @@ namespace ENI2.EditControls
this.CopyValuesToEntity(); this.CopyValuesToEntity();
} }
// private void buttonAddEntries_Click(object sender, RoutedEventArgs e)
// {
// this.WAS_RCPT.AddMissingWasteReceived();
// }
} }
} }

View File

@ -77,8 +77,11 @@ namespace ENI2.Excel
{ {
val = val.ToUpper(); val = val.ToUpper();
string portName = LocodeDB.PortNameFromLocode(val); string portName = LocodeDB.PortNameFromLocode(val);
if(portName.IsNullOrEmpty()) if (portName.IsNullOrEmpty())
_log.WarnFormat("unknown Locode {0}", val); {
_log.WarnFormat("unknown Locode {0}", val);
val = "";
}
} }
return val; return val;
} }

View File

@ -1379,7 +1379,7 @@ namespace ENI2.Excel
{ {
if(v != null) if(v != null)
{ {
_nameDict[lookupName].RefersToRange.Value = ((DateTime) v).ToOADate(); // Test this I dont believe it _nameDict[lookupName].RefersToRange.Value = ((DateTime) v).ToLocalTime().ToOADate();
} }
} }

View File

@ -380,7 +380,8 @@ namespace ENI2.Report
case Message.NotificationClass.TOWA: case Message.NotificationClass.TOWA:
case Message.NotificationClass.TOWD: case Message.NotificationClass.TOWD:
case Message.NotificationClass.HAZA when (message.Elements[0] is HAZ haz) && ((haz.IMDGPositions.Count > 0) || (haz.IBCPositions.Count > 0) || (haz.IGCPositions.Count > 0) || (haz.IMSBCPositions.Count > 0) || (haz.MARPOLPositions.Count > 0)): case Message.NotificationClass.HAZA when (message.Elements[0] is HAZ haz) && ((haz.IMDGPositions.Count > 0) || (haz.IBCPositions.Count > 0) || (haz.IGCPositions.Count > 0) || (haz.IMSBCPositions.Count > 0) || (haz.MARPOLPositions.Count > 0)):
{ case Message.NotificationClass.HAZD when (message.Elements[0] is HAZ hazd) && ((hazd.IMDGPositions.Count > 0) || (hazd.IBCPositions.Count > 0) || (hazd.IGCPositions.Count > 0) || (hazd.IMSBCPositions.Count > 0) || (hazd.MARPOLPositions.Count > 0)):
{
// Landscape if not set // Landscape if not set
if (_lastOrientation == Orientation.Portrait) if (_lastOrientation == Orientation.Portrait)
{ {
@ -434,6 +435,9 @@ namespace ENI2.Report
case Message.NotificationClass.HAZA when (message.Elements[0] is HAZ haz) && ((haz.IMDGPositions.Count > 0) || (haz.IBCPositions.Count > 0) || (haz.IGCPositions.Count > 0) || (haz.IMSBCPositions.Count > 0) || (haz.MARPOLPositions.Count > 0)): case Message.NotificationClass.HAZA when (message.Elements[0] is HAZ haz) && ((haz.IMDGPositions.Count > 0) || (haz.IBCPositions.Count > 0) || (haz.IGCPositions.Count > 0) || (haz.IMSBCPositions.Count > 0) || (haz.MARPOLPositions.Count > 0)):
CreateHAZPage(document, haz); CreateHAZPage(document, haz);
return; return;
case Message.NotificationClass.HAZD when (message.Elements[0] is HAZ haz) && ((haz.IMDGPositions.Count > 0) || (haz.IBCPositions.Count > 0) || (haz.IGCPositions.Count > 0) || (haz.IMSBCPositions.Count > 0) || (haz.MARPOLPositions.Count > 0)):
CreateHAZPage(document, haz);
return;
case Message.NotificationClass.WAS: case Message.NotificationClass.WAS:
CreateWASTable(document, message); CreateWASTable(document, message);
return; return;
@ -1096,63 +1100,58 @@ namespace ENI2.Report
Table table = AddGrayTable(document); Table table = AddGrayTable(document);
table.AddColumn(290); _ = table.AddColumn(290);
table.AddColumn(200); _ = table.AddColumn(200);
Row row = table.AddRow(); Row row = table.AddRow();
row.Cells[0].AddParagraph("Valid exemption?"); _ = row.Cells[0].AddParagraph("Last port where waste or cargo residues were discharged");
row.Cells[1].AddParagraph("Confirmation of correctness"); _ = row.Cells[1].AddParagraph(LocodeDB.PortNameFromLocode(was.LastWasteDisposalPort) ?? "");
row = table.AddRow();
row.Cells[0].AddParagraph(was.WasteDisposalValidExemption ?? false ? "Yes" : "No"); _ = row = table.AddRow();
row.Cells[1].AddParagraph(was.ConfirmationOfCorrectness ?? false ? "Yes" : "No"); _ = row.Cells[0].AddParagraph("Date of last disposal");
if (was.LastWasteDisposalDate.HasValue)
row.Cells[1].AddParagraph(was.LastWasteDisposalDate?.ToShortDateString());
row = table.AddRow(); row = table.AddRow();
row.Cells[0].AddParagraph("Last port where waste or cargo residues were discharged"); _ = row.Cells[0].AddParagraph("Name of waste disposal service provider");
row.Cells[1].AddParagraph("Date of last disposal");
row = table.AddRow();
row.Cells[0].AddParagraph(LocodeDB.PortNameFromLocode(was.LastWasteDisposalPort) ?? "");
if(was.LastWasteDisposalDate.HasValue)
row.Cells[1].AddParagraph(was.LastWasteDisposalDate?.ToShortDateString());
row = table.AddRow();
row.Cells[0].AddParagraph("Name of waste disposal service provider");
row.Cells[1].AddParagraph("Waste disposal order (all, some, none)");
row = table.AddRow();
for (int i = 0; i < was.WasteDisposalServiceProvider.Count; i++) for (int i = 0; i < was.WasteDisposalServiceProvider.Count; i++)
row.Cells[0].AddParagraph(((WasteDisposalServiceProvider) was.WasteDisposalServiceProvider[i]).WasteDisposalServiceProviderName); row.Cells[1].AddParagraph(((WasteDisposalServiceProvider)was.WasteDisposalServiceProvider[i]).WasteDisposalServiceProviderName);
row = table.AddRow();
_ = row.Cells[0].AddParagraph("Next waste disposal port");
_ = row.Cells[1].AddParagraph(LocodeDB.PortNameFromLocode(was.NextWasteDisposalPort) ?? "");
table = document.LastSection.AddTable(); table = document.LastSection.AddTable();
table.Rows.VerticalAlignment = VerticalAlignment.Top; table.Rows.VerticalAlignment = VerticalAlignment.Top;
table.Borders.Visible = true; table.Borders.Visible = true;
table.Borders.Color = Colors.LightGray; table.Borders.Color = Colors.LightGray;
table.AddColumn(100); table.AddColumn(100);
table.AddColumn(65); table.AddColumn(65);
table.AddColumn(65); table.AddColumn(65);
table.AddColumn(65); table.AddColumn(65);
table.AddColumn(65); table.AddColumn(65);
table.AddColumn(65); table.AddColumn(65);
table.AddColumn(65); table.AddColumn(65);
row = table.AddRow(); row = table.AddRow();
row.Cells[0].AddParagraph("TYPE"); _ = row.Cells[0].AddParagraph("TYPE");
row.Cells[1].AddParagraph("Description"); _ = row.Cells[1].AddParagraph("Description");
row.Cells[2].AddParagraph("Amount to be disposed"); _ = row.Cells[2].AddParagraph("Amount to be disposed");
row.Cells[3].AddParagraph("Maximum dedicated storage capacity on board"); _ = row.Cells[3].AddParagraph("Maximum dedicated storage capacity on board");
row.Cells[4].AddParagraph("Amount retained on board"); _ = row.Cells[4].AddParagraph("Amount retained on board");
row.Cells[5].AddParagraph("Port of delivery of remaining waste"); _ = row.Cells[5].AddParagraph("Port of delivery of remaining waste");
row.Cells[6].AddParagraph("Estimated waste/cargo residues amount generated between port of call and next port"); _ = row.Cells[6].AddParagraph("Estimated waste/cargo residues amount generated between port of call and next port");
for (int i = 0; i < WAS.WasteCodes.Length; i++) for (int i = 0; i < WAS.WasteCodes.Length; i++)
{ {
row = table.AddRow(); row = table.AddRow();
row.Cells[0].AddParagraph(string.Format("{0} {1}", WAS.WasteCodes[i], WAS.WasteCodeDescriptions[i])); _ = row.Cells[0].AddParagraph(string.Format("{0} {1}", WAS.WasteCodes[i], WAS.WasteCodeDescriptions[i]));
if(Int32.TryParse(WAS.WasteCodes[i], out int wasteCode)) if(Int32.TryParse(WAS.WasteCodes[i], out int wasteCode))
GetWasteForIndex(wasteCode, was, row); GetWasteForIndex(wasteCode, was, row);
} }
} }
private static void GetWasteForIndex(int index, WAS was, Row row) private static void GetWasteForIndex(int index, WAS was, Row row)
@ -1161,13 +1160,13 @@ namespace ENI2.Report
{ {
if (!waste.WasteType.HasValue) continue; // kaputt! if (!waste.WasteType.HasValue) continue; // kaputt!
if (waste.WasteType.Value == index) if (waste.WasteType.Value == index)
{ {
row.Cells[1].AddParagraph(waste.WasteDescription ?? ""); _ = row.Cells[1].AddParagraph(waste.WasteDescription ?? "");
row.Cells[2].AddParagraph(waste.WasteDisposalAmount_MTQ.HasValue ? waste.WasteDisposalAmount_MTQ.Value.ToString("N3") : ""); _ = row.Cells[2].AddParagraph(waste.WasteDisposalAmount_MTQ.HasValue ? waste.WasteDisposalAmount_MTQ.Value.ToString("N3") : "");
row.Cells[3].AddParagraph(waste.WasteCapacity_MTQ.HasValue ? waste.WasteCapacity_MTQ.Value.ToString("N3") : ""); _ = row.Cells[3].AddParagraph(waste.WasteCapacity_MTQ.HasValue ? waste.WasteCapacity_MTQ.Value.ToString("N3") : "");
row.Cells[4].AddParagraph(waste.WasteAmountRetained_MTQ.HasValue ? waste.WasteAmountRetained_MTQ.Value.ToString("N3") : ""); _ = row.Cells[4].AddParagraph(waste.WasteAmountRetained_MTQ.HasValue ? waste.WasteAmountRetained_MTQ.Value.ToString("N3") : "");
row.Cells[5].AddParagraph(LocodeDB.PortNameFromLocode(waste.WasteDisposalPort) ?? ""); _ = row.Cells[5].AddParagraph(LocodeDB.PortNameFromLocode(waste.WasteDisposalPort) ?? "");
row.Cells[6].AddParagraph(waste.WasteAmountGeneratedTillNextPort_MTQ.HasValue ? waste.WasteAmountGeneratedTillNextPort_MTQ.Value.ToString("N3") : ""); _ = row.Cells[6].AddParagraph(waste.WasteAmountGeneratedTillNextPort_MTQ.HasValue ? waste.WasteAmountGeneratedTillNextPort_MTQ.Value.ToString("N3") : "");
} }
} }
} }
@ -1197,10 +1196,10 @@ namespace ENI2.Report
row.Cells[1].AddParagraph(was_rpct.PortReceptionFacilityProviderName); row.Cells[1].AddParagraph(was_rpct.PortReceptionFacilityProviderName);
row = table.AddRow(); row = table.AddRow();
row.Cells[0].AddParagraph("Waste delivery from"); row.Cells[0].AddParagraph("Waste delivery from");
row.Cells[1].AddParagraph(was_rpct.WasteDeliveryDateFrom.HasValue ? was_rpct.WasteDeliveryDateFrom.ToString() : ""); row.Cells[1].AddParagraph(was_rpct.WasteDeliveryDateFrom.HasValue ? was_rpct.WasteDeliveryDateFrom.Value.ToLocalTime().ToString() : "");
row = table.AddRow(); row = table.AddRow();
row.Cells[0].AddParagraph("Waste delivery to"); row.Cells[0].AddParagraph("Waste delivery to");
row.Cells[1].AddParagraph(was_rpct.WasteDeliveryDateTo.HasValue ? was_rpct.WasteDeliveryDateTo.ToString() : ""); row.Cells[1].AddParagraph(was_rpct.WasteDeliveryDateTo.HasValue ? was_rpct.WasteDeliveryDateTo.Value.ToLocalTime().ToString() : "");
row = table.AddRow(); row = table.AddRow();
row.Cells[0].AddParagraph("Treatment facility provider"); row.Cells[0].AddParagraph("Treatment facility provider");
row.Cells[1].AddParagraph(was_rpct.TreatmentFacilityProviderText); row.Cells[1].AddParagraph(was_rpct.TreatmentFacilityProviderText);

View File

@ -186,20 +186,29 @@ namespace ENI2.Locode
if (locode.IsNullOrEmpty()) return null; if (locode.IsNullOrEmpty()) return null;
if (locode.Length != 5) return null; if (locode.Length != 5) return null;
string result = null; try
string query = string.Format("SELECT LocationName FROM SSN_LOCODES WHERE LocationCode = '{0}'", locode);
SQLiteCommand cmd = new SQLiteCommand(query, _con);
IDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{ {
if (!reader.IsDBNull(0))
result = reader.GetString(0); string result = null;
break; string query = string.Format("SELECT LocationName FROM SSN_LOCODES WHERE LocationCode = '{0}'", locode);
SQLiteCommand cmd = new SQLiteCommand(query, _con);
IDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
if (!reader.IsDBNull(0))
result = reader.GetString(0);
break;
}
reader.Close();
cmd.Dispose();
return result;
}
catch (Exception ex)
{
_log.WarnFormat("error reading SSN location from locode: {0}", ex.ToString());
return null;
} }
reader.Close();
cmd.Dispose();
return result;
} }
@ -212,21 +221,28 @@ namespace ENI2.Locode
{ {
if (locode.IsNullOrEmpty()) return null; if (locode.IsNullOrEmpty()) return null;
if (locode.Length != 5) return null; if (locode.Length != 5) return null;
try
string result = null;
string query = string.Format("SELECT locodes.name_wo_diacritics FROM locodes JOIN countries ON locodes.country_id = countries.ID WHERE locodes.city_code = '{0}' AND countries.code = '{1}'",
locode.Substring(2), locode.Substring(0, 2));
SQLiteCommand cmd = new SQLiteCommand(query, _con);
IDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{ {
if (!reader.IsDBNull(0)) string result = null;
result = reader.GetString(0); string query = string.Format("SELECT locodes.name_wo_diacritics FROM locodes JOIN countries ON locodes.country_id = countries.ID WHERE locodes.city_code = '{0}' AND countries.code = '{1}'",
break; locode.Substring(2), locode.Substring(0, 2));
SQLiteCommand cmd = new SQLiteCommand(query, _con);
IDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
if (!reader.IsDBNull(0))
result = reader.GetString(0);
break;
}
reader.Close();
cmd.Dispose();
return result;
}
catch(Exception ex)
{
_log.WarnFormat("error reading location from locode: {0}", ex.ToString());
return null;
} }
reader.Close();
cmd.Dispose();
return result;
} }
public static void CloseDB() public static void CloseDB()

View File

@ -2,7 +2,7 @@
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<UseIISExpress>true</UseIISExpress> <UseIISExpress>true</UseIISExpress>
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig> <LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>
<Use64BitIISExpress /> <Use64BitIISExpress />
<IISExpressSSLPort /> <IISExpressSSLPort />
<IISExpressAnonymousAuthentication /> <IISExpressAnonymousAuthentication />

View File

@ -2,6 +2,6 @@
[assembly: AssemblyCompany("schick Informatik")] [assembly: AssemblyCompany("schick Informatik")]
[assembly: AssemblyProduct("BSMD NSW interface")] [assembly: AssemblyProduct("BSMD NSW interface")]
[assembly: AssemblyInformationalVersion("7.0.1")] [assembly: AssemblyInformationalVersion("7.0.2")]
[assembly: AssemblyCopyright("Copyright © 2014-2022 schick Informatik")] [assembly: AssemblyCopyright("Copyright © 2014-2022 schick Informatik")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]

View File

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

View File

@ -84,7 +84,7 @@ namespace bsmd.database
[ENI2Validation] [ENI2Validation]
public int? WasteType { get; set; } public int? WasteType { get; set; }
[ShowReport] [ShowReport]
[MaxLength(99)] [MaxLength(99)]
[ENI2Validation] [ENI2Validation]
public string WasteDescription { get; set; } public string WasteDescription { get; set; }

View File

@ -1309,7 +1309,7 @@ namespace bsmd.hisnord
for (int j = 0; j < was_rcpt.WasteReceived.Count; j++) for (int j = 0; j < was_rcpt.WasteReceived.Count; j++)
{ {
hn_was_rcpt.Items[i].WasteReceived[j] = new was_rcptWasteDeliveryReceiptWasteReceived(); hn_was_rcpt.Items[i].WasteReceived[j] = new was_rcptWasteDeliveryReceiptWasteReceived();
hn_was_rcpt.Items[i].WasteReceived[j].AmountWasteReceived_MTQ = (decimal) (was_rcpt.WasteReceived[j].AmountWasteReceived_MTQ ?? 0); hn_was_rcpt.Items[i].WasteReceived[j].AmountWasteReceived_MTQ = decimal.Round((decimal) (was_rcpt.WasteReceived[j].AmountWasteReceived_MTQ ?? 0), 3);
hn_was_rcpt.Items[i].WasteReceived[j].WasteType = new was_rcptWasteDeliveryReceiptWasteReceivedWasteType(); hn_was_rcpt.Items[i].WasteReceived[j].WasteType = new was_rcptWasteDeliveryReceiptWasteReceivedWasteType();
hn_was_rcpt.Items[i].WasteReceived[j].WasteType.WasteCode = was_rcpt.WasteReceived[j].WasteCode; hn_was_rcpt.Items[i].WasteReceived[j].WasteType.WasteCode = was_rcpt.WasteReceived[j].WasteCode;
if(!was_rcpt.WasteReceived[j].WasteDescription.IsNullOrEmpty()) if(!was_rcpt.WasteReceived[j].WasteDescription.IsNullOrEmpty())