Version 3.0.0 ausgeliefert (erste mit neuen NSW 3.0 Tabellen, aber immer noch Testing, keine Datenintegration von HE bisher)
This commit is contained in:
parent
e3a917bd91
commit
02e2d40fdb
@ -1,3 +1,9 @@
|
|||||||
|
-------------------------------------------------------------------------------------------------
|
||||||
|
-- AGNT
|
||||||
|
|
||||||
|
PRINT N'new table AGNT';
|
||||||
|
GO
|
||||||
|
|
||||||
CREATE TABLE [dbo].[AGNT] (
|
CREATE TABLE [dbo].[AGNT] (
|
||||||
[Id] UNIQUEIDENTIFIER CONSTRAINT [DF_AGNT_Id] DEFAULT (newid()) ROWGUIDCOL NOT NULL,
|
[Id] UNIQUEIDENTIFIER CONSTRAINT [DF_AGNT_Id] DEFAULT (newid()) ROWGUIDCOL NOT NULL,
|
||||||
[MessageHeaderId] UNIQUEIDENTIFIER NULL,
|
[MessageHeaderId] UNIQUEIDENTIFIER NULL,
|
||||||
@ -14,4 +20,98 @@ CREATE TABLE [dbo].[AGNT] (
|
|||||||
|
|
||||||
CONSTRAINT [PK_AGNT] PRIMARY KEY CLUSTERED ([Id] ASC),
|
CONSTRAINT [PK_AGNT] PRIMARY KEY CLUSTERED ([Id] ASC),
|
||||||
CONSTRAINT [FK_AGNT_MessageHeader] FOREIGN KEY ([MessageHeaderId]) REFERENCES [dbo].[MessageHeader] ([Id])
|
CONSTRAINT [FK_AGNT_MessageHeader] FOREIGN KEY ([MessageHeaderId]) REFERENCES [dbo].[MessageHeader] ([Id])
|
||||||
);
|
);
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------
|
||||||
|
-- INFO
|
||||||
|
|
||||||
|
PRINT N'Altering [dbo].[INFO]...';
|
||||||
|
|
||||||
|
GO
|
||||||
|
ALTER TABLE [dbo].[INFO]
|
||||||
|
ADD [PortArea] NVARCHAR (50) NULL,
|
||||||
|
[BowThrusterPower] NVARCHAR (50) NULL,
|
||||||
|
[SternThrusterPower] NVARCHAR (50) NULL;
|
||||||
|
GO
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------
|
||||||
|
-- INFO
|
||||||
|
|
||||||
|
PRINT N'Altering [dbo].[STAT]...';
|
||||||
|
|
||||||
|
ALTER TABLE [dbo].[STAT]
|
||||||
|
ADD [TransportMode] NCHAR (1) NULL;
|
||||||
|
GO
|
||||||
|
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------
|
||||||
|
-- IMDGPosition
|
||||||
|
|
||||||
|
PRINT N'Altering [dbo].[IMDGPosition]...';
|
||||||
|
|
||||||
|
|
||||||
|
GO
|
||||||
|
ALTER TABLE [dbo].[IMDGPosition]
|
||||||
|
ADD [Bay] NVARCHAR (5) NULL,
|
||||||
|
[Row] NVARCHAR (5) NULL,
|
||||||
|
[Tier] NVARCHAR (5) NULL;
|
||||||
|
|
||||||
|
GO
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------
|
||||||
|
-- SanitaryMeasuresDetail
|
||||||
|
|
||||||
|
PRINT N'New table [dbo].[SanitaryMeasuresDetail]...';
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE [dbo].[SanitaryMeasuresDetail] (
|
||||||
|
[Id] UNIQUEIDENTIFIER CONSTRAINT [DF_SanitaryMeasuresDetail_Id] DEFAULT (newid()) ROWGUIDCOL NOT NULL,
|
||||||
|
[MDH_Id] UNIQUEIDENTIFIER NULL,
|
||||||
|
[SanitaryMeasuresType] NVARCHAR (255) NULL,
|
||||||
|
[SanitaryMeasuresLocation] NVARCHAR (255) NULL,
|
||||||
|
[SanitaryMeasuresDate] DATE NULL,
|
||||||
|
[Identifier] NVARCHAR (50) NULL,
|
||||||
|
CONSTRAINT [PK_SanitaryMeasuresDetail] PRIMARY KEY CLUSTERED ([Id] ASC),
|
||||||
|
CONSTRAINT [FK_SanitaryMeasuresDetail_MDH] FOREIGN KEY ([MDH_Id]) REFERENCES [dbo].[MDH] ([Id])
|
||||||
|
);
|
||||||
|
|
||||||
|
GO
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------
|
||||||
|
-- StowawaysJoiningLocation
|
||||||
|
|
||||||
|
PRINT N'New table [dbo].[StowawaysJoiningLocation]...';
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE [dbo].[StowawaysJoiningLocation] (
|
||||||
|
[Id] UNIQUEIDENTIFIER CONSTRAINT [DF_StowawaysJoiningLocation_Id] DEFAULT (newid()) ROWGUIDCOL NOT NULL,
|
||||||
|
[MDH_Id] UNIQUEIDENTIFIER NULL,
|
||||||
|
[StowawaysJoiningLocation] NVARCHAR (255) NULL,
|
||||||
|
[Identifier] NVARCHAR (50) NULL,
|
||||||
|
CONSTRAINT [PK_StowawaysJoiningLocation] PRIMARY KEY CLUSTERED ([Id] ASC),
|
||||||
|
CONSTRAINT [FK_StowawaysJoiningLocation_MDH] FOREIGN KEY ([MDH_Id]) REFERENCES [dbo].[MDH] ([Id])
|
||||||
|
);
|
||||||
|
|
||||||
|
GO
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------
|
||||||
|
-- InfectedArea
|
||||||
|
|
||||||
|
PRINT N'New table [dbo].[InfectedArea]...';
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE [dbo].[InfectedArea] (
|
||||||
|
[Id] UNIQUEIDENTIFIER CONSTRAINT [DF_InfectedArea_Id] DEFAULT (newid()) ROWGUIDCOL NOT NULL,
|
||||||
|
[MDH_Id] UNIQUEIDENTIFIER NULL,
|
||||||
|
[InfectedAreaPort] NVARCHAR (255) NULL,
|
||||||
|
[InfectedAreaDate] DATE NULL,
|
||||||
|
[Identifier] NVARCHAR (50) NULL,
|
||||||
|
CONSTRAINT [PK_InfectedArea] PRIMARY KEY CLUSTERED ([Id] ASC),
|
||||||
|
CONSTRAINT [FK_SInfectedArea_MDH] FOREIGN KEY ([MDH_Id]) REFERENCES [dbo].[MDH] ([Id])
|
||||||
|
);
|
||||||
|
|
||||||
|
GO
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -7,14 +7,13 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2015 Informatikbüro Daniel Schick. All rights reserved.
|
// Copyright (c) 2015 Informatikbüro Daniel Schick. All rights reserved.
|
||||||
|
|
||||||
|
using log4net;
|
||||||
|
using Microsoft.Office.Interop.Excel;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.Linq;
|
||||||
|
|
||||||
using log4net;
|
|
||||||
using Microsoft.Office.Interop.Excel;
|
|
||||||
|
|
||||||
namespace bsmd.ExcelReadService
|
namespace bsmd.ExcelReadService
|
||||||
{
|
{
|
||||||
@ -37,7 +36,7 @@ namespace bsmd.ExcelReadService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ReadText(string lookup)
|
internal string ReadText(string lookup)
|
||||||
{
|
{
|
||||||
if (!_nameDict.ContainsKey(lookup)) return null;
|
if (!_nameDict.ContainsKey(lookup)) return null;
|
||||||
var val = _nameDict[lookup].RefersToRange.Value;
|
var val = _nameDict[lookup].RefersToRange.Value;
|
||||||
@ -48,7 +47,72 @@ namespace bsmd.ExcelReadService
|
|||||||
return val2.ToString();
|
return val2.ToString();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal string ReadTextNoWhitespace(string lookup)
|
||||||
|
{
|
||||||
|
string val = this.ReadText(lookup);
|
||||||
|
if (val == null) return val;
|
||||||
|
return new string(val.Where(c => !Char.IsWhiteSpace(c)).ToArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
internal byte? ReadGender(string lookup)
|
||||||
|
{
|
||||||
|
string val = this.ReadText(lookup);
|
||||||
|
if (val == null) return null;
|
||||||
|
if (val.Equals("m", StringComparison.CurrentCultureIgnoreCase) || val.Equals("male", StringComparison.CurrentCultureIgnoreCase)) return 0;
|
||||||
|
if (val.Equals("f", StringComparison.CurrentCultureIgnoreCase) || val.Equals("female", StringComparison.CurrentCultureIgnoreCase)) return 1;
|
||||||
|
return 2; // whatever
|
||||||
|
}
|
||||||
|
|
||||||
|
internal byte? ReadIdentityDocumentType(string lookup)
|
||||||
|
{
|
||||||
|
string val = this.ReadText(lookup);
|
||||||
|
if (val == null) return null;
|
||||||
|
if (val.Equals("identity_card", StringComparison.CurrentCultureIgnoreCase)) return 0;
|
||||||
|
if (val.Equals("passport", StringComparison.CurrentCultureIgnoreCase)) return 1;
|
||||||
|
if (val.Equals("muster_book", StringComparison.CurrentCultureIgnoreCase)) return 2;
|
||||||
|
if (val.Equals("picture_id", StringComparison.CurrentCultureIgnoreCase)) return 3;
|
||||||
|
if (val.Equals("residental_permit", StringComparison.CurrentCultureIgnoreCase)) return 4;
|
||||||
|
if (val.Equals("other_legal_identity_document", StringComparison.CurrentCultureIgnoreCase)) return 5;
|
||||||
|
|
||||||
|
return 5; // default?
|
||||||
|
}
|
||||||
|
|
||||||
|
internal byte? ReadShippingArea(string lookup)
|
||||||
|
{
|
||||||
|
string val = this.ReadText(lookup);
|
||||||
|
if (val.IndexOf("baltic", StringComparison.OrdinalIgnoreCase) >= 0) return 0;
|
||||||
|
if (val.IndexOf("europe", StringComparison.OrdinalIgnoreCase) >= 0) return 1;
|
||||||
|
if (val.IndexOf("overseas", StringComparison.OrdinalIgnoreCase) >= 0) return 2;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal byte? ReadHullConfiguration(string lookup)
|
||||||
|
{
|
||||||
|
string val = this.ReadText(lookup);
|
||||||
|
if (val.IndexOf("sbt", StringComparison.OrdinalIgnoreCase) >= 0) return 1;
|
||||||
|
if (val.IndexOf("single", StringComparison.OrdinalIgnoreCase) >= 0) return 0;
|
||||||
|
if (val.IndexOf("double", StringComparison.OrdinalIgnoreCase) >= 0) return 2;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal byte? ReadConditionTanks(string lookup)
|
||||||
|
{
|
||||||
|
string val = this.ReadText(lookup);
|
||||||
|
if (val.IndexOf("full", StringComparison.OrdinalIgnoreCase) >= 0) return 0;
|
||||||
|
if (val.IndexOf("empty", StringComparison.OrdinalIgnoreCase) >= 0) return 1;
|
||||||
|
if (val.IndexOf("inerted", StringComparison.OrdinalIgnoreCase) >= 0) return 2;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal byte? ReadDelivery(string lookup)
|
||||||
|
{
|
||||||
|
string val = this.ReadText(lookup);
|
||||||
|
if (val.IndexOf("all", StringComparison.OrdinalIgnoreCase) >= 0) return 0;
|
||||||
|
if (val.IndexOf("some", StringComparison.OrdinalIgnoreCase) >= 0) return 1;
|
||||||
|
if (val.IndexOf("none", StringComparison.OrdinalIgnoreCase) >= 0) return 2;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
@ -80,6 +144,22 @@ namespace bsmd.ExcelReadService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal DateTime? ReadDateTime(string dateField, string timeField)
|
||||||
|
{
|
||||||
|
DateTime? result = null;
|
||||||
|
DateTime? etaDate = this.ReadDate(dateField);
|
||||||
|
DateTime? etaTime = this.ReadTime(timeField);
|
||||||
|
if (etaDate != null)
|
||||||
|
{
|
||||||
|
result = new DateTime(etaDate.Value.Year, etaDate.Value.Month, etaDate.Value.Day);
|
||||||
|
if (etaTime != null)
|
||||||
|
{
|
||||||
|
result = new DateTime(etaDate.Value.Year, etaDate.Value.Month, etaDate.Value.Day, etaTime.Value.Hour, etaTime.Value.Minute, etaTime.Value.Second);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
internal DateTime? ReadTime(string lookup)
|
internal DateTime? ReadTime(string lookup)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -124,6 +204,15 @@ namespace bsmd.ExcelReadService
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal bool? ReadBoolean(string lookup)
|
||||||
|
{
|
||||||
|
string val = this.ReadText(lookup);
|
||||||
|
if (val == null) return null;
|
||||||
|
if ((val == "y") || (val == "Y") || (val == "yes") || (val == "YES") || (val == "1") || (val == "x") || (val == "X"))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -56,6 +56,21 @@ namespace bsmd.ExcelReadService
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static List<string> AllLocodesForCityName(string city)
|
||||||
|
{
|
||||||
|
List<string> results = new List<string>();
|
||||||
|
string query = string.Format("SELECT city_code, countries.code FROM locodes JOIN countries ON locodes.country_id = countries.ID WHERE locodes.port='t' AND locodes.name like '{1}'", city);
|
||||||
|
SQLiteCommand cmd = new SQLiteCommand(query, _con);
|
||||||
|
IDataReader reader = cmd.ExecuteReader();
|
||||||
|
while (reader.Read())
|
||||||
|
{
|
||||||
|
if (!reader.IsDBNull(0) && !reader.IsDBNull(1))
|
||||||
|
results.Add(string.Format("{0}{1}", reader.GetString(1), reader.GetString(0)));
|
||||||
|
}
|
||||||
|
reader.Close();
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Lookup 2CHAR Country Code from country name (like search). Hopefully this will result in many hits
|
/// Lookup 2CHAR Country Code from country name (like search). Hopefully this will result in many hits
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -10,7 +10,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Linq.Expressions;
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using log4net;
|
using log4net;
|
||||||
using bsmd.database;
|
using bsmd.database;
|
||||||
@ -39,9 +38,9 @@ namespace bsmd.ExcelReadService
|
|||||||
|
|
||||||
ScanAGNT(messages, messageCore, reader);
|
ScanAGNT(messages, messageCore, reader);
|
||||||
|
|
||||||
// NOA_NOD
|
ScanNOA_NOD(messages, messageCore, reader);
|
||||||
|
|
||||||
// SEC
|
ScanSEC(messages, messageCore, reader);
|
||||||
|
|
||||||
ScanPOBA(messages, messageCore, reader);
|
ScanPOBA(messages, messageCore, reader);
|
||||||
|
|
||||||
@ -53,15 +52,15 @@ namespace bsmd.ExcelReadService
|
|||||||
|
|
||||||
ScanSTAT(messages, messageCore, reader);
|
ScanSTAT(messages, messageCore, reader);
|
||||||
|
|
||||||
// MDH
|
ScanMDH(messages, messageCore, reader);
|
||||||
|
|
||||||
// CREW
|
ScanCREW(messages, messageCore, reader);
|
||||||
|
|
||||||
// PAS
|
ScanPAS(messages, messageCore, reader);
|
||||||
|
|
||||||
// BPOL
|
// BPOL nicht im sheet
|
||||||
|
|
||||||
// TOWA
|
ScanTOWA(messages, messageCore, reader);
|
||||||
|
|
||||||
// HAZA
|
// HAZA
|
||||||
|
|
||||||
@ -74,13 +73,13 @@ namespace bsmd.ExcelReadService
|
|||||||
|
|
||||||
ScanAGNT(messages, messageCore, reader);
|
ScanAGNT(messages, messageCore, reader);
|
||||||
|
|
||||||
// NOA_NOD
|
ScanNOA_NOD(messages, messageCore, reader);
|
||||||
|
|
||||||
ScanATA(messages, messageCore, reader);
|
ScanATA(messages, messageCore, reader);
|
||||||
|
|
||||||
ScanATD(messages, messageCore, reader);
|
ScanATD(messages, messageCore, reader);
|
||||||
|
|
||||||
// SEC
|
ScanSEC(messages, messageCore, reader);
|
||||||
|
|
||||||
ScanPOBA(messages, messageCore, reader);
|
ScanPOBA(messages, messageCore, reader);
|
||||||
|
|
||||||
@ -98,27 +97,27 @@ namespace bsmd.ExcelReadService
|
|||||||
|
|
||||||
ScanSTAT(messages, messageCore, reader);
|
ScanSTAT(messages, messageCore, reader);
|
||||||
|
|
||||||
// LADG
|
ScanLADG(messages, messageCore, reader);
|
||||||
|
|
||||||
// INFO
|
ScanINFO(messages, messageCore, reader);
|
||||||
|
|
||||||
// SERV
|
|
||||||
|
|
||||||
// PRE72H
|
ScanSERV(messages, messageCore, reader);
|
||||||
|
|
||||||
// MDH
|
ScanPRE72H(messages, messageCore, reader);
|
||||||
|
|
||||||
// WAS
|
ScanMDH(messages, messageCore, reader);
|
||||||
|
|
||||||
// CREW
|
ScanWAS(messages, messageCore, reader);
|
||||||
|
|
||||||
// PAS
|
ScanCREW(messages, messageCore, reader);
|
||||||
|
|
||||||
// BPOL
|
ScanPAS(messages, messageCore, reader);
|
||||||
|
|
||||||
// TOWA
|
// BPOL nicht im Sheet
|
||||||
|
|
||||||
// TOWD
|
ScanTOWA(messages, messageCore, reader);
|
||||||
|
|
||||||
|
ScanTOWD(messages, messageCore, reader);
|
||||||
|
|
||||||
// HAZA
|
// HAZA
|
||||||
|
|
||||||
@ -279,6 +278,27 @@ namespace bsmd.ExcelReadService
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region INFO
|
||||||
|
|
||||||
|
static void ScanINFO(List<Message> messages, MessageCore messageCore, ExcelReader reader)
|
||||||
|
{
|
||||||
|
Message infoMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.INFO);
|
||||||
|
if(infoMessage.Elements.Count == 0)
|
||||||
|
{
|
||||||
|
INFO newINFO = new INFO();
|
||||||
|
newINFO.MessageHeader = infoMessage;
|
||||||
|
infoMessage.Elements.Add(newINFO);
|
||||||
|
}
|
||||||
|
INFO info = infoMessage.Elements[0] as INFO;
|
||||||
|
Util.ScanMessage(info, reader);
|
||||||
|
|
||||||
|
info.ShippingArea = reader.ReadShippingArea(@"INFO.ShippingArea"); // enum read func
|
||||||
|
|
||||||
|
// wird nicht wieder entfernt
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region STAT
|
#region STAT
|
||||||
|
|
||||||
static void ScanSTAT(List<Message> messages, MessageCore messageCore, ExcelReader reader)
|
static void ScanSTAT(List<Message> messages, MessageCore messageCore, ExcelReader reader)
|
||||||
@ -307,6 +327,56 @@ namespace bsmd.ExcelReadService
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region NOA_NOD
|
||||||
|
|
||||||
|
static void ScanNOA_NOD(List<Message> messages, MessageCore messageCore, ExcelReader reader)
|
||||||
|
{
|
||||||
|
Message noa_nodMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.NOA_NOD);
|
||||||
|
if (noa_nodMessage.Elements.Count == 0)
|
||||||
|
{
|
||||||
|
NOA_NOD newNoa_nod = new NOA_NOD();
|
||||||
|
newNoa_nod.MessageHeader = noa_nodMessage;
|
||||||
|
noa_nodMessage.Elements.Add(newNoa_nod);
|
||||||
|
}
|
||||||
|
|
||||||
|
NOA_NOD noa_nod = noa_nodMessage.Elements[0] as NOA_NOD;
|
||||||
|
if (messageCore.IsTransit)
|
||||||
|
noa_nod.ETAToKielCanal = messageCore.ETAKielCanal;
|
||||||
|
else {
|
||||||
|
noa_nod.ETAToPortOfCall = messageCore.ETA;
|
||||||
|
|
||||||
|
string callPurposeDescription = reader.ReadText("NOA_NOD.CallPuposeDescription");
|
||||||
|
if (!callPurposeDescription.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
CallPurpose callPurpose = new CallPurpose();
|
||||||
|
callPurpose.CallPurposeCode = noa_nod.getCallPurposeCodeFromDescription(callPurposeDescription) ?? 0;
|
||||||
|
callPurpose.CallPurposeDescription = callPurposeDescription;
|
||||||
|
noa_nod.CallPurposes.Add(callPurpose);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
string lastPort = reader.ReadText("NOA_NOD.LastPort").Trim();
|
||||||
|
List<string> lastPorts = LocodeDB.AllLocodesForCityName(lastPort);
|
||||||
|
if (lastPorts.Count == 1)
|
||||||
|
noa_nod.LastPort = lastPorts[0];
|
||||||
|
else
|
||||||
|
_log.WarnFormat("{0} results in {1} possible LOCODES", lastPort, lastPorts.Count);
|
||||||
|
|
||||||
|
string nextPort = reader.ReadText("NOA_NOD.NextPort").Trim();
|
||||||
|
List<string> nextPorts = LocodeDB.AllLocodesForCityName(nextPort);
|
||||||
|
if (nextPorts.Count == 1)
|
||||||
|
noa_nod.NextPort = nextPorts[0];
|
||||||
|
else
|
||||||
|
_log.WarnFormat("{0} results in {1} possible LOCODES", nextPort, nextPorts.Count);
|
||||||
|
|
||||||
|
noa_nod.ETDFromPortOfCall = reader.ReadDateTime("NOA_NOD.ETDDateFromPortOfCall", "NOA_NOD.ETDTimeFromPortOfCall");
|
||||||
|
noa_nod.ETDFromLastPort = reader.ReadDateTime("NOA_NOD.ETDDateFromLastPort", "NOA_NOD.ETDTimeFromLastPort");
|
||||||
|
noa_nod.ETAToNextPort = reader.ReadDateTime("NOA_NOD.ETADateToNextPort", "NOA_NOD.ETATimeToNextPort");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region AGNT
|
#region AGNT
|
||||||
|
|
||||||
static void ScanAGNT(List<Message> messages, MessageCore messageCore, ExcelReader reader)
|
static void ScanAGNT(List<Message> messages, MessageCore messageCore, ExcelReader reader)
|
||||||
@ -325,6 +395,58 @@ namespace bsmd.ExcelReadService
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region WAS
|
||||||
|
|
||||||
|
static void ScanWAS(List<Message> messages, MessageCore messageCore, ExcelReader reader)
|
||||||
|
{
|
||||||
|
Message wasMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.WAS);
|
||||||
|
if (wasMessage.Elements.Count == 0)
|
||||||
|
{
|
||||||
|
WAS newWAS = new WAS();
|
||||||
|
newWAS.MessageHeader = wasMessage;
|
||||||
|
wasMessage.Elements.Add(newWAS);
|
||||||
|
}
|
||||||
|
WAS was = wasMessage.Elements[0] as WAS;
|
||||||
|
Util.ScanMessage(was, reader);
|
||||||
|
was.WasteDisposalDelivery = reader.ReadDelivery("WAS.WasteDisposalDelivery");
|
||||||
|
List<string> deliveryLocodes = LocodeDB.AllLocodesForCityName(reader.ReadText("WAS.LastWasteDisposalPort"));
|
||||||
|
if (deliveryLocodes.Count == 1)
|
||||||
|
was.LastWasteDisposalPort = deliveryLocodes[0];
|
||||||
|
|
||||||
|
// Waste 1 - 9
|
||||||
|
for (int i = 1; i <= was.NumberOfExcelRows; i++)
|
||||||
|
{
|
||||||
|
// string wastetype = string.Format("WAS.WasteType_{0}", i);
|
||||||
|
string wasteDescription = string.Format("WAS.WasteDescription_{0}", i);
|
||||||
|
string wasteAmount = string.Format("WAS.WasteDisposalAmount_MTQ_{0}", i);
|
||||||
|
string wasteCapacity = string.Format("WAS.WasteCapacity_MTQ_{0}", i);
|
||||||
|
string wasteRetained = string.Format("WAS.WasteAmountRetained_MTQ_{0}", i);
|
||||||
|
string wastePort = string.Format("WAS.WasteDisposalPort_{0}", i);
|
||||||
|
string amountGen = string.Format("WAS.WasteAmountGeneratedTillNextPort_MTQ_{0}", i);
|
||||||
|
|
||||||
|
Waste waste = was.GetSublistElementWithIdentifier(i.ToString()) as Waste;
|
||||||
|
if(waste == null)
|
||||||
|
{
|
||||||
|
waste = new Waste();
|
||||||
|
waste.Identifier = i.ToString();
|
||||||
|
waste.WAS = was;
|
||||||
|
was.Waste.Add(waste);
|
||||||
|
}
|
||||||
|
|
||||||
|
waste.WasteType = (byte)i;
|
||||||
|
waste.WasteDescription = reader.ReadText(wasteDescription);
|
||||||
|
waste.WasteDisposalAmount_MTQ = reader.ReadNumber(wasteAmount);
|
||||||
|
waste.WasteCapacity_MTQ = reader.ReadNumber(wasteCapacity);
|
||||||
|
waste.WasteAmountRetained_MTQ = reader.ReadNumber(wasteRetained);
|
||||||
|
waste.WasteDisposalPort = reader.ReadText(wastePort); // TODO: check for LOCODE?
|
||||||
|
waste.WasteAmountGeneratedTillNextPort_MTQ = reader.ReadNumber(amountGen);
|
||||||
|
|
||||||
|
// empty wastes not removed, are required elements!
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region MDH
|
#region MDH
|
||||||
|
|
||||||
static void ScanMDH(List<Message> messages, MessageCore messageCore, ExcelReader reader)
|
static void ScanMDH(List<Message> messages, MessageCore messageCore, ExcelReader reader)
|
||||||
@ -340,7 +462,7 @@ namespace bsmd.ExcelReadService
|
|||||||
Util.ScanMessage(mdh, reader);
|
Util.ScanMessage(mdh, reader);
|
||||||
|
|
||||||
// POC last 30 days
|
// POC last 30 days
|
||||||
for (int i = 0; i < 15; i++)
|
for (int i = 0; i < mdh.NumberOfExcelRows; i++)
|
||||||
{
|
{
|
||||||
string portName = string.Format("MDH.PortOfCallLast30DaysPort_{0}", i + 1);
|
string portName = string.Format("MDH.PortOfCallLast30DaysPort_{0}", i + 1);
|
||||||
string portCountry = string.Format("MDH.PortOfCallLast30DaysCountry_{0}", i + 1);
|
string portCountry = string.Format("MDH.PortOfCallLast30DaysCountry_{0}", i + 1);
|
||||||
@ -354,37 +476,123 @@ namespace bsmd.ExcelReadService
|
|||||||
{
|
{
|
||||||
poc30d = new PortOfCallLast30Days();
|
poc30d = new PortOfCallLast30Days();
|
||||||
poc30d.Identifier = (i + 1).ToString();
|
poc30d.Identifier = (i + 1).ToString();
|
||||||
poc30d.MessageHeader = mdhMessage;
|
poc30d.MDH = mdh;
|
||||||
mdh.PortOfCallLast30Days.Add(poc30d);
|
mdh.PortOfCallLast30Days.Add(poc30d);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO! geht nicht weil sich der Index ändert und das Namensattribut konstant ist
|
poc30d.PortOfCallLast30DaysDateOfDeparture = reader.ReadDate(depDate);
|
||||||
|
poc30d.PortOfCallLast30DaysLocode = reader.ReadTextNoWhitespace(locode);
|
||||||
|
poc30d.PortOfCallLast30DaysCrewMembersJoined = reader.ReadBoolean(crewJoined);
|
||||||
|
|
||||||
|
if (poc30d.PortOfCallLast30DaysCrewMembersJoined ?? false)
|
||||||
|
{
|
||||||
|
string crewNameString = reader.ReadText(crewName);
|
||||||
|
if (!crewName.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
// try different separators
|
||||||
|
string[] crew = crewNameString.Split(';');
|
||||||
|
if (crew.Length == 1)
|
||||||
|
crew = crewNameString.Split(',');
|
||||||
|
|
||||||
// Util.ScanMessage(poc30d, reader);
|
for (int j = 0; j < crew.Length; j++)
|
||||||
|
{
|
||||||
|
PortOfCallLast30DaysCrewJoinedShip poc30dCrew = poc30d.GetSublistElementWithIdentifier((j + 1).ToString()) as PortOfCallLast30DaysCrewJoinedShip;
|
||||||
|
if (poc30dCrew == null)
|
||||||
|
{
|
||||||
|
poc30dCrew = new PortOfCallLast30DaysCrewJoinedShip();
|
||||||
|
poc30dCrew.Identifier = (j + 1).ToString();
|
||||||
|
poc30dCrew.PortOfCallLast30Days = poc30d;
|
||||||
|
poc30d.CrewJoinedShip.Add(poc30dCrew);
|
||||||
|
}
|
||||||
|
|
||||||
|
poc30dCrew.PortOfCallLast30DaysCrewJoinedShipName = crew[j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Leer/def. Zeilen entfernen
|
// Leer/def. Zeilen entfernen
|
||||||
if (!poc30d.PortOfCallLast30DaysDateOfDeparture.HasValue && (poc30d.PortOfCallLast30DaysLocode == null))
|
if (!poc30d.PortOfCallLast30DaysDateOfDeparture.HasValue && (poc30d.PortOfCallLast30DaysLocode == null))
|
||||||
mdh.PortOfCallLast30Days.Remove(poc30d);
|
mdh.PortOfCallLast30Days.Remove(poc30d);
|
||||||
|
}
|
||||||
|
|
||||||
string crewJoinedText = reader.ReadText(crewName);
|
// wird nicht wieder entfernt falls keine Daten vorliegen
|
||||||
if (!crewJoinedText.IsNullOrEmpty())
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region SEC
|
||||||
|
|
||||||
|
static void ScanSEC(List<Message> messages, MessageCore messageCore, ExcelReader reader)
|
||||||
|
{
|
||||||
|
Message secMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.SEC);
|
||||||
|
if (secMessage.Elements.Count == 0)
|
||||||
|
{
|
||||||
|
SEC newSEC = new SEC();
|
||||||
|
newSEC.MessageHeader = secMessage;
|
||||||
|
secMessage.Elements.Add(newSEC);
|
||||||
|
}
|
||||||
|
SEC sec = secMessage.Elements[0] as SEC;
|
||||||
|
Util.ScanMessage(sec, reader);
|
||||||
|
|
||||||
|
// Last10PortFacilitesCalled
|
||||||
|
for (int i = 1; i <= 10; i++)
|
||||||
|
{
|
||||||
|
string portName = string.Format("SEC.PortFacilityPortName_{0}", i);
|
||||||
|
string portCountry = string.Format("SEC.PortFacilityPortCountry_{0}", i);
|
||||||
|
string portLocode = string.Format("SEC.PortFacilityPortLoCode_{0}", i);
|
||||||
|
string portDateOfArrival = string.Format("SEC.PortFacilityDateOfArrival_{0}", i);
|
||||||
|
string portDateOfDeparture = string.Format("SEC.PortFacilityDateOfDeparture_{0}", i);
|
||||||
|
string portShipSecLevel = string.Format("SEC.PortFacilityShipSecurityLevel_{0}", i);
|
||||||
|
string portGISISCode = string.Format("SEC.PortFacilityGISISCode_{0}", i);
|
||||||
|
|
||||||
|
LastTenPortFacilitiesCalled l10fc = sec.GetPortFacilityWithIdentifier(i.ToString()) as LastTenPortFacilitiesCalled;
|
||||||
|
if (l10fc == null)
|
||||||
{
|
{
|
||||||
PortOfCallLast30DaysCrewJoinedShip poc30C = mdh.GetSublistElementWithIdentifier("1") as PortOfCallLast30DaysCrewJoinedShip;
|
l10fc = new LastTenPortFacilitiesCalled();
|
||||||
if (poc30C == null)
|
l10fc.Identifier = i.ToString();
|
||||||
{
|
l10fc.SEC = sec;
|
||||||
poc30C = new PortOfCallLast30DaysCrewJoinedShip();
|
sec.LastTenPortFacilitesCalled.Add(l10fc);
|
||||||
poc30C.PortOfCallLast30Days = poc30d;
|
|
||||||
poc30d.CrewJoinedShip.Add(poc30C);
|
|
||||||
}
|
|
||||||
poc30C.PortOfCallLast30DaysCrewJoinedShipName = crewJoinedText;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
l10fc.PortFacilityPortName = reader.ReadText(portName);
|
||||||
|
l10fc.PortFacilityPortCountry = reader.ReadText(portCountry);
|
||||||
|
l10fc.PortFacilityPortLoCode = reader.ReadTextNoWhitespace(portLocode);
|
||||||
|
l10fc.PortFacilityDateOfArrival = reader.ReadDate(portDateOfArrival);
|
||||||
|
l10fc.PortFacilityDateOfDeparture = reader.ReadDate(portDateOfDeparture);
|
||||||
|
l10fc.PortFacilityShipSecurityLevel = (byte) reader.ReadNumber(portShipSecLevel);
|
||||||
|
l10fc.PortFacilityGISISCode = reader.ReadTextNoWhitespace(portGISISCode);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ship2ShipActivities
|
||||||
|
for (int i = 1; i <= 10; i++)
|
||||||
|
{
|
||||||
|
string s2sName = string.Format("SEC.ShipToShipActivityLocationName_{0}", i);
|
||||||
|
string s2sLocode = string.Format("SEC.ShipToShipActivityLocationLoCode_{0}", i);
|
||||||
|
string s2sLatitude = string.Format("SEC.ShipToShipActivityLocationCoordinatesLatitude_{0}", i);
|
||||||
|
string s2sLongitude = string.Format("SEC.ShipToShipActivityLocationCoordinatesLongitude_{0}", i);
|
||||||
|
string s2sFromDate = string.Format("SEC.ShipToShipActivityDateFrom_{0}", i);
|
||||||
|
string s2sToDate = string.Format("SEC.ShipToShipActivityDateTo_{0}", i);
|
||||||
|
string s2sActivityString = string.Format("SEC.ShipToShipActivityType_{0}", i);
|
||||||
|
|
||||||
|
ShipToShipActivitiesDuringLastTenPortFacilitiesCalled s2sActivity = sec.GetShipToShipWithIdentifier(i.ToString()) as ShipToShipActivitiesDuringLastTenPortFacilitiesCalled;
|
||||||
|
if (s2sActivity == null)
|
||||||
|
{
|
||||||
|
s2sActivity = new ShipToShipActivitiesDuringLastTenPortFacilitiesCalled();
|
||||||
|
s2sActivity.Identifier = i.ToString();
|
||||||
|
s2sActivity.SEC = sec;
|
||||||
|
sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Add(s2sActivity);
|
||||||
|
}
|
||||||
|
|
||||||
|
s2sActivity.ShipToShipActivityLocationName = reader.ReadText(s2sName);
|
||||||
|
s2sActivity.ShipToShipActivityLocationLoCode = reader.ReadTextNoWhitespace(s2sLocode);
|
||||||
|
s2sActivity.ShipToShipActivityLocationCoordinatesLatitude = (int)reader.ReadNumber(s2sLatitude);
|
||||||
|
s2sActivity.ShipToShipActivityLocationCoordinatesLongitude = (int)reader.ReadNumber(s2sLongitude);
|
||||||
|
s2sActivity.ShipToShipActivityDateFrom = reader.ReadDate(s2sFromDate);
|
||||||
|
s2sActivity.ShipToShipActivityDateTo = reader.ReadDate(s2sToDate);
|
||||||
|
s2sActivity.ShipToShipActivityType = reader.ReadText(s2sActivityString);
|
||||||
|
}
|
||||||
|
|
||||||
// wird nicht wieder entfernt falls keine Daten vorliegen
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -447,6 +655,92 @@ namespace bsmd.ExcelReadService
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region TOWA
|
||||||
|
|
||||||
|
static void ScanTOWA(List<Message> messages, MessageCore messageCore, ExcelReader reader)
|
||||||
|
{
|
||||||
|
// TOWA ist eigentlich 1:n, es ist aber keine Liste im Sheet!
|
||||||
|
Message towaMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.TOWA);
|
||||||
|
|
||||||
|
string towageName = reader.ReadText("TOWA.TowageOnArrivalName");
|
||||||
|
if (!towageName.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
if (towaMessage.Elements.Count == 0)
|
||||||
|
{
|
||||||
|
TOWA newTOWA = new TOWA();
|
||||||
|
newTOWA.MessageHeader = towaMessage;
|
||||||
|
towaMessage.Elements.Add(newTOWA);
|
||||||
|
}
|
||||||
|
|
||||||
|
TOWA towa = towaMessage.Elements[0] as TOWA;
|
||||||
|
Util.ScanMessage(towa, reader);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region TOWD
|
||||||
|
|
||||||
|
static void ScanTOWD(List<Message> messages, MessageCore messageCore, ExcelReader reader)
|
||||||
|
{
|
||||||
|
// TOWD ist 1:n, es ist aber keine Liste im Sheet!
|
||||||
|
Message towdMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.TOWD);
|
||||||
|
string towageName = reader.ReadText("TOWD.TowageOnDepartureName");
|
||||||
|
if(!towageName.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
if(towdMessage.Elements.Count == 0)
|
||||||
|
{
|
||||||
|
TOWD newTOWD = new TOWD();
|
||||||
|
newTOWD.MessageHeader = towdMessage;
|
||||||
|
towdMessage.Elements.Add(newTOWD);
|
||||||
|
}
|
||||||
|
|
||||||
|
TOWD towd = towdMessage.Elements[0] as TOWD;
|
||||||
|
Util.ScanMessage(towd, reader);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region PRE72H
|
||||||
|
|
||||||
|
static void ScanPRE72H(List<Message> messages, MessageCore messageCore, ExcelReader reader)
|
||||||
|
{
|
||||||
|
Message pre72hMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.PRE72H);
|
||||||
|
if (pre72hMessage.Elements.Count == 0)
|
||||||
|
{
|
||||||
|
PRE72H newPRE72H = new PRE72H();
|
||||||
|
newPRE72H.MessageHeader = pre72hMessage;
|
||||||
|
pre72hMessage.Elements.Add(newPRE72H);
|
||||||
|
}
|
||||||
|
PRE72H pre72h = pre72hMessage.Elements[0] as PRE72H;
|
||||||
|
Util.ScanMessage(pre72h, reader);
|
||||||
|
// diese Nachricht bleibt auch wenn sie leer ist
|
||||||
|
pre72h.ConditionCargoBallastTanks = reader.ReadConditionTanks("PRE72H.ConditionCargoBallastTanks");
|
||||||
|
pre72h.TankerHullConfiguration = reader.ReadHullConfiguration("PRE72H.TankerHullConfiguration");
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region SERV
|
||||||
|
|
||||||
|
static void ScanSERV(List<Message> messages, MessageCore messageCore, ExcelReader reader)
|
||||||
|
{
|
||||||
|
Message servMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.SERV);
|
||||||
|
if(servMessage.Elements.Count == 0)
|
||||||
|
{
|
||||||
|
SERV newSERV = new SERV();
|
||||||
|
newSERV.MessageHeader = servMessage;
|
||||||
|
servMessage.Elements.Add(newSERV);
|
||||||
|
}
|
||||||
|
SERV serv = servMessage.Elements[0] as SERV;
|
||||||
|
Util.ScanMessage(serv, reader);
|
||||||
|
if (serv.ServiceBeneficiary.IsNullOrEmpty() && serv.ServiceInvoiceRecipient.IsNullOrEmpty())
|
||||||
|
servMessage.Elements.Remove(serv);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region LADG
|
#region LADG
|
||||||
|
|
||||||
static void ScanLADG(List<Message> messages, MessageCore messageCore, ExcelReader reader)
|
static void ScanLADG(List<Message> messages, MessageCore messageCore, ExcelReader reader)
|
||||||
@ -486,10 +780,107 @@ namespace bsmd.ExcelReadService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region CREW
|
||||||
|
|
||||||
|
static void ScanCREW(List<Message> messages, MessageCore messageCore, ExcelReader reader)
|
||||||
|
{
|
||||||
|
Message crewMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.CREW);
|
||||||
|
for (int i = 0; i < crewMessage.NumberOfExcelRows; i++)
|
||||||
|
{
|
||||||
|
string crewLastName = string.Format("CREW.CrewMemberLastName_{0}", i + 1);
|
||||||
|
string crewFirstName = string.Format("CREW.CrewMemberFirstName_{0}", i + 1);
|
||||||
|
string crewGender = string.Format("CREW.CrewMemberGender_{0}", i + 1);
|
||||||
|
string crewNationality = string.Format("CREW.CrewMemberNationality_{0}", i + 1);
|
||||||
|
string crewDuty = string.Format("CREW.CrewMemberDuty_{0}", i + 1);
|
||||||
|
string crewPlaceOfBirth = string.Format("CREW.CrewMemberPlaceOfBirth_{0}", i + 1);
|
||||||
|
string crewDateOfBirth = string.Format("CREW.CrewMemberDateOfBirth_{0}", i + 1);
|
||||||
|
string crewIdentDocType = string.Format("CREW.CrewMemberIdentityDocumentType_{0}", i + 1);
|
||||||
|
string crewIdentDocId = string.Format("CREW.CrewMemberIdentityDocumentId_{0}", i + 1);
|
||||||
|
string crewVisaNo = string.Format("CREW.CrewMemberVisaNumber_{0}", i + 1);
|
||||||
|
|
||||||
|
string lastName = reader.ReadText(crewLastName);
|
||||||
|
if (!lastName.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
CREW crew = crewMessage.GetSublistElementWithIdentifier((i + 1).ToString()) as CREW;
|
||||||
|
if (crew == null)
|
||||||
|
{
|
||||||
|
crew = new CREW();
|
||||||
|
crew.Identifier = (i + 1).ToString();
|
||||||
|
crew.MessageHeader = crewMessage;
|
||||||
|
crewMessage.Elements.Add(crew);
|
||||||
|
}
|
||||||
|
|
||||||
|
crew.CrewMemberLastName = lastName;
|
||||||
|
crew.CrewMemberFirstName = reader.ReadText(crewFirstName);
|
||||||
|
crew.CrewMemberGender = reader.ReadGender(crewGender);
|
||||||
|
crew.CrewMemberDuty = reader.ReadText(crewDuty);
|
||||||
|
crew.CrewMemberPlaceOfBirth = reader.ReadText(crewPlaceOfBirth);
|
||||||
|
crew.CrewMemberDateOfBirth = reader.ReadDate(crewDateOfBirth);
|
||||||
|
crew.CrewMemberIdentityDocumentType = reader.ReadIdentityDocumentType(crewIdentDocType);
|
||||||
|
crew.CrewMemberIdentityDocumentId = reader.ReadText(crewIdentDocId);
|
||||||
|
crew.CrewMemberVisaNumber = reader.ReadText(crewVisaNo);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region PAS
|
||||||
|
|
||||||
|
static void ScanPAS(List<Message> messages, MessageCore messageCore, ExcelReader reader)
|
||||||
|
{
|
||||||
|
Message pasMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.PAS);
|
||||||
|
for (int i = 0; i < pasMessage.NumberOfExcelRows; i++)
|
||||||
|
{
|
||||||
|
string pasLastName = string.Format("PAS.PassengerLastName_{0}", i + 1);
|
||||||
|
string pasFirstName = string.Format("PAS.PassengerFirstName_{0}", i + 1);
|
||||||
|
string pasGender = string.Format("PAS.PassengerGender_{0}", i + 1);
|
||||||
|
string pasNationality = string.Format("PAS.PassengerNationality_{0}", i + 1);
|
||||||
|
string pasEmbarkation = string.Format("PAS.PassengerPortOfEmbarkation_{0}", i + 1);
|
||||||
|
string pasDebarkation = string.Format("PAS.PassengerPortOfDisembarkation_{0}", i + 1);
|
||||||
|
string pasTransit = string.Format("PAS.PassengerInTransit_{0}", i + 1);
|
||||||
|
string pasPlaceOfBirth = string.Format("PAS.PassengerPlaceOfBirth_{0}", i + 1);
|
||||||
|
string pasDateOfBirth = string.Format("PAS.PassengerDateOfBirth_{0}", i + 1);
|
||||||
|
string pasIdentDocType = string.Format("PAS.PassengerIdentityDocumentType_{0}", i + 1);
|
||||||
|
string pasIdentDocId = string.Format("PAS.PassengerIdentityDocumentId_{0}", i + 1);
|
||||||
|
string pasVisaNo = string.Format("PAS.PassengerVisaNumber_{0}", i + 1);
|
||||||
|
|
||||||
|
string lastName = reader.ReadText(pasLastName);
|
||||||
|
if (!lastName.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
PAS pas = pasMessage.GetSublistElementWithIdentifier((i + 1).ToString()) as PAS;
|
||||||
|
if (pas == null)
|
||||||
|
{
|
||||||
|
pas = new PAS();
|
||||||
|
pas.Identifier = (i + 1).ToString();
|
||||||
|
pas.MessageHeader = pasMessage;
|
||||||
|
pasMessage.Elements.Add(pas);
|
||||||
|
}
|
||||||
|
|
||||||
|
pas.PassengerLastName = lastName;
|
||||||
|
pas.PassengerFirstName = reader.ReadText(pasFirstName);
|
||||||
|
pas.PassengerGender = reader.ReadGender(pasGender);
|
||||||
|
pas.PassengerNationality = reader.ReadText(pasNationality);
|
||||||
|
// TODO: Nicht klar ob hier LOCODEs kommen oder nicht
|
||||||
|
pas.PassengerPortOfEmbarkation = reader.ReadTextNoWhitespace(pasEmbarkation);
|
||||||
|
pas.PassengerPortOfDisembarkation = reader.ReadTextNoWhitespace(pasDebarkation);
|
||||||
|
pas.PassengerInTransit = reader.ReadBoolean(pasTransit);
|
||||||
|
pas.PassengerPlaceOfBirth = reader.ReadText(pasPlaceOfBirth);
|
||||||
|
pas.PassengerDateOfBirth = reader.ReadDate(pasDateOfBirth);
|
||||||
|
pas.PassengerIdentityDocumentType = reader.ReadIdentityDocumentType(pasIdentDocType);
|
||||||
|
pas.PassengerIdentityDocumentId = reader.ReadText(pasIdentDocId);
|
||||||
|
pas.PassengerVisaNumber = reader.ReadText(pasVisaNo);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region ScanMessage (generic)
|
||||||
|
|
||||||
private static void ScanMessage(DatabaseEntity dbEntity, ExcelReader reader)
|
private static void ScanMessage(DatabaseEntity dbEntity, ExcelReader reader)
|
||||||
{
|
{
|
||||||
@ -529,6 +920,8 @@ namespace bsmd.ExcelReadService
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Check with cell values if this message core is already in our DB
|
/// Check with cell values if this message core is already in our DB
|
||||||
@ -580,17 +973,7 @@ namespace bsmd.ExcelReadService
|
|||||||
imo = reader.ReadText("Visit.IMONumber");
|
imo = reader.ReadText("Visit.IMONumber");
|
||||||
|
|
||||||
// ETA
|
// ETA
|
||||||
|
eta = reader.ReadDateTime("NOA_NOD.ETADateToPortOfCall", "NOA_NOD.ETATimeToPortOfCall");
|
||||||
DateTime? etaDate = reader.ReadDate("NOA_NOD.ETADateToPortOfCall");
|
|
||||||
DateTime? etaTime = reader.ReadTime("NOA_NOD.ETATimeToPortOfCall");
|
|
||||||
if (etaDate != null)
|
|
||||||
{
|
|
||||||
eta = new DateTime(etaDate.Value.Year, etaDate.Value.Month, etaDate.Value.Day);
|
|
||||||
if (etaTime != null)
|
|
||||||
{
|
|
||||||
eta = new DateTime(etaDate.Value.Year, etaDate.Value.Month, etaDate.Value.Day, etaTime.Value.Hour, etaTime.Value.Minute, etaTime.Value.Second);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
result = DBManager.Instance.GetMessageCoreByShipInfos(imo, eta.Value, poc);
|
result = DBManager.Instance.GetMessageCoreByShipInfos(imo, eta.Value, poc);
|
||||||
if (result.IsNew)
|
if (result.IsNew)
|
||||||
|
|||||||
@ -669,6 +669,14 @@ namespace bsmd.ReportGenerator
|
|||||||
column.Width = Unit.FromCentimeter(6);
|
column.Width = Unit.FromCentimeter(6);
|
||||||
|
|
||||||
Row row = table.AddRow();
|
Row row = table.AddRow();
|
||||||
|
|
||||||
|
row.Cells[0].AddParagraph("Valid exemption?");
|
||||||
|
row.Cells[1].AddParagraph("Confirmation of correctness");
|
||||||
|
row = table.AddRow();
|
||||||
|
row.Cells[0].AddParagraph(was.WasteDisposalValidExemption ?? false ? "YES" : "NO");
|
||||||
|
row.Cells[1].AddParagraph(was.ConfirmationOfCorrectness ?? false ? "YES" : "NO");
|
||||||
|
|
||||||
|
row = table.AddRow();
|
||||||
row.Cells[0].AddParagraph("Last port where waste or cargo residues were discharged");
|
row.Cells[0].AddParagraph("Last port where waste or cargo residues were discharged");
|
||||||
row.Cells[1].AddParagraph("Date of last disposal");
|
row.Cells[1].AddParagraph("Date of last disposal");
|
||||||
row = table.AddRow();
|
row = table.AddRow();
|
||||||
@ -677,12 +685,12 @@ namespace bsmd.ReportGenerator
|
|||||||
row.Cells[1].AddParagraph(was.LastWasteDisposalDate.ToString());
|
row.Cells[1].AddParagraph(was.LastWasteDisposalDate.ToString());
|
||||||
row = table.AddRow();
|
row = table.AddRow();
|
||||||
row.Cells[0].AddParagraph("Name of waste disposal service provider");
|
row.Cells[0].AddParagraph("Name of waste disposal service provider");
|
||||||
row.Cells[1].AddParagraph("Waste disposal order (all, some, none");
|
row.Cells[1].AddParagraph("Waste disposal order (all, some, none)");
|
||||||
row = table.AddRow();
|
row = table.AddRow();
|
||||||
for (int i = 0; i < was.WasteDisposalServiceProvider.Count; i++)
|
for (int i = 0; i < was.WasteDisposalServiceProvider.Count; i++)
|
||||||
row.Cells[0].AddParagraph(was.WasteDisposalServiceProvider[i].WasteDisposalServiceProviderName);
|
row.Cells[0].AddParagraph(was.WasteDisposalServiceProvider[i].WasteDisposalServiceProviderName);
|
||||||
if (was.WasteDisposalDelivery.HasValue)
|
if (was.WasteDisposalDelivery.HasValue)
|
||||||
row.Cells[1].AddParagraph((was.WasteDisposalDelivery.Value == 0) ? "ALL" : (was.WasteDisposalDelivery == 1) ? "SOME" : "NONE");
|
row.Cells[1].AddParagraph((was.WasteDisposalDelivery.Value == 0) ? "ALL" : (was.WasteDisposalDelivery == 1) ? "SOME" : "NONE");
|
||||||
|
|
||||||
table = document.LastSection.AddTable();
|
table = document.LastSection.AddTable();
|
||||||
table.Rows.VerticalAlignment = VerticalAlignment.Top;
|
table.Rows.VerticalAlignment = VerticalAlignment.Top;
|
||||||
|
|||||||
@ -79,6 +79,7 @@ namespace bsmd.database
|
|||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[ReportDisplayName("Visa number")]
|
[ReportDisplayName("Visa number")]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string CrewMemberVisaNumber { get; set; }
|
public string CrewMemberVisaNumber { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
|||||||
@ -564,6 +564,7 @@ namespace bsmd.database
|
|||||||
if (databaseEntity.GetType().IsAssignableFrom(typeof(MDH)))
|
if (databaseEntity.GetType().IsAssignableFrom(typeof(MDH)))
|
||||||
{
|
{
|
||||||
MDH mdh = databaseEntity as MDH;
|
MDH mdh = databaseEntity as MDH;
|
||||||
|
|
||||||
PortOfCallLast30Days poc30 = new PortOfCallLast30Days();
|
PortOfCallLast30Days poc30 = new PortOfCallLast30Days();
|
||||||
poc30.PrepareLoadCommand(cmd, Message.LoadFilter.MDH_ID, mdh.Id);
|
poc30.PrepareLoadCommand(cmd, Message.LoadFilter.MDH_ID, mdh.Id);
|
||||||
SqlDataReader reader = this.PerformCommand(cmd);
|
SqlDataReader reader = this.PerformCommand(cmd);
|
||||||
@ -574,6 +575,37 @@ namespace bsmd.database
|
|||||||
apoc30.MDH = mdh;
|
apoc30.MDH = mdh;
|
||||||
this.LoadDependingLists(apoc30);
|
this.LoadDependingLists(apoc30);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SanitaryMeasuresDetail smd = new SanitaryMeasuresDetail();
|
||||||
|
smd.PrepareLoadCommand(cmd, Message.LoadFilter.MDH_ID, mdh.Id);
|
||||||
|
reader = this.PerformCommand(cmd);
|
||||||
|
List<DatabaseEntity> smds = smd.LoadList(reader);
|
||||||
|
foreach(SanitaryMeasuresDetail aSmd in smds)
|
||||||
|
{
|
||||||
|
mdh.SanitaryMeasuresDetails.Add(aSmd);
|
||||||
|
aSmd.MDH = mdh;
|
||||||
|
}
|
||||||
|
|
||||||
|
StowawaysJoiningLocation sjl = new StowawaysJoiningLocation();
|
||||||
|
sjl.PrepareLoadCommand(cmd, Message.LoadFilter.MDH_ID, mdh.Id);
|
||||||
|
reader = this.PerformCommand(cmd);
|
||||||
|
List<DatabaseEntity> sjls = sjl.LoadList(reader);
|
||||||
|
foreach(StowawaysJoiningLocation aSjl in sjls)
|
||||||
|
{
|
||||||
|
mdh.StowawaysJoiningLocations.Add(aSjl);
|
||||||
|
aSjl.MDH = mdh;
|
||||||
|
}
|
||||||
|
|
||||||
|
InfectedArea ia = new InfectedArea();
|
||||||
|
ia.PrepareLoadCommand(cmd, Message.LoadFilter.MDH_ID, mdh.Id);
|
||||||
|
reader = this.PerformCommand(cmd);
|
||||||
|
List<DatabaseEntity> ias = ia.LoadList(reader);
|
||||||
|
foreach(InfectedArea aIa in ias)
|
||||||
|
{
|
||||||
|
mdh.InfectedAreas.Add(aIa);
|
||||||
|
aIa.MDH = mdh;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -90,6 +90,13 @@ namespace bsmd.database
|
|||||||
[ShowReport]
|
[ShowReport]
|
||||||
[Validation(ValidationCode.NOT_NULL)]
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string StowagePosition { get; set; }
|
public string StowagePosition { get; set; }
|
||||||
|
|
||||||
|
public string Bay { get; set; }
|
||||||
|
|
||||||
|
public string Row { get; set; }
|
||||||
|
|
||||||
|
public string Tier { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[Validation(ValidationCode.LOCODE)]
|
[Validation(ValidationCode.LOCODE)]
|
||||||
public string PortOfLoading { get; set; }
|
public string PortOfLoading { get; set; }
|
||||||
@ -143,6 +150,9 @@ namespace bsmd.database
|
|||||||
scmd.Parameters.AddWithNullableValue("@P30", this.PortOfDischarge);
|
scmd.Parameters.AddWithNullableValue("@P30", this.PortOfDischarge);
|
||||||
scmd.Parameters.AddWithNullableValue("@P31", this.Remarks);
|
scmd.Parameters.AddWithNullableValue("@P31", this.Remarks);
|
||||||
scmd.Parameters.AddWithNullableValue("@P32", this.Identifier);
|
scmd.Parameters.AddWithNullableValue("@P32", this.Identifier);
|
||||||
|
scmd.Parameters.AddWithNullableValue("@P33", this.Bay);
|
||||||
|
scmd.Parameters.AddWithNullableValue("@P34", this.Row);
|
||||||
|
scmd.Parameters.AddWithNullableValue("@P35", this.Tier);
|
||||||
|
|
||||||
if (this.IsNew)
|
if (this.IsNew)
|
||||||
{
|
{
|
||||||
@ -154,9 +164,9 @@ namespace bsmd.database
|
|||||||
"Class7CSI, ControlTemperature_CEL, EmergencyTemperature_CEL, MarinePollutant, NumberOfPackages, " +
|
"Class7CSI, ControlTemperature_CEL, EmergencyTemperature_CEL, MarinePollutant, NumberOfPackages, " +
|
||||||
"PackageType, LimitedQuantities, ExceptedQuantities, NetQuantity_KGM, GrossQuantity_KGM, Volume_MTQ, " +
|
"PackageType, LimitedQuantities, ExceptedQuantities, NetQuantity_KGM, GrossQuantity_KGM, Volume_MTQ, " +
|
||||||
"GeneralCargoIBC, ContainerNumber, VehicleLicenseNumber, StowagePosition, PortOfLoading, PortOfDischarge, " +
|
"GeneralCargoIBC, ContainerNumber, VehicleLicenseNumber, StowagePosition, PortOfLoading, PortOfDischarge, " +
|
||||||
"Remarks, Identifier) VALUES (@P1, @P2, @P3, @P4, @P5, @P6, @P7, @P8, @P9, @P10, @P11, @P12, @P13, " +
|
"Remarks, Identifier, Bay, [Row], Tier) 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, " +
|
"@P14, @P15, @P16, @P17, @P18, @P19, @P20, @P21, @P22, @P23, @P24, @P25, @P26, @P27, @P28, @P29, @P30, " +
|
||||||
"@P31, @P32)", this.Tablename);
|
"@P31, @P32, @P33, @P34, @P35)", this.Tablename);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -168,7 +178,7 @@ namespace bsmd.database
|
|||||||
"MarinePollutant = @P17, NumberOfPackages = @P18, PackageType = @P19, LimitedQuantities = @P20, ExceptedQuantities = @P21, " +
|
"MarinePollutant = @P17, NumberOfPackages = @P18, PackageType = @P19, LimitedQuantities = @P20, ExceptedQuantities = @P21, " +
|
||||||
"NetQuantity_KGM = @P22, GrossQuantity_KGM = @P23, Volume_MTQ = @P24, GeneralCargoIBC = @P25, ContainerNumber = @P26, " +
|
"NetQuantity_KGM = @P22, GrossQuantity_KGM = @P23, Volume_MTQ = @P24, GeneralCargoIBC = @P25, ContainerNumber = @P26, " +
|
||||||
"VehicleLicenseNumber = @P27, StowagePosition = @P28, PortOfLoading = @P29, PortOfDischarge = @P30, Remarks = @P31, " +
|
"VehicleLicenseNumber = @P27, StowagePosition = @P28, PortOfLoading = @P29, PortOfDischarge = @P30, Remarks = @P31, " +
|
||||||
"Identifier = @P32 WHERE Id = @ID", this.Tablename);
|
"Identifier = @P32, Bay = @P33, [Row] = @P34, Tier = @P35 WHERE Id = @ID", this.Tablename);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -179,7 +189,7 @@ namespace bsmd.database
|
|||||||
"TechnicalName, NetExplosiveMass_KGM, Flashpoint_CEL, Class7NuclideName, Class7MaxActivity_BQL, Class7Category, " +
|
"TechnicalName, NetExplosiveMass_KGM, Flashpoint_CEL, Class7NuclideName, Class7MaxActivity_BQL, Class7Category, " +
|
||||||
"Class7TransportIndex, Class7CSI, ControlTemperature_CEL, EmergencyTemperature_CEL, MarinePollutant, NumberOfPackages, " +
|
"Class7TransportIndex, Class7CSI, ControlTemperature_CEL, EmergencyTemperature_CEL, MarinePollutant, NumberOfPackages, " +
|
||||||
"PackageType, LimitedQuantities, ExceptedQuantities, NetQuantity_KGM, GrossQuantity_KGM, Volume_MTQ, GeneralCargoIBC, " +
|
"PackageType, LimitedQuantities, ExceptedQuantities, NetQuantity_KGM, GrossQuantity_KGM, Volume_MTQ, GeneralCargoIBC, " +
|
||||||
"ContainerNumber, VehicleLicenseNumber, StowagePosition, PortOfLoading, PortOfDischarge, Remarks, Identifier " +
|
"ContainerNumber, VehicleLicenseNumber, StowagePosition, PortOfLoading, PortOfDischarge, Remarks, Identifier, Bay, [Row], Tier " +
|
||||||
"FROM {0} ", this.Tablename);
|
"FROM {0} ", this.Tablename);
|
||||||
|
|
||||||
switch (filter)
|
switch (filter)
|
||||||
@ -237,6 +247,9 @@ namespace bsmd.database
|
|||||||
if (!reader.IsDBNull(29)) imdg.PortOfDischarge = reader.GetString(29);
|
if (!reader.IsDBNull(29)) imdg.PortOfDischarge = reader.GetString(29);
|
||||||
if (!reader.IsDBNull(30)) imdg.Remarks = reader.GetString(30);
|
if (!reader.IsDBNull(30)) imdg.Remarks = reader.GetString(30);
|
||||||
if (!reader.IsDBNull(31)) imdg.Identifier = reader.GetString(31);
|
if (!reader.IsDBNull(31)) imdg.Identifier = reader.GetString(31);
|
||||||
|
if (!reader.IsDBNull(32)) imdg.Bay = reader.GetString(32);
|
||||||
|
if (!reader.IsDBNull(33)) imdg.Row = reader.GetString(33);
|
||||||
|
if (!reader.IsDBNull(34)) imdg.Tier = reader.GetString(34);
|
||||||
|
|
||||||
result.Add(imdg);
|
result.Add(imdg);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,6 +30,7 @@ namespace bsmd.database
|
|||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[Validation(ValidationCode.NOT_NULL)]
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
|
[LookupName("INFO.RequestedPositionInPortOfCall")]
|
||||||
public string RequestedPositionInPortOfCall { get; set; }
|
public string RequestedPositionInPortOfCall { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
@ -40,11 +41,20 @@ namespace bsmd.database
|
|||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[Validation(ValidationCode.NOT_NULL)]
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
|
[LookupName("INFO.FumigatedBulkCargo")]
|
||||||
public byte? FumigatedBulkCargo { get; set; }
|
public byte? FumigatedBulkCargo { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
public double? DeplacementSummerDraught_TNE { get; set; }
|
public double? DeplacementSummerDraught_TNE { get; set; }
|
||||||
|
|
||||||
|
[ShowReport]
|
||||||
|
[LookupName("INFO.PortArea")]
|
||||||
|
public string PortArea { get; set; }
|
||||||
|
|
||||||
|
public string BowThrusterPower { get; set; }
|
||||||
|
|
||||||
|
public string SternThrusterPower { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region DatabaseEntity implementation
|
#region DatabaseEntity implementation
|
||||||
@ -69,26 +79,29 @@ namespace bsmd.database
|
|||||||
scmd.Parameters.AddWithNullableValue("@P5", this.ConstructionCharacteristicsOfShip);
|
scmd.Parameters.AddWithNullableValue("@P5", this.ConstructionCharacteristicsOfShip);
|
||||||
scmd.Parameters.AddWithNullableValue("@P6", this.FumigatedBulkCargo);
|
scmd.Parameters.AddWithNullableValue("@P6", this.FumigatedBulkCargo);
|
||||||
scmd.Parameters.AddWithNullableValue("@P7", this.DeplacementSummerDraught_TNE);
|
scmd.Parameters.AddWithNullableValue("@P7", this.DeplacementSummerDraught_TNE);
|
||||||
|
scmd.Parameters.AddWithNullableValue("@P8", this.PortArea);
|
||||||
|
scmd.Parameters.AddWithNullableValue("@P9", this.BowThrusterPower);
|
||||||
|
scmd.Parameters.AddWithNullableValue("@P10", this.SternThrusterPower);
|
||||||
|
|
||||||
if (this.IsNew)
|
if (this.IsNew)
|
||||||
{
|
{
|
||||||
scmd.CommandText = string.Format("INSERT INTO {0} (MessageHeaderId, ShippingArea, RequestedPositionInPortOfCall, " +
|
scmd.CommandText = string.Format("INSERT INTO {0} (MessageHeaderId, ShippingArea, RequestedPositionInPortOfCall, " +
|
||||||
"SpecialRequirementsOfShipAtBerth, ConstructionCharacteristicsOfShip, FumigatedBulkCargo, DeplacementSummerDraught_TNE) " +
|
"SpecialRequirementsOfShipAtBerth, ConstructionCharacteristicsOfShip, FumigatedBulkCargo, DeplacementSummerDraught_TNE, " +
|
||||||
"VALUES ( @P1, @P2, @P3, @P4, @P5, @P6, @P7 )", this.Tablename);
|
"PortArea, BowThrusterPower, SternThrusterPower) VALUES ( @P1, @P2, @P3, @P4, @P5, @P6, @P7, @P8, @P9, @P10 )", this.Tablename);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
scmd.Parameters.AddWithValue(@"ID", this.Id);
|
scmd.Parameters.AddWithValue(@"ID", this.Id);
|
||||||
scmd.CommandText = string.Format("UPDATE {0} SET ShippingArea = @P2, RequestedPositionInPortOfCall = @P3, " +
|
scmd.CommandText = string.Format("UPDATE {0} SET ShippingArea = @P2, RequestedPositionInPortOfCall = @P3, " +
|
||||||
"SpecialRequirementsOfShipAtBerth = @P4, ConstructionCharacteristicsOfShip = @P5, FumigatedBulkCargo = @P6," +
|
"SpecialRequirementsOfShipAtBerth = @P4, ConstructionCharacteristicsOfShip = @P5, FumigatedBulkCargo = @P6," +
|
||||||
"DeplacementSummerDraught_TNE = @P7 WHERE Id = @ID", this.Tablename);
|
"DeplacementSummerDraught_TNE = @P7, PortArea = @P8, BowThrusterPower = @P9, SternThrusterPower = @P10 WHERE Id = @ID", this.Tablename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void PrepareLoadCommand(System.Data.IDbCommand cmd, Message.LoadFilter filter, params object[] criteria)
|
public override void PrepareLoadCommand(System.Data.IDbCommand cmd, Message.LoadFilter filter, params object[] criteria)
|
||||||
{
|
{
|
||||||
string query = string.Format("SELECT Id, ShippingArea, RequestedPositionInPortOfCall, SpecialRequirementsOfShipAtBerth, " +
|
string query = string.Format("SELECT Id, ShippingArea, RequestedPositionInPortOfCall, SpecialRequirementsOfShipAtBerth, " +
|
||||||
"ConstructionCharacteristicsOfShip, FumigatedBulkCargo, DeplacementSummerDraught_TNE FROM {0}",
|
"ConstructionCharacteristicsOfShip, FumigatedBulkCargo, DeplacementSummerDraught_TNE, PortArea, BowThrusterPower, SternThrusterPower FROM {0}",
|
||||||
this.Tablename);
|
this.Tablename);
|
||||||
|
|
||||||
switch (filter)
|
switch (filter)
|
||||||
@ -121,6 +134,9 @@ namespace bsmd.database
|
|||||||
if (!reader.IsDBNull(4)) info.ConstructionCharacteristicsOfShip = reader.GetString(4);
|
if (!reader.IsDBNull(4)) info.ConstructionCharacteristicsOfShip = reader.GetString(4);
|
||||||
if (!reader.IsDBNull(5)) info.FumigatedBulkCargo = reader.GetByte(5);
|
if (!reader.IsDBNull(5)) info.FumigatedBulkCargo = reader.GetByte(5);
|
||||||
if (!reader.IsDBNull(6)) info.DeplacementSummerDraught_TNE = (float) reader.GetDouble(6);
|
if (!reader.IsDBNull(6)) info.DeplacementSummerDraught_TNE = (float) reader.GetDouble(6);
|
||||||
|
if (!reader.IsDBNull(7)) info.PortArea = reader.GetString(7);
|
||||||
|
if (!reader.IsDBNull(8)) info.BowThrusterPower = reader.GetString(8);
|
||||||
|
if (!reader.IsDBNull(9)) info.SternThrusterPower = reader.GetString(9);
|
||||||
result.Add(info);
|
result.Add(info);
|
||||||
}
|
}
|
||||||
reader.Close();
|
reader.Close();
|
||||||
|
|||||||
@ -19,6 +19,12 @@ namespace bsmd.database
|
|||||||
|
|
||||||
private List<PortOfCallLast30Days> portOfCallLast30Days = new List<PortOfCallLast30Days>();
|
private List<PortOfCallLast30Days> portOfCallLast30Days = new List<PortOfCallLast30Days>();
|
||||||
|
|
||||||
|
private List<SanitaryMeasuresDetail> sanitaryMeasuresDetails = new List<SanitaryMeasuresDetail>();
|
||||||
|
|
||||||
|
private List<StowawaysJoiningLocation> stowawaysJoiningLocations = new List<database.StowawaysJoiningLocation>();
|
||||||
|
|
||||||
|
private List<InfectedArea> infectedAreas = new List<InfectedArea>();
|
||||||
|
|
||||||
public MDH()
|
public MDH()
|
||||||
{
|
{
|
||||||
this.tablename = "[dbo].[MDH]";
|
this.tablename = "[dbo].[MDH]";
|
||||||
@ -27,6 +33,13 @@ namespace bsmd.database
|
|||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
public List<PortOfCallLast30Days> PortOfCallLast30Days { get { return this.portOfCallLast30Days; } }
|
public List<PortOfCallLast30Days> PortOfCallLast30Days { get { return this.portOfCallLast30Days; } }
|
||||||
|
|
||||||
|
public List<SanitaryMeasuresDetail> SanitaryMeasuresDetails { get { return this.sanitaryMeasuresDetails; } }
|
||||||
|
|
||||||
|
public List<StowawaysJoiningLocation> StowawaysJoiningLocations { get { return this.stowawaysJoiningLocations; } }
|
||||||
|
|
||||||
|
public List<InfectedArea> InfectedAreas { get { return this.infectedAreas; } }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[Validation1(ValidationCode.NOT_NULL)]
|
[Validation1(ValidationCode.NOT_NULL)]
|
||||||
[LookupName("MDH.ValidSanitaryControlExemptionOrCertificateOnBoard")]
|
[LookupName("MDH.ValidSanitaryControlExemptionOrCertificateOnBoard")]
|
||||||
@ -264,6 +277,22 @@ namespace bsmd.database
|
|||||||
DBManager.Instance.Save(poc30d);
|
DBManager.Instance.Save(poc30d);
|
||||||
((ISublistContainer)poc30d).SaveElements();
|
((ISublistContainer)poc30d).SaveElements();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach(SanitaryMeasuresDetail smd in this.SanitaryMeasuresDetails)
|
||||||
|
{
|
||||||
|
DBManager.Instance.Save(smd);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(StowawaysJoiningLocation sjl in this.stowawaysJoiningLocations)
|
||||||
|
{
|
||||||
|
DBManager.Instance.Save(sjl);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(InfectedArea ia in this.InfectedAreas)
|
||||||
|
{
|
||||||
|
DBManager.Instance.Save(ia);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -421,6 +421,8 @@ namespace bsmd.database
|
|||||||
case NotificationClass.BKRA: return 5;
|
case NotificationClass.BKRA: return 5;
|
||||||
case NotificationClass.BKRD: return 5;
|
case NotificationClass.BKRD: return 5;
|
||||||
case NotificationClass.LADG: return 5;
|
case NotificationClass.LADG: return 5;
|
||||||
|
case NotificationClass.CREW: return 30;
|
||||||
|
case NotificationClass.PAS: return 30;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@ -215,5 +215,37 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region public methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Hilfsmethode (Heuristik) wenn nur der Text verfügbar ist (Excel)
|
||||||
|
/// Quelle: http://www.unece.org/trade/untdid/d01a/tred/tred8025.htm
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Code nach NSW Spec, null on failure</returns>
|
||||||
|
public int? getCallPurposeCodeFromDescription(string description)
|
||||||
|
{
|
||||||
|
if (description.IsNullOrEmpty()) return null;
|
||||||
|
|
||||||
|
if (description.Contains("cargo", StringComparison.CurrentCultureIgnoreCase)) return 1;
|
||||||
|
if (description.Contains("passenger", StringComparison.CurrentCultureIgnoreCase)) return 2;
|
||||||
|
if (description.Contains("bunker", StringComparison.CurrentCultureIgnoreCase)) return 3;
|
||||||
|
if (description.Contains("crew", StringComparison.CurrentCultureIgnoreCase)) return 4;
|
||||||
|
if (description.Contains("visit", StringComparison.CurrentCultureIgnoreCase)) return 5;
|
||||||
|
if (description.Contains("supplies", StringComparison.CurrentCultureIgnoreCase)) return 6;
|
||||||
|
if (description.Contains("repair", StringComparison.CurrentCultureIgnoreCase)) return 7;
|
||||||
|
if (description.Contains("laid-up", StringComparison.CurrentCultureIgnoreCase)) return 8;
|
||||||
|
if (description.Contains("order", StringComparison.CurrentCultureIgnoreCase)) return 9;
|
||||||
|
if (description.Contains("miscellaneous", StringComparison.CurrentCultureIgnoreCase)) return 10;
|
||||||
|
if (description.Contains("movement", StringComparison.CurrentCultureIgnoreCase)) return 11;
|
||||||
|
if (description.Contains("cruise", StringComparison.CurrentCultureIgnoreCase)) return 12;
|
||||||
|
if (description.Contains("government", StringComparison.CurrentCultureIgnoreCase)) return 13;
|
||||||
|
if (description.Contains("quarantine", StringComparison.CurrentCultureIgnoreCase)) return 14;
|
||||||
|
if (description.Contains("refuge", StringComparison.CurrentCultureIgnoreCase)) return 15;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,26 +26,32 @@ namespace bsmd.database
|
|||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[Validation(ValidationCode.NOT_NULL)]
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
|
[LookupName("PRE72H.Tanker")]
|
||||||
public bool? Tanker { get; set; }
|
public bool? Tanker { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
public byte? TankerHullConfiguration { get; set; }
|
public byte? TankerHullConfiguration { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
public byte? ConditionCargoBallastTanks { get; set; }
|
public byte? ConditionCargoBallastTanks { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[LookupName("PRE72H.NaturOfCargo")]
|
||||||
public string NatureOfCargo { get; set; }
|
public string NatureOfCargo { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[LookupName("PRE72H.VolumeOfCargo_TNE")]
|
||||||
public double? VolumeOfCargo { get; set; }
|
public double? VolumeOfCargo { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[Validation(ValidationCode.NOT_NULL)]
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
|
[LookupName("PRE72H.PlannedOperations")]
|
||||||
public string PlannedOperations { get; set; }
|
public string PlannedOperations { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[Validation(ValidationCode.NOT_NULL)]
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
|
[LookupName("PRE72H.PlannedWorks")]
|
||||||
public string PlannedWorks { get; set; }
|
public string PlannedWorks { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[Validation(ValidationCode.NOT_NULL)]
|
[LookupName("PRE72H.DateOfLastExpandedInspection")]
|
||||||
public DateTime? DateOfLastExpandedInspection { get; set; }
|
public DateTime? DateOfLastExpandedInspection { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[Validation(ValidationCode.DOUBLE_GT_ZERO)]
|
[Validation(ValidationCode.DOUBLE_GT_ZERO)]
|
||||||
|
[LookupName("PRE72H.PlannedPeriodOfStay_HUR")]
|
||||||
public double? PlannedPeriodOfStay_HUR { get; set; }
|
public double? PlannedPeriodOfStay_HUR { get; set; }
|
||||||
|
|
||||||
public override string Subtitle
|
public override string Subtitle
|
||||||
|
|||||||
@ -80,7 +80,8 @@ namespace bsmd.database
|
|||||||
{
|
{
|
||||||
case Message.LoadFilter.MDH_ID:
|
case Message.LoadFilter.MDH_ID:
|
||||||
query += "WHERE MDH_Id = @MDHID";
|
query += "WHERE MDH_Id = @MDHID";
|
||||||
((SqlCommand)cmd).Parameters.AddWithValue("@MDHID", criteria[0]);
|
if (!cmd.Parameters.Contains("@MDHID"))
|
||||||
|
((SqlCommand)cmd).Parameters.AddWithValue("@MDHID", criteria[0]);
|
||||||
break;
|
break;
|
||||||
case Message.LoadFilter.ALL:
|
case Message.LoadFilter.ALL:
|
||||||
default:
|
default:
|
||||||
|
|||||||
@ -2,6 +2,6 @@
|
|||||||
|
|
||||||
[assembly: AssemblyCompany("Informatikbüro Daniel Schick")]
|
[assembly: AssemblyCompany("Informatikbüro Daniel Schick")]
|
||||||
[assembly: AssemblyProduct("BSMD NSW interface")]
|
[assembly: AssemblyProduct("BSMD NSW interface")]
|
||||||
[assembly: AssemblyInformationalVersion("2.4.18")]
|
[assembly: AssemblyInformationalVersion("3.0.0")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2014-2015 Informatikbüro Daniel Schick. All rights reserved.")]
|
[assembly: AssemblyCopyright("Copyright © 2014-2016 Informatikbüro Daniel Schick. All rights reserved.")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
@ -1,4 +1,4 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
[assembly: AssemblyVersion("2.4.18.*")]
|
[assembly: AssemblyVersion("3.0.0.*")]
|
||||||
|
|
||||||
|
|||||||
@ -35,11 +35,13 @@ namespace bsmd.database
|
|||||||
public string PortOfCallWhereCompleteSECNotified { get; set; }
|
public string PortOfCallWhereCompleteSECNotified { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[Validation2(ValidationCode.NOT_NULL)]
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
|
[LookupName("SEC.CSOLastName")]
|
||||||
public string CSOLastName { get; set; }
|
public string CSOLastName { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
public string CSOFirstName { get; set; }
|
public string CSOFirstName { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[Validation2(ValidationCode.NOT_NULL)]
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
|
[LookupName("SEC.CSOPhone")]
|
||||||
public string CSOPhone { get; set; }
|
public string CSOPhone { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
public string CSOFax { get; set; }
|
public string CSOFax { get; set; }
|
||||||
@ -47,16 +49,21 @@ namespace bsmd.database
|
|||||||
public string CSOEMail { get; set; }
|
public string CSOEMail { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[Validation2(ValidationCode.NOT_NULL)]
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
|
[LookupName("SEC.ValidISSCOnBoard")]
|
||||||
public bool? ValidISSCOnBoard { get; set; }
|
public bool? ValidISSCOnBoard { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[LookupName("SEC.ReasonsForNoValidISSC")]
|
||||||
public string ReasonsForNoValidISSC { get; set; }
|
public string ReasonsForNoValidISSC { get; set; }
|
||||||
[Validation2(ValidationCode.NOT_NULL)]
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
|
[LookupName("SEC.ISSCType")]
|
||||||
public byte? ISSCType { get; set; }
|
public byte? ISSCType { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[ReportDisplayName("ISSC type")]
|
[ReportDisplayName("ISSC type")]
|
||||||
public string ISSCTypeDisplay { get { return Util.GetISSCTypeDisplay(this.ISSCType); } }
|
public string ISSCTypeDisplay { get { return Util.GetISSCTypeDisplay(this.ISSCType); } }
|
||||||
|
|
||||||
[Validation2(ValidationCode.NOT_NULL)]
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
|
[LookupName("SEC.ISSCIssuerType")]
|
||||||
|
|
||||||
public byte? ISSCIssuerType { get; set; }
|
public byte? ISSCIssuerType { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[ReportDisplayName("ISSC issuer type")]
|
[ReportDisplayName("ISSC issuer type")]
|
||||||
@ -64,20 +71,25 @@ namespace bsmd.database
|
|||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[Validation2(ValidationCode.NOT_NULL)]
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
|
[LookupName("SEC.ISSCIssuerName")]
|
||||||
public string ISSCIssuerName { get; set; }
|
public string ISSCIssuerName { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[Validation2(ValidationCode.NOT_NULL)]
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
|
[LookupName("SEC.ISSCDateOfExpiration")]
|
||||||
public DateTime? ISSCDateOfExpiration { get; set; }
|
public DateTime? ISSCDateOfExpiration { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[Validation2(ValidationCode.NOT_NULL)]
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
|
[LookupName("SEC.ApprovedSecurityPlanOnBoard")]
|
||||||
public bool? ApprovedSecurityPlanOnBoard { get; set; }
|
public bool? ApprovedSecurityPlanOnBoard { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[Validation2(ValidationCode.NOT_NULL)]
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
|
[LookupName("SEC.CurrentShipSecurityLevel")]
|
||||||
public byte? CurrentShipSecurityLevel { get; set; }
|
public byte? CurrentShipSecurityLevel { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
public string PortFacilityOfArrival { get; set; }
|
public string PortFacilityOfArrival { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[Validation2(ValidationCode.NOT_NULL)]
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
|
[LookupName("SEC.GeneralDescriptionOfCargo")]
|
||||||
public byte? GeneralDescriptionOfCargo { get; set; }
|
public byte? GeneralDescriptionOfCargo { get; set; }
|
||||||
|
|
||||||
public List<LastTenPortFacilitiesCalled> LastTenPortFacilitesCalled { get { return this.ltpfc; } }
|
public List<LastTenPortFacilitiesCalled> LastTenPortFacilitesCalled { get { return this.ltpfc; } }
|
||||||
|
|||||||
@ -27,9 +27,11 @@ namespace bsmd.database
|
|||||||
public string ServiceName { get; set; }
|
public string ServiceName { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[Validation1(ValidationCode.NOT_NULL)]
|
[Validation1(ValidationCode.NOT_NULL)]
|
||||||
|
[LookupName("SERV.ServiceBeneficiary")]
|
||||||
public string ServiceBeneficiary { get; set; }
|
public string ServiceBeneficiary { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[Validation1(ValidationCode.NOT_NULL)]
|
[Validation1(ValidationCode.NOT_NULL)]
|
||||||
|
[LookupName("SERV.ServiceInvoiceRecipient")]
|
||||||
public string ServiceInvoiceRecipient { get; set; }
|
public string ServiceInvoiceRecipient { get; set; }
|
||||||
|
|
||||||
public string Identifier { get; set; }
|
public string Identifier { get; set; }
|
||||||
|
|||||||
@ -67,6 +67,26 @@ namespace bsmd.database
|
|||||||
[ShowReport]
|
[ShowReport]
|
||||||
public string InmarsatCallNumber { get; set; }
|
public string InmarsatCallNumber { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// UNECE Rec.19 Code (http://www.unece.org/fileadmin/DAM/cefact/recommendations/rec19/rec19_ecetrd138.pdf)
|
||||||
|
/// </summary>
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
|
public string TransportMode { get; set; }
|
||||||
|
|
||||||
|
[ShowReport]
|
||||||
|
public string TransportModeDisplay
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (!this.TransportMode.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
if (this.TransportMode == "1") return "Maritime transport";
|
||||||
|
if (this.TransportMode == "8") return "Inland water transport";
|
||||||
|
}
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[Validation(ValidationCode.NOT_NULL)]
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
[LookupName("STAT.ShipType")]
|
[LookupName("STAT.ShipType")]
|
||||||
@ -109,7 +129,7 @@ namespace bsmd.database
|
|||||||
{
|
{
|
||||||
string query = string.Format("SELECT Id, ShipName, Callsign, MMSINumber, Flag, LengthOverall_MTR, Beam_MTR, " +
|
string query = string.Format("SELECT Id, ShipName, Callsign, MMSINumber, Flag, LengthOverall_MTR, Beam_MTR, " +
|
||||||
"GrossTonnage, PortOfRegistry, InmarsatCallNumber, ShipType, ISMCompanyName, ISMCompanyId, ISMCompanyStreetAndNumber, " +
|
"GrossTonnage, PortOfRegistry, InmarsatCallNumber, ShipType, ISMCompanyName, ISMCompanyId, ISMCompanyStreetAndNumber, " +
|
||||||
"ISMCompanyPostalCode, ISMCompanyCity, ISMCompanyCountry FROM {0} ", this.Tablename);
|
"ISMCompanyPostalCode, ISMCompanyCity, ISMCompanyCountry, TransportMode FROM {0} ", this.Tablename);
|
||||||
|
|
||||||
switch (filter)
|
switch (filter)
|
||||||
{
|
{
|
||||||
@ -151,6 +171,7 @@ namespace bsmd.database
|
|||||||
if (!reader.IsDBNull(14)) stat.ISMCompanyPostalCode = reader.GetString(14);
|
if (!reader.IsDBNull(14)) stat.ISMCompanyPostalCode = reader.GetString(14);
|
||||||
if (!reader.IsDBNull(15)) stat.ISMCompanyCity = reader.GetString(15);
|
if (!reader.IsDBNull(15)) stat.ISMCompanyCity = reader.GetString(15);
|
||||||
if (!reader.IsDBNull(16)) stat.ISMCompanyCountry = reader.GetString(16);
|
if (!reader.IsDBNull(16)) stat.ISMCompanyCountry = reader.GetString(16);
|
||||||
|
if (!reader.IsDBNull(17)) stat.TransportMode = reader.GetString(17);
|
||||||
|
|
||||||
result.Add(stat);
|
result.Add(stat);
|
||||||
}
|
}
|
||||||
@ -195,21 +216,24 @@ namespace bsmd.database
|
|||||||
else scmd.Parameters.AddWithValue("@P16", DBNull.Value);
|
else scmd.Parameters.AddWithValue("@P16", DBNull.Value);
|
||||||
if (this.ISMCompanyCountry != null) scmd.Parameters.AddWithValue("@P17", this.ISMCompanyCountry);
|
if (this.ISMCompanyCountry != null) scmd.Parameters.AddWithValue("@P17", this.ISMCompanyCountry);
|
||||||
else scmd.Parameters.AddWithValue("@P17", DBNull.Value);
|
else scmd.Parameters.AddWithValue("@P17", DBNull.Value);
|
||||||
|
if (this.TransportMode != null) scmd.Parameters.AddWithValue("@P18", this.TransportMode);
|
||||||
|
else scmd.Parameters.AddWithValue("@P18", DBNull.Value);
|
||||||
|
|
||||||
if (this.IsNew)
|
if (this.IsNew)
|
||||||
{
|
{
|
||||||
cmd.CommandText = string.Format("INSERT INTO {0} (MessageHeaderId, ShipName, CallSign, MMSINumber, " +
|
cmd.CommandText = string.Format("INSERT INTO {0} (MessageHeaderId, ShipName, CallSign, MMSINumber, " +
|
||||||
"Flag, LengthOverall_MTR, Beam_MTR, GrossTonnage, PortOfRegistry, InmarsatCallNumber, ShipType, " +
|
"Flag, LengthOverall_MTR, Beam_MTR, GrossTonnage, PortOfRegistry, InmarsatCallNumber, ShipType, " +
|
||||||
"ISMCompanyName, ISMCompanyId, ISMCompanyStreetAndNumber, ISMCompanyPostalCode, ISMCompanyCity, " +
|
"ISMCompanyName, ISMCompanyId, ISMCompanyStreetAndNumber, ISMCompanyPostalCode, ISMCompanyCity, " +
|
||||||
"ISMCompanyCountry) VALUES (@P1, @P2, @P3, @P4, @P5, @P6, @P7, @P8, @P9, @P10, @P11, @P12, @P13, @P14, " +
|
"ISMCompanyCountry, TransportMode) VALUES (@P1, @P2, @P3, @P4, @P5, @P6, @P7, @P8, @P9, @P10, @P11, " +
|
||||||
"@P15, @P16, @P17)", this.Tablename);
|
" @P12, @P13, @P14, @P15, @P16, @P17, @P18)", this.Tablename);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cmd.CommandText = string.Format("UPDATE {0} SET ShipName = @P2, CallSign = @P3, MMSINumber = @P4, Flag = @P5, " +
|
cmd.CommandText = string.Format("UPDATE {0} SET ShipName = @P2, CallSign = @P3, MMSINumber = @P4, Flag = @P5, " +
|
||||||
"LengthOverall_MTR = @P6, Beam_MTR = @P7, GrossTonnage = @P8, PortOfRegistry = @P9, InmarsatCallNumber = @P10, " +
|
"LengthOverall_MTR = @P6, Beam_MTR = @P7, GrossTonnage = @P8, PortOfRegistry = @P9, InmarsatCallNumber = @P10, " +
|
||||||
"ShipType = @P11, ISMCompanyName = @P12, ISMCompanyId = @P13, ISMCompanyStreetAndNumber = @P14, " +
|
"ShipType = @P11, ISMCompanyName = @P12, ISMCompanyId = @P13, ISMCompanyStreetAndNumber = @P14, " +
|
||||||
"ISMCompanyPostalCode = @P15, ISMCompanyCity = @P16, ISMCompanyCountry = @P17 WHERE Id = @ID", this.Tablename);
|
"ISMCompanyPostalCode = @P15, ISMCompanyCity = @P16, ISMCompanyCountry = @P17, TransportMode = @P18 " +
|
||||||
|
"WHERE Id = @ID", this.Tablename);
|
||||||
scmd.Parameters.AddWithValue("@ID", this.Id);
|
scmd.Parameters.AddWithValue("@ID", this.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -25,10 +25,12 @@ namespace bsmd.database
|
|||||||
#region Properties
|
#region Properties
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[Validation(ValidationCode.NOT_NULL)]
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
|
[LookupName("TOWA.TowageOnArrivalName")]
|
||||||
public string TowageOnArrivalName { get; set; }
|
public string TowageOnArrivalName { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[Validation(ValidationCode.FLAG_CODE)]
|
[Validation(ValidationCode.FLAG_CODE)]
|
||||||
|
[LookupName("TOWA.TowageOnArrivalFlag")]
|
||||||
public string TowageOnArrivalFlag { get; set; }
|
public string TowageOnArrivalFlag { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
@ -57,22 +59,27 @@ namespace bsmd.database
|
|||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[Validation(ValidationCode.INT_GT_ZERO)]
|
[Validation(ValidationCode.INT_GT_ZERO)]
|
||||||
|
[LookupName("TOWA.TowageOnArrivalGrossTonnage")]
|
||||||
public int? TowageOnArrivalGrossTonnage { get; set; }
|
public int? TowageOnArrivalGrossTonnage { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[Validation(ValidationCode.DOUBLE_GT_ZERO)]
|
[Validation(ValidationCode.DOUBLE_GT_ZERO)]
|
||||||
|
[LookupName("TOWA.TowageOnArrivalLengthOverall_MTR")]
|
||||||
public double? TowageOnArrivalLengthOverall_MTR { get; set; }
|
public double? TowageOnArrivalLengthOverall_MTR { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[Validation(ValidationCode.DOUBLE_GT_ZERO)]
|
[Validation(ValidationCode.DOUBLE_GT_ZERO)]
|
||||||
|
[LookupName("TOWA.TowageOnArrivalBeam_MTR")]
|
||||||
public double? TowageOnArrivalBeam_MTR { get; set; }
|
public double? TowageOnArrivalBeam_MTR { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[Validation(ValidationCode.NOT_NULL)]
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
|
[LookupName("TOWA.TowageOnArrivalPurposeOfCall")]
|
||||||
public string TowageOnArrivalPurposeOfCall { get; set; }
|
public string TowageOnArrivalPurposeOfCall { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[Validation(ValidationCode.DOUBLE_GT_ZERO)]
|
[Validation(ValidationCode.DOUBLE_GT_ZERO)]
|
||||||
|
[LookupName("TOWA.TowageOnArrivalDraught_DMT")]
|
||||||
public double? TowageOnArrivalDraught_DMT { get; set; }
|
public double? TowageOnArrivalDraught_DMT { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
|||||||
@ -26,9 +26,11 @@ namespace bsmd.database
|
|||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[Validation(ValidationCode.NOT_NULL)]
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
|
[LookupName("TOWD.TowageOnDepartureName")]
|
||||||
public string TowageOnDepartureName { get; set; }
|
public string TowageOnDepartureName { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[LookupName("TOWD.TowageOnDepartureFlag")]
|
||||||
public string TowageOnDepartureFlag { get; set; }
|
public string TowageOnDepartureFlag { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
@ -56,13 +58,16 @@ namespace bsmd.database
|
|||||||
public string TowageOnDepartureOperatorEmail { get; set; }
|
public string TowageOnDepartureOperatorEmail { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[LookupName("TOWD.TowageOnDepartureLengthOverall_MTR")]
|
||||||
public double? TowageOnDepartureLengthOverall_MTR { get; set; }
|
public double? TowageOnDepartureLengthOverall_MTR { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[LookupName("TOWD.TowageOnDepartureBeam_MTR")]
|
||||||
public double? TowageOnDepartureBeam_MTR { get; set; }
|
public double? TowageOnDepartureBeam_MTR { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[Validation(ValidationCode.DOUBLE_GT_ZERO)]
|
[Validation(ValidationCode.DOUBLE_GT_ZERO)]
|
||||||
|
[LookupName("TOWD.TowageOnDepartureDraught_DMT")]
|
||||||
public double? TowageOnDepartureDraught_DMT { get; set; }
|
public double? TowageOnDepartureDraught_DMT { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
|||||||
@ -30,13 +30,15 @@ namespace bsmd.database
|
|||||||
[ShowReport]
|
[ShowReport]
|
||||||
public bool? WasteDisposalValidExemption { get; set; }
|
public bool? WasteDisposalValidExemption { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[Validation2(ValidationCode.NOT_NULL)]
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
public string LastWasteDisposalPort { get; set; }
|
public string LastWasteDisposalPort { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[Validation2(ValidationCode.NOT_NULL)]
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
|
[LookupName("WAS.ConfirmationOfCorrectness")]
|
||||||
public bool? ConfirmationOfCorrectness { get; set; }
|
public bool? ConfirmationOfCorrectness { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[Validation2(ValidationCode.NOT_NULL)]
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
|
[LookupName("WAS.LastWasteDisposalDate")]
|
||||||
public DateTime? LastWasteDisposalDate { get; set; }
|
public DateTime? LastWasteDisposalDate { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[Validation2(ValidationCode.NOT_NULL)]
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
|
|||||||
@ -51,6 +51,7 @@ namespace bsmd.database
|
|||||||
[Validation(ValidationCode.NOT_NULL)]
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public byte? WasteType { get; set; }
|
public byte? WasteType { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string WasteDescription { get; set; }
|
public string WasteDescription { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[Validation(ValidationCode.NOT_NULL)]
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
|
|||||||
@ -64,6 +64,7 @@
|
|||||||
<Compile Include="IMDGPosition.cs" />
|
<Compile Include="IMDGPosition.cs" />
|
||||||
<Compile Include="IMessageParagraph.cs" />
|
<Compile Include="IMessageParagraph.cs" />
|
||||||
<Compile Include="IMSBCPosition.cs" />
|
<Compile Include="IMSBCPosition.cs" />
|
||||||
|
<Compile Include="InfectedArea.cs" />
|
||||||
<Compile Include="ISublistContainer.cs" />
|
<Compile Include="ISublistContainer.cs" />
|
||||||
<Compile Include="LastTenPortFacilitiesCalled.cs" />
|
<Compile Include="LastTenPortFacilitiesCalled.cs" />
|
||||||
<Compile Include="LookupNameAttribute.cs" />
|
<Compile Include="LookupNameAttribute.cs" />
|
||||||
@ -98,12 +99,14 @@
|
|||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="ReportingParty.cs" />
|
<Compile Include="ReportingParty.cs" />
|
||||||
<Compile Include="RuleEngine.cs" />
|
<Compile Include="RuleEngine.cs" />
|
||||||
|
<Compile Include="SanitaryMeasuresDetail.cs" />
|
||||||
<Compile Include="SEC.cs" />
|
<Compile Include="SEC.cs" />
|
||||||
<Compile Include="SERV.cs" />
|
<Compile Include="SERV.cs" />
|
||||||
<Compile Include="ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.cs" />
|
<Compile Include="ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.cs" />
|
||||||
<Compile Include="ShowReportAttribute.cs" />
|
<Compile Include="ShowReportAttribute.cs" />
|
||||||
<Compile Include="SOAPLoggerExtension.cs" />
|
<Compile Include="SOAPLoggerExtension.cs" />
|
||||||
<Compile Include="STAT.cs" />
|
<Compile Include="STAT.cs" />
|
||||||
|
<Compile Include="StowawaysJoiningLocation.cs" />
|
||||||
<Compile Include="SubsidiaryRisks.cs" />
|
<Compile Include="SubsidiaryRisks.cs" />
|
||||||
<Compile Include="TIEFA.cs" />
|
<Compile Include="TIEFA.cs" />
|
||||||
<Compile Include="TIEFD.cs" />
|
<Compile Include="TIEFD.cs" />
|
||||||
|
|||||||
@ -14,6 +14,8 @@ using System.Net;
|
|||||||
using System.Net.Mime;
|
using System.Net.Mime;
|
||||||
using System.Net.Mail;
|
using System.Net.Mail;
|
||||||
using log4net;
|
using log4net;
|
||||||
|
using System.Security.Cryptography.X509Certificates;
|
||||||
|
using System.Net.Security;
|
||||||
|
|
||||||
namespace bsmd.email
|
namespace bsmd.email
|
||||||
{
|
{
|
||||||
@ -38,6 +40,10 @@ namespace bsmd.email
|
|||||||
smtpClient.Timeout = (60 * 5 * 1000);
|
smtpClient.Timeout = (60 * 5 * 1000);
|
||||||
smtpClient.EnableSsl = true;
|
smtpClient.EnableSsl = true;
|
||||||
|
|
||||||
|
// evil workaround for invalid BSMD E-Mail certificate!
|
||||||
|
ServicePointManager.ServerCertificateValidationCallback = delegate (object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
|
||||||
|
{ return true; };
|
||||||
|
|
||||||
message.From = fromAddress;
|
message.From = fromAddress;
|
||||||
message.Subject = string.Format(subject);
|
message.Subject = string.Format(subject);
|
||||||
message.IsBodyHtml = false;
|
message.IsBodyHtml = false;
|
||||||
|
|||||||
@ -1041,6 +1041,12 @@ namespace bsmd.herberg.FormService
|
|||||||
if (((waste.WasteType ?? 0) == 9) && waste.WasteDescription.IsNullOrEmpty())
|
if (((waste.WasteType ?? 0) == 9) && waste.WasteDescription.IsNullOrEmpty())
|
||||||
waste.WasteDescription = "-";
|
waste.WasteDescription = "-";
|
||||||
|
|
||||||
|
if(waste.WasteDisposalPort.Length == 7)
|
||||||
|
{
|
||||||
|
_log.WarnFormat("WasteDisposalPort format ERROR [{0}], truncating", was.LastWasteDisposalPort);
|
||||||
|
waste.WasteDisposalPort = waste.WasteDisposalPort.Substring(2);
|
||||||
|
}
|
||||||
|
|
||||||
if (waste.WasteType.HasValue)
|
if (waste.WasteType.HasValue)
|
||||||
{
|
{
|
||||||
saveMessages.Add(waste);
|
saveMessages.Add(waste);
|
||||||
|
|||||||
@ -256,7 +256,7 @@ namespace bsmd.hisnord
|
|||||||
_nsw.conveyance.CREW.CrewMembers[i].CrewMemberLastName = crew.CrewMemberLastName;
|
_nsw.conveyance.CREW.CrewMembers[i].CrewMemberLastName = crew.CrewMemberLastName;
|
||||||
_nsw.conveyance.CREW.CrewMembers[i].CrewMemberNationality = crew.CrewMemberNationality;
|
_nsw.conveyance.CREW.CrewMembers[i].CrewMemberNationality = crew.CrewMemberNationality;
|
||||||
_nsw.conveyance.CREW.CrewMembers[i].CrewMemberPlaceOfBirth = crew.CrewMemberPlaceOfBirth;
|
_nsw.conveyance.CREW.CrewMembers[i].CrewMemberPlaceOfBirth = crew.CrewMemberPlaceOfBirth;
|
||||||
_nsw.conveyance.CREW.CrewMembers[i].CrewMemberVisaNumber = crew.CrewMemberVisaNumber;
|
_nsw.conveyance.CREW.CrewMembers[i].CrewMemberVisaNumber = crew.CrewMemberVisaNumber.IsNullOrEmpty() ? "-" : crew.CrewMemberVisaNumber;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -722,11 +722,16 @@ namespace bsmd.hisnord
|
|||||||
}
|
}
|
||||||
|
|
||||||
_transit.LastPort = new lastport();
|
_transit.LastPort = new lastport();
|
||||||
if (noa_nod.ETDFromLastPort.HasValue)
|
|
||||||
_transit.LastPort.ETD = noa_nod.ETDFromLastPort.Value;
|
|
||||||
_transit.LastPort.ETDSpecified = noa_nod.ETDFromLastPort.HasValue;
|
|
||||||
if((noa_nod.LastPort != null) && (noa_nod.LastPort.Trim() != ""))
|
if((noa_nod.LastPort != null) && (noa_nod.LastPort.Trim() != ""))
|
||||||
_transit.LastPort.Locode = noa_nod.LastPort;
|
_transit.LastPort.Locode = noa_nod.LastPort;
|
||||||
|
if(!noa_nod.LastPort.IsNullOrEmpty() && !noa_nod.LastPort.Equals("ZZUKN"))
|
||||||
|
{
|
||||||
|
if (noa_nod.ETDFromLastPort.HasValue)
|
||||||
|
_transit.LastPort.ETD = noa_nod.ETDFromLastPort.Value;
|
||||||
|
_transit.LastPort.ETDSpecified = noa_nod.ETDFromLastPort.HasValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
_transit.NextPort = new nextporthazmat();
|
_transit.NextPort = new nextporthazmat();
|
||||||
if (noa_nod.ETAToNextPort.HasValue)
|
if (noa_nod.ETAToNextPort.HasValue)
|
||||||
@ -745,11 +750,16 @@ namespace bsmd.hisnord
|
|||||||
}
|
}
|
||||||
|
|
||||||
_import.LastPort = new lastport();
|
_import.LastPort = new lastport();
|
||||||
if (noa_nod.ETDFromLastPort.HasValue)
|
|
||||||
_import.LastPort.ETD = noa_nod.ETDFromLastPort.Value;
|
|
||||||
_import.LastPort.ETDSpecified = noa_nod.ETDFromLastPort.HasValue;
|
|
||||||
if ((noa_nod.LastPort != null) && (noa_nod.LastPort.Trim() != ""))
|
if ((noa_nod.LastPort != null) && (noa_nod.LastPort.Trim() != ""))
|
||||||
_import.LastPort.Locode = noa_nod.LastPort;
|
_import.LastPort.Locode = noa_nod.LastPort;
|
||||||
|
if (!noa_nod.LastPort.IsNullOrEmpty() && !noa_nod.LastPort.Equals("ZZUKN"))
|
||||||
|
{
|
||||||
|
if (noa_nod.ETDFromLastPort.HasValue)
|
||||||
|
_import.LastPort.ETD = noa_nod.ETDFromLastPort.Value;
|
||||||
|
_import.LastPort.ETDSpecified = noa_nod.ETDFromLastPort.HasValue;
|
||||||
|
}
|
||||||
|
|
||||||
_import.PortOfCall = new portofcallhazmat();
|
_import.PortOfCall = new portofcallhazmat();
|
||||||
if (noa_nod.ETAToPortOfCall.HasValue)
|
if (noa_nod.ETAToPortOfCall.HasValue)
|
||||||
_import.PortOfCall.ETA = noa_nod.ETAToPortOfCall.Value;
|
_import.PortOfCall.ETA = noa_nod.ETAToPortOfCall.Value;
|
||||||
@ -757,7 +767,16 @@ namespace bsmd.hisnord
|
|||||||
_import.PortOfCall.ETD = noa_nod.ETDFromPortOfCall.Value;
|
_import.PortOfCall.ETD = noa_nod.ETDFromPortOfCall.Value;
|
||||||
if ((message.MessageCore.PoC != null) && (message.MessageCore.PoC.Trim() != ""))
|
if ((message.MessageCore.PoC != null) && (message.MessageCore.PoC.Trim() != ""))
|
||||||
_import.PortOfCall.Locode = message.MessageCore.PoC;
|
_import.PortOfCall.Locode = message.MessageCore.PoC;
|
||||||
|
if (noa_nod.CallPurposes.Count > 0)
|
||||||
|
{
|
||||||
|
_import.PortOfCall.CallPurposes = new callpurpose[noa_nod.CallPurposes.Count];
|
||||||
|
for(int i=0;i<noa_nod.CallPurposes.Count;i++)
|
||||||
|
{
|
||||||
|
_import.PortOfCall.CallPurposes[i] = new callpurpose();
|
||||||
|
_import.PortOfCall.CallPurposes[i].CallPurposeCode = noa_nod.CallPurposes[i].CallPurposeCode.ToString();
|
||||||
|
_import.PortOfCall.CallPurposes[i].CallPurposeDescription = noa_nod.CallPurposes[i].CallPurposeDescription;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else // auslaufend
|
else // auslaufend
|
||||||
{
|
{
|
||||||
@ -910,7 +929,7 @@ namespace bsmd.hisnord
|
|||||||
_sec.CSOLastName = sec.CSOLastName;
|
_sec.CSOLastName = sec.CSOLastName;
|
||||||
_sec.CSOPhone = sec.CSOPhone;
|
_sec.CSOPhone = sec.CSOPhone;
|
||||||
if (sec.CurrentShipSecurityLevel.HasValue)
|
if (sec.CurrentShipSecurityLevel.HasValue)
|
||||||
_sec.CurrentShipSecurityLevel = (posint13type)sec.CurrentShipSecurityLevel.Value;
|
_sec.CurrentShipSecurityLevel = (posint13type) (sec.CurrentShipSecurityLevel.Value + 1); // HRO Enumeration is 1-based
|
||||||
if (sec.GeneralDescriptionOfCargo.HasValue)
|
if (sec.GeneralDescriptionOfCargo.HasValue)
|
||||||
_sec.GeneralDescriptionOfCargo = (cargodescriptiontype)sec.GeneralDescriptionOfCargo.Value;
|
_sec.GeneralDescriptionOfCargo = (cargodescriptiontype)sec.GeneralDescriptionOfCargo.Value;
|
||||||
if (sec.ISSCDateOfExpiration.HasValue)
|
if (sec.ISSCDateOfExpiration.HasValue)
|
||||||
@ -938,10 +957,10 @@ namespace bsmd.hisnord
|
|||||||
_sec.Last10Ports[i].PortFacilityGISISCode = sec.LastTenPortFacilitesCalled[i].PortFacilityGISISCode;
|
_sec.Last10Ports[i].PortFacilityGISISCode = sec.LastTenPortFacilitesCalled[i].PortFacilityGISISCode;
|
||||||
_sec.Last10Ports[i].PortFacilityPortCountry = sec.LastTenPortFacilitesCalled[i].PortFacilityPortCountry;
|
_sec.Last10Ports[i].PortFacilityPortCountry = sec.LastTenPortFacilitesCalled[i].PortFacilityPortCountry;
|
||||||
_sec.Last10Ports[i].PortFacilityPortLoCode = sec.LastTenPortFacilitesCalled[i].PortFacilityPortLoCode;
|
_sec.Last10Ports[i].PortFacilityPortLoCode = sec.LastTenPortFacilitesCalled[i].PortFacilityPortLoCode;
|
||||||
_sec.Last10Ports[i].PortFacilityPortName = sec.LastTenPortFacilitesCalled[i].PortFacilitySecurityMattersToReport;
|
_sec.Last10Ports[i].PortFacilityPortName = sec.LastTenPortFacilitesCalled[i].PortFacilityPortName;
|
||||||
_sec.Last10Ports[i].PortFacilitySecurityMattersToReport = sec.LastTenPortFacilitesCalled[i].PortFacilitySecurityMattersToReport;
|
_sec.Last10Ports[i].PortFacilitySecurityMattersToReport = sec.LastTenPortFacilitesCalled[i].PortFacilitySecurityMattersToReport;
|
||||||
if (sec.LastTenPortFacilitesCalled[i].PortFacilityShipSecurityLevel.HasValue)
|
if (sec.LastTenPortFacilitesCalled[i].PortFacilityShipSecurityLevel.HasValue)
|
||||||
_sec.Last10Ports[i].PortFacilityShipSecurityLevel = (posint13type)sec.LastTenPortFacilitesCalled[i].PortFacilityShipSecurityLevel.Value;
|
_sec.Last10Ports[i].PortFacilityShipSecurityLevel = (posint13type) (sec.LastTenPortFacilitesCalled[i].PortFacilityShipSecurityLevel.Value + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1236,7 +1255,7 @@ namespace bsmd.hisnord
|
|||||||
|
|
||||||
public static void ReadAnswers()
|
public static void ReadAnswers()
|
||||||
{
|
{
|
||||||
foreach(string answerFile in Directory.GetFiles(Properties.Settings.Default.AnswerDir))
|
foreach (string answerFile in Directory.GetFiles(Properties.Settings.Default.AnswerDir))
|
||||||
{
|
{
|
||||||
VisitId aVisitId = VisitId.ReadVisitId(answerFile);
|
VisitId aVisitId = VisitId.ReadVisitId(answerFile);
|
||||||
if (aVisitId != null)
|
if (aVisitId != null)
|
||||||
@ -1246,22 +1265,61 @@ namespace bsmd.hisnord
|
|||||||
if (aVisitId.MessageCoreId.HasValue)
|
if (aVisitId.MessageCoreId.HasValue)
|
||||||
{
|
{
|
||||||
MessageCore answerCore = DBManager.Instance.GetMessageCoreById(aVisitId.MessageCoreId.Value);
|
MessageCore answerCore = DBManager.Instance.GetMessageCoreById(aVisitId.MessageCoreId.Value);
|
||||||
if(!answerCore.IsTransit)
|
if (answerCore == null)
|
||||||
answerCore.VisitId = aVisitId.Value;
|
{
|
||||||
else
|
_log.WarnFormat("HIS-NORD: Core not found for conveyance code {0}", aVisitId.ConveyanceCode);
|
||||||
answerCore.TransitId = aVisitId.Value;
|
}
|
||||||
answerCore.BSMDStatusInternal = MessageCore.BSMDStatus.RESPONDED;
|
else {
|
||||||
DBManager.Instance.Save(answerCore);
|
if (!answerCore.IsTransit)
|
||||||
|
answerCore.VisitId = aVisitId.Value;
|
||||||
|
else
|
||||||
|
answerCore.TransitId = aVisitId.Value;
|
||||||
|
answerCore.BSMDStatusInternal = MessageCore.BSMDStatus.RESPONDED;
|
||||||
|
DBManager.Instance.Save(answerCore);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_log.WarnFormat("{0} ANSWER parsed, but MessageCoreId is no Guid: {1}",
|
_log.WarnFormat("{0} ANSWER parsed, but MessageCoreId is no Guid: {1}",
|
||||||
Path.GetFileName(answerFile),
|
Path.GetFileName(answerFile),
|
||||||
aVisitId.ConveyanceCode);
|
aVisitId.ConveyanceCode);
|
||||||
}
|
}
|
||||||
// archive file
|
// archive file
|
||||||
File.Move(answerFile, Path.Combine(Properties.Settings.Default.AnswerArchiveDir, Path.GetFileName(answerFile)));
|
File.Move(answerFile, Path.Combine(Properties.Settings.Default.AnswerArchiveDir, Path.GetFileName(answerFile)));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TransitId aTransitId = TransitId.ReadTransitId(answerFile);
|
||||||
|
if (aTransitId != null)
|
||||||
|
{
|
||||||
|
_log.InfoFormat("HIS-NORD: Transit-ID {0} delivered for Core {1}", aTransitId.Value, aTransitId.MessageCoreId);
|
||||||
|
// update MessageCore
|
||||||
|
if (aTransitId.MessageCoreId.HasValue)
|
||||||
|
{
|
||||||
|
MessageCore answerCore = DBManager.Instance.GetMessageCoreById(aTransitId.MessageCoreId.Value);
|
||||||
|
if (answerCore == null)
|
||||||
|
{
|
||||||
|
_log.WarnFormat("HIS-NORD: Core not found for conveyance code {0}", aTransitId.ConveyanceCode);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (!answerCore.IsTransit)
|
||||||
|
answerCore.VisitId = aTransitId.Value;
|
||||||
|
else
|
||||||
|
answerCore.TransitId = aTransitId.Value;
|
||||||
|
answerCore.BSMDStatusInternal = MessageCore.BSMDStatus.RESPONDED;
|
||||||
|
DBManager.Instance.Save(answerCore);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_log.WarnFormat("{0} ANSWER parsed, but MessageCoreId is no Guid: {1}",
|
||||||
|
Path.GetFileName(answerFile),
|
||||||
|
aTransitId.ConveyanceCode);
|
||||||
|
}
|
||||||
|
// archive file
|
||||||
|
File.Move(answerFile, Path.Combine(Properties.Settings.Default.AnswerArchiveDir, Path.GetFileName(answerFile)));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
94
nsw/Source/bsmd.hisnord/TransitId.cs
Normal file
94
nsw/Source/bsmd.hisnord/TransitId.cs
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
//
|
||||||
|
// Class: VisitId
|
||||||
|
// Current CLR: 4.0.30319.34209
|
||||||
|
// System: Microsoft Visual Studio 14.0
|
||||||
|
// Author: dani
|
||||||
|
// Created: 29/2/2016 18:27:03 AM
|
||||||
|
//
|
||||||
|
// Copyright (c) 2016 Informatikbüro Daniel Schick. All rights reserved.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Xml;
|
||||||
|
using System.Xml.Serialization;
|
||||||
|
|
||||||
|
using log4net;
|
||||||
|
|
||||||
|
namespace bsmd.hisnord
|
||||||
|
{
|
||||||
|
[Serializable]
|
||||||
|
public class TransitId
|
||||||
|
{
|
||||||
|
private string _transitId = null;
|
||||||
|
private static ILog _log = LogManager.GetLogger(typeof(bsmd.hisnord.TransitId));
|
||||||
|
|
||||||
|
#region Construction
|
||||||
|
|
||||||
|
public TransitId(string transitId)
|
||||||
|
{
|
||||||
|
this._transitId = transitId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TransitId() { }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Properties
|
||||||
|
|
||||||
|
[XmlAttribute]
|
||||||
|
public string ConveyanceCode { get; set; }
|
||||||
|
|
||||||
|
[XmlText]
|
||||||
|
public string Value { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Extract Guid aus ConveyanceCode
|
||||||
|
/// </summary>
|
||||||
|
public Guid? MessageCoreId
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Guid? result = null;
|
||||||
|
if (this.ConveyanceCode != null)
|
||||||
|
{
|
||||||
|
int startIndex = this.ConveyanceCode.IndexOf('-');
|
||||||
|
if (startIndex > 0)
|
||||||
|
{
|
||||||
|
Guid tmpGuid;
|
||||||
|
if (Guid.TryParse(this.ConveyanceCode.Substring(startIndex + 1), out tmpGuid))
|
||||||
|
result = tmpGuid;
|
||||||
|
else if (Guid.TryParse(this.ConveyanceCode, out tmpGuid))
|
||||||
|
result = tmpGuid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Deserialization
|
||||||
|
|
||||||
|
public static TransitId ReadTransitId(string filename)
|
||||||
|
{
|
||||||
|
TransitId aTransitId = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
XmlSerializer serializer = new XmlSerializer(typeof(bsmd.hisnord.TransitId));
|
||||||
|
using (FileStream fs = new FileStream(filename, FileMode.Open))
|
||||||
|
{
|
||||||
|
aTransitId = (TransitId)serializer.Deserialize(fs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_log.ErrorFormat("Exception occurred during deserialization: {0}", ex.Message);
|
||||||
|
|
||||||
|
}
|
||||||
|
return aTransitId;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -59,6 +59,8 @@ namespace bsmd.hisnord
|
|||||||
Guid tmpGuid;
|
Guid tmpGuid;
|
||||||
if (Guid.TryParse(this.ConveyanceCode.Substring(startIndex + 1), out tmpGuid))
|
if (Guid.TryParse(this.ConveyanceCode.Substring(startIndex + 1), out tmpGuid))
|
||||||
result = tmpGuid;
|
result = tmpGuid;
|
||||||
|
else if (Guid.TryParse(this.ConveyanceCode, out tmpGuid))
|
||||||
|
result = tmpGuid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@ -65,6 +65,7 @@
|
|||||||
<DependentUpon>Settings.settings</DependentUpon>
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Request.cs" />
|
<Compile Include="Request.cs" />
|
||||||
|
<Compile Include="TransitId.cs" />
|
||||||
<Compile Include="transmitter.cs" />
|
<Compile Include="transmitter.cs" />
|
||||||
<Compile Include="VisitId.cs" />
|
<Compile Include="VisitId.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user