This commit is contained in:
Daniel Schick 2016-03-13 19:40:06 +00:00
parent d8f36781f4
commit 0a517a3e15
21 changed files with 6476 additions and 9167 deletions

View File

@ -1,7 +1,8 @@
# HISMV ImportClient Konfiguration
# Raute (#) zum auskommentieren
# Serveradresse
SERVER = 62.52.6.41
# SERVER = 62.52.6.41
SERVER = 62.52.6.45
# Paketgroesse (Standard ist 500, nur bei abreissender Verbindung veraendern)
#PACKETSIZE = 500
PORT = 7283

View File

@ -211,3 +211,16 @@
10.12.2015 20:18:59 PACKETSIZE: 500
10.12.2015 20:18:59 Tiles: 1
10.12.2015 20:18:59 No more Answers
-----------------------------
20.01.2016 19:13:37 Client started
-----------------------------
20.01.2016 19:13:39 No more Answers
20.01.2016 19:13:40 FileName: IMP\20151227111102-ad8761c2-bfbe-4afc-a9f5-004ab739ebd2.xml
20.01.2016 19:13:40 FileSize: 29212(28,53 kB)
-----------------------------
20.01.2016 19:13:43 20151227111102-ad8761c2-bfbe-4afc-a9f5-004ab739ebd2.xml(28,53 kB) - Transfer successful
-----------------------------
20.01.2016 19:15:25 Client started
-----------------------------
20.01.2016 19:15:25 No files to send
20.01.2016 19:15:26 No more Answers

View File

@ -278,9 +278,9 @@ namespace SendNSWMessageService
}
else
{
_log.Fatal("database connection failure, stopping service");
this.EventLog.WriteEntry("NSW Send Service stopped: DB connection failed", EventLogEntryType.Error);
this.Stop();
// _log.Fatal("database connection failure, stopping service");
this.EventLog.WriteEntry("NSW Send Service DB connection failure", EventLogEntryType.Warning);
// this.Stop();
}
lock (this._timerlock)

View File

@ -81,8 +81,7 @@ namespace bsmd.ReportGenerator
}
else
{
this.EventLog.WriteEntry("ReportService stopped: DB connection failed", EventLogEntryType.Error);
this.Stop();
this.EventLog.WriteEntry("ReportService DB connection failed", EventLogEntryType.Error);
}
lock (this._timerlock)

View File

@ -56,7 +56,7 @@ namespace bsmd.database
}
catch (Exception ex)
{
_log.Error("DBManager cannot connect", ex);
_log.ErrorFormat("DBManager cannot connect:{0}", ex.Message);
return false;
}
}

View File

@ -90,5 +90,10 @@ namespace bsmd.database
}
}
public static string ToDBHDateString(this DateTime source)
{
return source.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'Z'");
}
}
}

View File

@ -0,0 +1,106 @@
//
// Class: InfectedArea
// Current CLR: 4.0.30319.34209
// System: Microsoft Visual Studio 14.0
// Author: dani
// Created: 2/26/2016 8:35:02 AM
//
// Copyright (c) 2016 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 InfectedArea : DatabaseEntity, ISublistElement
{
public InfectedArea()
{
this.tablename = "[dbo].[InfectedArea]";
}
#region Properties
public MDH MDH { get; set; }
[ShowReport]
public string InfectedAreaPort { get; set; }
[ShowReport]
public DateTime? InfectedAreaDate { get; set; }
public string Identifier { get; set; }
#endregion
#region abstract class implementation
public override List<DatabaseEntity> LoadList(IDataReader reader)
{
List<DatabaseEntity> result = new List<DatabaseEntity>();
while (reader.Read())
{
InfectedArea ia = new InfectedArea();
ia.id = reader.GetGuid(0);
if (!reader.IsDBNull(1)) ia.InfectedAreaPort = reader.GetString(1);
if (!reader.IsDBNull(2)) ia.InfectedAreaDate = reader.GetDateTime(2);
if (!reader.IsDBNull(3)) ia.Identifier = reader.GetString(3);
result.Add(ia);
}
reader.Close();
return result;
}
public override void PrepareLoadCommand(IDbCommand cmd, Message.LoadFilter filter, params object[] criteria)
{
string query = string.Format("SELECT Id, InfectedAreaPort, InfectedAreaDate, " +
"Identifier FROM {0} ", this.Tablename);
switch (filter)
{
case Message.LoadFilter.MDH_ID:
query += "WHERE MDH_Id = @MDHID";
if (!cmd.Parameters.Contains("@MDHID"))
((SqlCommand)cmd).Parameters.AddWithValue("@MDHID", criteria[0]);
break;
case Message.LoadFilter.ALL:
default:
break;
}
cmd.CommandText = query;
}
public override void PrepareSave(IDbCommand cmd)
{
SqlCommand scmd = cmd as SqlCommand;
scmd.Parameters.AddWithNullableValue("@P1", this.MDH.Id);
scmd.Parameters.AddWithNullableValue("@P2", this.InfectedAreaPort);
scmd.Parameters.AddWithNullableValue("@P3", this.InfectedAreaDate);
scmd.Parameters.AddWithNullableValue("@P4", this.Identifier);
if (this.IsNew)
{
this.CreateId();
scmd.Parameters.AddWithValue("@ID", this.Id);
scmd.CommandText = string.Format("INSERT INTO {0} (Id, MDH_Id, InfectedAreaPort, InfectedAreaDate, " +
"Identifier) VALUES (@ID, @P1, @P2, @P3, @P4)", this.Tablename);
}
else
{
scmd.CommandText = string.Format("UPDATE {0} SET InfectedAreaPort = @P2, InfectedAreaDate = @P3, " +
"WHERE Id = @ID", this.Tablename);
scmd.Parameters.AddWithNullableValue("@ID", this.Id);
}
}
#endregion
}
}

View File

@ -292,7 +292,27 @@ namespace bsmd.database
{
DBManager.Instance.Save(ia);
}
}
public SanitaryMeasuresDetail GetSanitaryMeasuresDetailWithIdentifier(string identifier)
{
foreach (SanitaryMeasuresDetail sd in this.sanitaryMeasuresDetails)
if (sd.Identifier.Equals(identifier)) return sd;
return null;
}
public StowawaysJoiningLocation GetStowawaysJoiningLocationWithIdentifier(string identifier)
{
foreach (StowawaysJoiningLocation sj in this.stowawaysJoiningLocations)
if (sj.Identifier.Equals(identifier)) return sj;
return null;
}
public InfectedArea GetInfectedAreaWithIdentifier(string identifier)
{
foreach (InfectedArea ia in this.infectedAreas)
if (ia.Identifier.Equals(identifier)) return ia;
return null;
}
#endregion

View File

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

View File

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

View File

@ -0,0 +1,113 @@
//
// Class: SanitaryMeasuresDetail
// Current CLR: 4.0.30319.34209
// System: Microsoft Visual Studio 14.0
// Author: dani
// Created: 2/23/2016 8:35:02 AM
//
// Copyright (c) 2016 Informatikbüro Daniel Schick. All rights reserved.
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Data;
namespace bsmd.database
{
public class SanitaryMeasuresDetail : DatabaseEntity, ISublistElement
{
public SanitaryMeasuresDetail()
{
this.tablename = "[dbo].[SanitaryMeasuresDetail]";
}
#region Properties
public MDH MDH { get; set; }
[ShowReport]
public string SanitaryMeasuresType { get; set; }
[ShowReport]
public string SanitaryMeasuresLocation { get; set; }
[ShowReport]
public DateTime? SanitaryMeasuresDate { get; set; }
public string Identifier { get; set; }
#endregion
#region abstract class implementation
public override void PrepareSave(IDbCommand cmd)
{
SqlCommand scmd = cmd as SqlCommand;
scmd.Parameters.AddWithNullableValue("@P1", this.MDH.Id);
scmd.Parameters.AddWithNullableValue("@P2", this.SanitaryMeasuresType);
scmd.Parameters.AddWithNullableValue("@P3", this.SanitaryMeasuresLocation);
scmd.Parameters.AddWithNullableValue("@P4", this.SanitaryMeasuresDate);
scmd.Parameters.AddWithNullableValue("@P5", this.Identifier);
if (this.IsNew)
{
this.CreateId();
scmd.Parameters.AddWithValue("@ID", this.Id);
scmd.CommandText = string.Format("INSERT INTO {0} (Id, MDH_Id, SanitaryMeasuresType, SanitaryMeasuresLocation, " +
"SanitaryMeasuresDate, Identifier) VALUES (@ID, @P1, @P2, @P3, @P4, @P5)", this.Tablename);
}
else
{
scmd.CommandText = string.Format("UPDATE {0} SET SanitaryMeasuresType = @P2, SanitaryMeasuresLocation = @P3, " +
"SanitaryMeasuresDate = @P4 WHERE Id = @ID", this.Tablename);
scmd.Parameters.AddWithNullableValue("@ID", this.Id);
}
}
public override void PrepareLoadCommand(IDbCommand cmd, Message.LoadFilter filter, params object[] criteria)
{
string query = string.Format("SELECT Id, SanitaryMeasuresType, SanitaryMeasuresLocation, " +
"SanitaryMeasuresDate, Identifier FROM {0} ", this.Tablename);
switch (filter)
{
case Message.LoadFilter.MDH_ID:
query += "WHERE MDH_Id = @MDHID";
if(!cmd.Parameters.Contains("@MDHID"))
((SqlCommand)cmd).Parameters.AddWithValue("@MDHID", 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())
{
SanitaryMeasuresDetail smd = new SanitaryMeasuresDetail();
smd.id = reader.GetGuid(0);
if (!reader.IsDBNull(1)) smd.SanitaryMeasuresType = reader.GetString(1);
if (!reader.IsDBNull(2)) smd.SanitaryMeasuresLocation = reader.GetString(2);
if (!reader.IsDBNull(3)) smd.SanitaryMeasuresDate = reader.GetDateTime(3);
if (!reader.IsDBNull(4)) smd.Identifier = reader.GetString(4);
result.Add(smd);
}
reader.Close();
return result;
}
#endregion
}
}

View File

@ -0,0 +1,101 @@
//
// Class: StowawaysJoiningLocation
// Current CLR: 4.0.30319.34209
// System: Microsoft Visual Studio 14.0
// Author: dani
// Created: 2/23/2016 8:35:02 AM
//
// Copyright (c) 2016 Informatikbüro Daniel Schick. All rights reserved.
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Data;
namespace bsmd.database
{
public class StowawaysJoiningLocation : DatabaseEntity, ISublistElement
{
public StowawaysJoiningLocation()
{
this.tablename = "[dbo].[StowawaysJoiningLocation]";
}
#region Properties
public MDH MDH { get; set; }
[ShowReport]
public string StowawayJoiningLocation { get; set; }
public string Identifier { get; set; }
#endregion
#region abstract class implementation
public override void PrepareSave(IDbCommand cmd)
{
SqlCommand scmd = cmd as SqlCommand;
scmd.Parameters.AddWithNullableValue("@P1", this.MDH.Id);
scmd.Parameters.AddWithNullableValue("@P2", this.StowawayJoiningLocation);
scmd.Parameters.AddWithNullableValue("@P3", this.Identifier);
if (this.IsNew)
{
this.CreateId();
scmd.Parameters.AddWithValue("@ID", this.Id);
scmd.CommandText = string.Format("INSERT INTO {0} (Id, MDH_Id, StowawaysJoiningLocation, " +
"Identifier) VALUES (@ID, @P1, @P2, @P3)", this.Tablename);
}
else
{
scmd.CommandText = string.Format("UPDATE {0} SET StowawaysJoiningLocation = @P2 WHERE Id = @ID", this.Tablename);
scmd.Parameters.AddWithNullableValue("@ID", this.Id);
}
}
public override void PrepareLoadCommand(IDbCommand cmd, Message.LoadFilter filter, params object[] criteria)
{
string query = string.Format("SELECT Id, StowawaysJoiningLocation, Identifier FROM {0} ", this.Tablename);
switch (filter)
{
case Message.LoadFilter.MDH_ID:
query += "WHERE MDH_Id = @MDHID";
if (!cmd.Parameters.Contains("@MDHID"))
((SqlCommand)cmd).Parameters.AddWithValue("@MDHID", 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())
{
StowawaysJoiningLocation sjl = new StowawaysJoiningLocation();
sjl.id = reader.GetGuid(0);
if (!reader.IsDBNull(1)) sjl.StowawayJoiningLocation = reader.GetString(1);
if (!reader.IsDBNull(2)) sjl.Identifier = reader.GetString(2);
result.Add(sjl);
}
reader.Close();
return result;
}
#endregion
}
}

View File

@ -21,10 +21,10 @@ namespace bsmd.dbh.ResponseService
[XmlSerializerFormatAttribute()]
void root(string Version, string MessageId, string VisitId, string TransitId, DateTime Timestamp,
string SenderReference, bsmd.dbh.response.RootType Type,
List<bsmd.dbh.response.RootReportingClassesFullReportingClass> ReportingClassesFull,
List<bsmd.dbh.response.RootReportingClassesPartialReportingClass> ReportingClassesPartial,
List<bsmd.dbh.response.RootReportingClassesErrorReportingClass> RootReportingClassesError,
List<bsmd.dbh.response.RootReportingClassesResettedReportingClass> ReportingClassesResetted,
List<bsmd.dbh.response.RootReportingClassesFull> ReportingClassesFull,
List<bsmd.dbh.response.RootReportingClassesPartial> ReportingClassesPartial,
List<bsmd.dbh.response.RootReportingClassesError> RootReportingClassesError,
List<bsmd.dbh.response.RootReportingClassesResetted> ReportingClassesResetted,
List<bsmd.dbh.response.RootMessage> Messages);
}

View File

@ -19,10 +19,10 @@ namespace bsmd.dbh.ResponseService
public void root(string Version, string MessageId, string VisitId, string TransitId, DateTime Timestamp,
string SenderReference, bsmd.dbh.response.RootType Type,
List<bsmd.dbh.response.RootReportingClassesFullReportingClass> ReportingClassesFull,
List<bsmd.dbh.response.RootReportingClassesPartialReportingClass> ReportingClassesPartial,
List<bsmd.dbh.response.RootReportingClassesErrorReportingClass> RootReportingClassesError,
List<bsmd.dbh.response.RootReportingClassesResettedReportingClass> ReportingClassesResetted,
List<bsmd.dbh.response.RootReportingClassesFull> ReportingClassesFull,
List<bsmd.dbh.response.RootReportingClassesPartial> ReportingClassesPartial,
List<bsmd.dbh.response.RootReportingClassesError> RootReportingClassesError,
List<bsmd.dbh.response.RootReportingClassesResetted> ReportingClassesResetted,
List<bsmd.dbh.response.RootMessage> Messages)
{

File diff suppressed because it is too large Load Diff

View File

@ -15,7 +15,6 @@ namespace bsmd.dbh.response
using System.IO;
using System.Text;
using System.Collections.Generic;
using System.Runtime.Serialization;
public partial class Root
@ -29,9 +28,9 @@ namespace bsmd.dbh.response
private string transitIdField;
private System.DateTime timestampField;
private List<string> sisNumbersField;
private string senderField;
private System.DateTime timestampField;
private string senderReferenceField;
@ -56,6 +55,7 @@ namespace bsmd.dbh.response
this.reportingClassesErrorField = new RootReportingClassesError();
this.reportingClassesPartialField = new RootReportingClassesPartial();
this.reportingClassesFullField = new RootReportingClassesFull();
this.sisNumbersField = new List<string>();
}
public string Version
@ -106,6 +106,19 @@ namespace bsmd.dbh.response
}
}
[System.Xml.Serialization.XmlArrayItemAttribute("SisNumber", IsNullable = false)]
public List<string> SisNumbers
{
get
{
return this.sisNumbersField;
}
set
{
this.sisNumbersField = value;
}
}
public System.DateTime Timestamp
{
get
@ -118,18 +131,6 @@ namespace bsmd.dbh.response
}
}
public string Sender
{
get
{
return this.senderField;
}
set
{
this.senderField = value;
}
}
public string SenderReference
{
get
@ -202,7 +203,7 @@ namespace bsmd.dbh.response
}
}
[System.Xml.Serialization.XmlArrayItemAttribute("Message", IsNullable = false, Namespace="")]
[System.Xml.Serialization.XmlArrayItemAttribute("Message", IsNullable = false)]
public List<RootMessage> Messages
{
get
@ -423,16 +424,16 @@ namespace bsmd.dbh.response
public partial class RootReportingClassesFull
{
private List<RootReportingClassesFullReportingClass> reportingClassField;
private List<ReportingClassCode> reportingClassField;
private static System.Xml.Serialization.XmlSerializer serializer;
public RootReportingClassesFull()
{
this.reportingClassField = new List<RootReportingClassesFullReportingClass>();
this.reportingClassField = new List<ReportingClassCode>();
}
public List<RootReportingClassesFullReportingClass> ReportingClass
public List<ReportingClassCode> ReportingClass
{
get
{
@ -630,7 +631,7 @@ namespace bsmd.dbh.response
#endregion
}
public enum RootReportingClassesFullReportingClass
public enum ReportingClassCode
{
/// <remarks/>
@ -645,6 +646,9 @@ namespace bsmd.dbh.response
/// <remarks/>
SEC,
/// <remarks/>
AGNT,
/// <remarks/>
POBA,
@ -712,16 +716,16 @@ namespace bsmd.dbh.response
public partial class RootReportingClassesPartial
{
private List<RootReportingClassesPartialReportingClass> reportingClassField;
private List<ReportingClassCode> reportingClassField;
private static System.Xml.Serialization.XmlSerializer serializer;
public RootReportingClassesPartial()
{
this.reportingClassField = new List<RootReportingClassesPartialReportingClass>();
this.reportingClassField = new List<ReportingClassCode>();
}
public List<RootReportingClassesPartialReportingClass> ReportingClass
public List<ReportingClassCode> ReportingClass
{
get
{
@ -919,98 +923,19 @@ namespace bsmd.dbh.response
#endregion
}
public enum RootReportingClassesPartialReportingClass
{
/// <remarks/>
NOA_NOD,
/// <remarks/>
ATA,
/// <remarks/>
ATD,
/// <remarks/>
SEC,
/// <remarks/>
POBA,
/// <remarks/>
POBD,
/// <remarks/>
NAME,
/// <remarks/>
TIEFA,
/// <remarks/>
TIEFD,
/// <remarks/>
BKRA,
/// <remarks/>
BKRD,
/// <remarks/>
STAT,
/// <remarks/>
LADG,
/// <remarks/>
INFO,
/// <remarks/>
SERV,
/// <remarks/>
PRE72H,
/// <remarks/>
MDH,
/// <remarks/>
WAS,
/// <remarks/>
CREW,
/// <remarks/>
PAS,
/// <remarks/>
BPOL,
/// <remarks/>
TOWA,
/// <remarks/>
TOWD,
/// <remarks/>
HAZA,
/// <remarks/>
HAZD,
}
public partial class RootReportingClassesError
{
private List<RootReportingClassesErrorReportingClass> reportingClassField;
private List<ReportingClassCode> reportingClassField;
private static System.Xml.Serialization.XmlSerializer serializer;
public RootReportingClassesError()
{
this.reportingClassField = new List<RootReportingClassesErrorReportingClass>();
this.reportingClassField = new List<ReportingClassCode>();
}
public List<RootReportingClassesErrorReportingClass> ReportingClass
public List<ReportingClassCode> ReportingClass
{
get
{
@ -1208,98 +1133,19 @@ namespace bsmd.dbh.response
#endregion
}
public enum RootReportingClassesErrorReportingClass
{
/// <remarks/>
NOA_NOD,
/// <remarks/>
ATA,
/// <remarks/>
ATD,
/// <remarks/>
SEC,
/// <remarks/>
POBA,
/// <remarks/>
POBD,
/// <remarks/>
NAME,
/// <remarks/>
TIEFA,
/// <remarks/>
TIEFD,
/// <remarks/>
BKRA,
/// <remarks/>
BKRD,
/// <remarks/>
STAT,
/// <remarks/>
LADG,
/// <remarks/>
INFO,
/// <remarks/>
SERV,
/// <remarks/>
PRE72H,
/// <remarks/>
MDH,
/// <remarks/>
WAS,
/// <remarks/>
CREW,
/// <remarks/>
PAS,
/// <remarks/>
BPOL,
/// <remarks/>
TOWA,
/// <remarks/>
TOWD,
/// <remarks/>
HAZA,
/// <remarks/>
HAZD,
}
public partial class RootReportingClassesResetted
{
private List<RootReportingClassesResettedReportingClass> reportingClassField;
private List<ReportingClassCode> reportingClassField;
private static System.Xml.Serialization.XmlSerializer serializer;
public RootReportingClassesResetted()
{
this.reportingClassField = new List<RootReportingClassesResettedReportingClass>();
this.reportingClassField = new List<ReportingClassCode>();
}
public List<RootReportingClassesResettedReportingClass> ReportingClass
public List<ReportingClassCode> ReportingClass
{
get
{
@ -1497,88 +1343,6 @@ namespace bsmd.dbh.response
#endregion
}
public enum RootReportingClassesResettedReportingClass
{
/// <remarks/>
NOA_NOD,
/// <remarks/>
ATA,
/// <remarks/>
ATD,
/// <remarks/>
SEC,
/// <remarks/>
POBA,
/// <remarks/>
POBD,
/// <remarks/>
NAME,
/// <remarks/>
TIEFA,
/// <remarks/>
TIEFD,
/// <remarks/>
BKRA,
/// <remarks/>
BKRD,
/// <remarks/>
STAT,
/// <remarks/>
LADG,
/// <remarks/>
INFO,
/// <remarks/>
SERV,
/// <remarks/>
PRE72H,
/// <remarks/>
MDH,
/// <remarks/>
WAS,
/// <remarks/>
CREW,
/// <remarks/>
PAS,
/// <remarks/>
BPOL,
/// <remarks/>
TOWA,
/// <remarks/>
TOWD,
/// <remarks/>
HAZA,
/// <remarks/>
HAZD,
}
[XmlType(TypeName = "Message")]
public partial class RootMessage
{

View File

@ -15,7 +15,11 @@
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="MessageId" type="xs:string" />
<xs:element name="MessageId" type="xs:string">
<xs:annotation>
<xs:documentation>Unique message identifier.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" name="VisitId">
<xs:annotation>
<xs:documentation>Required when TransitId is missing and field "Type" is not "VISIT or "TRANSIT"</xs:documentation>
@ -38,13 +42,41 @@
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element minOccurs="0" name="SisNumbers">
<xs:annotation>
<xs:documentation>A list of SIS numbers. An empty list means that all sent numbers will be deleted. Sending a new list overwrites existing ones completely.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="SisNumber">
<xs:annotation>
<xs:documentation>One SIS number</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="[A-Z0-9]{4}" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Timestamp" type="xs:dateTime">
<xs:annotation>
<xs:documentation>Timestamp, when the message is sent</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="Sender" type="xs:string"/>
<xs:element name="SenderReference" type="xs:string"/>
<xs:element minOccurs="0" name="SenderReference">
<xs:annotation>
<xs:documentation>A customer reference that can be freely filled and will be send back in the following response. No checks are made on this field. When a new Visit- or TransitId is obtained, it should be used as a reference to match the response to its corresponding request.</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="35" />
<xs:minLength value="0" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Type">
<xs:annotation>
<xs:documentation>The message type (should be the same as in the request message):
@ -70,39 +102,10 @@
</xs:annotation>
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="ReportingClass">
<xs:element name="ReportingClass" type="ReportingClassCode">
<xs:annotation>
<xs:documentation>The code of a reporting class.</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="NOA_NOD" />
<xs:enumeration value="ATA" />
<xs:enumeration value="ATD" />
<xs:enumeration value="SEC" />
<xs:enumeration value="POBA" />
<xs:enumeration value="POBD" />
<xs:enumeration value="NAME" />
<xs:enumeration value="TIEFA" />
<xs:enumeration value="TIEFD" />
<xs:enumeration value="BKRA" />
<xs:enumeration value="BKRD" />
<xs:enumeration value="STAT" />
<xs:enumeration value="LADG" />
<xs:enumeration value="INFO" />
<xs:enumeration value="SERV" />
<xs:enumeration value="PRE72H" />
<xs:enumeration value="MDH" />
<xs:enumeration value="WAS" />
<xs:enumeration value="CREW" />
<xs:enumeration value="PAS" />
<xs:enumeration value="BPOL" />
<xs:enumeration value="TOWA" />
<xs:enumeration value="TOWD" />
<xs:enumeration value="HAZA" />
<xs:enumeration value="HAZD" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
@ -113,39 +116,10 @@
</xs:annotation>
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="ReportingClass">
<xs:element name="ReportingClass" type="ReportingClassCode">
<xs:annotation>
<xs:documentation>The code of a reporting class.</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="NOA_NOD" />
<xs:enumeration value="ATA" />
<xs:enumeration value="ATD" />
<xs:enumeration value="SEC" />
<xs:enumeration value="POBA" />
<xs:enumeration value="POBD" />
<xs:enumeration value="NAME" />
<xs:enumeration value="TIEFA" />
<xs:enumeration value="TIEFD" />
<xs:enumeration value="BKRA" />
<xs:enumeration value="BKRD" />
<xs:enumeration value="STAT" />
<xs:enumeration value="LADG" />
<xs:enumeration value="INFO" />
<xs:enumeration value="SERV" />
<xs:enumeration value="PRE72H" />
<xs:enumeration value="MDH" />
<xs:enumeration value="WAS" />
<xs:enumeration value="CREW" />
<xs:enumeration value="PAS" />
<xs:enumeration value="BPOL" />
<xs:enumeration value="TOWA" />
<xs:enumeration value="TOWD" />
<xs:enumeration value="HAZA" />
<xs:enumeration value="HAZD" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
@ -156,39 +130,10 @@
</xs:annotation>
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="ReportingClass">
<xs:element name="ReportingClass" type="ReportingClassCode">
<xs:annotation>
<xs:documentation>The code of a reporting class.</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="NOA_NOD" />
<xs:enumeration value="ATA" />
<xs:enumeration value="ATD" />
<xs:enumeration value="SEC" />
<xs:enumeration value="POBA" />
<xs:enumeration value="POBD" />
<xs:enumeration value="NAME" />
<xs:enumeration value="TIEFA" />
<xs:enumeration value="TIEFD" />
<xs:enumeration value="BKRA" />
<xs:enumeration value="BKRD" />
<xs:enumeration value="STAT" />
<xs:enumeration value="LADG" />
<xs:enumeration value="INFO" />
<xs:enumeration value="SERV" />
<xs:enumeration value="PRE72H" />
<xs:enumeration value="MDH" />
<xs:enumeration value="WAS" />
<xs:enumeration value="CREW" />
<xs:enumeration value="PAS" />
<xs:enumeration value="BPOL" />
<xs:enumeration value="TOWA" />
<xs:enumeration value="TOWD" />
<xs:enumeration value="HAZA" />
<xs:enumeration value="HAZD" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
@ -199,39 +144,10 @@
</xs:annotation>
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="ReportingClass">
<xs:element name="ReportingClass" type="ReportingClassCode">
<xs:annotation>
<xs:documentation>The code of a reporting class.</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="NOA_NOD" />
<xs:enumeration value="ATA" />
<xs:enumeration value="ATD" />
<xs:enumeration value="SEC" />
<xs:enumeration value="POBA" />
<xs:enumeration value="POBD" />
<xs:enumeration value="NAME" />
<xs:enumeration value="TIEFA" />
<xs:enumeration value="TIEFD" />
<xs:enumeration value="BKRA" />
<xs:enumeration value="BKRD" />
<xs:enumeration value="STAT" />
<xs:enumeration value="LADG" />
<xs:enumeration value="INFO" />
<xs:enumeration value="SERV" />
<xs:enumeration value="PRE72H" />
<xs:enumeration value="MDH" />
<xs:enumeration value="WAS" />
<xs:enumeration value="CREW" />
<xs:enumeration value="PAS" />
<xs:enumeration value="BPOL" />
<xs:enumeration value="TOWA" />
<xs:enumeration value="TOWD" />
<xs:enumeration value="HAZA" />
<xs:enumeration value="HAZD" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
@ -252,8 +168,8 @@
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="3" />
<xs:maxLength value="6" />
<xs:pattern value="([A-Z]{0,3}[1-9][0-9]{2})" />
<xs:maxLength value="4" />
<xs:pattern value="([1-9][0-9]{2,3})" />
</xs:restriction>
</xs:simpleType>
</xs:element>
@ -295,4 +211,34 @@
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:simpleType name="ReportingClassCode">
<xs:restriction base="xs:string">
<xs:enumeration value="NOA_NOD" />
<xs:enumeration value="ATA" />
<xs:enumeration value="ATD" />
<xs:enumeration value="SEC" />
<xs:enumeration value="AGNT" />
<xs:enumeration value="POBA" />
<xs:enumeration value="POBD" />
<xs:enumeration value="NAME" />
<xs:enumeration value="TIEFA" />
<xs:enumeration value="TIEFD" />
<xs:enumeration value="BKRA" />
<xs:enumeration value="BKRD" />
<xs:enumeration value="STAT" />
<xs:enumeration value="LADG" />
<xs:enumeration value="INFO" />
<xs:enumeration value="SERV" />
<xs:enumeration value="PRE72H" />
<xs:enumeration value="MDH" />
<xs:enumeration value="WAS" />
<xs:enumeration value="CREW" />
<xs:enumeration value="PAS" />
<xs:enumeration value="BPOL" />
<xs:enumeration value="TOWA" />
<xs:enumeration value="TOWD" />
<xs:enumeration value="HAZA" />
<xs:enumeration value="HAZD" />
</xs:restriction>
</xs:simpleType>
</xs:schema>

View File

@ -24,7 +24,7 @@ namespace bsmd.dbh
{
if (message == null) return false;
RootType rootType = RootType.DATA;
DBHWebReference.RootType rootType = DBHWebReference.RootType.DATA;
if (message.ReportingParty == null)
{
@ -59,14 +59,14 @@ namespace bsmd.dbh
rp.RPStreetAndNumber = message.ReportingParty.StreetAndNumber;
rp.RPTypeSpecified = message.ReportingParty.ReportingPartyType.HasValue;
if (rp.RPTypeSpecified)
rp.RPType = (ReportingPartyRPType) message.ReportingParty.ReportingPartyType.Value;
rp.RPType = (DBHWebReference.ReportingPartyRPType) message.ReportingParty.ReportingPartyType.Value;
DateTime timestamp = DateTime.Now;
string version = "1.0";
object item = null;
string senderReference = message.Id.Value.ToString("N");
ItemChoiceType2 itemChoiceType2 = ItemChoiceType2.Visit;
DBHWebReference.ItemChoiceType2 itemChoiceType2 = DBHWebReference.ItemChoiceType2.Visit;
switch (message.MessageNotificationClass)
{
@ -74,17 +74,17 @@ namespace bsmd.dbh
#region VISIT
case Message.NotificationClass.VISIT:
{
RootVisit rootVisit = new RootVisit();
rootType = RootType.VISIT;
DBHWebReference.RootVisit rootVisit = new DBHWebReference.RootVisit();
rootType = DBHWebReference.RootType.VISIT;
if (message.MessageCore.IMO != null)
{
rootVisit.ItemElementName = ItemChoiceType.IMONumber;
rootVisit.ItemElementName = DBHWebReference.ItemChoiceType.IMONumber;
rootVisit.Item = message.MessageCore.IMO;
}
else
{
rootVisit.ItemElementName = ItemChoiceType.ENINumber;
rootVisit.ItemElementName = DBHWebReference.ItemChoiceType.ENINumber;
rootVisit.Item = message.MessageCore.ENI;
}
@ -99,18 +99,18 @@ namespace bsmd.dbh
#region TRANSIT
case Message.NotificationClass.TRANSIT:
{
RootTransit rootTransit = new RootTransit();
rootType = RootType.TRANSIT;
itemChoiceType2 = ItemChoiceType2.Transit;
DBHWebReference.RootTransit rootTransit = new DBHWebReference.RootTransit();
rootType = DBHWebReference.RootType.TRANSIT;
itemChoiceType2 = DBHWebReference.ItemChoiceType2.Transit;
if (message.MessageCore.IMO != null)
{
rootTransit.ItemElementName = ItemChoiceType1.IMONumber;
rootTransit.ItemElementName = DBHWebReference.ItemChoiceType1.IMONumber;
rootTransit.Item = message.MessageCore.IMO;
}
else
{
rootTransit.ItemElementName = ItemChoiceType1.ENINumber;
rootTransit.ItemElementName = DBHWebReference.ItemChoiceType1.ENINumber;
rootTransit.Item = message.MessageCore.ENI;
}
@ -130,12 +130,12 @@ namespace bsmd.dbh
RootNOA_NOD rootNoaNod = new RootNOA_NOD();
if (noa_nod.ETAToNextPort.HasValue)
rootNoaNod.ETAToNextPort = noa_nod.ETAToNextPort.Value;
rootNoaNod.ETAToNextPortSpecified = noa_nod.ETAToNextPort.HasValue;
rootNoaNod.ETAToNextPort = noa_nod.ETAToNextPort.Value.ToDBHDateString();
// rootNoaNod.ETAToNextPortSpecified = noa_nod.ETAToNextPort.HasValue;
if (noa_nod.ETDFromLastPort.HasValue)
rootNoaNod.ETDFromLastPort = noa_nod.ETDFromLastPort.Value;
rootNoaNod.ETDFromLastPortSpecified = noa_nod.ETDFromLastPort.HasValue;
if ((noa_nod.ETDFromLastPort.HasValue) && (!noa_nod.LastPort.Equals("ZZUKN", StringComparison.OrdinalIgnoreCase)))
rootNoaNod.ETDFromLastPort = noa_nod.ETDFromLastPort.Value.ToDBHDateString();
// rootNoaNod.ETDFromLastPortSpecified = noa_nod.ETDFromLastPort.HasValue;
rootNoaNod.LastPort = noa_nod.LastPort;
rootNoaNod.NextPort = noa_nod.NextPort;
@ -190,6 +190,31 @@ namespace bsmd.dbh
}
#endregion
#region AGNT
case Message.NotificationClass.AGNT:
{
AGNT agnt = message.Elements[0] as AGNT;
if (agnt != null)
{
RootAGNT rootAGNT = new RootAGNT();
rootAGNT.AgentCity = agnt.AgentCity;
rootAGNT.AgentCompanyName = agnt.AgentCompanyName;
rootAGNT.AgentCountry = agnt.AgentCountry;
rootAGNT.AgentEMail = agnt.AgentEMail;
rootAGNT.AgentFax = agnt.AgentFax;
rootAGNT.AgentFirstName = agnt.AgentFirstName;
rootAGNT.AgentLastName = agnt.AgentLastName;
rootAGNT.AgentPhone = agnt.AgentPhone;
rootAGNT.AgentPostalCode = agnt.AgentPostalCode;
rootAGNT.AgentStreetAndNumber = agnt.AgentStreetAndNumber;
item = rootAGNT;
}
break;
}
#endregion
#region ATA
case Message.NotificationClass.ATA:
{
@ -198,7 +223,7 @@ namespace bsmd.dbh
{
RootATA rootATA = new RootATA();
if (ata.ATAPortOfCall.HasValue)
rootATA.ATAPortOfCall = ata.ATAPortOfCall.Value;
rootATA.ATAPortOfCall = ata.ATAPortOfCall.Value.ToDBHDateString();
item = rootATA;
}
break;
@ -212,7 +237,7 @@ namespace bsmd.dbh
if (atd != null)
{
RootATD rootATD = new RootATD();
rootATD.ATDPortOfCall = atd.ATDPortOfCall.Value;
rootATD.ATDPortOfCall = atd.ATDPortOfCall.Value.ToDBHDateString();
item = rootATD;
}
break;
@ -225,10 +250,13 @@ namespace bsmd.dbh
RootSEC rootSEC = new RootSEC();
SEC sec = message.Elements[0] as SEC;
int numFields = (sec.SECSimplification ?? false) ?
2 : (15 + sec.LastTenPortFacilitesCalled.Count + sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Count);
2 : (14 + sec.LastTenPortFacilitesCalled.Count + sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Count);
rootSEC.Items = new object[numFields];
rootSEC.ItemsElementName = new ItemsChoiceType1[numFields];
rootSEC.CurrentShipSecurityLevel = (int)sec.CurrentShipSecurityLevel.Value;
if (sec.SECSimplification ?? false)
{
rootSEC.ItemsElementName[0] = ItemsChoiceType1.SECSimplification;
@ -257,21 +285,20 @@ namespace bsmd.dbh
rootSEC.Items[7] = sec.ISSCDateOfExpiration.Value;
rootSEC.ItemsElementName[8] = ItemsChoiceType1.ApprovedSecurityPlanOnBoard;
rootSEC.Items[8] = sec.ApprovedSecurityPlanOnBoard ?? false ? RootSECApprovedSecurityPlanOnBoard.Y : RootSECApprovedSecurityPlanOnBoard.N;
rootSEC.ItemsElementName[9] = ItemsChoiceType1.CurrentShipSecurityLevel;
if (sec.CurrentShipSecurityLevel.HasValue) rootSEC.Items[9] = (int)sec.CurrentShipSecurityLevel.Value;
rootSEC.ItemsElementName[10] = ItemsChoiceType1.PortFacilityOfArrival;
rootSEC.Items[10] = sec.PortFacilityOfArrival;
rootSEC.ItemsElementName[11] = ItemsChoiceType1.GeneralDescriptionOfCargo;
rootSEC.ItemsElementName[9] = ItemsChoiceType1.PortFacilityOfArrival;
rootSEC.Items[9] = sec.PortFacilityOfArrival;
rootSEC.ItemsElementName[10] = ItemsChoiceType1.GeneralDescriptionOfCargo;
if (sec.GeneralDescriptionOfCargo.HasValue)
rootSEC.Items[11] = (RootSECGeneralDescriptionOfCargo)sec.GeneralDescriptionOfCargo.Value;
rootSEC.ItemsElementName[12] = ItemsChoiceType1.ReasonsForNoValidISSC;
rootSEC.Items[12] = sec.ReasonsForNoValidISSC;
rootSEC.ItemsElementName[13] = ItemsChoiceType1.ISSCIssuerType;
rootSEC.Items[13] = (RootSECISSCIssuerType) (sec.ISSCIssuerType ?? 0);
rootSEC.ItemsElementName[14] = ItemsChoiceType1.CSOEMail;
rootSEC.Items[14] = sec.CSOEMail;
rootSEC.Items[10] = (RootSECGeneralDescriptionOfCargo)sec.GeneralDescriptionOfCargo.Value;
rootSEC.ItemsElementName[11] = ItemsChoiceType1.ReasonsForNoValidISSC;
rootSEC.Items[11] = sec.ReasonsForNoValidISSC;
rootSEC.ItemsElementName[12] = ItemsChoiceType1.ISSCIssuerType;
rootSEC.Items[12] = (RootSECISSCIssuerType) (sec.ISSCIssuerType ?? 0);
rootSEC.ItemsElementName[13] = ItemsChoiceType1.CSOEMail;
rootSEC.Items[13] = sec.CSOEMail;
int index = 15;
int index = 14;
for (int i=0; i < sec.LastTenPortFacilitesCalled.Count; index++, i++)
{
rootSEC.ItemsElementName[index] = ItemsChoiceType1.LastTenPortFacilitiesCalled;
@ -292,7 +319,7 @@ namespace bsmd.dbh
for (int i = 0; i < sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Count; index++, i++ )
{
rootSEC.ItemsElementName[index] = ItemsChoiceType1.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled;
rootSEC.ItemsElementName[index] = ItemsChoiceType1.ShipToShipActivities;
RootSECShipToShipActivitiesDuringLastTenPortFacilitiesCalled s2s = new RootSECShipToShipActivitiesDuringLastTenPortFacilitiesCalled();
rootSEC.Items[index] = s2s;
s2s.ShipToShipActivityLocation = new RootSECShipToShipActivitiesDuringLastTenPortFacilitiesCalledShipToShipActivityLocation();
@ -332,14 +359,14 @@ namespace bsmd.dbh
{
RootBPOLPortOfItinerary port = new RootBPOLPortOfItinerary();
if (bpol.PortOfItineraries[i].PortOfItineraryETA.HasValue)
port.PortOfItineraryETA = bpol.PortOfItineraries[i].PortOfItineraryETA.Value;
port.PortOfItineraryETA = bpol.PortOfItineraries[i].PortOfItineraryETA.Value.ToDBHDateString();
port.PortOfItineraryName = bpol.PortOfItineraries[i].PortOfItineraryName;
poiArray[i] = port;
}
if (bpol.StowawaysOnBoard.HasValue)
rootBPOL.StowawayOnBoard = bpol.StowawaysOnBoard.Value ?
RootBPOLStowawayOnBoard.Y : RootBPOLStowawayOnBoard.N;
RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N;
item = rootBPOL;
}
@ -364,10 +391,10 @@ namespace bsmd.dbh
rootCREW.CrewMember[i].CrewMemberFirstName = crew.CrewMemberFirstName;
rootCREW.CrewMember[i].CrewMemberGenderSpecified = crew.CrewMemberGender.HasValue;
if (crew.CrewMemberGender.HasValue)
rootCREW.CrewMember[i].CrewMemberGender = (RootCREWCrewMemberCrewMemberGender)crew.CrewMemberGender.Value;
rootCREW.CrewMember[i].CrewMemberGender = (Gender)crew.CrewMemberGender.Value;
rootCREW.CrewMember[i].CrewMemberIdentityDocumentId = crew.CrewMemberIdentityDocumentId;
if (crew.CrewMemberIdentityDocumentType.HasValue)
rootCREW.CrewMember[i].CrewMemberIdentityDocumentType = (RootCREWCrewMemberCrewMemberIdentityDocumentType)crew.CrewMemberIdentityDocumentType.Value;
rootCREW.CrewMember[i].CrewMemberIdentityDocumentType = (IdDocType)crew.CrewMemberIdentityDocumentType.Value;
rootCREW.CrewMember[i].CrewMemberLastName = crew.CrewMemberLastName;
rootCREW.CrewMember[i].CrewMemberNationality = crew.CrewMemberNationality;
rootCREW.CrewMember[i].CrewMemberPlaceOfBirth = crew.CrewMemberPlaceOfBirth;
@ -395,15 +422,15 @@ namespace bsmd.dbh
rootPAS.Passenger[i].PassengerDateOfBirth = pas.PassengerDateOfBirth.Value;
rootPAS.Passenger[i].PassengerGenderSpecified = pas.PassengerGender.HasValue;
if (pas.PassengerGender.HasValue)
rootPAS.Passenger[i].PassengerGender = (RootPASPassengerPassengerGender) pas.PassengerGender.Value;
rootPAS.Passenger[i].PassengerGender = (Gender) pas.PassengerGender.Value;
rootPAS.Passenger[i].PassengerNationality = pas.PassengerNationality;
if (pas.PassengerIdentityDocumentType.HasValue)
rootPAS.Passenger[i].PassengerIdentityDocumentType = (RootPASPassengerPassengerIdentityDocumentType)pas.PassengerIdentityDocumentType.Value;
rootPAS.Passenger[i].PassengerIdentityDocumentType = (IdDocType)pas.PassengerIdentityDocumentType.Value;
rootPAS.Passenger[i].PassengerIdentityDocumentId = pas.PassengerIdentityDocumentId;
rootPAS.Passenger[i].PassengerVisaNumber = pas.PassengerVisaNumber;
rootPAS.Passenger[i].PassengerPortOfEmbarkation = pas.PassengerPortOfEmbarkation;
rootPAS.Passenger[i].PassengerPortOfDisembarkation = pas.PassengerPortOfDisembarkation;
rootPAS.Passenger[i].PassengerInTransit = pas.PassengerInTransit ?? false ? RootPASPassengerPassengerInTransit.Y : RootPASPassengerPassengerInTransit.N;
rootPAS.Passenger[i].PassengerInTransit = pas.PassengerInTransit ?? false ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N;
}
item = rootPAS;
}
@ -421,7 +448,7 @@ namespace bsmd.dbh
{
BRKA bkra = message.Elements[i] as BRKA;
rootBKRA.BunkerFuelArrival[i] = new RootBKRABunkerFuelArrival();
rootBKRA.BunkerFuelArrival[i].BunkerFuelQuantity_TNE = (float) (bkra.BunkerFuelQuantity_TNE ?? 0);
rootBKRA.BunkerFuelArrival[i].BunkerFuelQuantity_TNE = (decimal) (bkra.BunkerFuelQuantity_TNE ?? 0);
rootBKRA.BunkerFuelArrival[i].BunkerFuelType = bkra.BunkerFuelType;
}
item = rootBKRA;
@ -440,7 +467,7 @@ namespace bsmd.dbh
{
BRKD bkrd = message.Elements[i] as BRKD;
rootBKRD.BunkerFuelDeparture[i] = new RootBKRDBunkerFuelDeparture();
rootBKRD.BunkerFuelDeparture[i].BunkerFuelQuantity_TNE = (float) (bkrd.BunkerFuelQuantity_TNE ?? 0);
rootBKRD.BunkerFuelDeparture[i].BunkerFuelQuantity_TNE = (decimal) (bkrd.BunkerFuelQuantity_TNE ?? 0);
rootBKRD.BunkerFuelDeparture[i].BunkerFuelType = bkrd.BunkerFuelType;
}
item = rootBKRD;
@ -453,7 +480,7 @@ namespace bsmd.dbh
{
RootTIEFA rootTIEFA = new RootTIEFA();
TIEFA tiefa = message.Elements[0] as TIEFA;
rootTIEFA.DraughtUponArrival_DMT = (float) (tiefa.DraughtUponArrival_DMT ?? 0);
rootTIEFA.DraughtUponArrival_DMT = (decimal) (tiefa.DraughtUponArrival_DMT ?? 0);
item = rootTIEFA;
}
break;
@ -464,7 +491,7 @@ namespace bsmd.dbh
{
RootTIEFD rootTIEFD = new RootTIEFD();
TIEFD tiefd = message.Elements[0] as TIEFD;
rootTIEFD.DraughtUponDeparture_DMT = (float) (tiefd.DraughtUponDeparture_DMT ?? 0);
rootTIEFD.DraughtUponDeparture_DMT = (decimal) (tiefd.DraughtUponDeparture_DMT ?? 0);
item = rootTIEFD;
}
break;
@ -518,11 +545,20 @@ namespace bsmd.dbh
rootStat.CallSign = stat.CallSign;
rootStat.MMSINumber = stat.MMSINumber;
rootStat.Flag = stat.Flag;
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.LengthOverall_MTR.HasValue) rootStat.LengthOverall_MTR = (decimal) (stat.LengthOverall_MTR.Value);
if (stat.Beam_MTR.HasValue) rootStat.Beam_MTR = (decimal) (stat.Beam_MTR.Value);
if (stat.GrossTonnage.HasValue) rootStat.GrossTonnage = stat.GrossTonnage.Value;
rootStat.PortOfRegistry = stat.PortOfRegistry;
rootStat.ShipType = stat.ShipType;
rootStat.InmarsatCallNumber = stat.InmarsatCallNumber;
RootSTATTransportMode transportMode;
if(Enum.TryParse<RootSTATTransportMode>(stat.TransportMode, out transportMode))
{
rootStat.TransportMode = transportMode;
} else
{
_log.WarnFormat("failed to parse transportmode {0}", stat.TransportMode);
}
if (!stat.ISMCompanyName.IsNullOrEmpty())
{
rootStat.ISMCompany = new RootSTATISMCompany();
@ -548,10 +584,10 @@ namespace bsmd.dbh
LADG ladg = message.Elements[i] as LADG;
rootLADG.Cargo[i] = new RootLADGCargo();
if(ladg.CargoHandlingType.HasValue)
rootLADG.Cargo[i].CargoHandlingType = (RootLADGCargoCargoHandlingType)(ladg.CargoHandlingType);
rootLADG.Cargo[i].CargoHandlingType = (HandlingType)(ladg.CargoHandlingType);
rootLADG.Cargo[i].CargoCodeNST = ladg.CargoCodeNST;
if (ladg.CargoGrossQuantity_TNE.HasValue)
rootLADG.Cargo[i].CargoGrossQuantity_TNE = (float) ladg.CargoGrossQuantity_TNE.Value;
rootLADG.Cargo[i].CargoGrossQuantity_TNE = (decimal) ladg.CargoGrossQuantity_TNE.Value;
rootLADG.Cargo[i].CargoNumberOfItemsSpecified = ladg.CargoNumberOfItems.HasValue;
if (ladg.CargoNumberOfItems.HasValue)
rootLADG.Cargo[i].CargoNumberOfItems = ladg.CargoNumberOfItems.Value;
@ -567,7 +603,8 @@ namespace bsmd.dbh
RootINFO rootInfo = new RootINFO();
INFO info = message.Elements[0] as INFO;
if (info.ShippingArea.HasValue)
rootInfo.ShippingArea = (RootINFOShippingArea)info.ShippingArea.Value;
rootInfo.ShippingArea = (ShippingArea)info.ShippingArea.Value;
rootInfo.PortArea = info.PortArea;
rootInfo.RequestedPositionInPortOfCall = info.RequestedPositionInPortOfCall;
rootInfo.SpecialRequirementsOfShipAtBerth = info.SpecialRequirementsOfShipAtBerth;
if(info.SpecialRequirementsOfShipAtBerth.IsNullOrEmpty())
@ -576,13 +613,15 @@ namespace bsmd.dbh
// Name des Agenten eintragen
}
rootInfo.ConstructionCharacteristicsOfShip = info.ConstructionCharacteristicsOfShip;
rootInfo.BowThrusterPower = info.BowThrusterPower;
rootInfo.SternThrusterPower = info.SternThrusterPower;
if (info.FumigatedBulkCargo.HasValue)
rootInfo.FumigatedBulkCargo = (info.FumigatedBulkCargo.Value == 0) ? RootINFOFumigatedBulkCargo.Y : RootINFOFumigatedBulkCargo.N;
else
rootInfo.FumigatedBulkCargo = RootINFOFumigatedBulkCargo.N;
rootInfo.DeadWeightSummer_TNESpecified = info.DeplacementSummerDraught_TNE.HasValue;
if (info.DeplacementSummerDraught_TNE.HasValue)
rootInfo.DeadWeightSummer_TNE = (float) info.DeplacementSummerDraught_TNE.Value;
rootInfo.DeadWeightSummer_TNE = (decimal) info.DeplacementSummerDraught_TNE.Value;
item = rootInfo;
}
break;
@ -611,26 +650,26 @@ namespace bsmd.dbh
{
RootPRE72H rootPre = new RootPRE72H();
PRE72H pre72h = message.Elements[0] as PRE72H;
rootPre.Tanker = pre72h.Tanker ?? false ? RootPRE72HTanker.Y : RootPRE72HTanker.N;
rootPre.Tanker = pre72h.Tanker ?? false ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N;
if (pre72h.Tanker ?? false)
{
rootPre.TankerDetails = new RootPRE72HTankerDetails();
if (pre72h.TankerHullConfiguration.HasValue)
rootPre.TankerDetails.TankerHullConfiguration = (RootPRE72HTankerDetailsTankerHullConfiguration)pre72h.TankerHullConfiguration.Value;
rootPre.TankerDetails.TankerHullConfiguration = (HullConfiguration)pre72h.TankerHullConfiguration.Value;
if (pre72h.ConditionCargoBallastTanks.HasValue)
rootPre.TankerDetails.ConditionCargoBallastTanks = (RootPRE72HTankerDetailsConditionCargoBallastTanks)pre72h.ConditionCargoBallastTanks.Value;
rootPre.TankerDetails.ConditionCargoBallastTanks = (TankCondition)pre72h.ConditionCargoBallastTanks.Value;
rootPre.TankerDetails.NatureOfCargo = pre72h.NatureOfCargo;
rootPre.TankerDetails.VolumeOfCargo_TNESpecified = pre72h.VolumeOfCargo.HasValue;
}
if (pre72h.VolumeOfCargo.HasValue)
rootPre.TankerDetails.VolumeOfCargo_TNE = (float) (pre72h.VolumeOfCargo.Value);
rootPre.TankerDetails.VolumeOfCargo_TNE = (decimal) (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 = (float) (pre72h.PlannedPeriodOfStay_HUR.Value);
rootPre.PlannedPeriodOfStay_HUR = (decimal) (pre72h.PlannedPeriodOfStay_HUR.Value);
item = rootPre;
}
@ -697,20 +736,26 @@ namespace bsmd.dbh
if (mdh.SanitaryMeasuresApplied ?? false)
{
choiceTypes2.Add(ItemsChoiceType2.SanitaryMeasuresDetails);
RootMDHSanitaryMeasuresDetails smDet = new RootMDHSanitaryMeasuresDetails();
if (mdh.SanitaryMeasuresDate.HasValue)
smDet.SanitaryMeasuresDate = mdh.SanitaryMeasuresDate.Value;
smDet.SanitaryMeasuresType = mdh.SanitaryMeasuresType;
smDet.SanitaryMeasuresLocation = mdh.SanitaryMeasuresLocation;
mdhItems.Add(smDet);
foreach (SanitaryMeasuresDetail smd in mdh.SanitaryMeasuresDetails)
{
choiceTypes2.Add(ItemsChoiceType2.SanitaryMeasuresDetails);
RootMDHSanitaryMeasuresDetails smDet = new RootMDHSanitaryMeasuresDetails();
if (mdh.SanitaryMeasuresDate.HasValue)
smDet.SanitaryMeasuresDate = smd.SanitaryMeasuresDate.Value;
smDet.SanitaryMeasuresType = smd.SanitaryMeasuresType;
smDet.SanitaryMeasuresLocation = smd.SanitaryMeasuresLocation;
mdhItems.Add(smDet);
}
}
choiceTypes2.Add(ItemsChoiceType2.StowawaysDetected);
mdhItems.Add(mdh.StowawaysDetected ?? false ? RootMDHStowawaysDetected.Y : RootMDHStowawaysDetected.N);
choiceTypes2.Add(ItemsChoiceType2.StowawaysJoiningLocation);
mdhItems.Add(mdh.StowawaysJoiningLocation);
foreach(StowawaysJoiningLocation sjl in mdh.StowawaysJoiningLocations)
{
choiceTypes2.Add(ItemsChoiceType2.StowawaysJoiningLocation);
mdhItems.Add(sjl.StowawayJoiningLocation);
}
choiceTypes2.Add(ItemsChoiceType2.SickAnimalOrPetOnBoard);
mdhItems.Add(mdh.SickAnimalOrPetOnBoard ?? false ? RootMDHSickAnimalOrPetOnBoard.Y : RootMDHSickAnimalOrPetOnBoard.N);
@ -733,13 +778,16 @@ namespace bsmd.dbh
choiceTypes2.Add(ItemsChoiceType2.InfectedAreaVisited);
mdhItems.Add(mdh.InfectedAreaVisited ?? false ? RootMDHInfectedAreaVisited.Y : RootMDHInfectedAreaVisited.N);
if (!mdh.InfectedAreaPort.IsNullOrEmpty() && mdh.InfectedAreaDate.HasValue)
foreach (InfectedArea ia in mdh.InfectedAreas)
{
choiceTypes2.Add(ItemsChoiceType2.InfectedArea);
RootMDHInfectedArea infected = new RootMDHInfectedArea();
mdhItems.Add(infected);
infected.InfectedAreaPort = mdh.InfectedAreaPort;
infected.InfectedAreaDate = mdh.InfectedAreaDate.Value;
if (!mdh.InfectedAreaPort.IsNullOrEmpty() && mdh.InfectedAreaDate.HasValue)
{
choiceTypes2.Add(ItemsChoiceType2.InfectedArea);
RootMDHInfectedArea infected = new RootMDHInfectedArea();
mdhItems.Add(infected);
infected.InfectedAreaPort = ia.InfectedAreaPort;
infected.InfectedAreaDate = ia.InfectedAreaDate.Value;
}
}
if (mdh.PortOfCallLast30Days.Count > 0)
@ -761,7 +809,7 @@ namespace bsmd.dbh
l30d.PortOfCallLast30Days[i].PortOfCallLast30DaysCrewJoinedShip.PortOfCallLast30DaysCrewJoinedShipName[j] = mdh.PortOfCallLast30Days[i].CrewJoinedShip[j].PortOfCallLast30DaysCrewJoinedShipName;
}
}
l30d.PortOfCallLast30Days[i].PortOfCallLast30DaysCrewMembersJoined = mdh.PortOfCallLast30Days[i].PortOfCallLast30DaysCrewMembersJoined ?? false ? RootMDHPortsOfCallLast30DaysPortOfCallLast30DaysPortOfCallLast30DaysCrewMembersJoined.Y : RootMDHPortsOfCallLast30DaysPortOfCallLast30DaysPortOfCallLast30DaysCrewMembersJoined.N;
l30d.PortOfCallLast30Days[i].PortOfCallLast30DaysCrewMembersJoined = mdh.PortOfCallLast30Days[i].PortOfCallLast30DaysCrewMembersJoined ?? false ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N;
if (mdh.PortOfCallLast30Days[i].PortOfCallLast30DaysDateOfDeparture.HasValue)
l30d.PortOfCallLast30Days[i].PortOfCallLast30DaysDateOfDeparture = mdh.PortOfCallLast30Days[i].PortOfCallLast30DaysDateOfDeparture.Value;
l30d.PortOfCallLast30Days[i].PortOfCallLast30DaysLocode = mdh.PortOfCallLast30Days[i].PortOfCallLast30DaysLocode;
@ -839,17 +887,17 @@ namespace bsmd.dbh
{
rww.WasteDescription = was.Waste[j-5].WasteDescription;
if (was.Waste[j - 5].WasteType.HasValue)
rww.WasteType = (RootWASWasteWasteType) (was.Waste[j - 5].WasteType.Value - 1); // im generierten Code ist das 0-basiert
rww.WasteType = (WasteType) (was.Waste[j - 5].WasteType.Value - 1); // im generierten Code ist das 0-basiert
if (was.Waste[j - 5].WasteDisposalAmount_MTQ.HasValue)
rww.WasteDisposalAmount_MTQ = (float)was.Waste[j - 5].WasteDisposalAmount_MTQ.Value;
rww.WasteDisposalAmount_MTQ = (decimal)was.Waste[j - 5].WasteDisposalAmount_MTQ.Value;
rww.WasteDetails = new RootWASWasteWasteDetails();
if (was.Waste[j - 5].WasteCapacity_MTQ.HasValue)
rww.WasteDetails.WasteCapacity_MTQ = (float)was.Waste[j - 5].WasteCapacity_MTQ.Value;
rww.WasteDetails.WasteCapacity_MTQ = (decimal)was.Waste[j - 5].WasteCapacity_MTQ.Value;
if (was.Waste[j - 5].WasteAmountRetained_MTQ.HasValue)
rww.WasteDetails.WasteAmountRetained_MTQ = (float)was.Waste[j - 5].WasteAmountRetained_MTQ.Value;
rww.WasteDetails.WasteAmountRetained_MTQ = (decimal)was.Waste[j - 5].WasteAmountRetained_MTQ.Value;
rww.WasteDetails.WasteDisposalPort = was.Waste[j - 5].WasteDisposalPort;
if (was.Waste[j - 5].WasteAmountGeneratedTillNextPort_MTQ.HasValue)
rww.WasteDetails.WasteAmountGeneratedTillNextPort_MTQ = (float)was.Waste[j - 5].WasteAmountGeneratedTillNextPort_MTQ.Value;
rww.WasteDetails.WasteAmountGeneratedTillNextPort_MTQ = (decimal)was.Waste[j - 5].WasteAmountGeneratedTillNextPort_MTQ.Value;
}
}
}
@ -883,12 +931,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 = (float) towa.TowageOnArrivalLengthOverall_MTR.Value;
rootTowa.TowageOnArrival[i].TowageOnArrivalLengthOverall_MTR = (decimal) towa.TowageOnArrivalLengthOverall_MTR.Value;
if (towa.TowageOnArrivalBeam_MTR.HasValue)
rootTowa.TowageOnArrival[i].TowageOnArrivalBeam_MTR = (float) towa.TowageOnArrivalBeam_MTR.Value;
rootTowa.TowageOnArrival[i].TowageOnArrivalBeam_MTR = (decimal) towa.TowageOnArrivalBeam_MTR.Value;
rootTowa.TowageOnArrival[i].TowageOnArrivalPurposeOfCall = towa.TowageOnArrivalPurposeOfCall;
if (towa.TowageOnArrivalDraught_DMT.HasValue)
rootTowa.TowageOnArrival[i].TowageOnArrivalDraught_DMT = (float) towa.TowageOnArrivalDraught_DMT.Value;
rootTowa.TowageOnArrival[i].TowageOnArrivalDraught_DMT = (decimal) towa.TowageOnArrivalDraught_DMT.Value;
rootTowa.TowageOnArrival[i].TowageOnArrivalRemarks = towa.TowageOnArrivalRemarks;
}
item = rootTowa;
@ -917,11 +965,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 = (float) towd.TowageOnDepartureLengthOverall_MTR.Value;
rootTowd.TowageOnDeparture[i].TowageOnDepartureLengthOverall_MTR = (decimal) towd.TowageOnDepartureLengthOverall_MTR.Value;
if (towd.TowageOnDepartureBeam_MTR.HasValue)
rootTowd.TowageOnDeparture[i].TowageOnDepartureBeam_MTR = (float) towd.TowageOnDepartureBeam_MTR.Value;
rootTowd.TowageOnDeparture[i].TowageOnDepartureBeam_MTR = (decimal) towd.TowageOnDepartureBeam_MTR.Value;
if (towd.TowageOnDepartureDraught_DMT.HasValue)
rootTowd.TowageOnDeparture[i].TowageOnDepartureDraught_DMT = (float) towd.TowageOnDepartureDraught_DMT.Value;
rootTowd.TowageOnDeparture[i].TowageOnDepartureDraught_DMT = (decimal) towd.TowageOnDepartureDraught_DMT.Value;
rootTowd.TowageOnDeparture[i].TowageOnDepartureRemarks = towd.TowageOnDepartureRemarks;
}
item = rootTowd;
@ -955,42 +1003,42 @@ namespace bsmd.dbh
#region IMDG
if (haz.IMDGPositions.Count > 0)
{
dpgOnArrival.DPGItemIMDG = new RootHAZADPGOnArrivalDPGItemIMDG[haz.IMDGPositions.Count];
dpgOnArrival.DPGItemIMDG = new IMDGPosition[haz.IMDGPositions.Count];
for (int i = 0; i < haz.IMDGPositions.Count; i++)
{
IMDGPosition imdgPos = haz.IMDGPositions[i];
RootHAZADPGOnArrivalDPGItemIMDG rootIMDG = new RootHAZADPGOnArrivalDPGItemIMDG();
bsmd.database.IMDGPosition imdgPos = haz.IMDGPositions[i];
IMDGPosition rootIMDG = new IMDGPosition();
rootIMDG.UNNumber = imdgPos.UNNumber;
if (imdgPos.PackingGroup.HasValue)
rootIMDG.PackingGroup = (RootHAZADPGOnArrivalDPGItemIMDGPackingGroup)imdgPos.PackingGroup.Value;
rootIMDG.PackingGroup = (PackingGroupType)imdgPos.PackingGroup.Value;
rootIMDG.ProperShippingName = imdgPos.ProperShippingName;
rootIMDG.IMOClass = imdgPos.IMOClass;
rootIMDG.CompatibilityGroup = imdgPos.CompatibilityGroup;
// rootIMDG.CompatibilityGroup = imdgPos.CompatibilityGroup;
rootIMDG.TechnicalName = imdgPos.TechnicalName;
rootIMDG.NetExplosiveMass_KGMSpecified = imdgPos.NetExplosiveMass_KGM.HasValue;
if (imdgPos.NetExplosiveMass_KGM.HasValue)
rootIMDG.NetExplosiveMass_KGM = (float)imdgPos.NetExplosiveMass_KGM.Value;
rootIMDG.NetExplosiveMass_KGM = (decimal)imdgPos.NetExplosiveMass_KGM.Value;
rootIMDG.Flashpoint_CEL = imdgPos.Flashpoint_CEL;
rootIMDG.Class7NuclideName = imdgPos.Class7NuclideName;
rootIMDG.Class7MaxActivity_BQLSpecified = imdgPos.Class7MaxActivity_BQL.HasValue;
if (imdgPos.Class7MaxActivity_BQL.HasValue)
rootIMDG.Class7MaxActivity_BQL = (float)imdgPos.Class7MaxActivity_BQL.Value;
rootIMDG.Class7MaxActivity_BQL = (decimal)imdgPos.Class7MaxActivity_BQL.Value;
rootIMDG.Class7CategorySpecified = imdgPos.Class7Category.HasValue;
if (imdgPos.Class7Category.HasValue)
rootIMDG.Class7Category = imdgPos.Class7Category.Value;
rootIMDG.Class7TransportIndexSpecified = imdgPos.Class7TransportIndex.HasValue;
if (imdgPos.Class7TransportIndex.HasValue)
rootIMDG.Class7TransportIndex = (float)imdgPos.Class7TransportIndex.Value;
rootIMDG.Class7TransportIndex = (decimal)imdgPos.Class7TransportIndex.Value;
rootIMDG.Class7CSISpecified = imdgPos.Class7CSI.HasValue;
if (imdgPos.Class7CSI.HasValue)
rootIMDG.Class7CSI = imdgPos.Class7CSI.Value;
rootIMDG.ControlTemperature_CELSpecified = imdgPos.ControlTemperature_CEL.HasValue;
if (imdgPos.ControlTemperature_CEL.HasValue)
rootIMDG.ControlTemperature_CEL = (float)imdgPos.ControlTemperature_CEL.Value;
rootIMDG.ControlTemperature_CEL = (decimal)imdgPos.ControlTemperature_CEL.Value;
rootIMDG.EmergencyTemperature_CELSpecified = imdgPos.EmergencyTemperature_CEL.HasValue;
if (imdgPos.EmergencyTemperature_CEL.HasValue)
rootIMDG.EmergencyTemperature_CEL = (float)imdgPos.EmergencyTemperature_CEL.Value;
rootIMDG.EmergencyTemperature_CEL = (decimal)imdgPos.EmergencyTemperature_CEL.Value;
if (imdgPos.SubsidiaryRiskList.Count > 0)
{
rootIMDG.SubsidiaryRisks = new string[imdgPos.SubsidiaryRiskList.Count];
@ -998,29 +1046,29 @@ namespace bsmd.dbh
rootIMDG.SubsidiaryRisks[sCount] = imdgPos.SubsidiaryRiskList[sCount].SubsidiaryRisk;
}
if (imdgPos.MarinePollutant.HasValue)
rootIMDG.MarinePollutant = imdgPos.MarinePollutant.Value ? RootHAZADPGOnArrivalDPGItemIMDGMarinePollutant.Y : RootHAZADPGOnArrivalDPGItemIMDGMarinePollutant.N;
rootIMDG.MarinePollutant = imdgPos.MarinePollutant.Value ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N;
if (imdgPos.NumberOfPackages.HasValue)
rootIMDG.NumberOfPackages = imdgPos.NumberOfPackages.Value;
rootIMDG.PackageType = imdgPos.PackageType;
if (imdgPos.LimitedQuantities.HasValue)
rootIMDG.LimitedQuantities = imdgPos.LimitedQuantities.Value ? RootHAZADPGOnArrivalDPGItemIMDGLimitedQuantities.Y : RootHAZADPGOnArrivalDPGItemIMDGLimitedQuantities.N;
rootIMDG.LimitedQuantities = imdgPos.LimitedQuantities.Value ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N;
if (imdgPos.ExceptedQuantities.HasValue)
rootIMDG.ExceptedQuantities = imdgPos.ExceptedQuantities.Value ? RootHAZADPGOnArrivalDPGItemIMDGExceptedQuantities.Y : RootHAZADPGOnArrivalDPGItemIMDGExceptedQuantities.N;
rootIMDG.ExceptedQuantities = imdgPos.ExceptedQuantities.Value ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N;
rootIMDG.NetQuantity_KGMSpecified = imdgPos.NetQuantity_KGM.HasValue;
if (imdgPos.NetQuantity_KGM.HasValue)
rootIMDG.NetQuantity_KGM = (float)imdgPos.NetQuantity_KGM.Value;
rootIMDG.NetQuantity_KGM = (decimal)imdgPos.NetQuantity_KGM.Value;
rootIMDG.GrossQuantity_KGMSpecified = imdgPos.GrossQuantity_KGM.HasValue;
if (imdgPos.GrossQuantity_KGM.HasValue)
rootIMDG.GrossQuantity_KGM = (float)imdgPos.GrossQuantity_KGM.Value;
rootIMDG.GrossQuantity_KGM = (decimal)imdgPos.GrossQuantity_KGM.Value;
rootIMDG.Volume_MTQSpecified = imdgPos.Volume_MTQ.HasValue;
if (imdgPos.Volume_MTQ.HasValue)
rootIMDG.Volume_MTQ = (float)imdgPos.Volume_MTQ.Value;
rootIMDG.Volume_MTQ = (decimal)imdgPos.Volume_MTQ.Value;
rootIMDG.GeneralCargoIBCSpecified = imdgPos.GeneralCargoIBC.HasValue;
if (imdgPos.GeneralCargoIBC.HasValue)
rootIMDG.GeneralCargoIBC = imdgPos.GeneralCargoIBC.Value ? RootHAZADPGOnArrivalDPGItemIMDGGeneralCargoIBC.Y : RootHAZADPGOnArrivalDPGItemIMDGGeneralCargoIBC.N;
rootIMDG.GeneralCargoIBC = imdgPos.GeneralCargoIBC.Value ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N;
rootIMDG.ContainerNumber = imdgPos.ContainerNumber;
rootIMDG.VehicleLicenseNumber = imdgPos.VehicleLicenseNumber;
rootIMDG.StowagePosition = imdgPos.StowagePosition;
// rootIMDG.StowagePosition = imdgPos.StowagePosition;
rootIMDG.PortOfLoading = imdgPos.PortOfLoading;
rootIMDG.PortOfDischarge = imdgPos.PortOfDischarge;
rootIMDG.Remarks = imdgPos.Remarks;
@ -1033,29 +1081,29 @@ namespace bsmd.dbh
#region IBC
if (haz.IBCPositions.Count > 0)
{
dpgOnArrival.DPGItemIBC = new RootHAZADPGOnArrivalDPGItemIBC[haz.IBCPositions.Count];
dpgOnArrival.DPGItemIBC = new IBCPosition[haz.IBCPositions.Count];
for (int i = 0; i < haz.IBCPositions.Count; i++)
{
RootHAZADPGOnArrivalDPGItemIBC rootIBC = new RootHAZADPGOnArrivalDPGItemIBC();
IBCPosition ibcPos = haz.IBCPositions[i];
IBCPosition rootIBC = new IBCPosition();
bsmd.database.IBCPosition ibcPos = haz.IBCPositions[i];
rootIBC.ProductName = ibcPos.ProductName;
if (ibcPos.PollutionCategory.HasValue)
rootIBC.PollutionCategory = (RootHAZADPGOnArrivalDPGItemIBCPollutionCategory)ibcPos.PollutionCategory.Value;
rootIBC.PollutionCategory = (PollutionCategoryType)ibcPos.PollutionCategory.Value;
rootIBC.HazardsSpecified = ibcPos.Hazards.HasValue;
if (ibcPos.Hazards.HasValue)
rootIBC.Hazards = (RootHAZADPGOnArrivalDPGItemIBCHazards)ibcPos.Hazards.Value;
rootIBC.Hazards = (HazardType)ibcPos.Hazards.Value;
if (ibcPos.FlashpointInformation.HasValue)
rootIBC.FlashpointInformation = (RootHAZADPGOnArrivalDPGItemIBCFlashpointInformation)ibcPos.FlashpointInformation.Value;
rootIBC.FlashpointInformation = (FlashpointInfoType)ibcPos.FlashpointInformation.Value;
rootIBC.Flashpoint_CEL = ibcPos.Flashpoint_CEL;
if (ibcPos.Quantity_KGM.HasValue)
rootIBC.Quantity_KGM = (float)ibcPos.Quantity_KGM.Value;
rootIBC.Quantity_KGM = (decimal)ibcPos.Quantity_KGM.Value;
rootIBC.StowagePosition = ibcPos.StowagePosition;
rootIBC.PortOfLoading = ibcPos.PortOfLoading;
rootIBC.PortOfDischarge = ibcPos.PortOfDischarge;
rootIBC.SpecRef15_19Specified = ibcPos.SpecRef15_19.HasValue;
if (ibcPos.SpecRef15_19.HasValue)
rootIBC.SpecRef15_19 = ibcPos.SpecRef15_19.Value ? RootHAZADPGOnArrivalDPGItemIBCSpecRef15_19.Y : RootHAZADPGOnArrivalDPGItemIBCSpecRef15_19.N;
rootIBC.SpecRef15_19 = ibcPos.SpecRef15_19.Value ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N;
rootIBC.Remarks = ibcPos.Remarks;
dpgOnArrival.DPGItemIBC[i] = rootIBC;
@ -1066,17 +1114,17 @@ namespace bsmd.dbh
#region IGC
if (haz.IGCPositions.Count > 0)
{
dpgOnArrival.DPGItemIGC = new RootHAZADPGOnArrivalDPGItemIGC[haz.IGCPositions.Count];
dpgOnArrival.DPGItemIGC = new IGCPosition[haz.IGCPositions.Count];
for (int i = 0; i < haz.IGCPositions.Count; i++)
{
RootHAZADPGOnArrivalDPGItemIGC rootIGC = new RootHAZADPGOnArrivalDPGItemIGC();
IGCPosition igcPos = haz.IGCPositions[i];
IGCPosition rootIGC = new IGCPosition();
bsmd.database.IGCPosition igcPos = haz.IGCPositions[i];
rootIGC.UNNumber = igcPos.UNNumber;
rootIGC.IMOClass = igcPos.IMOClass;
rootIGC.ProductName = igcPos.ProductName;
if (igcPos.Quantity_KGM.HasValue)
rootIGC.Quantity_KGM = (float)igcPos.Quantity_KGM.Value;
rootIGC.Quantity_KGM = (decimal)igcPos.Quantity_KGM.Value;
rootIGC.StowagePosition = igcPos.StowagePosition;
rootIGC.PortOfLoading = igcPos.PortOfLoading;
rootIGC.PortOfDischarge = igcPos.PortOfDischarge;
@ -1090,19 +1138,19 @@ namespace bsmd.dbh
#region IMSBC
if (haz.IMSBCPositions.Count > 0)
{
dpgOnArrival.DPGItemIMSBC = new RootHAZADPGOnArrivalDPGItemIMSBC[haz.IMSBCPositions.Count];
dpgOnArrival.DPGItemIMSBC = new IMSBCPosition[haz.IMSBCPositions.Count];
for (int i = 0; i < haz.IMSBCPositions.Count; i++)
{
RootHAZADPGOnArrivalDPGItemIMSBC rootIMSBC = new RootHAZADPGOnArrivalDPGItemIMSBC();
IMSBCPosition imsbcPos = haz.IMSBCPositions[i];
IMSBCPosition rootIMSBC = new IMSBCPosition();
bsmd.database.IMSBCPosition imsbcPos = haz.IMSBCPositions[i];
rootIMSBC.BulkCargoShippingName = imsbcPos.BulkCargoShippingName;
if (imsbcPos.MHB.HasValue)
rootIMSBC.MHB = imsbcPos.MHB.Value ? RootHAZADPGOnArrivalDPGItemIMSBCMHB.Y : RootHAZADPGOnArrivalDPGItemIMSBCMHB.N;
rootIMSBC.MHB = imsbcPos.MHB.Value ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N;
rootIMSBC.UNNumber = imsbcPos.UNNumber;
rootIMSBC.IMOClass = imsbcPos.IMOClass;
if (imsbcPos.Quantity_KGM.HasValue)
rootIMSBC.Quantity_KGM = (float)imsbcPos.Quantity_KGM.Value;
rootIMSBC.Quantity_KGM = (decimal)imsbcPos.Quantity_KGM.Value;
rootIMSBC.StowagePosition = imsbcPos.StowagePosition;
rootIMSBC.PortOfLoading = imsbcPos.PortOfLoading;
rootIMSBC.PortOfDischarge = imsbcPos.PortOfDischarge;
@ -1116,18 +1164,18 @@ namespace bsmd.dbh
#region MARPOL_ANNEX_I
if (haz.MARPOLPositions.Count > 0)
{
dpgOnArrival.DPGItemMARPOLAnnexI = new RootHAZADPGOnArrivalDPGItemMARPOLAnnexI[haz.MARPOLPositions.Count];
dpgOnArrival.DPGItemMARPOLAnnexI = new MARPOLPosition[haz.MARPOLPositions.Count];
for (int i = 0; i < haz.MARPOLPositions.Count; i++)
{
RootHAZADPGOnArrivalDPGItemMARPOLAnnexI rootMarpol = new RootHAZADPGOnArrivalDPGItemMARPOLAnnexI();
MARPOLPosition rootMarpol = new MARPOLPosition();
MARPOL_Annex_I_Position marpolPos = haz.MARPOLPositions[i];
rootMarpol.Name = marpolPos.Name;
if (marpolPos.FlashpointInformation.HasValue)
rootMarpol.FlashpointInformation = (RootHAZADPGOnArrivalDPGItemMARPOLAnnexIFlashpointInformation)marpolPos.FlashpointInformation.Value;
rootMarpol.FlashpointInformation = (FlashpointInfoType)marpolPos.FlashpointInformation.Value;
rootMarpol.Flashpoint_CEL = marpolPos.Flashpoint_CEL;
if (marpolPos.Quantity_KGM.HasValue)
rootMarpol.Quantity_KGM = (float)marpolPos.Quantity_KGM.Value;
rootMarpol.Quantity_KGM = (decimal) marpolPos.Quantity_KGM.Value;
rootMarpol.StowagePosition = marpolPos.StowagePosition;
rootMarpol.PortOfLoading = marpolPos.PortOfLoading;
rootMarpol.PortOfDischarge = marpolPos.PortOfDischarge;
@ -1181,42 +1229,42 @@ namespace bsmd.dbh
#region IMDG
if (haz.IMDGPositions.Count > 0)
{
dpgOnDeparture.DPGItemIMDG = new RootHAZDDPGOnDepartureDPGItemIMDG[haz.IMDGPositions.Count];
dpgOnDeparture.DPGItemIMDG = new IMDGPosition[haz.IMDGPositions.Count];
for (int i = 0; i < haz.IMDGPositions.Count; i++)
{
IMDGPosition imdgPos = haz.IMDGPositions[i];
RootHAZDDPGOnDepartureDPGItemIMDG rootIMDG = new RootHAZDDPGOnDepartureDPGItemIMDG();
bsmd.database.IMDGPosition imdgPos = haz.IMDGPositions[i];
IMDGPosition rootIMDG = new IMDGPosition();
rootIMDG.UNNumber = imdgPos.UNNumber;
if (imdgPos.PackingGroup.HasValue)
rootIMDG.PackingGroup = (RootHAZDDPGOnDepartureDPGItemIMDGPackingGroup)imdgPos.PackingGroup.Value;
rootIMDG.PackingGroup = (PackingGroupType)imdgPos.PackingGroup.Value;
rootIMDG.ProperShippingName = imdgPos.ProperShippingName;
rootIMDG.IMOClass = imdgPos.IMOClass;
rootIMDG.CompatibilityGroup = imdgPos.CompatibilityGroup;
// rootIMDG.CompatibilityGroup = imdgPos.CompatibilityGroup;
rootIMDG.TechnicalName = imdgPos.TechnicalName;
rootIMDG.NetExplosiveMass_KGMSpecified = imdgPos.NetExplosiveMass_KGM.HasValue;
if (imdgPos.NetExplosiveMass_KGM.HasValue)
rootIMDG.NetExplosiveMass_KGM = (float)imdgPos.NetExplosiveMass_KGM.Value;
rootIMDG.NetExplosiveMass_KGM = (decimal)imdgPos.NetExplosiveMass_KGM.Value;
rootIMDG.Flashpoint_CEL = imdgPos.Flashpoint_CEL;
rootIMDG.Class7NuclideName = imdgPos.Class7NuclideName;
rootIMDG.Class7MaxActivity_BQLSpecified = imdgPos.Class7MaxActivity_BQL.HasValue;
if (imdgPos.Class7MaxActivity_BQL.HasValue)
rootIMDG.Class7MaxActivity_BQL = (float)imdgPos.Class7MaxActivity_BQL.Value;
rootIMDG.Class7MaxActivity_BQL = (decimal)imdgPos.Class7MaxActivity_BQL.Value;
rootIMDG.Class7CategorySpecified = imdgPos.Class7Category.HasValue;
if (imdgPos.Class7Category.HasValue)
rootIMDG.Class7Category = imdgPos.Class7Category.Value;
rootIMDG.Class7TransportIndexSpecified = imdgPos.Class7TransportIndex.HasValue;
if (imdgPos.Class7TransportIndex.HasValue)
rootIMDG.Class7TransportIndex = (float)imdgPos.Class7TransportIndex.Value;
rootIMDG.Class7TransportIndex = (decimal)imdgPos.Class7TransportIndex.Value;
rootIMDG.Class7CSISpecified = imdgPos.Class7CSI.HasValue;
if (imdgPos.Class7CSI.HasValue)
rootIMDG.Class7CSI = imdgPos.Class7CSI.Value;
rootIMDG.ControlTemperature_CELSpecified = imdgPos.ControlTemperature_CEL.HasValue;
if (imdgPos.ControlTemperature_CEL.HasValue)
rootIMDG.ControlTemperature_CEL = (float)imdgPos.ControlTemperature_CEL.Value;
rootIMDG.ControlTemperature_CEL = (decimal)imdgPos.ControlTemperature_CEL.Value;
rootIMDG.EmergencyTemperature_CELSpecified = imdgPos.EmergencyTemperature_CEL.HasValue;
if (imdgPos.EmergencyTemperature_CEL.HasValue)
rootIMDG.EmergencyTemperature_CEL = (float)imdgPos.EmergencyTemperature_CEL.Value;
rootIMDG.EmergencyTemperature_CEL = (decimal)imdgPos.EmergencyTemperature_CEL.Value;
if (imdgPos.SubsidiaryRiskList.Count > 0)
{
rootIMDG.SubsidiaryRisks = new string[imdgPos.SubsidiaryRiskList.Count];
@ -1224,29 +1272,29 @@ namespace bsmd.dbh
rootIMDG.SubsidiaryRisks[sCount] = imdgPos.SubsidiaryRiskList[sCount].SubsidiaryRisk;
}
if (imdgPos.MarinePollutant.HasValue)
rootIMDG.MarinePollutant = imdgPos.MarinePollutant.Value ? RootHAZDDPGOnDepartureDPGItemIMDGMarinePollutant.Y : RootHAZDDPGOnDepartureDPGItemIMDGMarinePollutant.N;
rootIMDG.MarinePollutant = imdgPos.MarinePollutant.Value ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N;
if (imdgPos.NumberOfPackages.HasValue)
rootIMDG.NumberOfPackages = imdgPos.NumberOfPackages.Value;
rootIMDG.PackageType = imdgPos.PackageType;
if (imdgPos.LimitedQuantities.HasValue)
rootIMDG.LimitedQuantities = imdgPos.LimitedQuantities.Value ? RootHAZDDPGOnDepartureDPGItemIMDGLimitedQuantities.Y : RootHAZDDPGOnDepartureDPGItemIMDGLimitedQuantities.N;
rootIMDG.LimitedQuantities = imdgPos.LimitedQuantities.Value ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N;
if (imdgPos.ExceptedQuantities.HasValue)
rootIMDG.ExceptedQuantities = imdgPos.ExceptedQuantities.Value ? RootHAZDDPGOnDepartureDPGItemIMDGExceptedQuantities.Y : RootHAZDDPGOnDepartureDPGItemIMDGExceptedQuantities.N;
rootIMDG.ExceptedQuantities = imdgPos.ExceptedQuantities.Value ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N;
rootIMDG.NetQuantity_KGMSpecified = imdgPos.NetQuantity_KGM.HasValue;
if (imdgPos.NetQuantity_KGM.HasValue)
rootIMDG.NetQuantity_KGM = (float)imdgPos.NetQuantity_KGM.Value;
rootIMDG.NetQuantity_KGM = (decimal)imdgPos.NetQuantity_KGM.Value;
rootIMDG.GrossQuantity_KGMSpecified = imdgPos.GrossQuantity_KGM.HasValue;
if (imdgPos.GrossQuantity_KGM.HasValue)
rootIMDG.GrossQuantity_KGM = (float)imdgPos.GrossQuantity_KGM.Value;
rootIMDG.GrossQuantity_KGM = (decimal)imdgPos.GrossQuantity_KGM.Value;
rootIMDG.Volume_MTQSpecified = imdgPos.Volume_MTQ.HasValue;
if (imdgPos.Volume_MTQ.HasValue)
rootIMDG.Volume_MTQ = (float)imdgPos.Volume_MTQ.Value;
rootIMDG.Volume_MTQ = (decimal)imdgPos.Volume_MTQ.Value;
rootIMDG.GeneralCargoIBCSpecified = imdgPos.GeneralCargoIBC.HasValue;
if (imdgPos.GeneralCargoIBC.HasValue)
rootIMDG.GeneralCargoIBC = imdgPos.GeneralCargoIBC.Value ? RootHAZDDPGOnDepartureDPGItemIMDGGeneralCargoIBC.Y : RootHAZDDPGOnDepartureDPGItemIMDGGeneralCargoIBC.N;
rootIMDG.GeneralCargoIBC = imdgPos.GeneralCargoIBC.Value ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N;
rootIMDG.ContainerNumber = imdgPos.ContainerNumber;
rootIMDG.VehicleLicenseNumber = imdgPos.VehicleLicenseNumber;
rootIMDG.StowagePosition = imdgPos.StowagePosition;
//rootIMDG.StowagePosition = imdgPos.StowagePosition;
rootIMDG.PortOfLoading = imdgPos.PortOfLoading;
rootIMDG.PortOfDischarge = imdgPos.PortOfDischarge;
rootIMDG.Remarks = imdgPos.Remarks;
@ -1259,29 +1307,29 @@ namespace bsmd.dbh
#region IBC
if (haz.IBCPositions.Count > 0)
{
dpgOnDeparture.DPGItemIBC = new RootHAZDDPGOnDepartureDPGItemIBC[haz.IBCPositions.Count];
dpgOnDeparture.DPGItemIBC = new IBCPosition[haz.IBCPositions.Count];
for (int i = 0; i < haz.IBCPositions.Count; i++)
{
RootHAZDDPGOnDepartureDPGItemIBC rootIBC = new RootHAZDDPGOnDepartureDPGItemIBC();
IBCPosition ibcPos = haz.IBCPositions[i];
IBCPosition rootIBC = new IBCPosition();
bsmd.database.IBCPosition ibcPos = haz.IBCPositions[i];
rootIBC.ProductName = ibcPos.ProductName;
if (ibcPos.PollutionCategory.HasValue)
rootIBC.PollutionCategory = (RootHAZDDPGOnDepartureDPGItemIBCPollutionCategory)ibcPos.PollutionCategory.Value;
rootIBC.PollutionCategory = (PollutionCategoryType)ibcPos.PollutionCategory.Value;
rootIBC.HazardsSpecified = ibcPos.Hazards.HasValue;
if (ibcPos.Hazards.HasValue)
rootIBC.Hazards = (RootHAZDDPGOnDepartureDPGItemIBCHazards)ibcPos.Hazards.Value;
rootIBC.Hazards = (HazardType)ibcPos.Hazards.Value;
if (ibcPos.FlashpointInformation.HasValue)
rootIBC.FlashpointInformation = (RootHAZDDPGOnDepartureDPGItemIBCFlashpointInformation)ibcPos.FlashpointInformation.Value;
rootIBC.FlashpointInformation = (FlashpointInfoType)ibcPos.FlashpointInformation.Value;
rootIBC.Flashpoint_CEL = ibcPos.Flashpoint_CEL;
if (ibcPos.Quantity_KGM.HasValue)
rootIBC.Quantity_KGM = (float)ibcPos.Quantity_KGM.Value;
rootIBC.Quantity_KGM = (decimal) ibcPos.Quantity_KGM.Value;
rootIBC.StowagePosition = ibcPos.StowagePosition;
rootIBC.PortOfLoading = ibcPos.PortOfLoading;
rootIBC.PortOfDischarge = ibcPos.PortOfDischarge;
rootIBC.SpecRef15_19Specified = ibcPos.SpecRef15_19.HasValue;
if (ibcPos.SpecRef15_19.HasValue)
rootIBC.SpecRef15_19 = ibcPos.SpecRef15_19.Value ? RootHAZDDPGOnDepartureDPGItemIBCSpecRef15_19.Y : RootHAZDDPGOnDepartureDPGItemIBCSpecRef15_19.N;
rootIBC.SpecRef15_19 = ibcPos.SpecRef15_19.Value ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N;
rootIBC.Remarks = ibcPos.Remarks;
dpgOnDeparture.DPGItemIBC[i] = rootIBC;
@ -1292,17 +1340,17 @@ namespace bsmd.dbh
#region IGC
if (haz.IGCPositions.Count > 0)
{
dpgOnDeparture.DPGItemIGC = new RootHAZDDPGOnDepartureDPGItemIGC[haz.IGCPositions.Count];
dpgOnDeparture.DPGItemIGC = new IGCPosition[haz.IGCPositions.Count];
for (int i = 0; i < haz.IGCPositions.Count; i++)
{
RootHAZDDPGOnDepartureDPGItemIGC rootIGC = new RootHAZDDPGOnDepartureDPGItemIGC();
IGCPosition igcPos = haz.IGCPositions[i];
IGCPosition rootIGC = new IGCPosition();
bsmd.database.IGCPosition igcPos = haz.IGCPositions[i];
rootIGC.UNNumber = igcPos.UNNumber;
rootIGC.IMOClass = igcPos.IMOClass;
rootIGC.ProductName = igcPos.ProductName;
if (igcPos.Quantity_KGM.HasValue)
rootIGC.Quantity_KGM = (float)igcPos.Quantity_KGM.Value;
rootIGC.Quantity_KGM = (decimal)igcPos.Quantity_KGM.Value;
rootIGC.StowagePosition = igcPos.StowagePosition;
rootIGC.PortOfLoading = igcPos.PortOfLoading;
rootIGC.PortOfDischarge = igcPos.PortOfDischarge;
@ -1316,19 +1364,19 @@ namespace bsmd.dbh
#region IMSBC
if (haz.IMSBCPositions.Count > 0)
{
dpgOnDeparture.DPGItemIMSBC = new RootHAZDDPGOnDepartureDPGItemIMSBC[haz.IMSBCPositions.Count];
dpgOnDeparture.DPGItemIMSBC = new IMSBCPosition[haz.IMSBCPositions.Count];
for (int i = 0; i < haz.IMSBCPositions.Count; i++)
{
RootHAZDDPGOnDepartureDPGItemIMSBC rootIMSBC = new RootHAZDDPGOnDepartureDPGItemIMSBC();
IMSBCPosition imsbcPos = haz.IMSBCPositions[i];
IMSBCPosition rootIMSBC = new IMSBCPosition();
bsmd.database.IMSBCPosition imsbcPos = haz.IMSBCPositions[i];
rootIMSBC.BulkCargoShippingName = imsbcPos.BulkCargoShippingName;
if (imsbcPos.MHB.HasValue)
rootIMSBC.MHB = imsbcPos.MHB.Value ? RootHAZDDPGOnDepartureDPGItemIMSBCMHB.Y : RootHAZDDPGOnDepartureDPGItemIMSBCMHB.N;
rootIMSBC.MHB = imsbcPos.MHB.Value ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N;
rootIMSBC.UNNumber = imsbcPos.UNNumber;
rootIMSBC.IMOClass = imsbcPos.IMOClass;
if (imsbcPos.Quantity_KGM.HasValue)
rootIMSBC.Quantity_KGM = (float)imsbcPos.Quantity_KGM.Value;
rootIMSBC.Quantity_KGM = (decimal)imsbcPos.Quantity_KGM.Value;
rootIMSBC.StowagePosition = imsbcPos.StowagePosition;
rootIMSBC.PortOfLoading = imsbcPos.PortOfLoading;
rootIMSBC.PortOfDischarge = imsbcPos.PortOfDischarge;
@ -1342,18 +1390,18 @@ namespace bsmd.dbh
#region MARPOL_ANNEX_I
if (haz.MARPOLPositions.Count > 0)
{
dpgOnDeparture.DPGItemMARPOLAnnexI = new RootHAZDDPGOnDepartureDPGItemMARPOLAnnexI[haz.MARPOLPositions.Count];
dpgOnDeparture.DPGItemMARPOLAnnexI = new MARPOLPosition[haz.MARPOLPositions.Count];
for (int i = 0; i < haz.MARPOLPositions.Count; i++)
{
RootHAZDDPGOnDepartureDPGItemMARPOLAnnexI rootMarpol = new RootHAZDDPGOnDepartureDPGItemMARPOLAnnexI();
MARPOLPosition rootMarpol = new MARPOLPosition();
MARPOL_Annex_I_Position marpolPos = haz.MARPOLPositions[i];
rootMarpol.Name = marpolPos.Name;
if (marpolPos.FlashpointInformation.HasValue)
rootMarpol.FlashpointInformation = (RootHAZDDPGOnDepartureDPGItemMARPOLAnnexIFlashpointInformation)marpolPos.FlashpointInformation.Value;
rootMarpol.FlashpointInformation = (FlashpointInfoType) marpolPos.FlashpointInformation.Value;
rootMarpol.Flashpoint_CEL = marpolPos.Flashpoint_CEL;
if (marpolPos.Quantity_KGM.HasValue)
rootMarpol.Quantity_KGM = (float)marpolPos.Quantity_KGM.Value;
rootMarpol.Quantity_KGM = (decimal)marpolPos.Quantity_KGM.Value;
rootMarpol.StowagePosition = marpolPos.StowagePosition;
rootMarpol.PortOfLoading = marpolPos.PortOfLoading;
rootMarpol.PortOfDischarge = marpolPos.PortOfDischarge;
@ -1397,7 +1445,7 @@ namespace bsmd.dbh
try
{
object[] items = null;
if ((rootType == RootType.CANCEL) || (rootType == RootType.DATA) || (rootType == RootType.RESET))
if ((rootType == DBHWebReference.RootType.CANCEL) || (rootType == DBHWebReference.RootType.DATA) || (rootType == DBHWebReference.RootType.RESET))
{
items = new object[1];
items[0] = item;
@ -1405,12 +1453,12 @@ namespace bsmd.dbh
if (message.MessageCore.IsTransit)
{
item = message.MessageCore.TransitId;
itemChoiceType2 = ItemChoiceType2.TransitId;
itemChoiceType2 = DBHWebReference.ItemChoiceType2.TransitId;
}
else
{
item = message.MessageCore.VisitId;
itemChoiceType2 = ItemChoiceType2.VisitId;
itemChoiceType2 = DBHWebReference.ItemChoiceType2.VisitId;
}
}

View File

@ -23,10 +23,10 @@ namespace bsmd.dbh
public static void ProcessResponse(string VisitId, string TransitId, DateTime Timestamp,
string SenderReference, response.RootType Type, List<response.RootMessage> Messages,
List<bsmd.dbh.response.RootReportingClassesFullReportingClass> ReportingClassesFull,
List<bsmd.dbh.response.RootReportingClassesPartialReportingClass> ReportingClassesPartial,
List<bsmd.dbh.response.RootReportingClassesErrorReportingClass> RootReportingClassesError,
List<bsmd.dbh.response.RootReportingClassesResettedReportingClass> ReportingClassesResetted,
List<bsmd.dbh.response.RootReportingClassesFull> ReportingClassesFull,
List<bsmd.dbh.response.RootReportingClassesPartial> ReportingClassesPartial,
List<bsmd.dbh.response.RootReportingClassesError> RootReportingClassesError,
List<bsmd.dbh.response.RootReportingClassesResetted> ReportingClassesResetted,
string connectionString)
{
@ -73,7 +73,7 @@ namespace bsmd.dbh
break;
case dbh.response.RootType.CANCEL:
if ((ReportingClassesFull != null) && (ReportingClassesFull.Count > 0) &&
(int)ReportingClassesFull[0] == (int)aMessage.MessageNotificationClass)
(int) ReportingClassesFull[0].ReportingClass[0] == (int)aMessage.MessageNotificationClass)
{
aMessage.Cancel = true;
aMessage.InternalStatus = Message.BSMDStatus.CONFIRMED;
@ -81,7 +81,7 @@ namespace bsmd.dbh
break;
case dbh.response.RootType.RESET:
if ((ReportingClassesResetted != null) && (ReportingClassesResetted.Count > 0) &&
(int)ReportingClassesResetted[0] == (int)aMessage.MessageNotificationClass)
(int) ReportingClassesResetted[0] .ReportingClass[0] == (int)aMessage.MessageNotificationClass)
{
aMessage.Reset = true;
aMessage.InternalStatus = Message.BSMDStatus.CONFIRMED;
@ -89,7 +89,7 @@ namespace bsmd.dbh
break;
case dbh.response.RootType.DATA:
if((ReportingClassesFull != null) && (ReportingClassesFull.Count > 0) &&
(int)ReportingClassesFull[0] == (int)aMessage.MessageNotificationClass)
(int) ReportingClassesFull[0].ReportingClass[0] == (int)aMessage.MessageNotificationClass)
{
// this was successful, save status to MessageHeader
aMessage.InternalStatus = Message.BSMDStatus.CONFIRMED;

View File

@ -196,8 +196,7 @@ namespace bsmd.herberg.FormService
}
else
{
this.EventLog.WriteEntry("FormService stopped: DB connection failed", EventLogEntryType.Error);
this.Stop();
this.EventLog.WriteEntry("FormService DB connection failure", EventLogEntryType.Warning);
}
lock (this._timerlock)

View File

@ -11,6 +11,7 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Text.RegularExpressions;
using log4net;
@ -54,13 +55,19 @@ namespace bsmd.herberg.FormService
if (formResponse.formDatasets[i].formData[n].name.Contains("Transmission"))
{
_log.Info("foundit");
}
}
// Daten werden nur aktualisiert, wenn die form ein anderes (=neueres) Rev. Date hat
if (aMessageCore.HerbergRevDate.HasValue && (formResponse.formDatasets[i].revisionDate == aMessageCore.HerbergRevDate.Value))
return;
if (!aMessageCore.IMO.Equals("9000007"))
{
if (aMessageCore.HerbergRevDate.HasValue && (formResponse.formDatasets[i].revisionDate == aMessageCore.HerbergRevDate.Value))
return;
}
else
{
_log.Debug("TEST Vessel");
}
if (aMessageCore.ReportStatus != MessageCore.ReportStatusEnum.COMPLETE)
aMessageCore.ReportStatus = MessageCore.ReportStatusEnum.HE_REVISION;
@ -188,13 +195,16 @@ namespace bsmd.herberg.FormService
if (vDict.ContainsKey("ContactFirstName")) aMessageCore.Customer.ContactFirstName = vDict["ContactFirstName"];
if (vDict.ContainsKey("ContactLastName")) aMessageCore.Customer.ContactLastName = vDict["ContactLastName"];
continue; // das Zeug verhält sich wie eine Not. Class
// 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);
if (messageType.Equals("Agency"))
theMessage.MessageNotificationClass = Message.NotificationClass.AGNT;
else
theMessage.MessageNotificationClass = (Message.NotificationClass)Enum.Parse(typeof(Message.NotificationClass), messageType, true);
theMessage.MessageCoreId = aMessageCore.Id;
theMessage.MessageCore = aMessageCore;
@ -492,43 +502,93 @@ namespace bsmd.herberg.FormService
Dictionary<string, string> pDict = nDict[key];
if (pDict.Count > 0)
{
PortOfCallLast30Days poc30 = mdh.GetSublistElementWithIdentifier(key.ToString()) as PortOfCallLast30Days;
if (poc30 == null)
if(pDict.ContainsKey("InfectedAreaDate") || pDict.ContainsKey("InfectedAreaPort"))
{
poc30 = new PortOfCallLast30Days();
poc30.Identifier = key.ToString();
mdh.PortOfCallLast30Days.Add(poc30);
poc30.MDH = mdh;
InfectedArea infectedArea = mdh.GetInfectedAreaWithIdentifier(key.ToString());
if (infectedArea == null)
{
infectedArea = new InfectedArea();
infectedArea.Identifier = key.ToString();
mdh.InfectedAreas.Add(infectedArea);
infectedArea.MDH = mdh;
}
if (pDict.ContainsKey("InfectedAreaDate")) infectedArea.InfectedAreaDate = Extensions.TryParseDateTime(pDict["InfectedAreaDate"]);
if (pDict.ContainsKey("InfectedAreaPort")) infectedArea.InfectedAreaPort = pDict["InfectedAreaPort"];
saveMessages.Add(infectedArea);
}
if (pDict.ContainsKey("PortOfCallLast30DaysDateOfDeparture")) poc30.PortOfCallLast30DaysDateOfDeparture = Extensions.TryParseDateTime(pDict["PortOfCallLast30DaysDateOfDeparture"]);
if (pDict.ContainsKey("PortOfCallLast30DaysCrewMembersJoined")) poc30.PortOfCallLast30DaysCrewMembersJoined = pDict["PortOfCallLast30DaysCrewMembersJoined"].Equals("Y");
if (pDict.ContainsKey("PortOfCallLast30DaysPortCode") && pDict.ContainsKey("PortOfCallLast30DaysCountryCode"))
poc30.PortOfCallLast30DaysLocode = pDict["PortOfCallLast30DaysCountryCode"] + pDict["PortOfCallLast30DaysPortCode"];
saveMessages.Add(poc30);
// lookup / crew members (Identifier hier der Name! (vereinfachung, ich habe keine rowid))
if (pDict.ContainsKey("PortOfCallLast30DaysCrewMemberNamesJoined"))
if(pDict.ContainsKey("SanitaryMeasuresType") || pDict.ContainsKey("SanitaryMeasuresLocation") || pDict.ContainsKey("SanitaryMeasuresDate"))
{
string[] names = pDict["PortOfCallLast30DaysCrewMemberNamesJoined"].Split(',');
for (int k = 0; k < names.Length; k++)
SanitaryMeasuresDetail sdm = mdh.GetSanitaryMeasuresDetailWithIdentifier(key.ToString());
if (sdm == null)
{
string crewname = names[k].Trim();
PortOfCallLast30DaysCrewJoinedShip poc30Crew = poc30.GetSublistElementWithIdentifier(crewname) as PortOfCallLast30DaysCrewJoinedShip;
if (poc30Crew == null)
sdm = new SanitaryMeasuresDetail();
sdm.Identifier = key.ToString();
mdh.SanitaryMeasuresDetails.Add(sdm);
sdm.MDH = mdh;
}
if (pDict.ContainsKey("SanitaryMeasuresType")) sdm.SanitaryMeasuresType = pDict["SanitaryMeasuresType"];
if (pDict.ContainsKey("SanitaryMeasuresLocation")) sdm.SanitaryMeasuresLocation = pDict["SanitaryMeasuresLocation"];
if (pDict.ContainsKey("SanitaryMeasuresDate")) sdm.SanitaryMeasuresDate = Extensions.TryParseDateTime(pDict["SanitaryMeasuresDate"]);
saveMessages.Add(sdm);
}
if(pDict.ContainsKey("StowawaysJoiningLocation"))
{
StowawaysJoiningLocation sjl = mdh.GetStowawaysJoiningLocationWithIdentifier(key.ToString());
if (sjl == null)
{
sjl = new StowawaysJoiningLocation();
sjl.Identifier = key.ToString();
mdh.StowawaysJoiningLocations.Add(sjl);
sjl.MDH = mdh;
}
if (pDict.ContainsKey("StowawaysJoiningLocation")) sjl.StowawayJoiningLocation = pDict["StowawaysJoiningLocation"];
saveMessages.Add(sjl);
}
if (pDict.Keys.Where(pKey => pKey.StartsWith("PortOfCallLast30Days")).Count() > 0)
{
PortOfCallLast30Days poc30 = mdh.GetSublistElementWithIdentifier(key.ToString()) as PortOfCallLast30Days;
if (poc30 == null)
{
poc30 = new PortOfCallLast30Days();
poc30.Identifier = key.ToString();
mdh.PortOfCallLast30Days.Add(poc30);
poc30.MDH = mdh;
}
if (pDict.ContainsKey("PortOfCallLast30DaysDateOfDeparture")) poc30.PortOfCallLast30DaysDateOfDeparture = Extensions.TryParseDateTime(pDict["PortOfCallLast30DaysDateOfDeparture"]);
if (pDict.ContainsKey("PortOfCallLast30DaysCrewMembersJoined")) poc30.PortOfCallLast30DaysCrewMembersJoined = pDict["PortOfCallLast30DaysCrewMembersJoined"].Equals("Y");
if (pDict.ContainsKey("PortOfCallLast30DaysPortCode") && pDict.ContainsKey("PortOfCallLast30DaysCountryCode"))
poc30.PortOfCallLast30DaysLocode = pDict["PortOfCallLast30DaysCountryCode"] + pDict["PortOfCallLast30DaysPortCode"];
saveMessages.Add(poc30);
// lookup / crew members (Identifier hier der Name! (vereinfachung, ich habe keine rowid))
if (pDict.ContainsKey("PortOfCallLast30DaysCrewMemberNamesJoined"))
{
string[] names = pDict["PortOfCallLast30DaysCrewMemberNamesJoined"].Split(',');
for (int k = 0; k < names.Length; k++)
{
poc30Crew = new PortOfCallLast30DaysCrewJoinedShip();
poc30Crew.Identifier = crewname;
poc30Crew.PortOfCallLast30Days = poc30;
poc30Crew.PortOfCallLast30DaysCrewJoinedShipName = crewname;
poc30.CrewJoinedShip.Add(poc30Crew);
saveMessages.Add(poc30Crew);
string crewname = names[k].Trim();
PortOfCallLast30DaysCrewJoinedShip poc30Crew = poc30.GetSublistElementWithIdentifier(crewname) as PortOfCallLast30DaysCrewJoinedShip;
if (poc30Crew == null)
{
poc30Crew = new PortOfCallLast30DaysCrewJoinedShip();
poc30Crew.Identifier = crewname;
poc30Crew.PortOfCallLast30Days = poc30;
poc30Crew.PortOfCallLast30DaysCrewJoinedShipName = crewname;
poc30.CrewJoinedShip.Add(poc30Crew);
saveMessages.Add(poc30Crew);
}
}
}
}
}
}
}
@ -1082,10 +1142,10 @@ namespace bsmd.herberg.FormService
if (((waste.WasteType ?? 0) == 9) && waste.WasteDescription.IsNullOrEmpty())
waste.WasteDescription = "-";
if(waste.WasteDisposalPort.Length == 7)
if(!waste.WasteDisposalPort.IsNullOrEmpty() && waste.WasteDisposalPort.Length > 5)
{
_log.WarnFormat("WasteDisposalPort format ERROR [{0}], truncating", was.LastWasteDisposalPort);
waste.WasteDisposalPort = waste.WasteDisposalPort.Substring(2);
waste.WasteDisposalPort = waste.WasteDisposalPort.Substring(0, 5);
}
if (waste.WasteType.HasValue)