Stand nach Live-Schaltung (noch keine Übermittlung Richtung DBH/Dakosy)

Aktiv ist Herberg FormService und der Report Generator
30.Mai 2015
This commit is contained in:
Daniel Schick 2015-05-30 18:56:16 +00:00
parent eeabece855
commit f4b3d3caf0
123 changed files with 4819 additions and 396 deletions

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,9 @@
Unregelmässigkeiten:
STAT: Wenn Land = US, kommt kein 3-stelliger Hafencode mit, so dass ich den UNECE LOCODE nicht bilden kann!
(gleiches Problem auch bei NOA_NOD). Was ist hier für eine Regel?
SEC: Schreibfehler Simplification statt SECSimplification
- HAZ gibt es nicht, sollte HAZA / HAZD sein?

View File

@ -0,0 +1,5 @@
-- Fix IBCPosition
EXECUTE sp_rename @objname = N'[dbo].[IBCPosition].[ProductCategory]', @newname = N'PollutionCategory', @objtype = N'COLUMN';
GO

View File

@ -0,0 +1,6 @@
-- neue Spalte Bearbeiter
ALTER TABLE [dbo].[MessageCore] ADD [EditedBy] NVARCHAR (255) NULL;
GO

92
nsw/Source/SQL/purge.sql Normal file
View File

@ -0,0 +1,92 @@
-- SELECT * FROM information_schema.tables order by Table_NAME
PRINT 'Deleting IBCPosition'
DELETE FROM IBCPosition
PRINT 'Deleting IGCPosition'
DELETE FROM IGCPosition
PRINT 'Deleting IMDGPosition'
DELETE FROM IMDGPosition
PRINT 'Deleting IMSBCPosition'
DELETE FROM IMSBCPosition
PRINT 'Deleting MARPOL_Annex_IPosition'
DELETE FROM MARPOL_Annex_IPosition
PRINT 'Deleting ShipToShipActivitiesDuringLastTenPortFacilitiesCalled'
DELETE FROM ShipToShipActivitiesDuringLastTenPortFacilitiesCalled
PRINT 'Deleting LastTenPortFacilitiesCalled'
DELETE FROM LastTenPortFacilitiesCalled
PRINT 'Deleting PortOfCallLast30DaysCrewJoinedShip'
DELETE FROM PortOfCallLast30DaysCrewJoinedShip
PRINT 'Deleting PortOfCallLast30Days'
DELETE FROM PortOfCallLast30Days
PRINT 'Deleting PortOfItinerary'
DELETE FROM PortOfItinerary
PRINT 'Deleting WasteDisposalServiceProvider'
DELETE FROM WasteDisposalServiceProvider
PRINT 'Deleting Waste'
DELETE FROM Waste
-- DELETE FROM ReportingParty
PRINT 'Deleting Error'
DELETE FROM Error
PRINT 'Deleting Violation'
DELETE FROM Violation
PRINT 'Deleting Customer'
DELETE FROM Customer
PRINT 'Deleting CallPurpose'
DELETE FROM CallPurpose
PRINT 'Deleting ATA'
DELETE FROM ATA
PRINT 'Deleting ATD'
DELETE FROM ATD
PRINT 'Deleting BKRA'
DELETE FROM BKRA
PRINT 'Deleting BKRD'
DELETE FROM BKRD
PRINT 'Deleting BPOL'
DELETE FROM BPOL
PRINT 'Deleting CREW'
DELETE FROM CREW
PRINT 'Deleting HAZA'
DELETE FROM HAZA
PRINT 'Deleting HAZD'
DELETE FROM HAZD
PRINT 'Deleting INFO'
DELETE FROM INFO
PRINT 'Deleting LADG'
DELETE FROM LADG
PRINT 'Deleting MDH'
DELETE FROM MDH
PRINT 'Deleting NAME'
DELETE FROM NAME
PRINT 'Deleting NOA_NOD'
DELETE FROM NOA_NOD
PRINT 'Deleting PAS'
DELETE FROM PAS
PRINT 'Deleting POBA'
DELETE FROM POBA
PRINT 'Deleting POBD'
DELETE FROM POBD
PRINT 'Deleting PRE72H'
DELETE FROM PRE72H
PRINT 'Deleting SEC'
DELETE FROM SEC
PRINT 'Deleting SERV'
DELETE FROM SERV
PRINT 'Deleting STAT'
DELETE FROM STAT
PRINT 'Deleting TIEFA'
DELETE FROM TIEFA
PRINT 'Deleting TIEFD'
DELETE FROM TIEFD
PRINT 'Deleting TOWA'
DELETE FROM TOWA
PRINT 'Deleting TOWD'
DELETE FROM TOWD
PRINT 'Deleting WAS'
DELETE FROM WAS
PRINT 'Deleting MessageHeader'
DELETE FROM MessageHeader
PRINT 'Deleting MessageCore'
DELETE FROM MessageCore

View File

@ -0,0 +1,3 @@
SELECT COLUMN_NAME, DATA_TYPE
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'IMDGPosition' AND TABLE_SCHEMA='dbo'

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="SendNSWMessageService.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,Log4net"/>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="SendNSWMessageService.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<log4net>
<root>
@ -26,11 +26,14 @@
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<applicationSettings>
<userSettings>
<SendNSWMessageService.Properties.Settings>
<setting name="ConnectionString" serializeAs="String">
<value>Data Source=(localdb)\Projects;Initial Catalog=nsw;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False</value>
</setting>
<setting name="SleepSeconds" serializeAs="String">
<value>0</value>
</setting>
</SendNSWMessageService.Properties.Settings>
</applicationSettings>
</userSettings>
</configuration>

View File

@ -31,7 +31,6 @@
//
// NSWSendService
//
this.CanPauseAndContinue = true;
this.ServiceName = "NSWSendService";
}

View File

@ -35,23 +35,22 @@ namespace SendNSWMessageService
{
this.EventLog.Source = this.ServiceName;
this.EventLog.Log = "Application";
this.EventLog.BeginInit();
if (!EventLog.SourceExists(this.EventLog.Source, this.EventLog.Log))
EventLog.CreateEventSource(this.EventLog.Source, this.EventLog.Log);
this.EventLog.EndInit();
this.Init(args);
this.EventLog.WriteEntry("NSW Send Service started.", EventLogEntryType.Information);
this.DoOnce();
}
public void Init(string[] args)
{
this._timer = new Timer();
this._timer.Interval = 60000; // 1 min
this._timer.Interval = Properties.Settings.Default.SleepSeconds * 1000;
this._timer.Elapsed += _timer_Elapsed;
this._timer.Enabled = true;
_timer_Elapsed(null, null);
}
public void DoOnce()
{
this._timer_Elapsed(null, null);
}
void _timer_Elapsed(object sender, ElapsedEventArgs e)
@ -67,9 +66,54 @@ namespace SendNSWMessageService
// Datenbank auf zu sendende Objekte überprüfen und laden
List<Message> messagesToSendList = DBManager.Instance.GetToSendMessageList();
List<MessageCore> coresMarkedForSending = DBManager.Instance.GetMessageCoresByStatus(MessageCore.BSMDStatus.TOSEND);
foreach (Message message in messagesToSendList)
foreach (MessageCore core in coresMarkedForSending)
{
List<Message> messages = DBManager.Instance.GetMessagesForCore(core);
List<Message> toSendMessageList = new List<Message>();
if ((core.IsTransit && core.TransitId.IsNullOrEmpty()) ||
(!core.IsTransit && core.VisitId.IsNullOrEmpty()))
{
foreach (Message message in messages)
{
if((message.MessageNotificationClass == Message.NotificationClass.VISIT) ||
(message.MessageNotificationClass == Message.NotificationClass.TRANSIT))
{
if((message.InternalStatus == Message.BSMDStatus.UNDEFINED) ||
(message.InternalStatus == Message.BSMDStatus.PREPARE) ||
(message.InternalStatus == Message.BSMDStatus.TOSEND))
{
if (message.HIS == Message.NSWProvider.UNDEFINED)
message.HIS = core.InitialHIS;
toSendMessageList.Add(message);
}
}
}
}
else // eine VISIT/TRANSIT Id ist vorhanden, die Daten können gesendet werden
{
// versendet werden nur die Nachrichten, die den Status "UNDEFINED", "PREPARE" und "TOSEND" haben
// diese wurden entweder von EU-NOAD angelegt oder durch den Melder bearbeitet
// Wichtig ist eine erfolgreich versendete Meldung nicht erneut zu versenden
foreach (Message message in messages)
{
if ((message.InternalStatus == Message.BSMDStatus.UNDEFINED) ||
(message.InternalStatus == Message.BSMDStatus.PREPARE) ||
(message.InternalStatus == Message.BSMDStatus.TOSEND))
{
if (message.HIS == Message.NSWProvider.UNDEFINED)
message.HIS = core.InitialHIS;
toSendMessageList.Add(message);
}
}
}
foreach (Message message in toSendMessageList)
{
try
{
@ -82,9 +126,14 @@ namespace SendNSWMessageService
{
case Message.NSWProvider.DBH:
sendSucceeded = bsmd.dbh.Request.SendMessage(message);
if (!sendSucceeded)
{
message.InternalStatus = Message.BSMDStatus.SEND_FAILED;
}
break;
case Message.NSWProvider.DAKOSY:
sendSucceeded = bsmd.dakosy.Request.Send(message);
if (!sendSucceeded) message.InternalStatus = Message.BSMDStatus.SEND_FAILED;
break;
case Message.NSWProvider.DUDR:
@ -97,11 +146,13 @@ namespace SendNSWMessageService
if (sendSucceeded)
{
_log.Info("send successful, saving message.");
message.InternalStatus = Message.BSMDStatus.SENT;
message.SentAt = DateTime.Now;
DBManager.Instance.Save(message);
}
DBManager.Instance.Save(message);
}
catch (Exception ex)
{
@ -109,6 +160,10 @@ namespace SendNSWMessageService
}
}
}
DBManager.Instance.Disconnect();
}

View File

@ -26,8 +26,7 @@ namespace SendNSWMessageService
};
if (Debugger.IsAttached)
{
((NSWSendService)ServicesToRun[0]).Init(null);
while (true) ;
((NSWSendService)ServicesToRun[0]).DoOnce();
}
else
{

View File

@ -23,13 +23,29 @@ namespace SendNSWMessageService.Properties {
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("replace me!")]
[global::System.Configuration.DefaultSettingValueAttribute("Data Source=(localdb)\\Projects;Initial Catalog=nsw;Integrated Security=True;Conne" +
"ct Timeout=30;Encrypt=False;TrustServerCertificate=False")]
public string ConnectionString {
get {
return ((string)(this["ConnectionString"]));
}
set {
this["ConnectionString"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public int SleepSeconds {
get {
return ((int)(this["SleepSeconds"]));
}
set {
this["SleepSeconds"] = value;
}
}
}
}

View File

@ -2,8 +2,11 @@
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="SendNSWMessageService.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="ConnectionString" Type="System.String" Scope="Application">
<Value Profile="(Default)">replace me!</Value>
<Setting Name="ConnectionString" Type="System.String" Scope="User">
<Value Profile="(Default)">Data Source=(localdb)\Projects;Initial Catalog=nsw;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False</Value>
</Setting>
<Setting Name="SleepSeconds" Type="System.Int32" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@ -0,0 +1,28 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bsmd.ReportGenerator", "bsmd.ReportGenerator\bsmd.ReportGenerator.csproj", "{778C12E2-18A7-4A87-8272-BB69C716D50D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bsmd.database", "bsmd.database\bsmd.database.csproj", "{19945AF2-379B-46A5-B27A-303B5EC1D557}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{778C12E2-18A7-4A87-8272-BB69C716D50D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{778C12E2-18A7-4A87-8272-BB69C716D50D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{778C12E2-18A7-4A87-8272-BB69C716D50D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{778C12E2-18A7-4A87-8272-BB69C716D50D}.Release|Any CPU.Build.0 = Release|Any CPU
{19945AF2-379B-46A5-B27A-303B5EC1D557}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{19945AF2-379B-46A5-B27A-303B5EC1D557}.Debug|Any CPU.Build.0 = Debug|Any CPU
{19945AF2-379B-46A5-B27A-303B5EC1D557}.Release|Any CPU.ActiveCfg = Release|Any CPU
{19945AF2-379B-46A5-B27A-303B5EC1D557}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="bsmd.ReportGenerator.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<userSettings>
<bsmd.ReportGenerator.Properties.Settings>
<setting name="ConnectionString" serializeAs="String">
<value>replace me!</value>
</setting>
<setting name="OutputDirectory" serializeAs="String">
<value />
</setting>
<setting name="SleepSeconds" serializeAs="String">
<value>300</value>
</setting>
<setting name="ReportAuthor" serializeAs="String">
<value>BSMD ReportGenerator</value>
</setting>
<setting name="SMTPServer" serializeAs="String">
<value />
</setting>
<setting name="SMTPUser" serializeAs="String">
<value />
</setting>
<setting name="SMTPPassword" serializeAs="String">
<value />
</setting>
<setting name="Recipient" serializeAs="Xml">
<value>
<ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<string>nsw@textbausteine.net</string>
</ArrayOfString>
</value>
</setting>
<setting name="Sender" serializeAs="String">
<value>donotreply@bsmd.de</value>
</setting>
<setting name="LogoPath" serializeAs="String">
<value />
</setting>
</bsmd.ReportGenerator.Properties.Settings>
</userSettings>
</configuration>

View File

@ -0,0 +1,246 @@
//
// Class: Document
// Current CLR: 4.0.30319.34209
// System: Microsoft Visual Studio 10.0
// Author: dani
// Created: 5/27/2015 8:52:50 PM
//
// Copyright (c) 2015 Informatikbüro Daniel Schick. All rights reserved.
using System;
using System.Collections.Generic;
using System.IO;
using MigraDoc;
using MigraDoc.DocumentObjectModel;
using MigraDoc.DocumentObjectModel.Shapes;
using MigraDoc.DocumentObjectModel.Tables;
using MigraDoc.Rendering;
using bsmd.database;
namespace bsmd.ReportGenerator
{
public class BSMDDocument
{
#region create document
public static Document CreateDocument(string title, string subject, string author)
{
// Create a new MigraDoc document
Document document = new Document();
if(title != null) document.Info.Title = title;
if(subject != null) document.Info.Subject = subject;
if(author != null) document.Info.Author = author;
BSMDDocument.DefineStyles(document);
BSMDDocument.DefineCover(document);
BSMDDocument.DefineContentSection(document);
//TableOfContents.DefineTableOfContents(document);
//DefineContentSection(document);
//Paragraphs.DefineParagraphs(document);
//Tables.DefineTables(document);
//Charts.DefineCharts(document);
return document;
}
/// <summary>
/// create the final output document
/// </summary>
/// <param name="document">document to render</param>
/// <param name="filename">full path of bla.pdf output file</param>
public static void RenderDocument(Document document, string filename)
{
// wozu braucht man das hier?
string filenameCore = Path.GetFileNameWithoutExtension(filename);
string migraTempFile = string.Format("{1}\\{0}.mdddl", filenameCore, Path.GetDirectoryName(filename));
MigraDoc.DocumentObjectModel.IO.DdlWriter.WriteToFile(document, migraTempFile);
// TODO Test font embedding (-> filesize!)
PdfDocumentRenderer renderer = new PdfDocumentRenderer(true, PdfSharp.Pdf.PdfFontEmbedding.None);
renderer.Document = document;
renderer.RenderDocument();
renderer.PdfDocument.Save(filename);
}
#endregion
#region Style
public static void DefineStyles(Document document)
{
// Get the predefined style Normal.
Style style = document.Styles["Normal"];
// Because all styles are derived from Normal, the next line changes the
// font of the whole document. Or, more exactly, it changes the font of
// all styles and paragraphs that do not redefine the font.
style.Font.Name = "Times New Roman";
// Heading1 to Heading9 are predefined styles with an outline level. An outline level
// other than OutlineLevel.BodyText automatically creates the outline (or bookmarks)
// in PDF.
style = document.Styles["Heading1"];
style.Font.Name = "Tahoma";
style.Font.Size = 14;
style.Font.Bold = true;
style.Font.Color = Colors.DarkBlue;
style.ParagraphFormat.PageBreakBefore = true;
style.ParagraphFormat.SpaceAfter = 6;
style = document.Styles["Heading2"];
style.Font.Size = 12;
style.Font.Bold = true;
style.ParagraphFormat.PageBreakBefore = false;
style.ParagraphFormat.SpaceBefore = 6;
style.ParagraphFormat.SpaceAfter = 6;
style = document.Styles["Heading3"];
style.Font.Size = 10;
style.Font.Bold = true;
style.Font.Italic = true;
style.ParagraphFormat.SpaceBefore = 6;
style.ParagraphFormat.SpaceAfter = 3;
style = document.Styles[StyleNames.Header];
style.ParagraphFormat.AddTabStop("16cm", TabAlignment.Right);
style = document.Styles[StyleNames.Footer];
style.ParagraphFormat.AddTabStop("8cm", TabAlignment.Center);
// Create a new style called TextBox based on style Normal
style = document.Styles.AddStyle("TextBox", "Normal");
style.ParagraphFormat.Alignment = ParagraphAlignment.Justify;
style.ParagraphFormat.Borders.Width = 2.5;
style.ParagraphFormat.Borders.Distance = "3pt";
style.ParagraphFormat.Shading.Color = Colors.SkyBlue;
// Create a new style called TOC based on style Normal
style = document.Styles.AddStyle("TOC", "Normal");
style.ParagraphFormat.AddTabStop("16cm", TabAlignment.Right, TabLeader.Dots);
style.ParagraphFormat.Font.Color = Colors.Blue;
}
#endregion
#region Cover
/// <summary>
/// Defines the cover page.
/// </summary>
public static void DefineCover(Document document)
{
Section section = document.AddSection();
Paragraph paragraph = section.AddParagraph();
paragraph.Format.SpaceAfter = "3cm";
Image image = section.AddImage(Properties.Settings.Default.LogoPath);
image.Width = "3cm";
paragraph = section.AddParagraph("EU-NOAD incoming data receipt");
paragraph.Format.Font.Size = 16;
paragraph.Format.Font.Color = Colors.DarkRed;
paragraph.Format.SpaceBefore = "8cm";
paragraph.Format.SpaceAfter = "3cm";
paragraph = section.AddParagraph("Rendering date: ");
paragraph.AddDateField();
}
#endregion
#region setup, header and footers
/// <summary>
/// Defines page setup, headers, and footers.
/// </summary>
public static void DefineContentSection(Document document)
{
Section section = document.AddSection();
section.PageSetup.OddAndEvenPagesHeaderFooter = true;
section.PageSetup.StartingNumber = 1;
HeaderFooter header = section.Headers.Primary;
header.AddParagraph("\tEU-NOAD receive receipt");
header = section.Headers.EvenPage;
header.AddParagraph("EU-NOAD receive receipt");
// Create a paragraph with centered page number. See definition of style "Footer".
Paragraph paragraph = new Paragraph();
paragraph.AddTab();
paragraph.AddPageField();
// Add paragraph to footer for odd pages.
section.Footers.Primary.Add(paragraph);
// Add clone of paragraph to footer for odd pages. Cloning is necessary because an object must
// not belong to more than one other object. If you forget cloning an exception is thrown.
section.Footers.EvenPage.Add(paragraph.Clone());
}
#endregion
#region NSW data
public static void AddNSWMessageParagraph(Document document, IMessageParagraph messageParagraph)
{
Paragraph paragraph = document.LastSection.AddParagraph(messageParagraph.Title, "Heading2");
if (messageParagraph.MessageText != null) // 1:n message (CREW, PAS,..)
BSMDDocument.AddActualTableParagraph(document, messageParagraph.MessageText, false);
if (messageParagraph.ChildParagraphs != null)
{
foreach (IMessageParagraph childParagraph in messageParagraph.ChildParagraphs)
{
BSMDDocument.AddActualTableParagraph(document, childParagraph.MessageText, true);
}
}
}
private static void AddActualTableParagraph(Document document, List<KeyValuePair<string, string>> messageText, bool isSubTable)
{
Table table = document.LastSection.AddTable();
// table.LeftPadding = new Unit(0.5, UnitType.Centimeter);
Column leadColumn = table.AddColumn(Unit.FromCentimeter(8));
leadColumn.Format.Alignment = ParagraphAlignment.Left;
Column mainColumn = table.AddColumn(Unit.FromCentimeter(8));
mainColumn.Format.Alignment = ParagraphAlignment.Left;
for (int i = 0; i < messageText.Count; i++)
{
KeyValuePair<string, string> elem = messageText[i];
Row row = table.AddRow();
Cell cell = row.Cells[0];
cell.AddParagraph(elem.Key);
row.Cells[1].AddParagraph(elem.Value);
}
if (isSubTable)
{
table.SetEdge(0, 0, 2, messageText.Count, Edge.Box, BorderStyle.DashLargeGap, new Unit(1.0, UnitType.Point));
}
document.LastSection.AddParagraph();
}
#endregion
}
}

View File

@ -0,0 +1,91 @@
//
// Class: Mail
// Current CLR: 4.0.30319.34209
// System: Microsoft Visual Studio 10.0
// Author: dani
// Created: 5/28/2015 10:24:12 AM
//
// Copyright (c) 2015 Informatikbüro Daniel Schick. All rights reserved.
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Net.Mime;
using System.Net.Mail;
using log4net;
using bsmd.database;
namespace bsmd.ReportGenerator
{
public class BSMDMail
{
public static void SendNSWReportAsAttachment(MessageCore core, string filename)
{
ILog log = LogManager.GetLogger(typeof(BSMDMail));
SmtpClient smtpClient = new SmtpClient();
NetworkCredential basicCredential = new NetworkCredential(Properties.Settings.Default.SMTPUser,
Properties.Settings.Default.SMTPPassword);
MailMessage message = new MailMessage();
MailAddress fromAddress = new MailAddress(Properties.Settings.Default.Sender);
// setup up the host, increase the timeout to 5 minutes
smtpClient.Host = Properties.Settings.Default.SMTPServer;
smtpClient.UseDefaultCredentials = false;
smtpClient.Credentials = basicCredential;
smtpClient.Timeout = (60 * 5 * 1000);
smtpClient.EnableSsl = true;
message.From = fromAddress;
message.Subject = string.Format("NSW Message report for {0}", core.IMO);
message.IsBodyHtml = false;
message.Body = "see attachment";
foreach (string recipient in Properties.Settings.Default.Recipient)
message.To.Add(recipient);
if(filename != null)
{
Attachment attachment = new Attachment(filename, MediaTypeNames.Application.Octet);
ContentDisposition disposition = attachment.ContentDisposition;
disposition.CreationDate = File.GetCreationTime(filename);
disposition.ModificationDate = File.GetLastWriteTime(filename);
disposition.ReadDate = File.GetLastAccessTime(filename);
disposition.FileName = Path.GetFileName(filename);
disposition.Size = new FileInfo(filename).Length;
disposition.DispositionType = DispositionTypeNames.Attachment;
message.Attachments.Add(attachment);
}
// doch nicht asynchron, da nur eine Nachricht gleichzeitig geschickt werden kann und ich so den sync code spare
try
{
smtpClient.Send(message);
log.Info("Email sending successful.");
}
catch (SmtpException smtpException)
{
log.ErrorFormat("SMTP error while sending e-mail:{0}", smtpException.Message);
}
catch (Exception ex)
{
log.ErrorFormat("other error while sending e-mail:{0}", ex.Message);
}
smtpClient.Dispose();
message.Dispose();
// http://stackoverflow.com/questions/7276375/what-are-best-practices-for-using-smtpclient-sendasync-and-dispose-under-net-4
// asynchron schicken und wenn's erledigt ist gleich disposen (wichtig!)
/*
smtpClient.SendCompleted += (s, e) =>
{
smtpClient.Dispose();
message.Dispose();
};
smtpClient.SendAsync(message, null);
*/
}
}
}

View File

@ -0,0 +1,29 @@
using System.Diagnostics;
using System.ServiceProcess;
namespace bsmd.ReportGenerator
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main()
{
ServiceBase[] ServicesToRun;
log4net.Config.XmlConfigurator.Configure();
ServicesToRun = new ServiceBase[] { new ReportService() };
if (Debugger.IsAttached)
{
((ReportService)ServicesToRun[0]).DoOnce();
}
else
{
ServiceBase.Run(ServicesToRun);
}
}
}
}

View File

@ -0,0 +1,59 @@
namespace bsmd.ReportGenerator
{
partial class ProjectInstaller
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.serviceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller();
this.serviceInstaller1 = new System.ServiceProcess.ServiceInstaller();
//
// serviceProcessInstaller1
//
this.serviceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.LocalSystem;
this.serviceProcessInstaller1.Password = null;
this.serviceProcessInstaller1.Username = null;
//
// serviceInstaller1
//
this.serviceInstaller1.Description = "Creates reports from NSW message traffice";
this.serviceInstaller1.DisplayName = "NSW Report Generator";
this.serviceInstaller1.ServiceName = "NSW Report Generator";
//
// ProjectInstaller
//
this.Installers.AddRange(new System.Configuration.Install.Installer[] {
this.serviceProcessInstaller1,
this.serviceInstaller1});
}
#endregion
private System.ServiceProcess.ServiceProcessInstaller serviceProcessInstaller1;
private System.ServiceProcess.ServiceInstaller serviceInstaller1;
}
}

View File

@ -0,0 +1,19 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;
using System.Linq;
using System.Threading.Tasks;
namespace bsmd.ReportGenerator
{
[RunInstaller(true)]
public partial class ProjectInstaller : System.Configuration.Install.Installer
{
public ProjectInstaller()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,129 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="serviceProcessInstaller1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="serviceInstaller1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>196, 17</value>
</metadata>
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
</root>

View File

@ -0,0 +1,18 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("bsmd.ReportGenerator")]
[assembly: AssemblyDescription("Creates PDF reports for NSW messages")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("d5509a24-051f-440b-bfdd-f0b7ea16decc")]

View File

@ -0,0 +1,148 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34209
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace bsmd.ReportGenerator.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("replace me!")]
public string ConnectionString {
get {
return ((string)(this["ConnectionString"]));
}
set {
this["ConnectionString"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string OutputDirectory {
get {
return ((string)(this["OutputDirectory"]));
}
set {
this["OutputDirectory"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("300")]
public int SleepSeconds {
get {
return ((int)(this["SleepSeconds"]));
}
set {
this["SleepSeconds"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("BSMD ReportGenerator")]
public string ReportAuthor {
get {
return ((string)(this["ReportAuthor"]));
}
set {
this["ReportAuthor"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string SMTPServer {
get {
return ((string)(this["SMTPServer"]));
}
set {
this["SMTPServer"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string SMTPUser {
get {
return ((string)(this["SMTPUser"]));
}
set {
this["SMTPUser"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string SMTPPassword {
get {
return ((string)(this["SMTPPassword"]));
}
set {
this["SMTPPassword"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("<?xml version=\"1.0\" encoding=\"utf-16\"?>\r\n<ArrayOfString xmlns:xsi=\"http://www.w3." +
"org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\r\n <s" +
"tring>nsw@textbausteine.net</string>\r\n</ArrayOfString>")]
public global::System.Collections.Specialized.StringCollection Recipient {
get {
return ((global::System.Collections.Specialized.StringCollection)(this["Recipient"]));
}
set {
this["Recipient"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("donotreply@bsmd.de")]
public string Sender {
get {
return ((string)(this["Sender"]));
}
set {
this["Sender"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string LogoPath {
get {
return ((string)(this["LogoPath"]));
}
set {
this["LogoPath"] = value;
}
}
}
}

View File

@ -0,0 +1,39 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="bsmd.ReportGenerator.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="ConnectionString" Type="System.String" Scope="User">
<Value Profile="(Default)">replace me!</Value>
</Setting>
<Setting Name="OutputDirectory" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="SleepSeconds" Type="System.Int32" Scope="User">
<Value Profile="(Default)">300</Value>
</Setting>
<Setting Name="ReportAuthor" Type="System.String" Scope="User">
<Value Profile="(Default)">BSMD ReportGenerator</Value>
</Setting>
<Setting Name="SMTPServer" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="SMTPUser" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="SMTPPassword" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="Recipient" Type="System.Collections.Specialized.StringCollection" Scope="User">
<Value Profile="(Default)">&lt;?xml version="1.0" encoding="utf-16"?&gt;
&lt;ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
&lt;string&gt;nsw@textbausteine.net&lt;/string&gt;
&lt;/ArrayOfString&gt;</Value>
</Setting>
<Setting Name="Sender" Type="System.String" Scope="User">
<Value Profile="(Default)">donotreply@bsmd.de</Value>
</Setting>
<Setting Name="LogoPath" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>

View File

@ -0,0 +1,40 @@
namespace bsmd.ReportGenerator
{
partial class ReportService
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
//
// ReportService
//
this.ServiceName = "NSW Report Generator";
}
#endregion
}
}

View File

@ -0,0 +1,127 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading.Tasks;
using System.Timers;
using MigraDoc;
using MigraDoc.DocumentObjectModel;
using log4net;
using bsmd.database;
namespace bsmd.ReportGenerator
{
public partial class ReportService : ServiceBase
{
private Timer _timer;
private object _timerlock = new object();
private bool processRunning = false;
private ILog _log = LogManager.GetLogger(typeof(ReportService));
public ReportService()
{
Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);
InitializeComponent();
}
protected override void OnStart(string[] args)
{
this.EventLog.Source = this.ServiceName;
this.EventLog.Log = "Application";
this.Init(args);
this.EventLog.WriteEntry("Report Service started.", EventLogEntryType.Information);
this.DoOnce();
}
private void Init(string[] args)
{
this._timer = new Timer();
this._timer.Interval = Properties.Settings.Default.SleepSeconds * 1000;
this._timer.Elapsed += _timer_Elapsed;
this._timer.Enabled = true;
}
private void _timer_Elapsed(object sender, ElapsedEventArgs e)
{
lock (this._timerlock)
{
if (this.processRunning) return;
else this.processRunning = true;
}
if (DBManager.Instance.Connect(Properties.Settings.Default.ConnectionString))
{
try
{
// load all messages with report flag set
List<MessageCore> reportCores = DBManager.Instance.GetMessageCoresByStatus(MessageCore.BSMDStatus.CREATE_RECEIVE_RECEIPT);
// create report documents for each of the messages
foreach (MessageCore reportCore in reportCores)
{
List<Message> messages = DBManager.Instance.GetMessagesForCore(reportCore);
Document migraDocument = BSMDDocument.CreateDocument(
string.Format("NSW Eingangsdatenübersicht für IMO {0}, ETA {1}", reportCore.IMO, reportCore.ETA),
"NSW Meldung",
Properties.Settings.Default.ReportAuthor);
// print header area (with message core data)
// print messages in subsequent tables
foreach (Message message in messages)
{
BSMDDocument.AddNSWMessageParagraph(migraDocument, message);
}
// prepare and send E-Mail with generated attachment
string fullPath = string.Format("{0}\\{1}.pdf", Properties.Settings.Default.OutputDirectory,
reportCore.Id);
BSMDDocument.RenderDocument(migraDocument, fullPath);
_log.InfoFormat("Document created for MessageCoreId {0}, IMO {1}", reportCore.Id, reportCore.IMO);
BSMDMail.SendNSWReportAsAttachment(reportCore, fullPath);
// reset status on core message (get ready to prepare)
reportCore.BSMDStatusInternal = MessageCore.BSMDStatus.PREPARE;
DBManager.Instance.Save(reportCore);
}
DBManager.Instance.Disconnect();
}
catch (Exception ex)
{
_log.ErrorFormat("Exception occurred: {0}", ex.ToString());
}
}
else
{
this.EventLog.WriteEntry("ReportService stopped: DB connection failed", EventLogEntryType.Error);
this.Stop();
}
lock (this._timerlock)
{
this.processRunning = false;
}
}
protected override void OnStop()
{
}
internal void DoOnce()
{
this._timer_Elapsed(null, null);
}
}
}

View File

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
</root>

View File

@ -0,0 +1,134 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{778C12E2-18A7-4A87-8272-BB69C716D50D}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>bsmd.ReportGenerator</RootNamespace>
<AssemblyName>bsmd.ReportGenerator</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net">
<HintPath>..\packages\log4net.2.0.3\lib\net40-full\log4net.dll</HintPath>
</Reference>
<Reference Include="MigraDoc.DocumentObjectModel">
<HintPath>packages\PDFsharp-MigraDoc-GDI.1.32.4334.0\lib\net20\MigraDoc.DocumentObjectModel.dll</HintPath>
</Reference>
<Reference Include="MigraDoc.Rendering">
<HintPath>packages\PDFsharp-MigraDoc-GDI.1.32.4334.0\lib\net20\MigraDoc.Rendering.dll</HintPath>
</Reference>
<Reference Include="MigraDoc.RtfRendering">
<HintPath>packages\PDFsharp-MigraDoc-GDI.1.32.4334.0\lib\net20\MigraDoc.RtfRendering.dll</HintPath>
</Reference>
<Reference Include="PdfSharp">
<HintPath>packages\PDFsharp-MigraDoc-GDI.1.32.4334.0\lib\net20\PdfSharp.dll</HintPath>
</Reference>
<Reference Include="PdfSharp.Charting">
<HintPath>packages\PDFsharp-MigraDoc-GDI.1.32.4334.0\lib\net20\PdfSharp.Charting.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration.Install" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Management" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\bsmd.database\Properties\AssemblyProductInfo.cs">
<Link>Properties\AssemblyProductInfo.cs</Link>
</Compile>
<Compile Include="..\bsmd.database\Properties\AssemblyProjectInfo.cs">
<Link>Properties\AssemblyProjectInfo.cs</Link>
</Compile>
<Compile Include="..\bsmd.database\Properties\AssemblyProjectKeyInfo.cs">
<Link>Properties\AssemblyProjectKeyInfo.cs</Link>
</Compile>
<Compile Include="BSMDDocument.cs" />
<Compile Include="BSMDMail.cs" />
<Compile Include="ProjectInstaller.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ProjectInstaller.Designer.cs">
<DependentUpon>ProjectInstaller.cs</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<Compile Include="ReportService.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ReportService.Designer.cs">
<DependentUpon>ReportService.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="..\bsmdKey.snk" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="ProjectInstaller.resx">
<DependentUpon>ProjectInstaller.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="ReportService.resx">
<DependentUpon>ReportService.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\bsmd.database\bsmd.database.csproj">
<Project>{19945af2-379b-46a5-b27a-303b5ec1d557}</Project>
<Name>bsmd.database</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="log4net" version="2.0.3" targetFramework="net45" />
<package id="PDFsharp-MigraDoc-GDI" version="1.32.4334.0" targetFramework="net45" />
</packages>

View File

@ -88,12 +88,15 @@ namespace bsmd.dakosy
reqList.RequestId[0].ReportingParty.Name = aMessage.ReportingParty.Name;
reqList.RequestId[0].ReportingParty.Phone = aMessage.ReportingParty.Phone;
reqList.RequestId[0].ReportingParty.PostalCode = aMessage.ReportingParty.PostalCode;
if (!aMessage.ReportingParty.StreetAndNumber.IsNullOrEmpty())
{
int lastBlank = aMessage.ReportingParty.StreetAndNumber.LastIndexOf(' ');
if (lastBlank > 0)
{
reqList.RequestId[0].ReportingParty.StreetName = aMessage.ReportingParty.StreetAndNumber.Substring(0, lastBlank);
reqList.RequestId[0].ReportingParty.StreetNumber = aMessage.ReportingParty.StreetAndNumber.Substring(lastBlank);
}
}
reqList.RequestId[0].ReportingParty.Type = ReportingPartyType.OTHERS; // TBD
reqList.RequestId[0].ReportingParty.TypeSpecified = false; // TBD
@ -198,11 +201,16 @@ namespace bsmd.dakosy
if (noa_nod.ETDFromPortOfCall.HasValue) vList.Visit[0].NOA_NOD.EtdFromPortOfCall = noa_nod.ETDFromPortOfCall.Value;
vList.Visit[0].NOA_NOD.LastPort = noa_nod.LastPort;
vList.Visit[0].NOA_NOD.NextPort = noa_nod.NextPort;
vList.Visit[0].NOA_NOD.CallPurpose = new CallPurpose[1];
if (noa_nod.CallPurposeCode.HasValue) // TBD: wir haben nur einen CallPurposeCode, hier gibt es mehrere?
int numCallPurpose = noa_nod.CallPurposes.Count;
if (numCallPurpose > 0)
{
vList.Visit[0].NOA_NOD.CallPurpose[0].CallPurposeCode = noa_nod.CallPurposeCode.Value;
vList.Visit[0].NOA_NOD.CallPurpose[0].CallPurposeDescription = noa_nod.CallPurposeDescription;
vList.Visit[0].NOA_NOD.CallPurpose = new CallPurpose[numCallPurpose];
for (int i = 0; i < numCallPurpose; i++)
{
vList.Visit[0].NOA_NOD.CallPurpose[i] = new CallPurpose();
vList.Visit[0].NOA_NOD.CallPurpose[i].CallPurposeCode = noa_nod.CallPurposes[i].CallPurposeCode;
vList.Visit[0].NOA_NOD.CallPurpose[i].CallPurposeDescription = noa_nod.CallPurposes[i].CallPurposeDescription;
}
}
break;
case Message.NotificationClass.ATA:
@ -760,7 +768,9 @@ namespace bsmd.dakosy
}
// call sftp client to send
sftp.Put(fileName);
sftp.Put(fileName,
Properties.Settings.Default.TestMode ?
Properties.Settings.Default.RemoteTestIncomingDir : Properties.Settings.Default.RemoteProdIncomingDir);
// remove sent file if not test mode
if (!Properties.Settings.Default.TestMode)

View File

@ -80,7 +80,7 @@ namespace bsmd.dakosy
}
//aMessage.Status = Message.MessageStatus.
aMessage.InternalStatus = Message.BSMDStatus.RESPONDED;
aMessage.InternalStatus = Message.BSMDStatus.RESPONSE_RECEIVED;
DBManager.Instance.Save(aMessage);
}

View File

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="bsmd.dakosy.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="bsmd.dakosy.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<applicationSettings>
<userSettings>
<bsmd.dakosy.Properties.Settings>
<setting name="SFTPSessionName" serializeAs="String">
<value>dakosy</value>
@ -25,6 +25,18 @@
<setting name="WINSCPFullPath" serializeAs="String">
<value>E:\Tools\WinScp\WinSCP.exe</value>
</setting>
<setting name="RemoteProdIncomingDir" serializeAs="String">
<value>dakcmn/bsm/ext-dak </value>
</setting>
<setting name="RemoteTestIncomingDir" serializeAs="String">
<value>dakcmn/bsm/ext-dak/test </value>
</setting>
<setting name="RemoteProdOutgoingDir" serializeAs="String">
<value>dakcmn/bsm/dak-ext </value>
</setting>
<setting name="RemoteTestOutgoingDir" serializeAs="String">
<value>dakcmn/bsm/dak-ext/test </value>
</setting>
</bsmd.dakosy.Properties.Settings>
</applicationSettings>
</userSettings>
</configuration>

View File

@ -21,7 +21,7 @@ namespace bsmd.dakosy
/// </summary>
public static class sftp
{
public static void Put(string fullPath)
public static void Put(string fullPath, string targetDir)
{
Process winscp = new Process();
winscp.StartInfo.FileName = Properties.Settings.Default.WINSCPFullPath;
@ -37,6 +37,8 @@ namespace bsmd.dakosy
winscp.StandardInput.WriteLine("option confirm off");
winscp.StandardInput.WriteLine("open " + Properties.Settings.Default.SFTPSessionName);
winscp.StandardInput.WriteLine("ls");
if (targetDir != null)
winscp.StandardInput.WriteLine("cd " + targetDir);
winscp.StandardInput.WriteLine("put " + fullPath);
winscp.StandardInput.Close();

View File

@ -24,6 +24,7 @@ namespace bsmd.database
#region Properties
[ShowReport]
public DateTime? ATAPortOfCall { get; set; }
#endregion

View File

@ -24,6 +24,7 @@ namespace bsmd.database
#region Properties
[ShowReport]
public DateTime? ATDPortOfCall { get; set; }
#endregion

View File

@ -14,7 +14,7 @@ using System.Collections.Generic;
namespace bsmd.database
{
public class BRKA : DatabaseEntity
public class BRKA : DatabaseEntity, ISublistElement
{
public BRKA()
@ -24,9 +24,11 @@ namespace bsmd.database
#region Properties
[ShowReport]
public string BunkerFuelType { get; set; }
public float? BunkerFuelQuantity_TNE { get; set; }
[ShowReport]
public double? BunkerFuelQuantity_TNE { get; set; }
public string Identifier { get; set; }
@ -85,7 +87,7 @@ namespace bsmd.database
bkra.id = reader.GetGuid(0);
if (!reader.IsDBNull(1)) bkra.BunkerFuelType = reader.GetString(1);
if (!reader.IsDBNull(2)) bkra.BunkerFuelQuantity_TNE = (float) reader.GetDouble(2);
if (!reader.IsDBNull(2)) bkra.BunkerFuelQuantity_TNE = reader.GetDouble(2);
if (!reader.IsDBNull(3)) bkra.Identifier = reader.GetString(3);
result.Add(bkra);
}

View File

@ -26,6 +26,7 @@ namespace bsmd.database
#region Properties
[ShowReport]
public bool? StowawaysOnBoard { get; set; }
public List<PortOfItinerary> PortOfItineraries { get { return this.poi; } }
@ -105,6 +106,21 @@ namespace bsmd.database
#endregion
#region IMessageParagraph implementation
public override List<IMessageParagraph> ChildParagraphs
{
get
{
List<IMessageParagraph> result = new List<IMessageParagraph>();
foreach (IMessageParagraph imp in this.PortOfItineraries)
result.Add(imp);
return result;
}
}
#endregion
}
}

View File

@ -14,7 +14,7 @@ using System.Collections.Generic;
namespace bsmd.database
{
public class BRKD : DatabaseEntity
public class BRKD : DatabaseEntity, ISublistElement
{
public BRKD()
@ -24,9 +24,11 @@ namespace bsmd.database
#region Properties
[ShowReport]
public string BunkerFuelType { get; set; }
public float? BunkerFuelQuantity_TNE { get; set; }
[ShowReport]
public double? BunkerFuelQuantity_TNE { get; set; }
public string Identifier { get; set; }
@ -85,7 +87,7 @@ namespace bsmd.database
bkrd.id = reader.GetGuid(0);
if (!reader.IsDBNull(1)) bkrd.BunkerFuelType = reader.GetString(1);
if (!reader.IsDBNull(2)) bkrd.BunkerFuelQuantity_TNE = (float) reader.GetDouble(2);
if (!reader.IsDBNull(2)) bkrd.BunkerFuelQuantity_TNE = reader.GetDouble(2);
if (!reader.IsDBNull(3)) bkrd.Identifier = reader.GetString(3);
result.Add(bkrd);
}

View File

@ -14,7 +14,7 @@ using System.Collections.Generic;
namespace bsmd.database
{
public class CREW : DatabaseEntity
public class CREW : DatabaseEntity, ISublistElement
{
public CREW()
@ -24,24 +24,34 @@ namespace bsmd.database
#region Properties
[ShowReport]
public string CrewMemberLastName { get; set; }
[ShowReport]
public string CrewMemberFirstName { get; set; }
[ShowReport]
public string CrewMemberPlaceOfBirth { get; set; }
[ShowReport]
public DateTime? CrewMemberDateOfBirth { get; set; }
[ShowReport]
public byte? CrewMemberGender { get; set; }
[ShowReport]
public string CrewMemberNationality { get; set; }
[ShowReport]
public byte? CrewMemberIdentityDocumentType { get; set; }
[ShowReport]
public string CrewMemberIdentityDocumentId { get; set; }
[ShowReport]
public string CrewMemberVisaNumber { get; set; }
[ShowReport]
public string CrewMemberDuty { get; set; }
public string Identifier { get; set; }

View File

@ -26,8 +26,10 @@ namespace bsmd.database
public NOA_NOD NOA_NOD { get; set; }
[ShowReport]
public int CallPurposeCode { get; set; }
[ShowReport]
public string CallPurposeDescription { get; set; }
public string Identifier { get; set; }

View File

@ -65,17 +65,26 @@ namespace bsmd.database
#region public helper funcs
public Dictionary<Guid, MessageCore> GetToSendMessageCoreList()
{
List<MessageCore> toSendList = this.GetMessageCoresByStatus(MessageCore.BSMDStatus.TOSEND);
Dictionary<Guid, MessageCore> result = new Dictionary<Guid, MessageCore>();
foreach (MessageCore core in toSendList)
result.Add(core.Id.Value, core);
return result;
}
public List<MessageCore> GetMessageCoresByStatus(MessageCore.BSMDStatus status)
{
MessageCore aMessageCore = new MessageCore();
SqlCommand cmd = new SqlCommand();
Message.LoadFilter filter = Message.LoadFilter.BSMDSTATUS;
aMessageCore.PrepareLoadCommand(cmd, filter, Message.BSMDStatus.TOSEND);
aMessageCore.PrepareLoadCommand(cmd, filter, status);
SqlDataReader reader = this.PerformCommand(cmd);
List<DatabaseEntity> cores = aMessageCore.LoadList(reader);
Dictionary<Guid, MessageCore> result = new Dictionary<Guid, MessageCore>();
List<MessageCore> result = new List<MessageCore>();
foreach (MessageCore core in cores)
result.Add(core.Id.Value, core);
result.Add(core);
return result;
}
@ -108,28 +117,11 @@ namespace bsmd.database
List<DatabaseEntity> messages = aMessage.LoadList(reader);
List<Message> messageList = new List<Message>();
foreach (Message message in messages)
messageList.Add(message);
this.LoadMessageDependencies(messageList);
return messageList;
}
public List<Message> GetToSendMessageList()
{
Message aMessage = new Message();
SqlCommand cmd = new SqlCommand();
Message.LoadFilter filter = Message.LoadFilter.BSMDSTATUS;
aMessage.PrepareLoadCommand(cmd, filter, Message.BSMDStatus.TOSEND);
SqlDataReader reader = this.PerformCommand(cmd);
List<DatabaseEntity> messages = aMessage.LoadList(reader);
List<Message> messageList = new List<Message>();
foreach (Message message in messages)
message.MessageCore = core;
messageList.Add(message);
}
this.LoadMessageDependencies(messageList);
return messageList;
}
@ -243,12 +235,12 @@ namespace bsmd.database
internal void LoadMessageDependencies(List<Message> messageList)
{
Dictionary<Guid, MessageCore> messageCoreDict = this.GetToSendMessageCoreList();
// Dictionary<Guid, MessageCore> messageCoreDict = this.GetToSendMessageCoreList();
Dictionary<Guid, ReportingParty> reportingPartyDict = this.GetReportingPartyDict();
// Zuordnung MessageCore,Zuordnung Reporting party
Message.AssignReportingParties(messageList, reportingPartyDict);
Message.AssignMessageCores(messageList, messageCoreDict);
// Message.AssignMessageCores(messageList, messageCoreDict);
foreach (Message message in messageList)
{
@ -311,11 +303,9 @@ namespace bsmd.database
case Message.NotificationClass.BPOL: result = new BPOL(); break;
case Message.NotificationClass.TOWA: result = new TOWA(); break;
case Message.NotificationClass.TOWD: result = new TOWD(); break;
case Message.NotificationClass.HAZA: result = new HAZ(); break;
case Message.NotificationClass.HAZD: result = new HAZ(); ((HAZ)result).IsDeparture = true; break;
case Message.NotificationClass.HAZA:
case Message.NotificationClass.HAZD:
_log.WarnFormat("CreateMessage: message type {0} is not supported", notificationClass.ToString());
break;
default:
break; // VISIT, TRANSIT
}
@ -331,6 +321,92 @@ namespace bsmd.database
{
SqlCommand cmd = new SqlCommand();
#region BPOL
if (databaseEntity.GetType().IsAssignableFrom(typeof(BPOL)))
{
BPOL bpol = databaseEntity as BPOL;
PortOfItinerary poi = new PortOfItinerary();
poi.PrepareLoadCommand(cmd, Message.LoadFilter.BPOL_ID, bpol.Id);
SqlDataReader reader = this.PerformCommand(cmd);
List<DatabaseEntity> pois = poi.LoadList(reader);
foreach (PortOfItinerary aPoi in pois)
{
bpol.PortOfItineraries.Add(aPoi);
aPoi.BPOL = bpol;
}
}
#endregion
#region HAZ
if(databaseEntity.GetType().IsAssignableFrom(typeof(HAZ)))
{
HAZ haz = databaseEntity as HAZ;
// load all 5 position sublists
IMDGPosition imdg = new IMDGPosition();
imdg.PrepareLoadCommand(cmd, Message.LoadFilter.HAZ_ID, haz.Id);
SqlDataReader reader = this.PerformCommand(cmd);
List<DatabaseEntity> imdgs = imdg.LoadList(reader);
foreach (IMDGPosition imdgPosition in imdgs)
{
haz.IMDGPositions.Add(imdgPosition);
imdgPosition.HAZ = haz;
}
cmd = new SqlCommand();
IBCPosition ibc = new IBCPosition();
ibc.PrepareLoadCommand(cmd, Message.LoadFilter.HAZ_ID, haz.Id);
reader = this.PerformCommand(cmd);
List<DatabaseEntity> ibcs = ibc.LoadList(reader);
foreach (IBCPosition ibcPosition in ibcs)
{
haz.IBCPositions.Add(ibcPosition);
ibcPosition.HAZ = haz;
}
cmd = new SqlCommand();
IGCPosition igc = new IGCPosition();
igc.PrepareLoadCommand(cmd, Message.LoadFilter.HAZ_ID, haz.Id);
reader = this.PerformCommand(cmd);
List<DatabaseEntity> igcs = igc.LoadList(reader);
foreach (IGCPosition igcPosition in igcs)
{
haz.IGCPositions.Add(igcPosition);
igcPosition.HAZ = haz;
}
cmd = new SqlCommand();
IMSBCPosition imsbc = new IMSBCPosition();
imsbc.PrepareLoadCommand(cmd, Message.LoadFilter.HAZ_ID, haz.Id);
reader = this.PerformCommand(cmd);
List<DatabaseEntity> imsbcs = imsbc.LoadList(reader);
foreach (IMSBCPosition imsbcPosition in imsbcs)
{
haz.IMSBCPositions.Add(imsbcPosition);
imsbcPosition.HAZ = haz;
}
cmd = new SqlCommand();
MARPOL_Annex_I_Position marpol = new MARPOL_Annex_I_Position();
marpol.PrepareLoadCommand(cmd, Message.LoadFilter.HAZ_ID, haz.Id);
reader = this.PerformCommand(cmd);
List<DatabaseEntity> marpols = marpol.LoadList(reader);
foreach (MARPOL_Annex_I_Position marpolPosition in marpols)
{
haz.MARPOLPositions.Add(marpolPosition);
marpolPosition.HAZ = haz;
}
}
#endregion
#region MDH
if (databaseEntity.GetType().IsAssignableFrom(typeof(MDH)))
@ -427,6 +503,8 @@ namespace bsmd.database
#endregion
#region NOA_NOD
if (databaseEntity.GetType().IsAssignableFrom(typeof(NOA_NOD)))
{
NOA_NOD noa_nod = databaseEntity as NOA_NOD;
@ -442,9 +520,11 @@ namespace bsmd.database
}
}
#endregion
#region WasteDisposalServiceProvider
if(databaseEntity.GetType().IsAssignableFrom(typeof(WasteDisposalServiceProvider)))
if (databaseEntity.GetType().IsAssignableFrom(typeof(WasteDisposalServiceProvider)))
{
WasteDisposalServiceProvider wdsp = databaseEntity as WasteDisposalServiceProvider;

View File

@ -10,12 +10,15 @@
using System;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Linq.Expressions;
using System.Collections.Generic;
using System.Reflection;
namespace bsmd.database
{
public abstract class DatabaseEntity
public abstract class DatabaseEntity : IMessageParagraph
{
protected Guid? id;
protected string tablename;
@ -35,11 +38,6 @@ namespace bsmd.database
/// </summary>
public Message MessageHeader { get; set; }
/// <summary>
/// Status für Services
/// </summary>
public Message.BSMDStatus InternalStatus { get; set; }
/// <summary>
/// SQL Table name to construct queries
/// </summary>
@ -73,5 +71,44 @@ namespace bsmd.database
public abstract List<DatabaseEntity> LoadList(IDataReader reader);
#region IMessageParagraph implementation
public virtual string Title
{
get
{
string name = this.GetType().Name;
return name;
}
}
/// <summary>
/// must be overridden if it must make sense
/// </summary>
public virtual List<KeyValuePair<string, string>> MessageText
{
get {
List<KeyValuePair<string, string>> result = new List<KeyValuePair<string, string>>();
Type objType = this.GetType();
var props = objType.GetProperties().Where(
prop => Attribute.IsDefined(prop, typeof(ShowReportAttribute)));
foreach (PropertyInfo property in props)
{
object propValue = property.GetValue(this, null);
string value = (propValue == null) ? string.Empty : propValue.ToString();
result.Add(new KeyValuePair<string, string>(property.Name, value));
}
return result;
}
}
public virtual List<IMessageParagraph> ChildParagraphs { get { return null; } }
#endregion
}
}

View File

@ -0,0 +1,231 @@
//
// Class: HAZ
// Current CLR: 4.0.30319.34209
// System: Microsoft Visual Studio 10.0
// Author: dani
// Created: 5/26/2015 8:13:35 PM
//
// Copyright (c) 2015 Informatikbüro Daniel Schick. All rights reserved.
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
namespace bsmd.database
{
public class HAZ : DatabaseEntity, ISublistContainer
{
private List<IMDGPosition> imdgPositions = new List<IMDGPosition>();
private List<IBCPosition> ibcPositions = new List<IBCPosition>();
private List<IGCPosition> igcPositions = new List<IGCPosition>();
private List<IMSBCPosition> imsbcPositions = new List<IMSBCPosition>();
private List<MARPOL_Annex_I_Position> marpolPositions = new List<MARPOL_Annex_I_Position>();
public HAZ()
{
this.tablename = "[dbo].[HAZA]"; // muss noch umschaltbar
}
#region Properties
[ShowReport]
public bool? NoDPGOnBoardOnArrival { get; set; }
[ShowReport]
public bool? DPGManifestOnBoardOnArrival { get; set; }
[ShowReport]
public byte? INFShipClass { get; set; }
[ShowReport]
public bool? DPGClassificationIMDG { get; set; }
[ShowReport]
public bool? DPGClassificationIGC { get; set; }
[ShowReport]
public bool? DPGClassificationIBC { get; set; }
[ShowReport]
public bool? DPGClassificationIMSBC { get; set; }
[ShowReport]
public bool DPGClassificationMARPOL_ANNEX_I { get; set; }
public List<IMDGPosition> IMDGPositions { get { return this.imdgPositions; } }
public List<IBCPosition> IBCPositions { get { return this.ibcPositions; } }
public List<IGCPosition> IGCPositions { get { return this.igcPositions; } }
public List<IMSBCPosition> IMSBCPositions { get { return this.imsbcPositions; } }
public List<MARPOL_Annex_I_Position> MARPOLPositions { get { return this.marpolPositions; } }
[ShowReport]
public bool IsDeparture { get; set; } // selektor HAZA / HAZD
#endregion
#region DatabaseEntity implementation
public override void PrepareSave(System.Data.IDbCommand cmd)
{
SqlCommand scmd = cmd as SqlCommand;
scmd.Parameters.AddWithValue("@P1", this.MessageHeader.Id);
scmd.Parameters.AddWithNullableValue("@P2", this.NoDPGOnBoardOnArrival);
scmd.Parameters.AddWithNullableValue("@P3", this.DPGManifestOnBoardOnArrival);
scmd.Parameters.AddWithNullableValue("@P4", this.INFShipClass);
scmd.Parameters.AddWithNullableValue("@P5", this.DPGClassificationIMDG);
scmd.Parameters.AddWithNullableValue("@P6", this.DPGClassificationIGC);
scmd.Parameters.AddWithNullableValue("@P7", this.DPGClassificationIBC);
scmd.Parameters.AddWithNullableValue("@P8", this.DPGClassificationIMSBC);
scmd.Parameters.AddWithNullableValue("@P9", this.DPGClassificationMARPOL_ANNEX_I);
if (this.IsNew)
{
this.CreateId();
scmd.Parameters.AddWithValue("@ID", this.Id);
scmd.CommandText = string.Format("INSERT INTO {0} (Id, MessageHeaderId, NoDPGOnBoardOnArrival, DPGManifestOnBoardOnArrival, " +
"INFShipClass, DPGClassificationIMDG, DPGClassificationIGC, DPGClassificationIBC, DPGClassificationIMSBC, " +
"DPGClassificationMARPOL_ANNEX_I) VALUES (@ID, @P1, @P2, @P3, @P4, @P5, @P6, @P7, @P8, @P9)", this.Tablename);
}
else
{
scmd.Parameters.AddWithValue("@ID", this.Id);
scmd.CommandText = string.Format("UPDATE {0} SET NODPGOnBoardOnArrival = @P2, DPGManifestOnBoardOnArrival = @P3, " +
"INFShipClass = @P4, DPGClassificationIMDG = @P5, DPGClassificationIGC = @P6, DPGClassificationIBC = @P7, " +
"DPGClassificationIMSBC = @P8, DPGClassificationMARPOL_ANNEX_I = @P9 WHERE Id = @ID", this.Tablename);
}
}
public override void PrepareLoadCommand(System.Data.IDbCommand cmd, Message.LoadFilter filter, params object[] criteria)
{
string query = string.Format("SELECT Id, NoDPGOnBoardOnArrival, DPGManifestOnBoardOnArrival, INFShipClass, " +
"DPGClassificationIMDG, DPGClassificationIGC, DPGClassificationIBC, DPGClassificationIMSBC, " +
"DPGClassificationMARPOL_ANNEX_I FROM {0} ", this.Tablename);
switch (filter)
{
case Message.LoadFilter.MESSAGEHEADER:
query += "WHERE MessageHeaderId = @MHID";
((SqlCommand)cmd).Parameters.AddWithValue("@MHID", criteria[0]);
break;
case Message.LoadFilter.ALL:
default:
break;
}
cmd.CommandText = query;
}
public override List<DatabaseEntity> LoadList(System.Data.IDataReader reader)
{
List<DatabaseEntity> result = new List<DatabaseEntity>();
while (reader.Read())
{
HAZ haz = new HAZ();
haz.id = reader.GetGuid(0);
if (!reader.IsDBNull(1)) haz.NoDPGOnBoardOnArrival = reader.GetBoolean(1);
if (!reader.IsDBNull(2)) haz.DPGManifestOnBoardOnArrival = reader.GetBoolean(2);
if (!reader.IsDBNull(3)) haz.INFShipClass = reader.GetByte(3);
if (!reader.IsDBNull(4)) haz.DPGClassificationIMDG = reader.GetBoolean(4);
if (!reader.IsDBNull(5)) haz.DPGClassificationIGC = reader.GetBoolean(5);
if (!reader.IsDBNull(6)) haz.DPGClassificationIBC = reader.GetBoolean(6);
if (!reader.IsDBNull(7)) haz.DPGClassificationIMSBC = reader.GetBoolean(7);
if (!reader.IsDBNull(8)) haz.DPGClassificationMARPOL_ANNEX_I = reader.GetBoolean(8);
result.Add(haz);
}
reader.Close();
return result;
}
#endregion
#region ISublistContainer implementation
public ISublistElement GetSublistElementWithIdentifier(string identifier)
{
foreach (ISublistElement sublist in this.IMDGPositions)
{
if (sublist.Identifier.Equals(identifier))
return sublist;
}
return null;
}
public IGCPosition GetIGCPositionWithIdentifier(string identifier)
{
foreach (IGCPosition igcPosition in this.IGCPositions)
if (igcPosition.Identifier.Equals(identifier))
return igcPosition;
return null;
}
public IMDGPosition GetIMDGPositionWithIdentifier(string identifier)
{
foreach (IMDGPosition imdgPosition in this.IMDGPositions)
if (imdgPosition.Identifier.Equals(identifier))
return imdgPosition;
return null;
}
public IBCPosition GetIBCPositionWithIdentifier(string identifier)
{
foreach (IBCPosition ibcPosition in this.IBCPositions)
if (ibcPosition.Identifier.Equals(identifier))
return ibcPosition;
return null;
}
public IMSBCPosition GetIMSBCPositionWithIdentifier(string identifier)
{
foreach (IMSBCPosition imsbcPosition in this.IMSBCPositions)
if (imsbcPosition.Identifier.Equals(identifier))
return imsbcPosition;
return null;
}
public MARPOL_Annex_I_Position GetMARPOLPositionWithIdentifier(string identifier)
{
foreach (MARPOL_Annex_I_Position marpolPosition in this.MARPOLPositions)
if (marpolPosition.Identifier.Equals(identifier))
return marpolPosition;
return null;
}
#endregion
#region IMessageParagraph implementation
public override List<IMessageParagraph> ChildParagraphs
{
get
{
List<IMessageParagraph> result = new List<IMessageParagraph>();
foreach (IMessageParagraph imp in this.IMDGPositions)
result.Add(imp);
foreach (IMessageParagraph imp in this.IBCPositions)
result.Add(imp);
foreach (IMessageParagraph imp in this.IGCPositions)
result.Add(imp);
foreach (IMessageParagraph imp in this.IMSBCPositions)
result.Add(imp);
foreach (IMessageParagraph imp in this.MARPOLPositions)
result.Add(imp);
return result;
}
}
#endregion
}
}

View File

@ -0,0 +1,143 @@
//
// Class: IBCPosition
// Current CLR: 4.0.30319.34209
// System: Microsoft Visual Studio 10.0
// Author: dani
// Created: 5/27/2015 8:55:22 AM
//
// Copyright (c) 2015 Informatikbüro Daniel Schick. All rights reserved.
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
namespace bsmd.database
{
public class IBCPosition : DatabaseEntity, ISublistElement
{
public IBCPosition()
{
this.tablename = "[dbo].[IBCPosition]";
}
#region Properties
public HAZ HAZ { get; set; }
[ShowReport]
public string ProductName { get; set; }
[ShowReport]
public byte? PollutionCategory { get; set; }
[ShowReport]
public byte? Hazards { get; set; }
[ShowReport]
public byte? FlashpointInformation { get; set; }
[ShowReport]
public string Flashpoint_CEL { get; set; }
[ShowReport]
public double? Quantity_KGM { get; set; }
[ShowReport]
public string StowagePosition { get; set; }
[ShowReport]
public string PortOfLoading { get; set; }
[ShowReport]
public string PortOfDischarge { get; set; }
[ShowReport]
public bool? SpecRef15_19 { get; set; }
[ShowReport]
public string Remarks { get; set; }
public string Identifier { get; set; }
#endregion
#region DatabaseEntity implementation
public override void PrepareSave(System.Data.IDbCommand cmd)
{
SqlCommand scmd = cmd as SqlCommand;
scmd.Parameters.AddWithValue("@P1", this.HAZ.Id);
scmd.Parameters.AddWithNullableValue("@P2", this.ProductName);
scmd.Parameters.AddWithNullableValue("@P3", this.PollutionCategory);
scmd.Parameters.AddWithNullableValue("@P4", this.Hazards);
scmd.Parameters.AddWithNullableValue("@P5", this.FlashpointInformation);
scmd.Parameters.AddWithNullableValue("@P6", this.Flashpoint_CEL);
scmd.Parameters.AddWithNullableValue("@P7", this.Quantity_KGM);
scmd.Parameters.AddWithNullableValue("@P8", this.StowagePosition);
scmd.Parameters.AddWithNullableValue("@P9", this.PortOfLoading);
scmd.Parameters.AddWithNullableValue("@P10", this.PortOfDischarge);
scmd.Parameters.AddWithNullableValue("@P11", this.SpecRef15_19);
scmd.Parameters.AddWithNullableValue("@P12", this.Remarks);
scmd.Parameters.AddWithNullableValue("@P13", this.Identifier);
if (this.IsNew)
{
scmd.CommandText = string.Format("INSERT INTO {0} (HAZId, ProductName, PollutionCategory, Hazards, " +
"FlashpointInformation, Flashpoint_CEL, Quantity_KGM, StowagePosition, PortOfLoading, PortOfDischarge, " +
"SpecRef15_19, Remarks, Identifier) VALUES (@P1, @P2, @P3, @P4, @P5, @P6, @P7, @P8, @P9, @P10, " +
"@P11, @P12, @P13)", this.Tablename);
}
else
{
scmd.Parameters.AddWithValue(@"ID", this.Id);
scmd.CommandText = string.Format("UPDATE {0} SET ProductName = @P2, PollutionCategory = @P3, Hazards = @P4, " +
"FlashpointInformation = @P5, Flashpoint_CEL = @P6, Quantity_KGM = @P7, StowagePosition = @P8, " +
"PortOfLoading = @P9, PortOfDischarge = @P10, SpecRef15_19 = @P11, Remarks = @P12, Identifier = @P13 " +
"WHERE ID = @ID",
this.Tablename);
}
}
public override void PrepareLoadCommand(System.Data.IDbCommand cmd, Message.LoadFilter filter, params object[] criteria)
{
string query = string.Format("SELECT Id, ProductName, PollutionCategory, " +
"Hazards, FlashpointInformation, Flashpoint_CEL, Quantity_KGM, StowagePosition, PortOfLoading, " +
"PortOfDischarge, SpecRef15_19, Remarks, Identifier FROM {0} ", this.Tablename);
switch (filter)
{
case Message.LoadFilter.HAZ_ID:
query += " WHERE HAZId = @HAZID";
((SqlCommand)cmd).Parameters.AddWithValue("@HAZID", criteria[0]);
break;
case Message.LoadFilter.ALL:
default:
break;
}
cmd.CommandText = query;
}
public override List<DatabaseEntity> LoadList(System.Data.IDataReader reader)
{
List<DatabaseEntity> result = new List<DatabaseEntity>();
while (reader.Read())
{
IBCPosition ibc = new IBCPosition();
ibc.id = reader.GetGuid(0);
if (!reader.IsDBNull(1)) ibc.ProductName = reader.GetString(1);
if (!reader.IsDBNull(2)) ibc.PollutionCategory = reader.GetByte(2);
if (!reader.IsDBNull(3)) ibc.Hazards = reader.GetByte(3);
if (!reader.IsDBNull(4)) ibc.FlashpointInformation = reader.GetByte(4);
if (!reader.IsDBNull(5)) ibc.Flashpoint_CEL = reader.GetString(5);
if (!reader.IsDBNull(6)) ibc.Quantity_KGM = reader.GetDouble(6);
if (!reader.IsDBNull(7)) ibc.StowagePosition = reader.GetString(7);
if (!reader.IsDBNull(8)) ibc.PortOfLoading = reader.GetString(8);
if (!reader.IsDBNull(9)) ibc.PortOfDischarge = reader.GetString(9);
if (!reader.IsDBNull(10)) ibc.SpecRef15_19 = reader.GetBoolean(10);
if (!reader.IsDBNull(11)) ibc.Remarks = reader.GetString(11);
if (!reader.IsDBNull(12)) ibc.Identifier = reader.GetString(12);
result.Add(ibc);
}
reader.Close();
return result;
}
#endregion
}
}

View File

@ -0,0 +1,128 @@
//
// Class: IGCPosition
// Current CLR: 4.0.30319.34209
// System: Microsoft Visual Studio 10.0
// Author: dani
// Created: 5/27/2015 9:28:19 AM
//
// Copyright (c) 2015 Informatikbüro Daniel Schick. All rights reserved.
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
namespace bsmd.database
{
public class IGCPosition : DatabaseEntity, ISublistElement
{
public IGCPosition()
{
this.tablename = "[dbo].[IGCPosition]";
}
#region Properties
public HAZ HAZ { get; set; }
[ShowReport]
public string UNNumber { get; set; }
[ShowReport]
public string IMOClass { get; set; }
[ShowReport]
public string ProductName { get; set; }
[ShowReport]
public double? Quantity_KGM { get; set; }
[ShowReport]
public string StowagePosition { get; set; }
[ShowReport]
public string PortOfLoading { get; set; }
[ShowReport]
public string PortOfDischarge { get; set; }
[ShowReport]
public string Remarks { get; set; }
public string Identifier { get; set; }
#endregion
#region DatabaseEntity implementation
public override void PrepareSave(System.Data.IDbCommand cmd)
{
SqlCommand scmd = cmd as SqlCommand;
scmd.Parameters.AddWithValue("@P1", this.HAZ.Id);
scmd.Parameters.AddWithNullableValue("@P2", this.UNNumber);
scmd.Parameters.AddWithNullableValue("@P3", this.IMOClass);
scmd.Parameters.AddWithNullableValue("@P4", this.ProductName);
scmd.Parameters.AddWithNullableValue("@P5", this.Quantity_KGM);
scmd.Parameters.AddWithNullableValue("@P6", this.StowagePosition);
scmd.Parameters.AddWithNullableValue("@P7", this.PortOfLoading);
scmd.Parameters.AddWithNullableValue("@P8", this.PortOfDischarge);
scmd.Parameters.AddWithNullableValue("@P9", this.Remarks);
scmd.Parameters.AddWithNullableValue("@P10", this.Identifier);
if (this.IsNew)
{
scmd.CommandText = string.Format("INSERT INTO {0} (HAZId, UNNumber, IMOClass, ProductName, Quantity_KGM, " +
"StowagePosition, PortOfLoading, PortOfDischarge, Remarks, Identifier) VALUES (@P1, @P2, @P3, @P4, " +
"@P5, @P6, @P7, @P8, @P9, @P10)", this.Tablename);
}
else
{
scmd.Parameters.AddWithValue(@"ID", this.Id);
scmd.CommandText = string.Format("UPDATE {0} SET UNNumber = @P2, IMOClass = @P3, ProductName = @P4, " +
"Quantity_KGM = @P5, StowagePosition = @P6, PortOfLoading = @P7, PortOfDischarge = @P8, Remarks = @P9, " +
"Identifier = @P10 WHERE ID = @ID", this.Tablename);
}
}
public override void PrepareLoadCommand(System.Data.IDbCommand cmd, Message.LoadFilter filter, params object[] criteria)
{
string query = string.Format("SELECT Id, UNNumber, IMOClass, " +
"ProductName, Quantity_KGM, StowagePosition, PortOfLoading, PortOfDischarge, Remarks, " +
"Identifier FROM {0} ", this.Tablename);
switch (filter)
{
case Message.LoadFilter.HAZ_ID:
query += " WHERE HAZId = @HAZID";
((SqlCommand)cmd).Parameters.AddWithValue("@HAZID", criteria[0]);
break;
case Message.LoadFilter.ALL:
default:
break;
}
cmd.CommandText = query;
}
public override List<DatabaseEntity> LoadList(System.Data.IDataReader reader)
{
List<DatabaseEntity> result = new List<DatabaseEntity>();
while (reader.Read())
{
IGCPosition igc = new IGCPosition();
igc.id = reader.GetGuid(0);
if (!reader.IsDBNull(1)) igc.UNNumber = reader.GetString(1);
if (!reader.IsDBNull(2)) igc.IMOClass = reader.GetString(2);
if (!reader.IsDBNull(3)) igc.ProductName = reader.GetString(3);
if (!reader.IsDBNull(4)) igc.Quantity_KGM = reader.GetDouble(4);
if (!reader.IsDBNull(5)) igc.StowagePosition = reader.GetString(5);
if (!reader.IsDBNull(6)) igc.PortOfLoading = reader.GetString(6);
if (!reader.IsDBNull(7)) igc.PortOfDischarge = reader.GetString(7);
if (!reader.IsDBNull(8)) igc.Remarks = reader.GetString(8);
if (!reader.IsDBNull(9)) igc.Identifier = reader.GetString(9);
result.Add(igc);
}
reader.Close();
return result;
}
#endregion
}
}

View File

@ -0,0 +1,232 @@
//
// Class: IMDGPosition
// Current CLR: 4.0.30319.34209
// System: Microsoft Visual Studio 10.0
// Author: dani
// Created: 5/26/2015 8:56:57 PM
//
// Copyright (c) 2015 Informatikbüro Daniel Schick. All rights reserved.
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
namespace bsmd.database
{
public class IMDGPosition : DatabaseEntity, ISublistElement
{
public IMDGPosition()
{
this.tablename = "[dbo].[IMDGPosition]";
}
#region Properties
public HAZ HAZ { get; set; }
[ShowReport]
public string UNNumber { get; set; }
[ShowReport]
public byte? PackingGroup { get; set; }
[ShowReport]
public string ProperShippingName { get; set; }
[ShowReport]
public string IMOClass { get; set; }
[ShowReport]
public string CompatibilityGroup { get; set; }
[ShowReport]
public string TechnicalName { get; set; }
[ShowReport]
public double? NetExplosiveMass_KGM { get; set; }
[ShowReport]
public string Flashpoint_CEL { get; set; }
[ShowReport]
public string Class7NuclideName { get; set; }
[ShowReport]
public double? Class7MaxActivity_BQL { get; set; }
[ShowReport]
public int? Class7Category { get; set; }
[ShowReport]
public double? Class7TransportIndex { get; set; }
[ShowReport]
public int? Class7CSI { get; set; }
[ShowReport]
public double? ControlTemperature_CEL { get; set; }
[ShowReport]
public double? EmergencyTemperature_CEL { get; set; }
[ShowReport]
public bool? MarinePollutant { get; set; }
[ShowReport]
public int? NumberOfPackages { get; set; }
[ShowReport]
public string PackageType { get; set; }
[ShowReport]
public bool? LimitedQuantities { get; set; }
[ShowReport]
public bool? ExceptedQuantities { get; set; }
[ShowReport]
public double? NetQuantity_KGM { get; set; }
[ShowReport]
public double? GrossQuantity_KGM { get; set; }
[ShowReport]
public double? Volume_MTQ { get; set; }
[ShowReport]
public bool? GeneralCargoIBC { get; set; }
[ShowReport]
public string ContainerNumber { get; set; }
[ShowReport]
public string VehicleLicenseNumber { get; set; }
[ShowReport]
public string StowagePosition { get; set; }
[ShowReport]
public string PortOfLoading { get; set; }
[ShowReport]
public string PortOfDischarge { get; set; }
[ShowReport]
public string Remarks { get; set; }
public string Identifier { get; set; }
#endregion
#region DatabaseEntity implementation
public override void PrepareSave(IDbCommand cmd)
{
SqlCommand scmd = cmd as SqlCommand;
scmd.Parameters.AddWithValue("@P1", this.HAZ.Id);
scmd.Parameters.AddWithNullableValue("@P2", this.UNNumber);
scmd.Parameters.AddWithNullableValue("@P3", this.PackingGroup);
scmd.Parameters.AddWithNullableValue("@P4", this.ProperShippingName);
scmd.Parameters.AddWithNullableValue("@P5", this.IMOClass);
scmd.Parameters.AddWithNullableValue("@P6", this.CompatibilityGroup);
scmd.Parameters.AddWithNullableValue("@P7", this.TechnicalName);
scmd.Parameters.AddWithNullableValue("@P8", this.NetExplosiveMass_KGM);
scmd.Parameters.AddWithNullableValue("@P9", this.Flashpoint_CEL);
scmd.Parameters.AddWithNullableValue("@P10", this.Class7NuclideName);
scmd.Parameters.AddWithNullableValue("@P11", this.Class7MaxActivity_BQL);
scmd.Parameters.AddWithNullableValue("@P12", this.Class7Category);
scmd.Parameters.AddWithNullableValue("@P13", this.Class7TransportIndex);
scmd.Parameters.AddWithNullableValue("@P14", this.Class7CSI);
scmd.Parameters.AddWithNullableValue("@P15", this.ControlTemperature_CEL);
scmd.Parameters.AddWithNullableValue("@P16", this.EmergencyTemperature_CEL);
scmd.Parameters.AddWithNullableValue("@P17", this.MarinePollutant);
scmd.Parameters.AddWithNullableValue("@P18", this.NumberOfPackages);
scmd.Parameters.AddWithNullableValue("@P19", this.PackageType);
scmd.Parameters.AddWithNullableValue("@P20", this.LimitedQuantities);
scmd.Parameters.AddWithNullableValue("@P21", this.ExceptedQuantities);
scmd.Parameters.AddWithNullableValue("@P22", this.NetQuantity_KGM);
scmd.Parameters.AddWithNullableValue("@P23", this.GrossQuantity_KGM);
scmd.Parameters.AddWithNullableValue("@P24", this.Volume_MTQ);
scmd.Parameters.AddWithNullableValue("@P25", this.GeneralCargoIBC);
scmd.Parameters.AddWithNullableValue("@P26", this.ContainerNumber);
scmd.Parameters.AddWithNullableValue("@P27", this.VehicleLicenseNumber);
scmd.Parameters.AddWithNullableValue("@P28", this.StowagePosition);
scmd.Parameters.AddWithNullableValue("@P29", this.PortOfLoading);
scmd.Parameters.AddWithNullableValue("@P30", this.PortOfDischarge);
scmd.Parameters.AddWithNullableValue("@P31", this.Remarks);
scmd.Parameters.AddWithNullableValue("@P32", this.Identifier);
if (this.IsNew)
{
scmd.CommandText = string.Format("INSERT INTO {0} (HAZId, UNNumber, " +
"PackingGroup, ProperShippingName, IMOClass, CompatibilityGroup, TechnicalName, NetExplosiveMass_KGM," +
"Flashpoint_CEL, Class7NuclideName, Class7MaxActivity_BQL, Class7Category, Class7TransportIndex, " +
"Class7CSI, ControlTemperature_CEL, EmergencyTemperature_CEL, MarinePollutant, NumberOfPackages, " +
"PackageType, LimitedQuantities, ExceptedQuantities, NetQuantity_KGM, GrossQuantity_KGM, Volume_MTQ, " +
"GeneralCargoIBC, ContainerNumber, VehicleLicenseNumber, StowagePosition, PortOfLoading, PortOfDischarge, " +
"Remarks, Identifier) VALUES (@P1, @P2, @P3, @P4, @P5, @P6, @P7, @P8, @P9, @P10, @P11, @P12, @P13, " +
"@P14, @P15, @P16, @P17, @P18, @P19, @P20, @P21, @P22, @P23, @P24, @P25, @P26, @P27, @P28, @P29, @P30, " +
"@P31, @P32)", this.Tablename);
}
else
{
scmd.Parameters.AddWithValue(@"ID", this.Id);
scmd.CommandText = string.Format("UPDATE {0} SET UNNumber = @P2, PackingGroup = @P3, ProperShippingName = @P4, " +
"IMOClass = @P5, CompatibilityGroup = @P6, TechnicalName = @P7, NetExplosiveMass_KGM = @P8, " +
"Flashpoint_CEL = @P9, Class7NuclideName = @P10, Class7MaxActivity_BQL = @P11, Class7Category = @P12, " +
"Class7TransportIndex = @P13, Class7CSI = @P14, ControlTemperature_CEL = @P15, EmergencyTemperature_CEL = @P16, " +
"MarinePollutant = @P17, NumberOfPackages = @P18, PackageType = @P19, LimitedQuantities = @P20, ExceptedQuantities = @P21, " +
"NetQuantity_KGM = @P22, GrossQuantity_KGM = @P23, Volume_MTQ = @P24, GeneralCargoIBC = @P25, ContainerNumber = @P26, " +
"VehicleLicenseNumber = @P27, StowagePosition = @P28, PortOfLoading = @P29, PortOfDischarge = @P30, Remarks = @P31, " +
"Identifier = @P32 WHERE Id = @ID", this.Tablename);
}
}
public override void PrepareLoadCommand(IDbCommand cmd, Message.LoadFilter filter, params object[] criteria)
{
string query = string.Format("SELECT Id, UNNumber, PackingGroup, ProperShippingName, IMOClass, CompatibilityGroup, " +
"TechnicalName, NetExplosiveMass_KGM, Flashpoint_CEL, Class7NuclideName, Class7MaxActivity_BQL, Class7Category, " +
"Class7TransportIndex, Class7CSI, ControlTemperature_CEL, EmergencyTemperature_CEL, MarinePollutant, NumberOfPackages, " +
"PackageType, LimitedQuantities, ExceptedQuantities, NetQuantity_KGM, GrossQuantity_KGM, Volume_MTQ, GeneralCargoIBC, " +
"ContainerNumber, VehicleLicenseNumber, StowagePosition, PortOfLoading, PortOfDischarge, Remarks, Identifier " +
"FROM {0} ", this.Tablename);
switch (filter)
{
case Message.LoadFilter.HAZ_ID:
query += " WHERE HAZId = @HAZID";
((SqlCommand)cmd).Parameters.AddWithValue("@HAZID", criteria[0]);
break;
case Message.LoadFilter.ALL:
default:
break;
}
cmd.CommandText = query;
}
public override List<DatabaseEntity> LoadList(IDataReader reader)
{
List<DatabaseEntity> result = new List<DatabaseEntity>();
while (reader.Read())
{
IMDGPosition imdg = new IMDGPosition();
imdg.id = reader.GetGuid(0);
if(!reader.IsDBNull(1)) imdg.UNNumber = reader.GetString(1);
if (!reader.IsDBNull(2)) imdg.PackingGroup = reader.GetByte(2);
if (!reader.IsDBNull(3)) imdg.ProperShippingName = reader.GetString(3);
if (!reader.IsDBNull(4)) imdg.IMOClass = reader.GetString(4);
if (!reader.IsDBNull(5)) imdg.CompatibilityGroup = reader.GetString(5);
if (!reader.IsDBNull(6)) imdg.TechnicalName = reader.GetString(6);
if (!reader.IsDBNull(7)) imdg.NetExplosiveMass_KGM = reader.GetDouble(7);
if (!reader.IsDBNull(8)) imdg.Flashpoint_CEL = reader.GetString(8);
if (!reader.IsDBNull(9)) imdg.Class7NuclideName = reader.GetString(9);
if (!reader.IsDBNull(10)) imdg.Class7MaxActivity_BQL = reader.GetDouble(10);
if (!reader.IsDBNull(11)) imdg.Class7Category = reader.GetInt32(11);
if (!reader.IsDBNull(12)) imdg.Class7TransportIndex = reader.GetDouble(12);
if (!reader.IsDBNull(13)) imdg.Class7CSI = reader.GetInt32(13);
if (!reader.IsDBNull(14)) imdg.ControlTemperature_CEL = reader.GetDouble(14);
if (!reader.IsDBNull(15)) imdg.EmergencyTemperature_CEL = reader.GetDouble(15);
if (!reader.IsDBNull(16)) imdg.MarinePollutant = reader.GetBoolean(16);
if (!reader.IsDBNull(17)) imdg.NumberOfPackages = reader.GetInt32(17);
if (!reader.IsDBNull(18)) imdg.PackageType = reader.GetString(18);
if (!reader.IsDBNull(19)) imdg.LimitedQuantities = reader.GetBoolean(19);
if (!reader.IsDBNull(20)) imdg.ExceptedQuantities = reader.GetBoolean(20);
if (!reader.IsDBNull(21)) imdg.NetQuantity_KGM = reader.GetDouble(21);
if (!reader.IsDBNull(22)) imdg.GrossQuantity_KGM = reader.GetDouble(22);
if (!reader.IsDBNull(23)) imdg.Volume_MTQ = reader.GetDouble(23);
if (!reader.IsDBNull(24)) imdg.GeneralCargoIBC = reader.GetBoolean(24);
if (!reader.IsDBNull(25)) imdg.ContainerNumber = reader.GetString(25);
if (!reader.IsDBNull(26)) imdg.VehicleLicenseNumber = reader.GetString(26);
if (!reader.IsDBNull(27)) imdg.StowagePosition = reader.GetString(27);
if (!reader.IsDBNull(28)) imdg.PortOfLoading = reader.GetString(28);
if (!reader.IsDBNull(29)) imdg.PortOfDischarge = reader.GetString(29);
if (!reader.IsDBNull(30)) imdg.Remarks = reader.GetString(30);
if (!reader.IsDBNull(31)) imdg.Identifier = reader.GetString(31);
result.Add(imdg);
}
reader.Close();
return result;
}
#endregion
}
}

View File

@ -0,0 +1,127 @@
//
// Class: IMSBCPosition
// Current CLR: 4.0.30319.34209
// System: Microsoft Visual Studio 10.0
// Author: dani
// Created: 5/27/2015 9:43:58 AM
//
// Copyright (c) 2015 Informatikbüro Daniel Schick. All rights reserved.
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
namespace bsmd.database
{
public class IMSBCPosition : DatabaseEntity, ISublistElement
{
public IMSBCPosition()
{
this.tablename = "[dbo].[IMSBCPosition]";
}
#region Properties
public HAZ HAZ { get; set; }
[ShowReport]
public string BulkCargoShippingName { get; set; }
[ShowReport]
public bool? MHB { get; set; }
[ShowReport]
public string UNNumber { get; set; }
[ShowReport]
public string IMOClass { get; set; }
[ShowReport]
public double? Quantity_KGM { get; set; }
[ShowReport]
public string StowagePosition { get; set; }
[ShowReport]
public string PortOfLoading { get; set; }
[ShowReport]
public string PortOfDischarge { get; set; }
[ShowReport]
public string Remarks { get; set; }
public string Identifier { get; set; }
#endregion
public override void PrepareSave(IDbCommand cmd)
{
SqlCommand scmd = cmd as SqlCommand;
scmd.Parameters.AddWithValue("@P1", this.HAZ.Id);
scmd.Parameters.AddWithNullableValue("@P2", this.BulkCargoShippingName);
scmd.Parameters.AddWithNullableValue("@P3", this.MHB);
scmd.Parameters.AddWithNullableValue("@P4", this.UNNumber);
scmd.Parameters.AddWithNullableValue("@P5", this.IMOClass);
scmd.Parameters.AddWithNullableValue("@P6", this.Quantity_KGM);
scmd.Parameters.AddWithNullableValue("@P7", this.StowagePosition);
scmd.Parameters.AddWithNullableValue("@P8", this.PortOfLoading);
scmd.Parameters.AddWithNullableValue("@P9", this.PortOfDischarge);
scmd.Parameters.AddWithNullableValue("@P10", this.Remarks);
scmd.Parameters.AddWithNullableValue("@P11", this.Identifier);
if(this.IsNew)
{
scmd.CommandText = string.Format("INSERT INTO {0} (HAZId, BulkCargoShippingName, MHB, UNNumber, " +
"IMOClass, Quantity_KGM, StowagePosition, PortOfLoading, PortOfDischarge, Remarks, Identifier) " +
" VALUES (@P1, @P2, @P3, @P4, @P5, @P6, @P7, @P8, @P9, @P10, @P11)", this.Tablename);
}
else
{
scmd.Parameters.AddWithValue("@ID", this.Id);
scmd.CommandText = string.Format("UPDATE {0} SET BulkCargoShippingName = @P2, MHB = @P3, UNNumber = @P4, " +
"IMOClass = @P5, Quantity_KGM = @P6, StowagePosition = @P7, PortOfLoading = @P8, PortOfDischarge = @P9, " +
"Remarks = @P10, Identifier = @P11 WHERE Id = @ID", this.Tablename);
}
}
public override void PrepareLoadCommand(IDbCommand cmd, Message.LoadFilter filter, params object[] criteria)
{
string query = string.Format("SELECT Id, BulkCargoShippingName, MHB, " +
"UNNumber, IMOClass, Quantity_KGM, StowagePosition, PortOfLoading, PortOfDischarge, " +
"Remarks, Identifier FROM {0} ", this.Tablename);
switch (filter)
{
case Message.LoadFilter.HAZ_ID:
query += " WHERE HAZId = @HAZID";
((SqlCommand)cmd).Parameters.AddWithValue("@HAZID", criteria[0]);
break;
case Message.LoadFilter.ALL:
default:
break;
}
cmd.CommandText = query;
}
public override List<DatabaseEntity> LoadList(IDataReader reader)
{
List<DatabaseEntity> result = new List<DatabaseEntity>();
while (reader.Read())
{
IMSBCPosition imsbc = new IMSBCPosition();
imsbc.id = reader.GetGuid(0);
if (!reader.IsDBNull(1)) imsbc.BulkCargoShippingName = reader.GetString(1);
if (!reader.IsDBNull(2)) imsbc.MHB = reader.GetBoolean(2);
if (!reader.IsDBNull(3)) imsbc.UNNumber = reader.GetString(3);
if (!reader.IsDBNull(4)) imsbc.IMOClass = reader.GetString(4);
if (!reader.IsDBNull(5)) imsbc.Quantity_KGM = reader.GetDouble(5);
if (!reader.IsDBNull(6)) imsbc.StowagePosition = reader.GetString(6);
if (!reader.IsDBNull(7)) imsbc.PortOfLoading = reader.GetString(7);
if (!reader.IsDBNull(8)) imsbc.PortOfDischarge = reader.GetString(8);
if (!reader.IsDBNull(9)) imsbc.Remarks = reader.GetString(9);
if (!reader.IsDBNull(10)) imsbc.Identifier = reader.GetString(10);
result.Add(imsbc);
}
reader.Close();
return result;
}
}
}

View File

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace bsmd.database
{
/// <summary>
/// Interface to print nsw messages to a report (get text info from messages)
/// </summary>
public interface IMessageParagraph
{
string Title { get; }
List<KeyValuePair<string, string>> MessageText { get; }
List<IMessageParagraph> ChildParagraphs { get; }
}
}

View File

@ -24,17 +24,23 @@ namespace bsmd.database
#region Properties
[ShowReport]
public byte? ShippingArea { get; set; }
[ShowReport]
public string RequestedPositionInPortOfCall { get; set; }
[ShowReport]
public string SpecialRequirementsOfShipAtBerth { get; set; }
[ShowReport]
public string ConstructionCharacteristicsOfShip { get; set; }
[ShowReport]
public byte? FumigatedBulkCargo { get; set; }
public float? DeplacementSummerDraught_TNE { get; set; }
[ShowReport]
public double? DeplacementSummerDraught_TNE { get; set; }
#endregion

View File

@ -24,13 +24,17 @@ namespace bsmd.database
#region Properties
[ShowReport]
public byte? CargoHandlingType { get; set; }
[ShowReport]
public string CargoCodeNST { get; set; }
[ShowReport]
public int? CargoNumberOfItems { get; set; }
public float? CargoGrossQuantity_TNE { get; set; }
[ShowReport]
public double? CargoGrossQuantity_TNE { get; set; }
public string Identifier { get; set; }

View File

@ -25,21 +25,21 @@ namespace bsmd.database
#region Properties
public SEC SEC { get; set; }
[ShowReport]
public string PortFacilityPortName { get; set; }
[ShowReport]
public string PortFacilityPortCountry { get; set; }
[ShowReport]
public string PortFacilityPortLoCode { get; set; }
[ShowReport]
public DateTime? PortFacilityDateOfArrival { get; set; }
[ShowReport]
public DateTime? PortFacilityDateOfDeparture { get; set; }
[ShowReport]
public byte? PortFacilityShipSecurityLevel { get; set; }
[ShowReport]
public string PortFacilitySecurityMattersToReport { get; set; }
[ShowReport]
public string PortFacilityGISISCode { get; set; }
public string Identifier { get; set; }

View File

@ -0,0 +1,130 @@
//
// Class: MARPOL_Annex_I_Position
// Current CLR: 4.0.30319.34209
// System: Microsoft Visual Studio 10.0
// Author: dani
// Created: 5/27/2015 9:59:28 AM
//
// Copyright (c) 2015 Informatikbüro Daniel Schick. All rights reserved.
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
namespace bsmd.database
{
public class MARPOL_Annex_I_Position : DatabaseEntity, ISublistElement
{
public MARPOL_Annex_I_Position()
{
this.tablename = "[dbo].[MARPOL_Annex_IPosition]";
}
#region Properties
public HAZ HAZ { get; set; }
[ShowReport]
public string Name { get; set; }
[ShowReport]
public byte? FlashpointInformation { get; set; }
[ShowReport]
public string Flashpoint_CEL { get; set; }
[ShowReport]
public double? Quantity_KGM { get; set; }
[ShowReport]
public string StowagePosition { get; set; }
[ShowReport]
public string PortOfLoading { get; set; }
[ShowReport]
public string PortOfDischarge { get; set; }
[ShowReport]
public string Remarks { get; set; }
public string Identifier { get; set; }
#endregion
#region DatabaseEntity implementation
public override void PrepareSave(IDbCommand cmd)
{
SqlCommand scmd = cmd as SqlCommand;
scmd.Parameters.AddWithValue("@P1", this.HAZ.Id);
scmd.Parameters.AddWithNullableValue("@P2", this.Name);
scmd.Parameters.AddWithNullableValue("@P3", this.FlashpointInformation);
scmd.Parameters.AddWithNullableValue("@P4", this.Flashpoint_CEL);
scmd.Parameters.AddWithNullableValue("@P5", this.Quantity_KGM);
scmd.Parameters.AddWithNullableValue("@P6", this.StowagePosition);
scmd.Parameters.AddWithNullableValue("@P7", this.PortOfLoading);
scmd.Parameters.AddWithNullableValue("@P8", this.PortOfDischarge);
scmd.Parameters.AddWithNullableValue("@P9", this.Remarks);
scmd.Parameters.AddWithNullableValue("@P10", this.Identifier);
if (this.IsNew)
{
scmd.CommandText = string.Format("INSERT INTO {0} (HAZId, Name, FlashpointInformation, Flashpoint_CEL, " +
"Quantity_KGM, StowagePosition, PortOfLoading, PortOfDischarge, Remarks, Identifier) VALUES " +
"(@P1, @P2, @P3, @P4, @P5, @P6, @P7, @P8, @P9, @P10)", this.Tablename);
}
else
{
scmd.Parameters.AddWithValue(@"ID", this.Id);
scmd.CommandText = string.Format("UPDATE {0} SET Name = @P2, FlashpointInformation= @P3, Flashpoint_CEL = @P4, " +
"Quantity_KGM = @P5, StowagePosition = @P6, PortOfLoading = @P7, PortOfDischarge = @P8, Remarks = @P9, " +
"Identifier = @P10 WHERE Id = @ID", this.Tablename);
}
}
public override void PrepareLoadCommand(IDbCommand cmd, Message.LoadFilter filter, params object[] criteria)
{
string query = string.Format("SELECT Id, Name, FlashpointInformation, Flashpoint_CEL, Quantity_KGM, " +
"StowagePosition, PortOfLoading, PortOfDischarge, Remarks, Identifier FROM {0} ", this.Tablename);
switch (filter)
{
case Message.LoadFilter.HAZ_ID:
query += " WHERE HAZId = @HAZID";
((SqlCommand)cmd).Parameters.AddWithValue("@HAZID", criteria[0]);
break;
case Message.LoadFilter.ALL:
default:
break;
}
cmd.CommandText = query;
}
public override List<DatabaseEntity> LoadList(IDataReader reader)
{
List<DatabaseEntity> result = new List<DatabaseEntity>();
while (reader.Read())
{
MARPOL_Annex_I_Position map = new MARPOL_Annex_I_Position();
map.id = reader.GetGuid(0);
if (!reader.IsDBNull(1)) map.Name = reader.GetString(1);
if (!reader.IsDBNull(2)) map.FlashpointInformation = reader.GetByte(2);
if (!reader.IsDBNull(3)) map.Flashpoint_CEL = reader.GetString(3);
if (!reader.IsDBNull(4)) map.Quantity_KGM = reader.GetDouble(4);
if (!reader.IsDBNull(5)) map.StowagePosition = reader.GetString(5);
if (!reader.IsDBNull(6)) map.PortOfLoading = reader.GetString(6);
if (!reader.IsDBNull(7)) map.PortOfDischarge = reader.GetString(7);
if (!reader.IsDBNull(8)) map.Remarks = reader.GetString(8);
if (!reader.IsDBNull(9)) map.Identifier = reader.GetString(9);
result.Add(map);
}
reader.Close();
return result;
}
#endregion
}
}

View File

@ -27,53 +27,53 @@ namespace bsmd.database
#region Properties
public List<PortOfCallLast30Days> PortOfCallLast30Days { get { return this.portOfCallLast30Days; } }
[ShowReport]
public bool? MDHSimplification { get; set; }
[ShowReport]
public string PortOfCallWhereCompleteMDHNotified { get; set; }
[ShowReport]
public bool? NonAccidentalDeathsDuringVoyage { get; set; }
[ShowReport]
public int? NonAccidentalDeathsDuringVoyageCount { get; set; }
[ShowReport]
public bool? SuspisionInfectiousNature { get; set; }
[ShowReport]
public bool? NumberOfIllPersonsHigherThanExpected { get; set; }
[ShowReport]
public int? NumberOfIllPersons { get; set; }
[ShowReport]
public bool? SickPersonsOnBoard { get; set; }
[ShowReport]
public bool? MedicalConsulted { get; set; }
[ShowReport]
public bool? AwareOfFurtherInfections { get; set; }
[ShowReport]
public bool? SanitaryMeasuresApplied { get; set; }
[ShowReport]
public string SanitaryMeasuresType { get; set; }
[ShowReport]
public string SanitaryMeasuresLocation { get; set; }
[ShowReport]
public DateTime? SanitaryMeasuresDate { get; set; }
[ShowReport]
public bool? StowawaysDetected { get; set; }
[ShowReport]
public string StowawaysJoiningLocation { get; set; }
[ShowReport]
public bool? SickAnimalOrPetOnBoard { get; set; }
[ShowReport]
public bool? ValidSanitaryControlExemptionOrCertificateOnBoard { get; set; }
[ShowReport]
public string PlaceOfIssue { get; set; }
[ShowReport]
public DateTime? DateOfIssue { get; set; }
[ShowReport]
public bool? SanitaryControlReinspectionRequired { get; set; }
[ShowReport]
public bool? InfectedAreaVisited { get; set; }
[ShowReport]
public string InfectedAreaPort { get; set; }
[ShowReport]
public DateTime? InfectedAreaDate { get; set; }
#endregion
@ -216,5 +216,20 @@ namespace bsmd.database
#endregion
#region IMessageParagraph implementation
public override List<IMessageParagraph> ChildParagraphs
{
get
{
List<IMessageParagraph> result = new List<IMessageParagraph>();
foreach (IMessageParagraph imp in this.PortOfCallLast30Days)
result.Add(imp);
return result;
}
}
#endregion
}
}

View File

@ -55,11 +55,12 @@ namespace bsmd.database
HERBERG_FORMGUID,
BY_ID,
BY_CORE,
NOA_NODID
NOA_NODID,
HAZ_ID
}
/// <summary>
/// Dieser Status wird von den Services (MessageService, ResponseService) ausgewertet
/// Message Status einer NSW Einzelnachricht
/// </summary>
public enum BSMDStatus
{
@ -67,12 +68,10 @@ namespace bsmd.database
PREPARE,
TOSEND,
SENT,
RESPONDED,
FAILURE,
REPORTREQUESTED,
ARCHIVED,
HIS_FAILURE_DBH,
SEND_ALL // nur für messageCore, wenn alle Sub-Nachrichten einer Core-Nachricht auf "TOSEND" gesetzt werden sollen.
SEND_FAILED,
RESPONSE_RECEIVED,
VIOLATION,
ERROR
}
/// <summary>
@ -116,6 +115,7 @@ namespace bsmd.database
public MessageStatus? Status { get; set; }
[ShowReport]
public DateTime? Created { get { return this.created; } }
/// <summary>
@ -146,6 +146,11 @@ namespace bsmd.database
}
}
/// <summary>
/// Status für Services
/// </summary>
public BSMDStatus InternalStatus { get; set; }
/// <summary>
/// die zur Kommunikation zu verwendende HIS Schnittstelle
/// </summary>
@ -329,5 +334,99 @@ namespace bsmd.database
#endregion
#region IMessageParagraph implementation
public override string Title
{
get
{
if (this.Elements.Count > 0)
{
return this.Elements[0].Title;
}
else
{
if (this.MessageNotificationClass == NotificationClass.VISIT) return "VISIT";
if (this.MessageNotificationClass == NotificationClass.TRANSIT) return "TRANSIT";
return "unknown";
}
}
}
public override List<KeyValuePair<string, string>> MessageText
{
get
{
switch (this.MessageNotificationClass)
{
case NotificationClass.VISIT:
case NotificationClass.TRANSIT:
return base.MessageText;
case NotificationClass.ATA:
case NotificationClass.ATD:
case NotificationClass.BPOL:
case NotificationClass.HAZA:
case NotificationClass.HAZD:
case NotificationClass.INFO:
case NotificationClass.MDH:
case NotificationClass.NAME:
case NotificationClass.NOA_NOD:
case NotificationClass.POBA:
case NotificationClass.POBD:
case NotificationClass.PRE72H:
case NotificationClass.SEC:
case NotificationClass.STAT:
case NotificationClass.TIEFA:
case NotificationClass.TIEFD:
case NotificationClass.WAS:
return this.Elements[0].MessageText;
default:
return null;
}
}
}
public override List<IMessageParagraph> ChildParagraphs
{
get
{
switch (this.MessageNotificationClass)
{
case NotificationClass.VISIT:
case NotificationClass.TRANSIT:
return null;
case NotificationClass.ATA:
case NotificationClass.ATD:
case NotificationClass.BPOL:
case NotificationClass.HAZA:
case NotificationClass.HAZD:
case NotificationClass.INFO:
case NotificationClass.MDH:
case NotificationClass.NAME:
case NotificationClass.NOA_NOD:
case NotificationClass.POBA:
case NotificationClass.POBD:
case NotificationClass.PRE72H:
case NotificationClass.SEC:
case NotificationClass.STAT:
case NotificationClass.TIEFA:
case NotificationClass.TIEFD:
case NotificationClass.WAS:
return this.Elements[0].ChildParagraphs;
default:
List<IMessageParagraph> result = new List<IMessageParagraph>();
foreach (DatabaseEntity element in this.Elements)
result.Add(element);
return result;
}
}
}
#endregion
}
}

View File

@ -21,6 +21,27 @@ namespace bsmd.database
this.tablename = "[dbo].[MessageCore]";
}
#region Enum
/// <summary>
/// "globaler" Status des Schiffsanlaufs
/// </summary>
public enum BSMDStatus
{
UNDEFINED = 0,
PREPARE,
TOSEND,
SENT,
RESPONDED,
FAILURE,
REPORTREQUESTED,
ARCHIVED,
HIS_FAILURE_DBH,
CREATE_RECEIVE_RECEIPT
}
#endregion
#region Properties
public string VisitId { get; set; }
@ -41,7 +62,7 @@ namespace bsmd.database
public bool IsTransit { get; set; }
public Message.BSMDStatus BSMDStatus { get; set; }
public BSMDStatus BSMDStatusInternal { get; set; }
public Message.NSWProvider InitialHIS { get; set; }
@ -88,7 +109,7 @@ namespace bsmd.database
scmd.Parameters.AddWithValue("@P11", this.IsTransit ? 1 : 0);
if (this.wetris_zz_56_datensatz_id.HasValue) scmd.Parameters.AddWithValue("@P12", this.wetris_zz_56_datensatz_id);
else scmd.Parameters.AddWithValue("@P12", DBNull.Value);
scmd.Parameters.AddWithValue("@P13", this.BSMDStatus);
scmd.Parameters.AddWithValue("@P13", this.BSMDStatusInternal);
scmd.Parameters.AddWithValue("@P14", this.InitialHIS);
scmd.Parameters.AddWithNullableValue("@P15", this.HerbergFormGuid);
scmd.Parameters.AddWithNullableValue("@P16", this.HerbergFormTemplateGuid);
@ -141,6 +162,12 @@ namespace bsmd.database
((SqlCommand)cmd).Parameters.AddWithValue("@HFG", criteria[0]);
break;
}
case Message.LoadFilter.BSMDSTATUS:
{
query += "WHERE BSMDStatus = @STATUS";
((SqlCommand)cmd).Parameters.AddWithValue("@STATUS", criteria[0]);
break;
}
case Message.LoadFilter.ALL:
default:
break;
@ -168,7 +195,7 @@ namespace bsmd.database
if (!reader.IsDBNull(10)) core.next = reader.GetGuid(10);
core.IsTransit = reader.GetBoolean(11);
if (!reader.IsDBNull(12)) core.wetris_zz_56_datensatz_id = reader.GetInt32(12);
core.BSMDStatus = (Message.BSMDStatus) Enum.ToObject(typeof(Message.BSMDStatus), reader.GetByte(13));
core.BSMDStatusInternal = (BSMDStatus) Enum.ToObject(typeof(BSMDStatus), reader.GetByte(13));
core.InitialHIS = (Message.NSWProvider) Enum.ToObject(typeof(Message.NSWProvider), reader.GetByte(14));
if (!reader.IsDBNull(15)) core.HerbergFormGuid = reader.GetGuid(15);
if (!reader.IsDBNull(16)) core.HerbergFormTemplateGuid = reader.GetGuid(16);

View File

@ -24,6 +24,7 @@ namespace bsmd.database
#region Properties
[ShowReport]
public string NameOfMaster { get; set; }
#endregion

View File

@ -25,23 +25,23 @@ namespace bsmd.database
}
#region Properties
[ShowReport]
public DateTime? ETAToPortOfCall { get; set; }
[ShowReport]
public DateTime? ETDFromPortOfCall { get; set; }
public List<CallPurpose> CallPurposes { get { return this.callPurposes; } }
[ShowReport]
public DateTime? ETAToKielCanal { get; set; }
[ShowReport]
public DateTime? ETDFromKielCanal { get; set; }
[ShowReport]
public string LastPort { get; set; }
[ShowReport]
public DateTime? ETDFromLastPort { get; set; }
[ShowReport]
public string NextPort { get; set; }
[ShowReport]
public DateTime? ETAToNextPort { get; set; }
#endregion
@ -135,5 +135,20 @@ namespace bsmd.database
#endregion
#region IMessageParagraph implementation
public override List<IMessageParagraph> ChildParagraphs
{
get
{
List<IMessageParagraph> result = new List<IMessageParagraph>();
foreach (IMessageParagraph imp in this.CallPurposes)
result.Add(imp);
return result;
}
}
#endregion
}
}

View File

@ -14,7 +14,7 @@ using System.Collections.Generic;
namespace bsmd.database
{
public class PAS : DatabaseEntity
public class PAS : DatabaseEntity, ISublistElement
{
public PAS()
@ -23,29 +23,29 @@ namespace bsmd.database
}
#region Properties
[ShowReport]
public string PassengerLastName { get; set; }
[ShowReport]
public string PassengerFirstName { get; set; }
[ShowReport]
public string PassengerPlaceOfBirth { get; set; }
[ShowReport]
public DateTime? PassengerDateOfBirth { get; set; }
[ShowReport]
public byte? PassengerGender { get; set; }
[ShowReport]
public string PassengerNationality { get; set; }
[ShowReport]
public byte? PassengerIdentityDocumentType { get; set; }
[ShowReport]
public string PassengerIdentityDocumentId { get; set; }
[ShowReport]
public string PassengerVisaNumber { get; set; }
[ShowReport]
public string PassengerPortOfEmbarkation { get; set; }
[ShowReport]
public string PassengerPortOfDisembarkation { get; set; }
[ShowReport]
public bool? PassengerInTransit { get; set; }
public string Identifier { get; set; }
@ -87,7 +87,7 @@ namespace bsmd.database
scmd.Parameters.AddWithValue(@"ID", this.Id);
scmd.CommandText = string.Format("UPDATE {0} SET PassengerLastName = @P2, PassengerFirstName = @P3, " +
"PassengerPlaceOfBirth = @P4, PassengerDateOfBirth = @P5, PassengerGender = @P6," +
"PassengerNationality = @P7, PassengerIdentityDocumentType = @8, PassengerIdentityDocumentId = @P9, " +
"PassengerNationality = @P7, PassengerIdentityDocumentType = @P8, PassengerIdentityDocumentId = @P9, " +
"PassengerVisaNumber = @P10, PassengerPortOfEmbarkation = @P11, PassengerPortOfDisembarkation = @P12, " +
"PassengerInTransit = @P13 WHERE Id = @ID", this.Tablename);
}

View File

@ -23,13 +23,13 @@ namespace bsmd.database
}
#region Properties
[ShowReport]
public int? TotalPersonsOnBoardUponArrival { get; set; }
[ShowReport]
public int? TotalCrewMembersOnBoardUponArrival { get; set; }
[ShowReport]
public int? TotalPassengersOnBoardUponArrival { get; set; }
[ShowReport]
public int? TotalStowawaysOnBoardUponArrival { get; set; }
#endregion

View File

@ -23,13 +23,13 @@ namespace bsmd.database
}
#region Properties
[ShowReport]
public int? TotalPersonsOnBoardUponDeparture { get; set; }
[ShowReport]
public int? TotalCrewMembersOnBoardUponDeparture { get; set; }
[ShowReport]
public int? TotalPassengersOnBoardUponDeparture { get; set; }
[ShowReport]
public int? TotalStowawaysOnBoardUponDeparture { get; set; }
#endregion

View File

@ -23,24 +23,24 @@ namespace bsmd.database
}
#region Properties
[ShowReport]
public bool? Tanker { get; set; }
[ShowReport]
public byte? TankerHullConfiguration { get; set; }
[ShowReport]
public byte? ConditionCargoBallastTanks { get; set; }
[ShowReport]
public string NatureOfCargo { get; set; }
public float? VolumeOfCargo { get; set; }
[ShowReport]
public double? VolumeOfCargo { get; set; }
[ShowReport]
public string PlannedOperations { get; set; }
[ShowReport]
public string PlannedWorks { get; set; }
[ShowReport]
public DateTime? DateOfLastExpandedInspection { get; set; }
public float? PlannedPeriodOfStay_HUR { get; set; }
[ShowReport]
public double? PlannedPeriodOfStay_HUR { get; set; }
#endregion

View File

@ -29,11 +29,11 @@ namespace bsmd.database
public MDH MDH { get; set; }
public List<PortOfCallLast30DaysCrewJoinedShip> CrewJoinedShip { get { return this.poc30Crew; } }
[ShowReport]
public string PortOfCallLast30DaysLocode { get; set; }
[ShowReport]
public DateTime? PortOfCallLast30DaysDateOfDeparture { get; set; }
[ShowReport]
public bool? PortOfCallLast30DaysCrewMembersJoined { get; set; }
public string Identifier { get; set; }
@ -120,5 +120,20 @@ namespace bsmd.database
#endregion
#region IMessageParagraph implementation
public override List<IMessageParagraph> ChildParagraphs
{
get
{
List<IMessageParagraph> result = new List<IMessageParagraph>();
foreach (IMessageParagraph imp in this.CrewJoinedShip)
result.Add(imp);
return result;
}
}
#endregion
}
}

View File

@ -25,7 +25,7 @@ namespace bsmd.database
#region Properties
public PortOfCallLast30Days PortOfCallLast30Days { get; set; }
[ShowReport]
public string PortOfCallLast30DaysCrewJoinedShipName { get; set; }
public string Identifier { get; set; }

View File

@ -25,9 +25,9 @@ namespace bsmd.database
#region Properties
public BPOL BPOL { get; set; }
[ShowReport]
public string PortOfItineraryName { get; set; }
[ShowReport]
public DateTime? PortOfItineraryETA { get; set; }
public string Identifier { get; set; }

View File

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

View File

@ -4,6 +4,6 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.2.*")]
[assembly: AssemblyVersion("1.8.0.*")]
// wenn das nicht auskommentiert wird erhalten wir eine Warnung
// [assembly: AssemblyFileVersion("1.0.0.*")]

View File

@ -27,39 +27,39 @@ namespace bsmd.database
}
#region Properties
[ShowReport]
public bool? SECSimplification { get; set; }
[ShowReport]
public string PortOfCallWhereCompleteSECNotified { get; set; }
[ShowReport]
public string CSOLastName { get; set; }
[ShowReport]
public string CSOFirstName { get; set; }
[ShowReport]
public string CSOPhone { get; set; }
[ShowReport]
public string CSOFax { get; set; }
[ShowReport]
public string CSOEMail { get; set; }
[ShowReport]
public bool? ValidISSCOnBoard { get; set; }
[ShowReport]
public string ReasonsForNoValidISSC { get; set; }
[ShowReport]
public byte? ISSCType { get; set; }
[ShowReport]
public byte? ISSCIssuerType { get; set; }
[ShowReport]
public string ISSCIssuerName { get; set; }
[ShowReport]
public DateTime? ISSCDateOfExpiration { get; set; }
[ShowReport]
public bool? ApprovedSecurityPlanOnBoard { get; set; }
[ShowReport]
public byte? CurrentShipSecurityLevel { get; set; }
[ShowReport]
public string PortFacilityOfArrival { get; set; }
[ShowReport]
public byte? GeneralDescriptionOfCargo { get; set; }
public List<LastTenPortFacilitiesCalled> LastTenPortFacilitesCalled { get { return this.ltpfc; } }
@ -195,5 +195,22 @@ namespace bsmd.database
#endregion
#region IMessageParagraph implementation
public override List<IMessageParagraph> ChildParagraphs
{
get
{
List<IMessageParagraph> result = new List<IMessageParagraph>();
foreach (IMessageParagraph imp in this.LastTenPortFacilitesCalled)
result.Add(imp);
foreach (IMessageParagraph imp in this.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled)
result.Add(imp);
return result;
}
}
#endregion
}
}

View File

@ -23,11 +23,11 @@ namespace bsmd.database
}
#region Properties
[ShowReport]
public string ServiceName { get; set; }
[ShowReport]
public string ServiceBeneficiary { get; set; }
[ShowReport]
public string ServiceInvoiceRecipient { get; set; }
public string Identifier { get; set; }

View File

@ -24,36 +24,52 @@ namespace bsmd.database
#region Properties
[ShowReport]
public string ShipName { get; set; }
[ShowReport]
public string CallSign { get; set; }
[ShowReport]
public string MMSINumber { get; set; }
[ShowReport]
public string Flag { get; set; }
public float? LengthOverall_MTR { get; set; }
[ShowReport]
public double? LengthOverall_MTR { get; set; }
public float? Beam_MTR { get; set; }
[ShowReport]
public double? Beam_MTR { get; set; }
[ShowReport]
public int? GrossTonnage { get; set; }
[ShowReport]
public string PortOfRegistry { get; set; }
[ShowReport]
public string InmarsatCallNumber { get; set; }
[ShowReport]
public string ShipType { get; set; }
[ShowReport]
public string ISMCompanyName { get; set; }
[ShowReport]
public string ISMCompanyId { get; set; }
[ShowReport]
public string ISMCompanyStreetAndNumber { get; set; }
[ShowReport]
public string ISMCompanyPostalCode { get; set; }
[ShowReport]
public string ISMCompanyCity { get; set; }
[ShowReport]
public string ISMCompanyCountry { get; set; }
#endregion
@ -120,15 +136,15 @@ namespace bsmd.database
scmd.Parameters.AddWithValue("@P1", this.MessageHeader.Id);
if (this.ShipName != null) scmd.Parameters.AddWithValue("@P2", this.ShipName);
else scmd.Parameters.AddWithValue("@P2", DBNull.Value);
if (this.CallSign != null) scmd.Parameters.AddWithValue("@P3", DBNull.Value);
if (this.CallSign != null) scmd.Parameters.AddWithValue("@P3", this.CallSign);
else scmd.Parameters.AddWithValue("@P3", DBNull.Value);
if (this.MMSINumber != null) scmd.Parameters.AddWithValue("@P4", this.MMSINumber);
else scmd.Parameters.AddWithValue("@P4", DBNull.Value);
if (this.Flag != null) scmd.Parameters.AddWithValue("@P5", this.Flag);
else scmd.Parameters.AddWithValue("@P5", DBNull.Value);
if (this.LengthOverall_MTR.HasValue) scmd.Parameters.AddWithValue("@P6", this.LengthOverall_MTR.Value);
if (this.LengthOverall_MTR.HasValue) scmd.Parameters.AddWithValue("@P6", (double) this.LengthOverall_MTR.Value);
else scmd.Parameters.AddWithValue("@P6", DBNull.Value);
if (this.Beam_MTR.HasValue) scmd.Parameters.AddWithValue("@P7", this.Beam_MTR.Value);
if (this.Beam_MTR.HasValue) scmd.Parameters.AddWithValue("@P7", (double) this.Beam_MTR.Value);
else scmd.Parameters.AddWithValue("@P7", DBNull.Value);
if (this.GrossTonnage.HasValue) scmd.Parameters.AddWithValue("@P8", this.GrossTonnage.Value);
else scmd.Parameters.AddWithValue("@P8", DBNull.Value);
@ -172,5 +188,6 @@ namespace bsmd.database
#endregion
}
}

View File

@ -25,21 +25,21 @@ namespace bsmd.database
#region Properties
public SEC SEC { get; set; }
[ShowReport]
public string ShipToShipActivityLocationName { get; set; }
[ShowReport]
public string ShipToShipActivityLocationLoCode { get; set; }
[ShowReport]
public int? ShipToShipActivityLocationCoordinatesLatitude { get; set; }
[ShowReport]
public int? ShipToShipActivityLocationCoordinatesLongitude { get; set; }
[ShowReport]
public DateTime? ShipToShipActivityDateFrom { get; set; }
[ShowReport]
public DateTime? ShipToShipActivityDateTo { get; set; }
[ShowReport]
public string ShipToShipActivityType { get; set; }
[ShowReport]
public string ShipToShipActivitySecurityMattersToReport { get; set; }
public string Identifier { get; set; }

View File

@ -0,0 +1,19 @@
//
// Class: ShowReportAttribute
// Current CLR: 4.0.30319.34209
// System: Microsoft Visual Studio 10.0
// Author: dani
// Created: 5/28/2015 11:38:49 AM
//
// Copyright (c) 2015 Informatikbüro Daniel Schick. All rights reserved.
using System;
using System.Collections.Generic;
namespace bsmd.database
{
public class ShowReportAttribute : Attribute
{
public ShowReportAttribute() { }
}
}

View File

@ -23,8 +23,8 @@ namespace bsmd.database
}
#region Properties
public float? DraughtUponArrival_DMT { get; set; }
[ShowReport]
public double? DraughtUponArrival_DMT { get; set; }
#endregion
@ -78,7 +78,7 @@ namespace bsmd.database
TIEFA tiefa = new TIEFA();
tiefa.id = reader.GetGuid(0);
if (!reader.IsDBNull(1)) tiefa.DraughtUponArrival_DMT = (float) reader.GetDouble(1);
if (!reader.IsDBNull(1)) tiefa.DraughtUponArrival_DMT = reader.GetDouble(1);
result.Add(tiefa);
}
reader.Close();

View File

@ -23,8 +23,8 @@ namespace bsmd.database
}
#region Properties
public float? DraughtUponDeparture_DMT { get; set; }
[ShowReport]
public double? DraughtUponDeparture_DMT { get; set; }
#endregion
@ -78,7 +78,7 @@ namespace bsmd.database
TIEFD tiefd = new TIEFD();
tiefd.id = reader.GetGuid(0);
if (!reader.IsDBNull(1)) tiefd.DraughtUponDeparture_DMT = (float) reader.GetDouble(1);
if (!reader.IsDBNull(1)) tiefd.DraughtUponDeparture_DMT = reader.GetDouble(1);
result.Add(tiefd);
}
reader.Close();

View File

@ -14,7 +14,7 @@ using System.Collections.Generic;
namespace bsmd.database
{
public class TOWA : DatabaseEntity
public class TOWA : DatabaseEntity, ISublistElement
{
public TOWA()
@ -23,37 +23,52 @@ namespace bsmd.database
}
#region Properties
[ShowReport]
public string TowageOnArrivalName { get; set; }
[ShowReport]
public string TowageOnArrivalFlag { get; set; }
[ShowReport]
public string TowageOnArrivalOperatorCompanyName { get; set; }
[ShowReport]
public string TowageOnArrivalOperatorStreetNameAndNumber { get; set; }
[ShowReport]
public string TowageOnArrivalOperatorPostalCode { get; set; }
[ShowReport]
public string TowageOnArrivalOperatorCity { get; set; }
[ShowReport]
public string TowageOnArrivalOperatorCountry { get; set; }
[ShowReport]
public string TowageOnArrivalOperatorPhone { get; set; }
[ShowReport]
public string TowageOnArrivalOperatorFax { get; set; }
[ShowReport]
public string TowageOnArrivalOperatorEmail { get; set; }
[ShowReport]
public int? TowageOnArrivalGrossTonnage { get; set; }
public float? TowageOnArrivalLengthOverall_MTR { get; set; }
[ShowReport]
public double? TowageOnArrivalLengthOverall_MTR { get; set; }
public float? TowageOnArrivalBeam_MTR { get; set; }
[ShowReport]
public double? TowageOnArrivalBeam_MTR { get; set; }
[ShowReport]
public string TowageOnArrivalPurposeOfCall { get; set; }
public float? TowageOnArrivalDraught_DMT { get; set; }
[ShowReport]
public double? TowageOnArrivalDraught_DMT { get; set; }
[ShowReport]
public string TowageOnArrivalRemarks { get; set; }
public string Identifier { get; set; }

View File

@ -14,7 +14,7 @@ using System.Collections.Generic;
namespace bsmd.database
{
public class TOWD : DatabaseEntity
public class TOWD : DatabaseEntity, ISublistElement
{
public TOWD()
@ -24,32 +24,46 @@ namespace bsmd.database
#region Properties
[ShowReport]
public string TowageOnDepartureName { get; set; }
[ShowReport]
public string TowageOnDepartureFlag { get; set; }
[ShowReport]
public string TowageOnDepartureOperatorCompanyName { get; set; }
[ShowReport]
public string TowageOnDepartureOperatorStreetNameAndNumber { get; set; }
[ShowReport]
public string TowageOnDepartureOperatorPostalCode { get; set; }
[ShowReport]
public string TowageOnDepartureOperatorCity { get; set; }
[ShowReport]
public string TowageOnDepartureOperatorCountry { get; set; }
[ShowReport]
public string TowageOnDepartureOperatorPhone { get; set; }
[ShowReport]
public string TowageOnDepartureOperatorFax { get; set; }
[ShowReport]
public string TowageOnDepartureOperatorEmail { get; set; }
public float? TowageOnDepartureLengthOverall_MTR { get; set; }
[ShowReport]
public double? TowageOnDepartureLengthOverall_MTR { get; set; }
public float? TowageOnDepartureBeam_MTR { get; set; }
[ShowReport]
public double? TowageOnDepartureBeam_MTR { get; set; }
public float? TowageOnDepartureDraught_DMT { get; set; }
[ShowReport]
public double? TowageOnDepartureDraught_DMT { get; set; }
[ShowReport]
public string TowageOnDepartureRemarks { get; set; }
public string Identifier { get; set; }

View File

@ -27,15 +27,15 @@ namespace bsmd.database
}
#region Properties
[ShowReport]
public bool? WasteDisposalValidExemption { get; set; }
[ShowReport]
public string LastWasteDisposalPort { get; set; }
[ShowReport]
public bool? ConfirmationOfCorrectness { get; set; }
[ShowReport]
public DateTime? LastWasteDisposalDate { get; set; }
[ShowReport]
public byte? WasteDisposalDelivery { get; set; }
public List<Waste> Waste { get { return this.waste; } }
@ -131,5 +131,20 @@ namespace bsmd.database
#endregion
#region IMessageParagraph implementation
public override List<IMessageParagraph> ChildParagraphs
{
get
{
List<IMessageParagraph> result = new List<IMessageParagraph>();
foreach (IMessageParagraph imp in this.Waste)
result.Add(imp);
return result;
}
}
#endregion
}
}

View File

@ -25,20 +25,20 @@ namespace bsmd.database
#region Properties
public WAS WAS { get; set; }
[ShowReport]
public byte? WasteType { get; set; }
[ShowReport]
public string WasteDescription { get; set; }
public float? WasteDisposalAmount_MTQ { get; set; }
public float? WasteCapacity_MTQ { get; set; }
public float? WasteAmountRetained_MTQ { get; set; }
[ShowReport]
public double? WasteDisposalAmount_MTQ { get; set; }
[ShowReport]
public double? WasteCapacity_MTQ { get; set; }
[ShowReport]
public double? WasteAmountRetained_MTQ { get; set; }
[ShowReport]
public string WasteDisposalPort { get; set; }
public float? WasteAmountGeneratedTillNextPort_MTQ { get; set; }
[ShowReport]
public double? WasteAmountGeneratedTillNextPort_MTQ { get; set; }
public string Identifier { get; set; }

View File

@ -25,9 +25,9 @@ namespace bsmd.database
#region Properties
public WAS WAS { get; set; }
[ShowReport]
public string WasteDisposalServiceProviderName { get; set; }
[ShowReport]
public byte? WasteDisposalDelivery { get; set; }
public string Identifier { get; set; }

View File

@ -56,8 +56,15 @@
<Compile Include="CallPurpose.cs" />
<Compile Include="Customer.cs" />
<Compile Include="Extensions.cs" />
<Compile Include="HAZ.cs" />
<Compile Include="IBCPosition.cs" />
<Compile Include="IGCPosition.cs" />
<Compile Include="IMDGPosition.cs" />
<Compile Include="IMessageParagraph.cs" />
<Compile Include="IMSBCPosition.cs" />
<Compile Include="ISublistContainer.cs" />
<Compile Include="LastTenPortFacilitiesCalled.cs" />
<Compile Include="MARPOL_Annex_I_Position.cs" />
<Compile Include="Properties\AssemblyProductInfo.cs" />
<Compile Include="Properties\AssemblyProjectInfo.cs" />
<Compile Include="Properties\AssemblyProjectKeyInfo.cs" />
@ -90,6 +97,7 @@
<Compile Include="SEC.cs" />
<Compile Include="SERV.cs" />
<Compile Include="ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.cs" />
<Compile Include="ShowReportAttribute.cs" />
<Compile Include="STAT.cs" />
<Compile Include="TIEFA.cs" />
<Compile Include="TIEFD.cs" />

File diff suppressed because it is too large Load Diff

View File

@ -137,37 +137,45 @@ namespace bsmd.dbh
rootNoaNod.LastPort = noa_nod.LastPort;
rootNoaNod.NextPort = noa_nod.NextPort;
ItemsChoiceType[] choiceArray = new ItemsChoiceType[3];
object[] choices = new object[3];
int numItems = 2 + noa_nod.CallPurposes.Count;
choiceArray[0] = ItemsChoiceType.CallPurpose;
RootNOA_NODCallPurpose rnncp = new RootNOA_NODCallPurpose();
if (noa_nod.CallPurposeCode.HasValue)
rnncp.CallPurposeCode = noa_nod.CallPurposeCode.Value;
rnncp.CallPurposeDescription = noa_nod.CallPurposeDescription;
choices[0] = rnncp;
ItemsChoiceType[] choiceArray = new ItemsChoiceType[numItems];
object[] choices = new object[numItems];
if (noa_nod.ETAToKielCanal.HasValue)
{
choiceArray[1] = ItemsChoiceType.ETAToKielCanal;
choices[1] = noa_nod.ETAToKielCanal.Value;
choiceArray[0] = ItemsChoiceType.ETAToKielCanal;
choices[0] = noa_nod.ETAToKielCanal.Value;
}
if (noa_nod.ETAToPortOfCall.HasValue)
{
choiceArray[1] = ItemsChoiceType.ETAToPortOfCall;
choices[1] = noa_nod.ETAToPortOfCall.Value;
choiceArray[0] = ItemsChoiceType.ETAToPortOfCall;
choices[0] = noa_nod.ETAToPortOfCall.Value;
}
if (noa_nod.ETDFromKielCanal.HasValue)
{
choiceArray[2] = ItemsChoiceType.ETDFromKielCanal;
choices[2] = noa_nod.ETDFromKielCanal.Value;
choiceArray[1] = ItemsChoiceType.ETDFromKielCanal;
choices[1] = noa_nod.ETDFromKielCanal.Value;
}
if (noa_nod.ETDFromPortOfCall.HasValue)
{
choiceArray[2] = ItemsChoiceType.ETDFromPortOfCall;
choices[2] = noa_nod.ETDFromPortOfCall.Value;
choiceArray[1] = ItemsChoiceType.ETDFromPortOfCall;
choices[1] = noa_nod.ETDFromPortOfCall.Value;
}
for (int i = 0; i < noa_nod.CallPurposes.Count; i++)
{
choiceArray[i + 2] = ItemsChoiceType.CallPurpose;
RootNOA_NODCallPurpose rnncp = new RootNOA_NODCallPurpose();
rnncp.CallPurposeCode = noa_nod.CallPurposes[i].CallPurposeCode;
rnncp.CallPurposeDescription = noa_nod.CallPurposes[i].CallPurposeDescription;
choices[i+2] = rnncp;
}
rootNoaNod.Items = choices;
rootNoaNod.ItemsElementName = choiceArray;
item = rootNoaNod;
}
break;
@ -405,7 +413,7 @@ namespace bsmd.dbh
{
BRKA bkra = message.Elements[i] as BRKA;
rootBKRA.BunkerFuelArrival[i] = new RootBKRABunkerFuelArrival();
rootBKRA.BunkerFuelArrival[i].BunkerFuelQuantity_TNE = bkra.BunkerFuelQuantity_TNE ?? 0;
rootBKRA.BunkerFuelArrival[i].BunkerFuelQuantity_TNE = (float) (bkra.BunkerFuelQuantity_TNE ?? 0);
rootBKRA.BunkerFuelArrival[i].BunkerFuelType = bkra.BunkerFuelType;
}
item = rootBKRA;
@ -424,7 +432,7 @@ namespace bsmd.dbh
{
BRKD bkrd = message.Elements[i] as BRKD;
rootBKRD.BunkerFuelDeparture[i] = new RootBKRDBunkerFuelDeparture();
rootBKRD.BunkerFuelDeparture[i].BunkerFuelQuantity_TNE = bkrd.BunkerFuelQuantity_TNE ?? 0;
rootBKRD.BunkerFuelDeparture[i].BunkerFuelQuantity_TNE = (float) (bkrd.BunkerFuelQuantity_TNE ?? 0);
rootBKRD.BunkerFuelDeparture[i].BunkerFuelType = bkrd.BunkerFuelType;
}
item = rootBKRD;
@ -437,7 +445,7 @@ namespace bsmd.dbh
{
RootTIEFA rootTIEFA = new RootTIEFA();
TIEFA tiefa = message.Elements[0] as TIEFA;
rootTIEFA.DraughtUponArrival_DMT = tiefa.DraughtUponArrival_DMT ?? 0;
rootTIEFA.DraughtUponArrival_DMT = (float) (tiefa.DraughtUponArrival_DMT ?? 0);
item = rootTIEFA;
}
break;
@ -448,7 +456,7 @@ namespace bsmd.dbh
{
RootTIEFD rootTIEFD = new RootTIEFD();
TIEFD tiefd = message.Elements[0] as TIEFD;
rootTIEFD.DraughtUponDeparture_DMT = tiefd.DraughtUponDeparture_DMT ?? 0;
rootTIEFD.DraughtUponDeparture_DMT = (float) (tiefd.DraughtUponDeparture_DMT ?? 0);
item = rootTIEFD;
}
break;
@ -502,8 +510,8 @@ namespace bsmd.dbh
rootStat.CallSign = stat.CallSign;
rootStat.MMSINumber = stat.MMSINumber;
rootStat.Flag = stat.Flag;
if (stat.LengthOverall_MTR.HasValue) rootStat.LengthOverall_MTR = stat.LengthOverall_MTR.Value;
if (stat.Beam_MTR.HasValue) rootStat.Beam_MTR = stat.Beam_MTR.Value;
if (stat.LengthOverall_MTR.HasValue) rootStat.LengthOverall_MTR = (float) (stat.LengthOverall_MTR.Value);
if (stat.Beam_MTR.HasValue) rootStat.Beam_MTR = (float) (stat.Beam_MTR.Value);
if (stat.GrossTonnage.HasValue) rootStat.GrossTonnage = stat.GrossTonnage.Value;
rootStat.PortOfRegistry = stat.PortOfRegistry;
rootStat.ShipType = stat.ShipType;
@ -535,7 +543,7 @@ namespace bsmd.dbh
rootLADG.Cargo[i].CargoHandlingType = (RootLADGCargoCargoHandlingType)(ladg.CargoHandlingType);
rootLADG.Cargo[i].CargoCodeNST = ladg.CargoCodeNST;
if (ladg.CargoGrossQuantity_TNE.HasValue)
rootLADG.Cargo[i].CargoGrossQuantity_TNE = ladg.CargoGrossQuantity_TNE.Value;
rootLADG.Cargo[i].CargoGrossQuantity_TNE = (float) ladg.CargoGrossQuantity_TNE.Value;
rootLADG.Cargo[i].CargoNumberOfItemsSpecified = ladg.CargoNumberOfItems.HasValue;
if (ladg.CargoNumberOfItems.HasValue)
rootLADG.Cargo[i].CargoNumberOfItems = ladg.CargoNumberOfItems.Value;
@ -559,7 +567,7 @@ namespace bsmd.dbh
rootInfo.FumigatedBulkCargo = (info.FumigatedBulkCargo.Value == 0) ? RootINFOFumigatedBulkCargo.Y : RootINFOFumigatedBulkCargo.N;
rootInfo.DeadWeightSummer_TNESpecified = info.DeplacementSummerDraught_TNE.HasValue;
if (info.DeplacementSummerDraught_TNE.HasValue)
rootInfo.DeadWeightSummer_TNE = info.DeplacementSummerDraught_TNE.Value;
rootInfo.DeadWeightSummer_TNE = (float) info.DeplacementSummerDraught_TNE.Value;
item = rootInfo;
}
break;
@ -601,13 +609,13 @@ namespace bsmd.dbh
}
if (pre72h.VolumeOfCargo.HasValue)
rootPre.TankerDetails.VolumeOfCargo_TNE = pre72h.VolumeOfCargo.Value;
rootPre.TankerDetails.VolumeOfCargo_TNE = (float) (pre72h.VolumeOfCargo.Value);
rootPre.PlannedOperations = pre72h.PlannedOperations;
rootPre.PlannedWorks = pre72h.PlannedWorks;
if (pre72h.DateOfLastExpandedInspection.HasValue)
rootPre.DateOfLastExpandedInspection = pre72h.DateOfLastExpandedInspection.Value;
if (pre72h.PlannedPeriodOfStay_HUR.HasValue)
rootPre.PlannedPeriodOfStay_HUR = pre72h.PlannedPeriodOfStay_HUR.Value;
rootPre.PlannedPeriodOfStay_HUR = (float) (pre72h.PlannedPeriodOfStay_HUR.Value);
item = rootPre;
}
@ -766,15 +774,15 @@ namespace bsmd.dbh
if(was.Waste[i].WasteType.HasValue)
rww[i].WasteType = (RootWASWasteWasteType) was.Waste[i].WasteType.Value;
if (was.Waste[i].WasteDisposalAmount_MTQ.HasValue)
rww[i].WasteDisposalAmount_MTQ = was.Waste[i].WasteDisposalAmount_MTQ.Value;
rww[i].WasteDisposalAmount_MTQ = (float) was.Waste[i].WasteDisposalAmount_MTQ.Value;
rww[i].WasteDetails = new RootWASWasteWasteDetails();
if (was.Waste[i].WasteCapacity_MTQ.HasValue)
rww[i].WasteDetails.WasteCapacity_MTQ = was.Waste[i].WasteCapacity_MTQ.Value;
rww[i].WasteDetails.WasteCapacity_MTQ = (float) was.Waste[i].WasteCapacity_MTQ.Value;
if (was.Waste[i].WasteAmountRetained_MTQ.HasValue)
rww[i].WasteDetails.WasteAmountRetained_MTQ = was.Waste[i].WasteAmountRetained_MTQ.Value;
rww[i].WasteDetails.WasteAmountRetained_MTQ = (float) was.Waste[i].WasteAmountRetained_MTQ.Value;
rww[i].WasteDetails.WasteDisposalPort = was.Waste[i].WasteDisposalPort;
if (was.Waste[i].WasteAmountGeneratedTillNextPort_MTQ.HasValue)
rww[i].WasteDetails.WasteAmountGeneratedTillNextPort_MTQ = was.Waste[i].WasteAmountGeneratedTillNextPort_MTQ.Value;
rww[i].WasteDetails.WasteAmountGeneratedTillNextPort_MTQ = (float) was.Waste[i].WasteAmountGeneratedTillNextPort_MTQ.Value;
}
}
rootWAS.ItemsElementName[5] = ItemsChoiceType3.ConfirmationOfCorrectness;
@ -787,7 +795,6 @@ namespace bsmd.dbh
break;
#endregion
#region TOWA
case Message.NotificationClass.TOWA:
{
@ -811,12 +818,12 @@ namespace bsmd.dbh
if (towa.TowageOnArrivalGrossTonnage.HasValue)
rootTowa.TowageOnArrival[i].TowageOnArrivalGrossTonnage = towa.TowageOnArrivalGrossTonnage.Value;
if (towa.TowageOnArrivalLengthOverall_MTR.HasValue)
rootTowa.TowageOnArrival[i].TowageOnArrivalLengthOverall_MTR = towa.TowageOnArrivalLengthOverall_MTR.Value;
rootTowa.TowageOnArrival[i].TowageOnArrivalLengthOverall_MTR = (float) towa.TowageOnArrivalLengthOverall_MTR.Value;
if (towa.TowageOnArrivalBeam_MTR.HasValue)
rootTowa.TowageOnArrival[i].TowageOnArrivalBeam_MTR = towa.TowageOnArrivalBeam_MTR.Value;
rootTowa.TowageOnArrival[i].TowageOnArrivalBeam_MTR = (float) towa.TowageOnArrivalBeam_MTR.Value;
rootTowa.TowageOnArrival[i].TowageOnArrivalPurposeOfCall = towa.TowageOnArrivalPurposeOfCall;
if (towa.TowageOnArrivalDraught_DMT.HasValue)
rootTowa.TowageOnArrival[i].TowageOnArrivalDraught_DMT = towa.TowageOnArrivalDraught_DMT.Value;
rootTowa.TowageOnArrival[i].TowageOnArrivalDraught_DMT = (float) towa.TowageOnArrivalDraught_DMT.Value;
rootTowa.TowageOnArrival[i].TowageOnArrivalRemarks = towa.TowageOnArrivalRemarks;
}
item = rootTowa;
@ -845,11 +852,11 @@ namespace bsmd.dbh
rootTowd.TowageOnDeparture[i].TowageOnDepartureOperator.TowageOnDepartureOperatorFax = towd.TowageOnDepartureOperatorFax;
rootTowd.TowageOnDeparture[i].TowageOnDepartureOperator.TowageOnDepartureOperatorEMail = towd.TowageOnDepartureOperatorEmail;
if (towd.TowageOnDepartureLengthOverall_MTR.HasValue)
rootTowd.TowageOnDeparture[i].TowageOnDepartureLengthOverall_MTR = towd.TowageOnDepartureLengthOverall_MTR.Value;
rootTowd.TowageOnDeparture[i].TowageOnDepartureLengthOverall_MTR = (float) towd.TowageOnDepartureLengthOverall_MTR.Value;
if (towd.TowageOnDepartureBeam_MTR.HasValue)
rootTowd.TowageOnDeparture[i].TowageOnDepartureBeam_MTR = towd.TowageOnDepartureBeam_MTR.Value;
rootTowd.TowageOnDeparture[i].TowageOnDepartureBeam_MTR = (float) towd.TowageOnDepartureBeam_MTR.Value;
if (towd.TowageOnDepartureDraught_DMT.HasValue)
rootTowd.TowageOnDeparture[i].TowageOnDepartureDraught_DMT = towd.TowageOnDepartureDraught_DMT.Value;
rootTowd.TowageOnDeparture[i].TowageOnDepartureDraught_DMT = (float) towd.TowageOnDepartureDraught_DMT.Value;
rootTowd.TowageOnDeparture[i].TowageOnDepartureRemarks = towd.TowageOnDepartureRemarks;
}
item = rootTowd;

View File

@ -24,12 +24,17 @@ namespace bsmd.dbh
public static void ProcessResponse(response.Root aResponse, string connectionString)
{
_log.InfoFormat("processing message type {0}, version {1}", aResponse.Type, aResponse.Version);
/*
XmlSerializer serializer = new XmlSerializer(typeof(response.Root));
using(StringWriter textWriter = new StringWriter())
{
serializer.Serialize(textWriter, aResponse);
_log.Debug(textWriter.ToString());
}
*/
_log.Debug(aResponse.Serialize());
if (DBManager.Instance.Connect(connectionString))
{
@ -46,20 +51,25 @@ namespace bsmd.dbh
switch (aResponse.Messages[i].Type)
{
case dbh.response.RootMessageType.ERROR:
MessageError messageError = new MessageError();
messageError.ErrorText = aResponse.Messages[i].Text;
// messageError.ErrorCode =
MessageError error = new MessageError();
error.ErrorText = aResponse.Messages[i].Text;
_log.WarnFormat("Error received for {0}: {1}", aResponse.Messages[i].Type, error.ErrorText);
break;
case dbh.response.RootMessageType.VIOLATION:
MessageViolation violation = new MessageViolation();
violation.ViolationText = aResponse.Messages[i].Text;
_log.WarnFormat("Violation received for {0}: {1}", aResponse.Messages[i].Type, violation.ViolationText);
break;
case dbh.response.RootMessageType.WARNING:
_log.InfoFormat("WARNING received for {0}: {1}", aResponse.Messages[i].Type, aResponse.Messages[i].Text);
break;
case dbh.response.RootMessageType.INFO:
default:
_log.InfoFormat("INFO received for {0}: {1}", aResponse.Messages[i].Type, aResponse.Messages[i].Text);
break;
}
@ -86,10 +96,12 @@ namespace bsmd.dbh
case dbh.response.RootType.VISIT:
// neue VISIT - ID
aMessage.MessageCore.VisitId = aResponse.VisitId;
aMessage.MessageCore.BSMDStatusInternal = MessageCore.BSMDStatus.PREPARE;
DBManager.Instance.Save(aMessage.MessageCore);
break;
case dbh.response.RootType.TRANSIT:
aMessage.MessageCore.TransitId = aResponse.TransitId;
aMessage.MessageCore.BSMDStatusInternal = MessageCore.BSMDStatus.PREPARE;
DBManager.Instance.Save(aMessage.MessageCore);
break;
case dbh.response.RootType.CANCEL:
@ -103,9 +115,8 @@ namespace bsmd.dbh
break;
}
//aMessage.Status = Message.MessageStatus.
aMessage.ReceivedAt = DateTime.Now;
aMessage.InternalStatus = Message.BSMDStatus.RESPONDED;
aMessage.InternalStatus = Message.BSMDStatus.RESPONSE_RECEIVED;
DBManager.Instance.Save(aMessage);
}
else

View File

@ -115,5 +115,44 @@ namespace bsmd.herberg.FormService
OTHER_LEGAL_IDENTITY_DOCUMENT
}
public enum INFShipClass : byte
{
INF1,
INF2,
INF3
}
public enum PackingGroup : byte
{
NONE,
I,
II,
III
}
public enum PollutionCategory : byte
{
X,
Y,
Z,
OS
}
public static byte? ParseHazardType(string val)
{
if (val.Equals("P")) return 0;
if (val.Equals("S")) return 1;
if (val.Equals("S/P")) return 2;
return null;
}
public static byte? ParseFlashpointInformation(string val)
{
if (val.Equals("NF")) return 0;
if (val.Equals("GT60CEL")) return 1;
if (val.Equals("LE60CEL")) return 2;
return null;
}
}
}

View File

@ -33,22 +33,9 @@ namespace bsmd.herberg.FormService
{
this.EventLog.Source = this.ServiceName;
this.EventLog.Log = "Application";
/*
this.EventLog.BeginInit();
try
{
if (!EventLog.SourceExists(this.EventLog.Source, this.EventLog.Log))
EventLog.CreateEventSource(this.EventLog.Source, this.EventLog.Log);
}
catch (Exception ex)
{
_log.ErrorFormat("Source exists exception: {0}", ex.ToString());
}
this.EventLog.EndInit();
*/
this.Init(args);
this.EventLog.WriteEntry("NSW Send Service started.", EventLogEntryType.Information);
this.EventLog.WriteEntry("FormService started.", EventLogEntryType.Information);
this.DoOnce();
}
protected override void OnStop()
@ -168,13 +155,16 @@ namespace bsmd.herberg.FormService
}
else
{
_log.Info("formDataInfoDatasets null");
_log.Info("no data sets found on the server in this interval");
}
}
else
{
_log.Error("Request of form list failed");
}
DBManager.Instance.Disconnect();
}
catch (Exception ex)
{

View File

@ -1,10 +1,5 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Diagnostics;
using System.ServiceProcess;
using System.Text;
using System.Threading.Tasks;
namespace bsmd.herberg.FormService
{

View File

@ -34,6 +34,7 @@ namespace bsmd.herberg.FormService
}
}
bool isDeparture = false;
for (int i = 0; i < formResponse.formDatasets.Length; i++)
{
@ -48,32 +49,71 @@ namespace bsmd.herberg.FormService
foreach (WebReference.FormData formData in fds.formData)
{
string[] nElems = formData.name.Split('.');
if (nElems.Length != 2)
string keyString = null;
string valString = null;
if (nElems.Length == 1)
{
switch (nElems[0])
{
case "REGISTRATION_TYPE":
_log.WarnFormat("REGISTRATION_TYPE: {0}", formData.value);
break;
case "REPORT_TYPE":
aMessageCore.HerbergReportType = formData.value;
if (aMessageCore.HerbergReportType.Equals("Pre-Departure Notification Update") ||
aMessageCore.HerbergReportType.Equals("Departure Notification Update"))
isDeparture = true;
break;
case "EmailContactReportingVessel":
aMessageCore.HerbergEmailContactReportingVessel = formData.value;
break;
case "Email24HrsContact":
aMessageCore.HerbergEmail24HrsContact = formData.value;
break;
default:
_log.WarnFormat("unhandled single parameter {0}", nElems[0]);
break;
}
continue;
}
else if (nElems.Length == 2)
{
keyString = nElems[0];
valString = nElems[1];
}
else if (nElems.Length == 3)
{
// haza sublists
keyString = string.Format("{0}.{1}", nElems[0], nElems[1]);
valString = nElems[2];
}
else
{
_log.WarnFormat("Field name {0} has wrong format!", formData.name);
continue;
}
// create dictionaries on demand
if (!groupedVals.ContainsKey(nElems[0]))
groupedVals[nElems[0]] = new Dictionary<string, string>();
if (!groupedRowVals.ContainsKey(nElems[0]))
groupedRowVals[nElems[0]] = new Dictionary<int, Dictionary<string, string>>();
if (!groupedRowVals[nElems[0]].ContainsKey(formData.rowNo))
groupedRowVals[nElems[0]][formData.rowNo] = new Dictionary<string, string>();
if (!groupedVals.ContainsKey(keyString))
groupedVals[keyString] = new Dictionary<string, string>();
if (!groupedRowVals.ContainsKey(keyString))
groupedRowVals[keyString] = new Dictionary<int, Dictionary<string, string>>();
if (!groupedRowVals[keyString].ContainsKey(formData.rowNo))
groupedRowVals[keyString][formData.rowNo] = new Dictionary<string, string>();
if (formData.rowNoSpecified == false)
{
// "normale" Felder werden pro Nachrichtentyp in einem Dict abgespeichert
groupedVals[nElems[0]][nElems[1]] = formData.value;
groupedVals[keyString][valString] = formData.value;
}
else
{
// "1:n" Felder (mit Zeilennummer) werden in einem Dict<Dict .. abgespeichert. Erster
// Schlüssel ist die Row-Id, damit Datensätze aus derselben Zeile zusammenfinden
groupedRowVals[nElems[0]][formData.rowNo][nElems[1]] = formData.value;
groupedRowVals[keyString][formData.rowNo][valString] = formData.value;
}
}
@ -82,19 +122,23 @@ namespace bsmd.herberg.FormService
List<DatabaseEntity> saveMessages = new List<DatabaseEntity>(); // 1:n messages
foreach (string messageType in groupedVals.Keys)
foreach (string groupMessageType in groupedVals.Keys)
{
Dictionary<string, string> vDict = groupedVals[messageType];
Dictionary<int, Dictionary<string, string>> nDict = groupedRowVals[messageType];
string messageType = groupMessageType;
Dictionary<string, string> vDict = groupedVals[groupMessageType];
Dictionary<int, Dictionary<string, string>> nDict = groupedRowVals[groupMessageType];
DatabaseEntity derivedMessage = null;
saveMessages.Clear();
if (messageType.Equals("HAZ"))
messageType = isDeparture ? "HAZD" : "HAZA";
Message theMessage = null;
if (!messages.ContainsKey(messageType.ToUpper()))
{
theMessage = new Message();
if (messageType.Equals("HAZ")) continue; // HE spezial, sollte HAZA o. HAZD sein
if (messageType.Equals("Agency"))
{
if (aMessageCore.Customer == null) aMessageCore.Customer = new Customer();
@ -107,7 +151,12 @@ namespace bsmd.herberg.FormService
continue; // das Zeug verhält sich wie eine Not. Class
}
if (messageType.Contains(".")) // eine subliste
continue;
theMessage.MessageNotificationClass = (Message.NotificationClass)Enum.Parse(typeof(Message.NotificationClass), messageType, true);
theMessage.MessageCoreId = aMessageCore.Id;
theMessage.MessageCore = aMessageCore;
if (bsmdParty != null)
@ -119,7 +168,7 @@ namespace bsmd.herberg.FormService
theMessage = messages[messageType.ToUpper()];
}
switch (messageType)
switch (groupMessageType)
{
#region ATA
case "ATA":
@ -280,8 +329,8 @@ namespace bsmd.herberg.FormService
if (vDict.ContainsKey("MMSINumber")) stat.MMSINumber = vDict["MMSINumber"];
if (vDict.ContainsKey("Flag")) stat.Flag = vDict["Flag"];
if (vDict.ContainsKey("ShipType")) stat.ShipType = vDict["ShipType"];
if (vDict.ContainsKey("LengthOverall_MTR")) stat.LengthOverall_MTR = (float)Double.Parse(vDict["LengthOverall_MTR"]);
if (vDict.ContainsKey("Beam_MTR")) stat.Beam_MTR = (float)Double.Parse(vDict["Beam_MTR"]);
if (vDict.ContainsKey("LengthOverall_MTR")) stat.LengthOverall_MTR = Double.Parse(vDict["LengthOverall_MTR"], NumberFormatInfo.InvariantInfo);
if (vDict.ContainsKey("Beam_MTR")) stat.Beam_MTR = Double.Parse(vDict["Beam_MTR"], NumberFormatInfo.InvariantInfo);
if (vDict.ContainsKey("GrossTonnage")) stat.GrossTonnage = Int32.Parse(vDict["GrossTonnage"]);
// if (vDict.ContainsKey("PortNameOfRegistry")) stat.PortOfRegistry = vDict["PortNameOfRegistry"]; // existiert nicht
if (vDict.ContainsKey("InmarsatCallNumber")) stat.InmarsatCallNumber = vDict["InmarsatCallNumber"];
@ -520,7 +569,7 @@ namespace bsmd.herberg.FormService
try
{
if (bDict.ContainsKey("BunkerFuelType")) bkra.BunkerFuelType = bDict["BunkerFuelType"];
if (bDict.ContainsKey("BunkerFuelQuantity_TNE")) bkra.BunkerFuelQuantity_TNE = (float)Double.Parse(bDict["BunkerFuelQuantity_TNE"]);
if (bDict.ContainsKey("BunkerFuelQuantity_TNE")) bkra.BunkerFuelQuantity_TNE = Double.Parse(bDict["BunkerFuelQuantity_TNE"], NumberFormatInfo.InvariantInfo);
}
catch (Exception ex)
{
@ -622,7 +671,7 @@ namespace bsmd.herberg.FormService
try
{
if (bDict.ContainsKey("BunkerFuelType")) bkrd.BunkerFuelType = bDict["BunkerFuelType"];
if (bDict.ContainsKey("BunkerFuelQuantity_TNE")) bkrd.BunkerFuelQuantity_TNE = (float)Double.Parse(bDict["BunkerFuelQuantity_TNE"]);
if (bDict.ContainsKey("BunkerFuelQuantity_TNE")) bkrd.BunkerFuelQuantity_TNE = Double.Parse(bDict["BunkerFuelQuantity_TNE"], NumberFormatInfo.InvariantInfo);
}
catch (Exception ex)
{
@ -686,11 +735,11 @@ namespace bsmd.herberg.FormService
if (vDict.ContainsKey("TankerHullConfiguration")) pre72h.TankerHullConfiguration = (byte)Enum.Parse(typeof(Enums.TankerHullConfiguration), vDict["TankerHullConfiguration"]);
if (vDict.ContainsKey("ConditionCargoBallastTanks")) pre72h.ConditionCargoBallastTanks = (byte)Enum.Parse(typeof(Enums.ConditionCargoBallastTanks), vDict["ConditionCargoBallastTanks"]);
if (vDict.ContainsKey("NatureOfCargo")) pre72h.NatureOfCargo = vDict["NatureOfCargo"];
if (vDict.ContainsKey("VolumeOfCargo_TNE")) pre72h.VolumeOfCargo = (float)Double.Parse(vDict["VolumeOfCargo_TNE"]);
if (vDict.ContainsKey("VolumeOfCargo_TNE")) pre72h.VolumeOfCargo = Double.Parse(vDict["VolumeOfCargo_TNE"], NumberFormatInfo.InvariantInfo);
if (vDict.ContainsKey("PlannedOperations")) pre72h.PlannedOperations = vDict["PlannedOperations"];
if (vDict.ContainsKey("PlannedWorks")) pre72h.PlannedWorks = vDict["PlannedWorks"];
if (vDict.ContainsKey("DateOfLastExpandedInspection")) pre72h.DateOfLastExpandedInspection = DateTime.Parse(vDict["DateOfLastExpandedInspection"], DateTimeFormatInfo.InvariantInfo);
if (vDict.ContainsKey("PlannedPeriodOfStay_HUR")) pre72h.PlannedPeriodOfStay_HUR = (float)Double.Parse(vDict["PlannedPeriodOfStay_HUR"]);
if (vDict.ContainsKey("PlannedPeriodOfStay_HUR")) pre72h.PlannedPeriodOfStay_HUR = Double.Parse(vDict["PlannedPeriodOfStay_HUR"], NumberFormatInfo.InvariantInfo);
}
catch (Exception ex)
{
@ -716,7 +765,7 @@ namespace bsmd.herberg.FormService
theMessage.MessageNotificationClass = Message.NotificationClass.LADG;
theMessage.Elements.Add(ladg);
}
if (lDict.ContainsKey("CargoGrossQuantity_TNE")) ladg.CargoGrossQuantity_TNE = (float)Double.Parse(lDict["CargoGrossQuantity_TNE"]);
if (lDict.ContainsKey("CargoGrossQuantity_TNE")) ladg.CargoGrossQuantity_TNE = Double.Parse(lDict["CargoGrossQuantity_TNE"], NumberFormatInfo.InvariantInfo);
if (lDict.ContainsKey("CargoNumberOfItems")) ladg.CargoNumberOfItems = Int32.Parse(lDict["CargoNumberOfItems"]);
if (lDict.ContainsKey("CargoCodeNST")) ladg.CargoCodeNST = lDict["CargoCodeNST"];
if (lDict.ContainsKey("CargoHandlingType")) ladg.CargoHandlingType = (byte) Enum.Parse(typeof(Enums.CargoHandlingType), lDict["CargoHandlingType"]);
@ -806,10 +855,10 @@ namespace bsmd.herberg.FormService
was.Waste.Add(waste);
}
if(wDict.ContainsKey("WasteAmountGeneratedTillNextPort_MTQ")) waste.WasteAmountGeneratedTillNextPort_MTQ = (float) Double.Parse(wDict["WasteAmountGeneratedTillNextPort_MTQ"]);
if(wDict.ContainsKey("WasteAmountRetained_MTQ")) waste.WasteAmountRetained_MTQ = (float) Double.Parse(wDict["WasteAmountRetained_MTQ"]);
if(wDict.ContainsKey("WasteCapacity_MTQ")) waste.WasteCapacity_MTQ = (float) Double.Parse(wDict["WasteCapacity_MTQ"]);
if(wDict.ContainsKey("WasteDisposalAmount_MTQ")) waste.WasteDisposalAmount_MTQ = (float) Double.Parse(wDict["WasteDisposalAmount_MTQ"]);
if (wDict.ContainsKey("WasteAmountGeneratedTillNextPort_MTQ")) waste.WasteAmountGeneratedTillNextPort_MTQ = Double.Parse(wDict["WasteAmountGeneratedTillNextPort_MTQ"], NumberFormatInfo.InvariantInfo);
if (wDict.ContainsKey("WasteAmountRetained_MTQ")) waste.WasteAmountRetained_MTQ = Double.Parse(wDict["WasteAmountRetained_MTQ"], NumberFormatInfo.InvariantInfo);
if (wDict.ContainsKey("WasteCapacity_MTQ")) waste.WasteCapacity_MTQ = Double.Parse(wDict["WasteCapacity_MTQ"], NumberFormatInfo.InvariantInfo);
if (wDict.ContainsKey("WasteDisposalAmount_MTQ")) waste.WasteDisposalAmount_MTQ = Double.Parse(wDict["WasteDisposalAmount_MTQ"], NumberFormatInfo.InvariantInfo);
if(wDict.ContainsKey("WasteDescription")) waste.WasteDescription = wDict["WasteDescription"];
if(wDict.ContainsKey("WasteType")) waste.WasteType = Enums.ParseWasteType(wDict["WasteType"]);
if(wDict.ContainsKey("WasteDisposalPort")) waste.WasteDisposalPort = wDict["WasteDisposalPort"];
@ -875,6 +924,7 @@ namespace bsmd.herberg.FormService
if (vDict.ContainsKey("ISSCDateOfExpiration")) sec.ISSCDateOfExpiration = DateTime.Parse(vDict["ISSCDateOfExpiration"]);
if (vDict.ContainsKey("ApprovedSecurityPlanOnBoard")) sec.ApprovedSecurityPlanOnBoard = vDict["ApprovedSecurityPlanOnBoard"].Equals("Y");
if (vDict.ContainsKey("CurrentShipSecurityLevel")) sec.CurrentShipSecurityLevel = Byte.Parse(vDict["CurrentShipSecurityLevel"]);
if (vDict.ContainsKey("CurrentShipSecurityLevel ")) sec.CurrentShipSecurityLevel = Byte.Parse(vDict["CurrentShipSecurityLevel "]);
if (vDict.ContainsKey("PortFacilityOfArrival")) sec.PortFacilityOfArrival = vDict["PortFacilityOfArrival"];
if (vDict.ContainsKey("GeneralDescriptionOfCargo")) sec.GeneralDescriptionOfCargo = (byte)Enum.Parse(typeof(Enums.GeneralDescriptionOfCargo), vDict["GeneralDescriptionOfCargo"]);
@ -981,9 +1031,9 @@ namespace bsmd.herberg.FormService
}
try
{
if (pDict.ContainsKey("TowageOnArrivalBeam_MTR")) towa.TowageOnArrivalBeam_MTR = (float)Double.Parse(pDict["TowageOnArrivalBeam_MTR"]);
if (pDict.ContainsKey("TowageOnArrivalDraught_DMT")) towa.TowageOnArrivalDraught_DMT = (float)Double.Parse(pDict["TowageOnArrivalDraught_DMT"]);
if (pDict.ContainsKey("TowageOnArrivalLengthOverall_MTR")) towa.TowageOnArrivalLengthOverall_MTR = (float)Double.Parse(pDict["TowageOnArrivalLengthOverall_MTR"]);
if (pDict.ContainsKey("TowageOnArrivalBeam_MTR")) towa.TowageOnArrivalBeam_MTR = Double.Parse(pDict["TowageOnArrivalBeam_MTR"], NumberFormatInfo.InvariantInfo);
if (pDict.ContainsKey("TowageOnArrivalDraught_DMT")) towa.TowageOnArrivalDraught_DMT = Double.Parse(pDict["TowageOnArrivalDraught_DMT"], NumberFormatInfo.InvariantInfo);
if (pDict.ContainsKey("TowageOnArrivalLengthOverall_MTR")) towa.TowageOnArrivalLengthOverall_MTR = Double.Parse(pDict["TowageOnArrivalLengthOverall_MTR"], NumberFormatInfo.InvariantInfo);
if (pDict.ContainsKey("TowageOnArrivalGrossTonnage")) towa.TowageOnArrivalGrossTonnage = Int32.Parse(pDict["TowageOnArrivalGrossTonnage"]);
if (pDict.ContainsKey("TowageOnArrivalOperatorCountry")) towa.TowageOnArrivalOperatorCountry = pDict["TowageOnArrivalOperatorCountry"];
if (pDict.ContainsKey("TowageOnArrivalPurposeOfCall")) towa.TowageOnArrivalPurposeOfCall = pDict["TowageOnArrivalPurposeOfCall"];
@ -1023,9 +1073,9 @@ namespace bsmd.herberg.FormService
}
try
{
if (pDict.ContainsKey("TowageOnDepartureBeam_MTR")) towd.TowageOnDepartureBeam_MTR = (float)Double.Parse(pDict["TowageOnDepartureBeam_MTR"]);
if (pDict.ContainsKey("TowageOnDepartureDraught_DMT")) towd.TowageOnDepartureDraught_DMT = (float)Double.Parse(pDict["TowageOnDepartureDraught_DMT"]);
if (pDict.ContainsKey("TowageOnDepartureLengthOverall_MTR")) towd.TowageOnDepartureLengthOverall_MTR = (float)Double.Parse(pDict["TowageOnDepartureLengthOverall_MTR"]);
if (pDict.ContainsKey("TowageOnDepartureBeam_MTR")) towd.TowageOnDepartureBeam_MTR = Double.Parse(pDict["TowageOnDepartureBeam_MTR"], NumberFormatInfo.InvariantInfo);
if (pDict.ContainsKey("TowageOnDepartureDraught_DMT")) towd.TowageOnDepartureDraught_DMT = Double.Parse(pDict["TowageOnDepartureDraught_DMT"], NumberFormatInfo.InvariantInfo);
if (pDict.ContainsKey("TowageOnDepartureLengthOverall_MTR")) towd.TowageOnDepartureLengthOverall_MTR = Double.Parse(pDict["TowageOnDepartureLengthOverall_MTR"], NumberFormatInfo.InvariantInfo);
if (pDict.ContainsKey("TowageOnDepartureOperatorCountry")) towd.TowageOnDepartureOperatorCountry = pDict["TowageOnDepartureOperatorCountry"];
if (pDict.ContainsKey("TowageOnDepartureName")) towd.TowageOnDepartureName = pDict["TowageOnDepartureName"];
if (pDict.ContainsKey("TowageOnDepartureFlag")) towd.TowageOnDepartureFlag = pDict["TowageOnDepartureFlag"];
@ -1063,7 +1113,7 @@ namespace bsmd.herberg.FormService
{
try
{
if (vDict.ContainsKey("DraughtUponArrival_DMT")) tiefa.DraughtUponArrival_DMT = (float)Double.Parse(vDict["DraughtUponArrival_DMT"]);
if (vDict.ContainsKey("DraughtUponArrival_DMT")) tiefa.DraughtUponArrival_DMT = Double.Parse(vDict["DraughtUponArrival_DMT"], NumberFormatInfo.InvariantInfo);
}
catch (Exception ex)
{
@ -1090,7 +1140,7 @@ namespace bsmd.herberg.FormService
{
try
{
if (vDict.ContainsKey("DraughtUponDeparture_DMT")) tiefd.DraughtUponDeparture_DMT = (float)Double.Parse(vDict["DraughtUponDeparture_DMT"]);
if (vDict.ContainsKey("DraughtUponDeparture_DMT")) tiefd.DraughtUponDeparture_DMT = Double.Parse(vDict["DraughtUponDeparture_DMT"], NumberFormatInfo.InvariantInfo);
}
catch (Exception ex)
{
@ -1101,6 +1151,243 @@ namespace bsmd.herberg.FormService
}
#endregion
#region HAZ
case "HAZ":
{
if (theMessage.Elements.Count == 0)
{
HAZ newHaz = new HAZ();
newHaz.MessageHeader = theMessage;
theMessage.MessageNotificationClass = Message.NotificationClass.HAZA;
theMessage.Elements.Add(newHaz);
}
HAZ haz = theMessage.Elements[0] as HAZ;
derivedMessage = haz;
if (haz != null)
{
try
{
if (vDict.ContainsKey("NoDPGOnBoard")) haz.NoDPGOnBoardOnArrival = vDict["NoDPGOnBoard"].Equals("Y");
if (vDict.ContainsKey("DPGManifestOnBoard")) haz.DPGManifestOnBoardOnArrival = vDict["DPGManifestOnBoard"].Equals("Y");
if (vDict.ContainsKey("INFShipClass")) haz.INFShipClass = (byte)Enum.Parse(typeof(Enums.INFShipClass), vDict["INFShipClass"]);
if (vDict.ContainsKey("DPGClassificationIMDG")) haz.DPGClassificationIMDG = vDict["DPGClassificationIMDG"].Equals("1");
if (vDict.ContainsKey("DPGClassificationIGC")) haz.DPGClassificationIMDG = vDict["DPGClassificationIGC"].Equals("1");
if (vDict.ContainsKey("DPGClassificationIBC")) haz.DPGClassificationIMDG = vDict["DPGClassificationIBC"].Equals("1");
if (vDict.ContainsKey("DPGClassificationIMSBC")) haz.DPGClassificationIMDG = vDict["DPGClassificationIMSBC"].Equals("1");
if (vDict.ContainsKey("DPGClassificationMARPOL_ANNEX_I")) haz.DPGClassificationIMDG = vDict["DPGClassificationMARPOL_ANNEX_I"].Equals("1");
Dictionary<int, Dictionary<string, string>> subDict = null;
if (groupedRowVals.ContainsKey("HAZ.IMDG"))
{
subDict = groupedRowVals["HAZ.IMDG"];
foreach (int key in subDict.Keys)
{
Dictionary<string, string> aDict = subDict[key];
IMDGPosition imdgPosition = haz.GetIMDGPositionWithIdentifier(key.ToString());
if (imdgPosition == null)
{
imdgPosition = new IMDGPosition();
imdgPosition.Identifier = key.ToString();
haz.IMDGPositions.Add(imdgPosition);
imdgPosition.HAZ = haz;
}
if (aDict.ContainsKey("UNNumber")) imdgPosition.UNNumber = aDict["UNNumber"];
if (aDict.ContainsKey("PackingGroup")) imdgPosition.PackingGroup = (byte)Enum.Parse(typeof(Enums.PackingGroup), aDict["PackingGroup"]);
if (aDict.ContainsKey("ProperShippingName")) imdgPosition.ProperShippingName = aDict["ProperShippingName"];
if (aDict.ContainsKey("IMOClass")) imdgPosition.IMOClass = aDict["IMOClass"];
if (aDict.ContainsKey("CompatibilityGroup")) imdgPosition.CompatibilityGroup = aDict["CompatibilityGroup"];
if (aDict.ContainsKey("TechnicalName")) imdgPosition.TechnicalName = aDict["TechnicalName"];
if (aDict.ContainsKey("NetExplosiveMass_KGM")) imdgPosition.NetExplosiveMass_KGM = Double.Parse(aDict["NetExplosiveMass_KGM"], NumberFormatInfo.InvariantInfo);
if (aDict.ContainsKey("Flashpoint_CEL")) imdgPosition.Flashpoint_CEL = aDict["Flashpoint_CEL"];
if (aDict.ContainsKey("Class7NuclideName")) imdgPosition.Class7NuclideName = aDict["Class7NuclideName"];
if (aDict.ContainsKey("Class7MaxActivity_BQL")) imdgPosition.Class7MaxActivity_BQL = Double.Parse(aDict["Class7MaxActivity_BQL"], NumberFormatInfo.InvariantInfo);
if (aDict.ContainsKey("Class7Category")) imdgPosition.Class7Category = Int32.Parse(aDict["Class7Category"], NumberFormatInfo.InvariantInfo);
if (aDict.ContainsKey("Class7TransportIndex")) imdgPosition.Class7TransportIndex = Double.Parse(aDict["Class7TransportIndex"], NumberFormatInfo.InvariantInfo);
if (aDict.ContainsKey("Class7CSI")) imdgPosition.Class7CSI = Int32.Parse(aDict["Class7CSI"]);
if (aDict.ContainsKey("ControlTemperature_CEL")) imdgPosition.ControlTemperature_CEL = Double.Parse(aDict["ControlTemperature_CEL"], NumberFormatInfo.InvariantInfo);
if (aDict.ContainsKey("EmergencyTemperature_CEL")) imdgPosition.EmergencyTemperature_CEL = Double.Parse(aDict["EmergencyTemperature_CEL"], NumberFormatInfo.InvariantInfo);
// TODO if (aDict.ContainsKey("SubsidiaryRisk")) imdgPosition.su
if (aDict.ContainsKey("MarinePollutant")) imdgPosition.MarinePollutant = aDict["MarinePollutant"].Equals("Y");
if (aDict.ContainsKey("NumberOfPackages")) imdgPosition.NumberOfPackages = Int32.Parse(aDict["NumberOfPackages"]);
if (aDict.ContainsKey("PackageType")) imdgPosition.PackageType = aDict["PackageType"];
if (aDict.ContainsKey("LimitedQuantities")) imdgPosition.LimitedQuantities = aDict["LimitedQuantities"].Equals("Y");
if (aDict.ContainsKey("ExceptedQuantities")) imdgPosition.ExceptedQuantities = aDict["ExceptedQuantities"].Equals("Y");
if (aDict.ContainsKey("NetQuantity_KGM")) imdgPosition.NetQuantity_KGM = Double.Parse(aDict["NetQuantity_KGM"], NumberFormatInfo.InvariantInfo);
if (aDict.ContainsKey("GrossQuantity_KGM")) imdgPosition.GrossQuantity_KGM = Double.Parse(aDict["GrossQuantity_KGM"], NumberFormatInfo.InvariantInfo);
if (aDict.ContainsKey("Volume_MTQ")) imdgPosition.Volume_MTQ = Double.Parse(aDict["Volume_MTQ"], NumberFormatInfo.InvariantInfo);
if (aDict.ContainsKey("GeneralCargoIBC")) imdgPosition.GeneralCargoIBC = aDict["GeneralCargoIBC"].Equals("Y");
if (aDict.ContainsKey("ContainerNumber")) imdgPosition.ContainerNumber = aDict["ContainerNumber"];
if (aDict.ContainsKey("VehicleLicenseNumber")) imdgPosition.VehicleLicenseNumber = aDict["VehicleLicenseNumber"];
if (aDict.ContainsKey("StowagePosition")) imdgPosition.StowagePosition = aDict["StowagePosition"];
if (aDict.ContainsKey("PortCodeOfLoading") && aDict.ContainsKey("CountryCodeOfLoading"))
imdgPosition.PortOfLoading = aDict["CountryCodeOfLoading"] + aDict["PortCodeOfLoading"];
if (aDict.ContainsKey("PortCodeOfDischarge") && aDict.ContainsKey("CountryCodeOfDischarge"))
imdgPosition.PortOfDischarge = aDict["CountryCodeOfDischarge"] + aDict["PortCodeOfDischarge"];
if (aDict.ContainsKey("Remarks")) imdgPosition.Remarks = aDict["Remarks"];
if (aDict.ContainsKey("Identifier"))
{
_log.InfoFormat("Igoring IMDGPosition identifer {0}, using row number {1} instead",
aDict["Identifier"], key);
}
saveMessages.Add(imdgPosition);
}
}
if (groupedRowVals.ContainsKey("HAZ.IBC"))
{
subDict = groupedRowVals["HAZ.IBC"];
foreach (int key in subDict.Keys)
{
Dictionary<string, string> aDict = subDict[key];
IBCPosition ibcPosition = haz.GetIBCPositionWithIdentifier(key.ToString());
if (ibcPosition == null)
{
ibcPosition = new IBCPosition();
ibcPosition.Identifier = key.ToString();
haz.IBCPositions.Add(ibcPosition);
ibcPosition.HAZ = haz;
}
if (aDict.ContainsKey("ProductName")) ibcPosition.ProductName = aDict["ProductName"];
if (aDict.ContainsKey("PollutionCategory")) ibcPosition.PollutionCategory = (byte)Enum.Parse(typeof(Enums.PollutionCategory), aDict["PollutionCategory"]);
if (aDict.ContainsKey("Hazards")) ibcPosition.Hazards = Enums.ParseHazardType(aDict["Hazards"]);
if (aDict.ContainsKey("FlashpointInformation")) ibcPosition.FlashpointInformation = Enums.ParseFlashpointInformation(aDict["FlashpointInformation"]);
if (aDict.ContainsKey("Quantity_KGM")) ibcPosition.Quantity_KGM = Double.Parse(aDict["Quantity_KGM"], NumberFormatInfo.InvariantInfo);
if (aDict.ContainsKey("StowagePosition")) ibcPosition.StowagePosition = aDict["StowagePosition"];
if (aDict.ContainsKey("PortCodeOfLoading") && aDict.ContainsKey("CountryCodeOfLoading"))
ibcPosition.PortOfLoading = aDict["CountryCodeOfLoading"] + aDict["PortCodeOfLoading"];
if (aDict.ContainsKey("PortCodeOfDischarge") && aDict.ContainsKey("CountryCodeOfDischarge"))
ibcPosition.PortOfDischarge = aDict["CountryCodeOfDischarge"] + aDict["PortCodeOfDischarge"];
if (aDict.ContainsKey("Remarks")) ibcPosition.Remarks = aDict["Remarks"];
if (aDict.ContainsKey("Identifier"))
{
_log.InfoFormat("Igoring IMDGPosition identifer {0}, using row number {1} instead",
aDict["Identifier"], key);
}
saveMessages.Add(ibcPosition);
}
}
if (groupedRowVals.ContainsKey("HAZ.IGC"))
{
subDict = groupedRowVals["HAZ.IGC"];
foreach (int key in subDict.Keys)
{
Dictionary<string, string> aDict = subDict[key];
IGCPosition igcPosition = haz.GetIGCPositionWithIdentifier(key.ToString());
if(igcPosition == null) {
igcPosition = new IGCPosition();
igcPosition.Identifier = key.ToString();
haz.IGCPositions.Add(igcPosition);
igcPosition.HAZ = haz;
}
if (aDict.ContainsKey("UNNumber")) igcPosition.UNNumber = aDict["UNNumber"];
if (aDict.ContainsKey("IMOClass")) igcPosition.IMOClass = aDict["IMOClass"];
if (aDict.ContainsKey("ProductName")) igcPosition.ProductName = aDict["ProductName"];
if (aDict.ContainsKey("Quantity_KGM")) igcPosition.Quantity_KGM = Double.Parse(aDict["Quantity_KGM"], NumberFormatInfo.InvariantInfo);
if (aDict.ContainsKey("StowagePosition")) igcPosition.StowagePosition = aDict["StowagePosition"];
if (aDict.ContainsKey("PortCodeOfLoading") && aDict.ContainsKey("CountryCodeOfLoading"))
igcPosition.PortOfLoading = aDict["CountryCodeOfLoading"] + aDict["PortCodeOfLoading"];
if (aDict.ContainsKey("PortCodeOfDischarge") && aDict.ContainsKey("CountryCodeOfDischarge"))
igcPosition.PortOfDischarge = aDict["CountryCodeOfDischarge"] + aDict["PortCodeOfDischarge"];
if (aDict.ContainsKey("Remarks")) igcPosition.Remarks = aDict["Remarks"];
if (aDict.ContainsKey("Identifier"))
{
_log.InfoFormat("Igoring IMDGPosition identifer {0}, using row number {1} instead",
aDict["Identifier"], key);
}
saveMessages.Add(igcPosition);
}
}
if (groupedRowVals.ContainsKey("HAZ.IMSBC"))
{
subDict = groupedRowVals["HAZ.IMSBC"];
foreach (int key in subDict.Keys)
{
Dictionary<string, string> aDict = subDict[key];
IMSBCPosition imsbcPosition = haz.GetIMSBCPositionWithIdentifier(key.ToString());
if (imsbcPosition == null)
{
imsbcPosition = new IMSBCPosition();
imsbcPosition.Identifier = key.ToString();
imsbcPosition.HAZ = haz;
haz.IMSBCPositions.Add(imsbcPosition);
}
if (aDict.ContainsKey("BulkCargoShippingName")) imsbcPosition.BulkCargoShippingName = aDict["BulkCargoShippingName"];
if (aDict.ContainsKey("MHB")) imsbcPosition.MHB = aDict["MHB"].Equals("Y");
if (aDict.ContainsKey("UNNumber")) imsbcPosition.UNNumber = aDict["UNNumber"];
if (aDict.ContainsKey("IMOClass")) imsbcPosition.IMOClass = aDict["IMOClass"];
if (aDict.ContainsKey("Quantity_KGM")) imsbcPosition.Quantity_KGM = Double.Parse(aDict["Quantity_KGM"], NumberFormatInfo.InvariantInfo);
if (aDict.ContainsKey("StowagePosition")) imsbcPosition.StowagePosition = aDict["StowagePosition"];
if (aDict.ContainsKey("PortCodeOfLoading") && aDict.ContainsKey("CountryCodeOfLoading"))
imsbcPosition.PortOfLoading = aDict["CountryCodeOfLoading"] + aDict["PortCodeOfLoading"];
if (aDict.ContainsKey("PortCodeOfDischarge") && aDict.ContainsKey("CountryCodeOfDischarge"))
imsbcPosition.PortOfDischarge = aDict["CountryCodeOfDischarge"] + aDict["PortCodeOfDischarge"];
if (aDict.ContainsKey("Remarks")) imsbcPosition.Remarks = aDict["Remarks"];
if (aDict.ContainsKey("Identifier"))
{
_log.InfoFormat("Igoring IMDGPosition identifer {0}, using row number {1} instead",
aDict["Identifier"], key);
}
saveMessages.Add(imsbcPosition);
}
}
if (groupedRowVals.ContainsKey("HAZ.MARPOLAnnexI"))
{
subDict = groupedRowVals["HAZ.MARPOLAnnexI"];
foreach (int key in subDict.Keys)
{
Dictionary<string, string> aDict = subDict[key];
MARPOL_Annex_I_Position marpolPosition = haz.GetMARPOLPositionWithIdentifier(key.ToString());
if (marpolPosition == null)
{
marpolPosition = new MARPOL_Annex_I_Position();
marpolPosition.Identifier = key.ToString();
marpolPosition.HAZ = haz;
haz.MARPOLPositions.Add(marpolPosition);
}
if (aDict.ContainsKey("Name")) marpolPosition.Name = aDict["Name"];
if (aDict.ContainsKey("FlashpointInformation")) marpolPosition.FlashpointInformation = Enums.ParseFlashpointInformation(aDict["FlashpointInformation"]);
if (aDict.ContainsKey("Flashpoint_CEL")) marpolPosition.Flashpoint_CEL = aDict["Flashpoint_CEL"];
if (aDict.ContainsKey("Quantity_KGM")) marpolPosition.Quantity_KGM = Double.Parse(aDict["Quantity_KGM"], NumberFormatInfo.InvariantInfo);
if (aDict.ContainsKey("StowagePosition")) marpolPosition.StowagePosition = aDict["StowagePosition"];
if (aDict.ContainsKey("PortCodeOfLoading") && aDict.ContainsKey("CountryCodeOfLoading"))
marpolPosition.PortOfLoading = aDict["CountryCodeOfLoading"] + aDict["PortCodeOfLoading"];
if (aDict.ContainsKey("PortCodeOfDischarge") && aDict.ContainsKey("CountryCodeOfDischarge"))
marpolPosition.PortOfDischarge = aDict["CountryCodeOfDischarge"] + aDict["PortCodeOfDischarge"];
if (aDict.ContainsKey("Remarks")) marpolPosition.Remarks = aDict["Remarks"];
if (aDict.ContainsKey("Identifier"))
{
_log.InfoFormat("Igoring IMDGPosition identifer {0}, using row number {1} instead",
aDict["Identifier"], key);
}
saveMessages.Add(marpolPosition);
}
}
}
catch (Exception ex)
{
_log.ErrorFormat("Error reading HAZ fields: {0}", ex.Message);
}
}
}
break;
#endregion
}
// Die Logik dient dazu, dass bei "leeren" Nachrichten (also z.B. MDH ohne MDH Infos) nicht nur der
@ -1119,6 +1406,9 @@ namespace bsmd.herberg.FormService
}
}
if (aMessageCore.BSMDStatus == Message.BSMDStatus.UNDEFINED)
aMessageCore.BSMDStatus = Message.BSMDStatus.CREATE_RECEIVE_RECEIPT;
DBManager.Instance.Save(aMessageCore); // warum?
}
}

View File

@ -36,6 +36,12 @@
<PropertyGroup>
<StartupObject>bsmd.herberg.FormService.Program</StartupObject>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net">
<HintPath>..\packages\log4net.2.0.3\lib\net40-full\log4net.dll</HintPath>
@ -84,7 +90,10 @@
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="App.config">
<SubType>Designer</SubType>
</None>
<None Include="..\bsmdKey.snk" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>

BIN
nsw/Source/misc/ATA.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

BIN
nsw/Source/misc/Logo.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

BIN
nsw/Source/misc/NOA_NOD.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

BIN
nsw/Source/misc/Transit.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
nsw/Source/misc/Visit.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

BIN
nsw/Source/misc/atd.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

BIN
nsw/Source/misc/bkra.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

BIN
nsw/Source/misc/bkrd.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
nsw/Source/misc/bpol.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
nsw/Source/misc/bsmd.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
nsw/Source/misc/crew.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

BIN
nsw/Source/misc/haza.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Some files were not shown because too many files have changed in this diff Show More