Stand vor dbh Test am 15.9.
This commit is contained in:
parent
4be86d8f9f
commit
d280fd9570
Binary file not shown.
BIN
nsw/NSW Schnittstelle Meldetypen und Attribute V3.0.xlsx
Normal file
BIN
nsw/NSW Schnittstelle Meldetypen und Attribute V3.0.xlsx
Normal file
Binary file not shown.
BIN
nsw/NSW Schnittstelle Validierungsregeln V3.0.xlsx
Normal file
BIN
nsw/NSW Schnittstelle Validierungsregeln V3.0.xlsx
Normal file
Binary file not shown.
21
nsw/Source/SQL/ErrorText.sql
Normal file
21
nsw/Source/SQL/ErrorText.sql
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
-- Dieses Skript aktualisiert die Tabelle ErrorText
|
||||||
|
-- Die Texte werden bei der Validierung von Nachrichten verwendet
|
||||||
|
|
||||||
|
DELETE FROM ErrorText
|
||||||
|
GO
|
||||||
|
INSERT INTO ErrorText (ErrorCode, ErrorText) VALUES (1, '{0} must not be empty');
|
||||||
|
GO
|
||||||
|
INSERT INTO ErrorText (ErrorCode, ErrorText) VALUES (2, '{0} must be a LOCODE');
|
||||||
|
GO
|
||||||
|
INSERT INTO ErrorText (ErrorCode, ErrorText) VALUES (3, '{0} must be a german harbour LOCODE');
|
||||||
|
GO
|
||||||
|
INSERT INTO ErrorText (ErrorCode, ErrorText) VALUES (4, '{0} must be a GISIS code');
|
||||||
|
GO
|
||||||
|
INSERT INTO ErrorText (ErrorCode, ErrorText) VALUES (5, '{0} must be a number > 0');
|
||||||
|
GO
|
||||||
|
INSERT INTO ErrorText (ErrorCode, ErrorText) VALUES (6, '{0} must be a decimal > 0');
|
||||||
|
GO
|
||||||
|
INSERT INTO ErrorText (ErrorCode, ErrorText) VALUES (7, '{0} must be a 2 character flag code');
|
||||||
|
GO
|
||||||
|
INSERT INTO ErrorText (ErrorCode, ErrorText) VALUES (8, '{0} must be 2 digits');
|
||||||
|
GO
|
||||||
30
nsw/Source/SQL/Update_1.9_To_2.0.sql
Normal file
30
nsw/Source/SQL/Update_1.9_To_2.0.sql
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
PRINT N'Creating [dbo].[ErrorText]...';
|
||||||
|
|
||||||
|
|
||||||
|
GO
|
||||||
|
CREATE TABLE [dbo].[ErrorText]
|
||||||
|
(
|
||||||
|
[Id] UNIQUEIDENTIFIER CONSTRAINT [PK_Error_Id] DEFAULT (newid()) ROWGUIDCOL NOT NULL ,
|
||||||
|
[ErrorCode] INT NOT NULL,
|
||||||
|
[ErrorText] NVARCHAR(255) NOT NULL,
|
||||||
|
CONSTRAINT [PK_ErrorText] PRIMARY KEY NONCLUSTERED ([Id])
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
GO
|
||||||
|
|
||||||
|
|
||||||
|
PRINT N'Creating [dbo].[ViolationText]...';
|
||||||
|
|
||||||
|
|
||||||
|
GO
|
||||||
|
CREATE TABLE [dbo].[ViolationText]
|
||||||
|
(
|
||||||
|
[Id] UNIQUEIDENTIFIER CONSTRAINT [PK_Violation_Id] DEFAULT (newid()) ROWGUIDCOL NOT NULL ,
|
||||||
|
[ViolationCode] INT NOT NULL,
|
||||||
|
[ViolationText] NVARCHAR(255) NOT NULL,
|
||||||
|
CONSTRAINT [PK_ViolationText] PRIMARY KEY NONCLUSTERED ([Id])
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
GO
|
||||||
@ -180,6 +180,9 @@ namespace SendNSWMessageService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Auf erhaltene Visit-Ids prüfen (HIS-NORD)
|
||||||
|
bsmd.hisnord.Request.ReadAnswers();
|
||||||
|
|
||||||
DBManager.Instance.Disconnect();
|
DBManager.Instance.Disconnect();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -142,7 +142,7 @@ namespace bsmd.ReportGenerator
|
|||||||
Section section = document.AddSection();
|
Section section = document.AddSection();
|
||||||
|
|
||||||
Paragraph paragraph = section.AddParagraph();
|
Paragraph paragraph = section.AddParagraph();
|
||||||
paragraph.Format.SpaceAfter = "3cm";
|
paragraph.Format.SpaceAfter = "2cm";
|
||||||
|
|
||||||
Image image = section.AddImage(Properties.Settings.Default.LogoPath);
|
Image image = section.AddImage(Properties.Settings.Default.LogoPath);
|
||||||
image.Width = "3cm";
|
image.Width = "3cm";
|
||||||
@ -156,9 +156,9 @@ namespace bsmd.ReportGenerator
|
|||||||
paragraph.Format.Font.Color = Colors.DarkRed;
|
paragraph.Format.Font.Color = Colors.DarkRed;
|
||||||
paragraph.Format.SpaceBefore = Unit.FromCentimeter(4);
|
paragraph.Format.SpaceBefore = Unit.FromCentimeter(4);
|
||||||
|
|
||||||
paragraph = section.AddParagraph("Rendering date: ");
|
paragraph = section.AddParagraph("Rendering date: ");
|
||||||
paragraph.Format.SpaceAfter = Unit.FromCentimeter(3);
|
|
||||||
paragraph.AddDateField();
|
paragraph.AddDateField();
|
||||||
|
paragraph.Format.SpaceAfter = Unit.FromCentimeter(2);
|
||||||
|
|
||||||
Table table = document.LastSection.AddTable();
|
Table table = document.LastSection.AddTable();
|
||||||
table.Format.Font.Size = 14;
|
table.Format.Font.Size = 14;
|
||||||
|
|||||||
@ -103,6 +103,7 @@ namespace bsmd.ReportGenerator
|
|||||||
private void CreateReport(MessageCore reportCore)
|
private void CreateReport(MessageCore reportCore)
|
||||||
{
|
{
|
||||||
List<Message> messages = DBManager.Instance.GetMessagesForCore(reportCore);
|
List<Message> messages = DBManager.Instance.GetMessagesForCore(reportCore);
|
||||||
|
messages.Sort(new ANSWMessageComparer());
|
||||||
Dictionary<string, string> coverInfos = new Dictionary<string, string>();
|
Dictionary<string, string> coverInfos = new Dictionary<string, string>();
|
||||||
bool isReportUpdate = reportCore.ReportStatus != MessageCore.ReportStatusEnum.COMPLETE;
|
bool isReportUpdate = reportCore.ReportStatus != MessageCore.ReportStatusEnum.COMPLETE;
|
||||||
|
|
||||||
@ -122,6 +123,7 @@ namespace bsmd.ReportGenerator
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
coverInfos.Add("E-Mail Ship", reportCore.HerbergEmailContactReportingVessel);
|
||||||
coverInfos.Add("IMO", reportCore.IMO);
|
coverInfos.Add("IMO", reportCore.IMO);
|
||||||
DateTime eta = reportCore.ETA ?? (reportCore.ETAKielCanal ?? new DateTime(0));
|
DateTime eta = reportCore.ETA ?? (reportCore.ETAKielCanal ?? new DateTime(0));
|
||||||
coverInfos.Add("ETA", eta.ToShortDateString());
|
coverInfos.Add("ETA", eta.ToShortDateString());
|
||||||
|
|||||||
@ -80,6 +80,7 @@
|
|||||||
<Compile Include="..\bsmd.database\Properties\AssemblyProjectKeyInfo.cs">
|
<Compile Include="..\bsmd.database\Properties\AssemblyProjectKeyInfo.cs">
|
||||||
<Link>Properties\AssemblyProjectKeyInfo.cs</Link>
|
<Link>Properties\AssemblyProjectKeyInfo.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="ANSWMessageComparer.cs" />
|
||||||
<Compile Include="BSMDDocument.cs" />
|
<Compile Include="BSMDDocument.cs" />
|
||||||
<Compile Include="CrewPasHelper.cs" />
|
<Compile Include="CrewPasHelper.cs" />
|
||||||
<Compile Include="ProjectInstaller.cs">
|
<Compile Include="ProjectInstaller.cs">
|
||||||
|
|||||||
18
nsw/Source/bsmd.Tool/App.config
Normal file
18
nsw/Source/bsmd.Tool/App.config
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<configuration>
|
||||||
|
<configSections>
|
||||||
|
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
|
||||||
|
<section name="bsmd.Tool.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||||
|
</sectionGroup>
|
||||||
|
</configSections>
|
||||||
|
<startup>
|
||||||
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||||
|
</startup>
|
||||||
|
<userSettings>
|
||||||
|
<bsmd.Tool.Properties.Settings>
|
||||||
|
<setting name="ConnectionString" serializeAs="String">
|
||||||
|
<value>replace me!</value>
|
||||||
|
</setting>
|
||||||
|
</bsmd.Tool.Properties.Settings>
|
||||||
|
</userSettings>
|
||||||
|
</configuration>
|
||||||
55
nsw/Source/bsmd.Tool/CheckRules.cs
Normal file
55
nsw/Source/bsmd.Tool/CheckRules.cs
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
//
|
||||||
|
// Class: CheckRules
|
||||||
|
// Current CLR: 4.0.30319.42000
|
||||||
|
// System: Microsoft Visual Studio 10.0
|
||||||
|
// Author: dani
|
||||||
|
// Created: 9/14/2015 8:58:04 PM
|
||||||
|
//
|
||||||
|
// Copyright (c) 2015 Informatikbüro Daniel Schick. All rights reserved.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using bsmd.database;
|
||||||
|
using log4net;
|
||||||
|
|
||||||
|
namespace bsmd.Tool
|
||||||
|
{
|
||||||
|
public class CheckRules
|
||||||
|
{
|
||||||
|
private static ILog log = LogManager.GetLogger("CheckRules");
|
||||||
|
public static void Check(Guid messageCoreId)
|
||||||
|
{
|
||||||
|
if(DBManager.Instance.Connect(Properties.Settings.Default.ConnectionString))
|
||||||
|
{
|
||||||
|
MessageCore core = DBManager.Instance.GetMessageCoreById(messageCoreId);
|
||||||
|
if (core != null)
|
||||||
|
{
|
||||||
|
// get messges
|
||||||
|
List<Message> messages = DBManager.Instance.GetMessagesForCore(core);
|
||||||
|
RuleEngine ruleEngine = new RuleEngine();
|
||||||
|
|
||||||
|
foreach(Message message in messages) {
|
||||||
|
|
||||||
|
// clear old results
|
||||||
|
DBManager.Instance.DeleteMessageErrors(message);
|
||||||
|
DBManager.Instance.DeleteMessageViolations(message);
|
||||||
|
|
||||||
|
// perform validation
|
||||||
|
ruleEngine.Validate(message);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
log.Warn("cannot load message core from guid");
|
||||||
|
}
|
||||||
|
|
||||||
|
DBManager.Instance.Disconnect();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new ApplicationException("cannot connect to database");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
39
nsw/Source/bsmd.Tool/Options.cs
Normal file
39
nsw/Source/bsmd.Tool/Options.cs
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
//
|
||||||
|
// Class: Options
|
||||||
|
// Current CLR: 4.0.30319.42000
|
||||||
|
// System: Microsoft Visual Studio 10.0
|
||||||
|
// Author: dani
|
||||||
|
// Created: 9/14/2015 8:01:53 PM
|
||||||
|
//
|
||||||
|
// Copyright (c) 2015 Informatikbüro Daniel Schick. All rights reserved.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using CommandLine;
|
||||||
|
using CommandLine.Text;
|
||||||
|
|
||||||
|
namespace bsmd.Tool
|
||||||
|
{
|
||||||
|
public class Options
|
||||||
|
{
|
||||||
|
[Option('c', "core", Required=false, HelpText="MessageCoreId to process")]
|
||||||
|
public string MessageCoreId { get; set; }
|
||||||
|
|
||||||
|
[Option('v',"verbose", DefaultValue=true, HelpText="print messages to console")]
|
||||||
|
public bool Verbose { get; set; }
|
||||||
|
|
||||||
|
[Option('r', "checkrules", MutuallyExclusiveSet = "command", HelpText = "Use rule engine on message core")]
|
||||||
|
public bool CheckRules { get; set; }
|
||||||
|
|
||||||
|
[ParserState]
|
||||||
|
public IParserState LastParserState { get; set; }
|
||||||
|
|
||||||
|
[HelpOption]
|
||||||
|
public string GetUsage()
|
||||||
|
{
|
||||||
|
return HelpText.AutoBuild(this, (HelpText current) => HelpText.DefaultParsingErrorsHandler(this, current));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
54
nsw/Source/bsmd.Tool/Program.cs
Normal file
54
nsw/Source/bsmd.Tool/Program.cs
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using log4net;
|
||||||
|
|
||||||
|
namespace bsmd.Tool
|
||||||
|
{
|
||||||
|
class Program
|
||||||
|
{
|
||||||
|
private static ILog log = LogManager.GetLogger("Tool");
|
||||||
|
|
||||||
|
static int Main(string[] args)
|
||||||
|
{
|
||||||
|
log4net.Config.XmlConfigurator.Configure();
|
||||||
|
Options options = new Options();
|
||||||
|
if (CommandLine.Parser.Default.ParseArguments(args, options))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (options.CheckRules)
|
||||||
|
{
|
||||||
|
Guid coreId;
|
||||||
|
if (Guid.TryParse(options.MessageCoreId, out coreId))
|
||||||
|
{
|
||||||
|
CheckRules.Check(coreId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine("cannot parse message core id");
|
||||||
|
log.FatalFormat("CheckRules: cannot parse message core id");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// .. anderes
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
log.ErrorFormat("an exception occurred: {0}", ex.Message);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine(options.GetUsage());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
18
nsw/Source/bsmd.Tool/Properties/AssemblyInfo.cs
Normal file
18
nsw/Source/bsmd.Tool/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("bsmd.Tool")]
|
||||||
|
[assembly: AssemblyDescription("Kommandozeilen-Tool für Hilfsfunktionen")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("e85ea254-4436-4f8c-932c-e51a1f31567f")]
|
||||||
38
nsw/Source/bsmd.Tool/Properties/Settings.Designer.cs
generated
Normal file
38
nsw/Source/bsmd.Tool/Properties/Settings.Designer.cs
generated
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Runtime Version:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace bsmd.Tool.Properties {
|
||||||
|
|
||||||
|
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
|
||||||
|
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||||
|
|
||||||
|
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||||
|
|
||||||
|
public static Settings Default {
|
||||||
|
get {
|
||||||
|
return defaultInstance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Configuration.DefaultSettingValueAttribute("replace me!")]
|
||||||
|
public string ConnectionString {
|
||||||
|
get {
|
||||||
|
return ((string)(this["ConnectionString"]));
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
this["ConnectionString"] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
9
nsw/Source/bsmd.Tool/Properties/Settings.settings
Normal file
9
nsw/Source/bsmd.Tool/Properties/Settings.settings
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
|
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="bsmd.Tool.Properties" GeneratedClassName="Settings">
|
||||||
|
<Profiles />
|
||||||
|
<Settings>
|
||||||
|
<Setting Name="ConnectionString" Type="System.String" Scope="User">
|
||||||
|
<Value Profile="(Default)">replace me!</Value>
|
||||||
|
</Setting>
|
||||||
|
</Settings>
|
||||||
|
</SettingsFile>
|
||||||
98
nsw/Source/bsmd.Tool/bsmd.Tool.csproj
Normal file
98
nsw/Source/bsmd.Tool/bsmd.Tool.csproj
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{5F5E65EE-9351-4F30-817A-9C6C6D6835AE}</ProjectGuid>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>bsmd.Tool</RootNamespace>
|
||||||
|
<AssemblyName>bsmd.Tool</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<SignAssembly>true</SignAssembly>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="CommandLine">
|
||||||
|
<HintPath>..\packages\CommandLineParser.1.9.71\lib\net45\CommandLine.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="log4net">
|
||||||
|
<HintPath>..\packages\log4net.2.0.3\lib\net40-full\log4net.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="..\bsmd.database\Properties\AssemblyProductInfo.cs">
|
||||||
|
<Link>Properties\AssemblyProductInfo.cs</Link>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="..\bsmd.database\Properties\AssemblyProjectInfo.cs">
|
||||||
|
<Link>Properties\AssemblyProjectInfo.cs</Link>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="..\bsmd.database\Properties\AssemblyProjectKeyInfo.cs">
|
||||||
|
<Link>Properties\AssemblyProjectKeyInfo.cs</Link>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="CheckRules.cs" />
|
||||||
|
<Compile Include="Options.cs" />
|
||||||
|
<Compile Include="Program.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="Properties\Settings.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="App.config" />
|
||||||
|
<None Include="..\bsmdKey.snk" />
|
||||||
|
<None Include="packages.config" />
|
||||||
|
<None Include="Properties\Settings.settings">
|
||||||
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\bsmd.database\bsmd.database.csproj">
|
||||||
|
<Project>{19945af2-379b-46a5-b27a-303b5ec1d557}</Project>
|
||||||
|
<Name>bsmd.database</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
|
</Project>
|
||||||
6
nsw/Source/bsmd.Tool/bsmd.Tool.csproj.user
Normal file
6
nsw/Source/bsmd.Tool/bsmd.Tool.csproj.user
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
|
||||||
|
<StartArguments>-r -c "AA9074D7-2607-445E-A0B9-D07890B6DC23"</StartArguments>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
5
nsw/Source/bsmd.Tool/packages.config
Normal file
5
nsw/Source/bsmd.Tool/packages.config
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="CommandLineParser" version="1.9.71" targetFramework="net45" />
|
||||||
|
<package id="log4net" version="2.0.3" targetFramework="net45" />
|
||||||
|
</packages>
|
||||||
@ -25,6 +25,7 @@ namespace bsmd.database
|
|||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.DOUBLE_GT_ZERO)]
|
||||||
public DateTime? ATAPortOfCall { get; set; }
|
public DateTime? ATAPortOfCall { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -25,6 +25,7 @@ namespace bsmd.database
|
|||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.DOUBLE_GT_ZERO)]
|
||||||
public DateTime? ATDPortOfCall { get; set; }
|
public DateTime? ATDPortOfCall { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -25,9 +25,11 @@ namespace bsmd.database
|
|||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string BunkerFuelType { get; set; }
|
public string BunkerFuelType { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.DOUBLE_GT_ZERO)]
|
||||||
public double? BunkerFuelQuantity_TNE { get; set; }
|
public double? BunkerFuelQuantity_TNE { get; set; }
|
||||||
|
|
||||||
public string Identifier { get; set; }
|
public string Identifier { get; set; }
|
||||||
|
|||||||
@ -27,6 +27,7 @@ namespace bsmd.database
|
|||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public bool? StowawaysOnBoard { get; set; }
|
public bool? StowawaysOnBoard { get; set; }
|
||||||
|
|
||||||
public List<PortOfItinerary> PortOfItineraries { get { return this.poi; } }
|
public List<PortOfItinerary> PortOfItineraries { get { return this.poi; } }
|
||||||
@ -129,6 +130,16 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Validation
|
||||||
|
|
||||||
|
public override void Validate(List<MessageError> errors, List<MessageViolation> violations)
|
||||||
|
{
|
||||||
|
foreach (PortOfItinerary poi in this.PortOfItineraries)
|
||||||
|
RuleEngine.ValidateProperties(poi, errors);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -25,9 +25,11 @@ namespace bsmd.database
|
|||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string BunkerFuelType { get; set; }
|
public string BunkerFuelType { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.DOUBLE_GT_ZERO)]
|
||||||
public double? BunkerFuelQuantity_TNE { get; set; }
|
public double? BunkerFuelQuantity_TNE { get; set; }
|
||||||
|
|
||||||
public string Identifier { get; set; }
|
public string Identifier { get; set; }
|
||||||
|
|||||||
@ -26,16 +26,20 @@ namespace bsmd.database
|
|||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[ReportDisplayName("Last name")]
|
[ReportDisplayName("Last name")]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string CrewMemberLastName { get; set; }
|
public string CrewMemberLastName { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[ReportDisplayName("First name")]
|
[ReportDisplayName("First name")]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string CrewMemberFirstName { get; set; }
|
public string CrewMemberFirstName { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[ReportDisplayName("Place of birth")]
|
[ReportDisplayName("Place of birth")]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string CrewMemberPlaceOfBirth { get; set; }
|
public string CrewMemberPlaceOfBirth { get; set; }
|
||||||
|
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public DateTime? CrewMemberDateOfBirth { get; set; }
|
public DateTime? CrewMemberDateOfBirth { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
@ -58,8 +62,10 @@ namespace bsmd.database
|
|||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[ReportDisplayName("Nationality")]
|
[ReportDisplayName("Nationality")]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string CrewMemberNationality { get; set; }
|
public string CrewMemberNationality { get; set; }
|
||||||
|
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public byte? CrewMemberIdentityDocumentType { get; set; }
|
public byte? CrewMemberIdentityDocumentType { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
@ -68,6 +74,7 @@ namespace bsmd.database
|
|||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[ReportDisplayName("Identity document id")]
|
[ReportDisplayName("Identity document id")]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string CrewMemberIdentityDocumentId { get; set; }
|
public string CrewMemberIdentityDocumentId { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
@ -76,6 +83,7 @@ namespace bsmd.database
|
|||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[ReportDisplayName("Duty")]
|
[ReportDisplayName("Duty")]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string CrewMemberDuty { get; set; }
|
public string CrewMemberDuty { get; set; }
|
||||||
|
|
||||||
public string Identifier { get; set; }
|
public string Identifier { get; set; }
|
||||||
|
|||||||
@ -252,17 +252,7 @@ namespace bsmd.database
|
|||||||
SqlCommand cmd = new SqlCommand();
|
SqlCommand cmd = new SqlCommand();
|
||||||
entity.PrepareSave(cmd);
|
entity.PrepareSave(cmd);
|
||||||
int queryResult = this.PerformNonQuery(cmd);
|
int queryResult = this.PerformNonQuery(cmd);
|
||||||
switch(queryResult)
|
this.LogNonQueryResult(cmd.CommandText, queryResult);
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
_log.DebugFormat("Entity {0} saved", entity.Id); break;
|
|
||||||
case 0:
|
|
||||||
_log.DebugFormat("Entity {0} save affected no rows", entity.Id); break;
|
|
||||||
case -1:
|
|
||||||
_log.DebugFormat("Entity {0} save: error occurred", entity.Id); break;
|
|
||||||
default:
|
|
||||||
_log.DebugFormat("Entity {0} save affected {1} rows", entity.Id, queryResult); break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Delete(DatabaseEntity entity)
|
public void Delete(DatabaseEntity entity)
|
||||||
@ -270,19 +260,24 @@ namespace bsmd.database
|
|||||||
SqlCommand cmd = new SqlCommand();
|
SqlCommand cmd = new SqlCommand();
|
||||||
entity.PrepareDelete(cmd);
|
entity.PrepareDelete(cmd);
|
||||||
int queryResult = this.PerformNonQuery(cmd);
|
int queryResult = this.PerformNonQuery(cmd);
|
||||||
switch(queryResult)
|
this.LogNonQueryResult(cmd.CommandText, queryResult);
|
||||||
{
|
}
|
||||||
case 1:
|
|
||||||
_log.DebugFormat("Entity {0} deleted", entity.Id); break;
|
public void DeleteMessageErrors(Message message)
|
||||||
case 0:
|
{
|
||||||
_log.DebugFormat("Entity {0} delete affected no rows", entity.Id); break;
|
SqlCommand cmd = new SqlCommand();
|
||||||
case -1:
|
cmd.CommandText = string.Format("DELETE FROM Error WHERE MessageHeaderId='{0}'", message.Id);
|
||||||
_log.DebugFormat("Entity {0} delete: error occurred", entity.Id); break;
|
int queryResult = this.PerformNonQuery(cmd);
|
||||||
default:
|
this.LogNonQueryResult(cmd.CommandText, queryResult);
|
||||||
_log.DebugFormat("Entity {0} delete affected {1} rows", entity.Id, queryResult); break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void DeleteMessageViolations(Message message)
|
||||||
|
{
|
||||||
|
SqlCommand cmd = new SqlCommand();
|
||||||
|
cmd.CommandText = string.Format("DELETE FROM Violation WHERE MessageHeaderId='{0}'", message.Id);
|
||||||
|
int queryResult = this.PerformNonQuery(cmd);
|
||||||
|
this.LogNonQueryResult(cmd.CommandText, queryResult);
|
||||||
|
}
|
||||||
|
|
||||||
public void Save(MessageCore core)
|
public void Save(MessageCore core)
|
||||||
{
|
{
|
||||||
@ -297,16 +292,26 @@ namespace bsmd.database
|
|||||||
SqlCommand cmd = new SqlCommand();
|
SqlCommand cmd = new SqlCommand();
|
||||||
core.PrepareSave(cmd);
|
core.PrepareSave(cmd);
|
||||||
int queryResult = this.PerformNonQuery(cmd);
|
int queryResult = this.PerformNonQuery(cmd);
|
||||||
if (queryResult == 1)
|
this.LogNonQueryResult(cmd.CommandText, queryResult);
|
||||||
_log.DebugFormat("MessageCore {0} saved", core.Id);
|
|
||||||
else
|
|
||||||
_log.WarnFormat("MessageCore {0} save affected {1} rows", core.Id, queryResult);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region internal/private funcs
|
#region internal/private funcs
|
||||||
|
|
||||||
|
private void LogNonQueryResult(string query, int queryResult)
|
||||||
|
{
|
||||||
|
switch (queryResult)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
_log.DebugFormat("Query {0} affected no rows", query); break;
|
||||||
|
case -1:
|
||||||
|
_log.DebugFormat("Query {0} error occurred", query); break;
|
||||||
|
default:
|
||||||
|
_log.DebugFormat("Query {0} affected {1} rows", query, queryResult); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
internal void LoadMessageDependencies(List<Message> messageList)
|
internal void LoadMessageDependencies(List<Message> messageList)
|
||||||
{
|
{
|
||||||
// Dictionary<Guid, MessageCore> messageCoreDict = this.GetToSendMessageCoreList();
|
// Dictionary<Guid, MessageCore> messageCoreDict = this.GetToSendMessageCoreList();
|
||||||
@ -656,6 +661,38 @@ namespace bsmd.database
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal Dictionary<int, string> LoadErrorTexts()
|
||||||
|
{
|
||||||
|
SqlCommand cmd = new SqlCommand();
|
||||||
|
cmd.CommandText = "SELECT ErrorCode, ErrorText FROM ErrorText";
|
||||||
|
SqlDataReader reader = this.PerformCommand(cmd);
|
||||||
|
Dictionary<int, string> result = new Dictionary<int, string>();
|
||||||
|
while (reader.Read())
|
||||||
|
{
|
||||||
|
int errorCode = reader.GetInt32(0);
|
||||||
|
string errorText = reader.GetString(1);
|
||||||
|
result[errorCode] = errorText;
|
||||||
|
}
|
||||||
|
reader.Close();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal Dictionary<int, string> LoadViolationTexts()
|
||||||
|
{
|
||||||
|
SqlCommand cmd = new SqlCommand();
|
||||||
|
cmd.CommandText = "SELECT ViolationCode, ViolationText FROM ViolationText";
|
||||||
|
SqlDataReader reader = this.PerformCommand(cmd);
|
||||||
|
Dictionary<int, string> result = new Dictionary<int, string>();
|
||||||
|
while (reader.Read())
|
||||||
|
{
|
||||||
|
int violationCode = reader.GetInt32(0);
|
||||||
|
string violationText = reader.GetString(1);
|
||||||
|
result[violationCode] = violationText;
|
||||||
|
}
|
||||||
|
reader.Close();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
#region DB access methods
|
#region DB access methods
|
||||||
|
|
||||||
internal SqlDataReader PerformCommand(SqlCommand cmd)
|
internal SqlDataReader PerformCommand(SqlCommand cmd)
|
||||||
@ -663,11 +700,11 @@ namespace bsmd.database
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
cmd.Connection = this._con;
|
cmd.Connection = this._con;
|
||||||
Stopwatch sw = new Stopwatch();
|
// Stopwatch sw = new Stopwatch();
|
||||||
sw.Start();
|
// sw.Start();
|
||||||
SqlDataReader reader = cmd.ExecuteReader();
|
SqlDataReader reader = cmd.ExecuteReader();
|
||||||
sw.Stop();
|
// sw.Stop();
|
||||||
_log.DebugFormat("{1}ms: {0}", cmd.CommandText, sw.ElapsedMilliseconds);
|
// _log.DebugFormat("{1}ms: {0}", cmd.CommandText, sw.ElapsedMilliseconds);
|
||||||
return reader;
|
return reader;
|
||||||
}
|
}
|
||||||
catch (SqlException ex)
|
catch (SqlException ex)
|
||||||
|
|||||||
@ -21,7 +21,15 @@ namespace bsmd.database
|
|||||||
public abstract class DatabaseEntity : IMessageParagraph
|
public abstract class DatabaseEntity : IMessageParagraph
|
||||||
{
|
{
|
||||||
protected Guid? id;
|
protected Guid? id;
|
||||||
protected string tablename;
|
protected string tablename;
|
||||||
|
|
||||||
|
public enum ValidationBlock
|
||||||
|
{
|
||||||
|
BLOCK1,
|
||||||
|
BLOCK2
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Properties
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Nachrichtentyp der abgeleiteten Meldeklassen
|
/// Nachrichtentyp der abgeleiteten Meldeklassen
|
||||||
@ -53,6 +61,10 @@ namespace bsmd.database
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsNew { get { return !this.id.HasValue; } }
|
public bool IsNew { get { return !this.id.HasValue; } }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region public funcs
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// when it's time (during save), create id
|
/// when it's time (during save), create id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -71,6 +83,19 @@ namespace bsmd.database
|
|||||||
|
|
||||||
public abstract List<DatabaseEntity> LoadList(IDataReader reader);
|
public abstract List<DatabaseEntity> LoadList(IDataReader reader);
|
||||||
|
|
||||||
|
public virtual void Validate(List<MessageError> errors, List<MessageViolation> violations)
|
||||||
|
{
|
||||||
|
errors = new List<MessageError>();
|
||||||
|
violations = new List<MessageViolation>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual ValidationBlock GetValidationBlock()
|
||||||
|
{
|
||||||
|
return ValidationBlock.BLOCK1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region IMessageParagraph implementation
|
#region IMessageParagraph implementation
|
||||||
|
|
||||||
public virtual string Title
|
public virtual string Title
|
||||||
|
|||||||
@ -235,5 +235,53 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Validation
|
||||||
|
|
||||||
|
public override DatabaseEntity.ValidationBlock GetValidationBlock()
|
||||||
|
{
|
||||||
|
return (this.NoDPGOnBoardOnArrival ?? false) ? ValidationBlock.BLOCK1 : ValidationBlock.BLOCK2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Validate(List<MessageError> errors, List<MessageViolation> violations)
|
||||||
|
{
|
||||||
|
if (this.GetValidationBlock() == ValidationBlock.BLOCK2)
|
||||||
|
{
|
||||||
|
if ((this.IMDGPositions.Count == 0) && (this.IBCPositions.Count == 0) && (this.IGCPositions.Count == 0) &&
|
||||||
|
(this.IMSBCPositions.Count == 0) && (this.MARPOLPositions.Count == 0))
|
||||||
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.V805, "At least one DPG item has to be provided!", null));
|
||||||
|
|
||||||
|
foreach (IMDGPosition imdg in this.IMDGPositions)
|
||||||
|
{
|
||||||
|
RuleEngine.ValidateProperties(imdg, errors);
|
||||||
|
imdg.Validate(errors, violations);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(IBCPosition ibc in this.IBCPositions)
|
||||||
|
{
|
||||||
|
RuleEngine.ValidateProperties(ibc, errors);
|
||||||
|
ibc.Validate(errors, violations);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(IGCPosition igc in this.IGCPositions)
|
||||||
|
{
|
||||||
|
RuleEngine.ValidateProperties(igc, errors);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(IMSBCPosition imsbc in this.IMSBCPositions)
|
||||||
|
{
|
||||||
|
RuleEngine.ValidateProperties(imsbc, errors);
|
||||||
|
imsbc.Validate(errors, violations);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(MARPOL_Annex_I_Position marpol in this.MARPOLPositions)
|
||||||
|
{
|
||||||
|
RuleEngine.ValidateProperties(marpol, errors);
|
||||||
|
marpol.Validate(errors, violations);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,22 +26,29 @@ namespace bsmd.database
|
|||||||
|
|
||||||
public HAZ HAZ { get; set; }
|
public HAZ HAZ { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string ProductName { get; set; }
|
public string ProductName { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public byte? PollutionCategory { get; set; }
|
public byte? PollutionCategory { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
public byte? Hazards { get; set; }
|
public byte? Hazards { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public byte? FlashpointInformation { get; set; }
|
public byte? FlashpointInformation { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
public string Flashpoint_CEL { get; set; }
|
public string Flashpoint_CEL { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.DOUBLE_GT_ZERO)]
|
||||||
public double? Quantity_KGM { get; set; }
|
public double? Quantity_KGM { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string StowagePosition { get; set; }
|
public string StowagePosition { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.LOCODE)]
|
||||||
public string PortOfLoading { get; set; }
|
public string PortOfLoading { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.LOCODE)]
|
||||||
public string PortOfDischarge { get; set; }
|
public string PortOfDischarge { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
public bool? SpecRef15_19 { get; set; }
|
public bool? SpecRef15_19 { get; set; }
|
||||||
@ -139,5 +146,16 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Validation
|
||||||
|
|
||||||
|
public override void Validate(List<MessageError> errors, List<MessageViolation> violations)
|
||||||
|
{
|
||||||
|
if (this.FlashpointInformation.HasValue && (this.FlashpointInformation.Value == 2) &&
|
||||||
|
this.Flashpoint_CEL.IsNullOrEmpty())
|
||||||
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.V804, "flashpoint information missing", null));
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,14 +30,19 @@ namespace bsmd.database
|
|||||||
[ShowReport]
|
[ShowReport]
|
||||||
public string IMOClass { get; set; }
|
public string IMOClass { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string ProductName { get; set; }
|
public string ProductName { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.DOUBLE_GT_ZERO)]
|
||||||
public double? Quantity_KGM { get; set; }
|
public double? Quantity_KGM { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string StowagePosition { get; set; }
|
public string StowagePosition { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.LOCODE)]
|
||||||
public string PortOfLoading { get; set; }
|
public string PortOfLoading { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.LOCODE)]
|
||||||
public string PortOfDischarge { get; set; }
|
public string PortOfDischarge { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
public string Remarks { get; set; }
|
public string Remarks { get; set; }
|
||||||
|
|||||||
@ -28,12 +28,15 @@ namespace bsmd.database
|
|||||||
|
|
||||||
public HAZ HAZ { get; set; }
|
public HAZ HAZ { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string UNNumber { get; set; }
|
public string UNNumber { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
public byte? PackingGroup { get; set; }
|
public byte? PackingGroup { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string ProperShippingName { get; set; }
|
public string ProperShippingName { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string IMOClass { get; set; }
|
public string IMOClass { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
public string CompatibilityGroup { get; set; }
|
public string CompatibilityGroup { get; set; }
|
||||||
@ -58,14 +61,19 @@ namespace bsmd.database
|
|||||||
[ShowReport]
|
[ShowReport]
|
||||||
public double? EmergencyTemperature_CEL { get; set; }
|
public double? EmergencyTemperature_CEL { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public bool? MarinePollutant { get; set; }
|
public bool? MarinePollutant { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public int? NumberOfPackages { get; set; }
|
public int? NumberOfPackages { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string PackageType { get; set; }
|
public string PackageType { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public bool? LimitedQuantities { get; set; }
|
public bool? LimitedQuantities { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public bool? ExceptedQuantities { get; set; }
|
public bool? ExceptedQuantities { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
public double? NetQuantity_KGM { get; set; }
|
public double? NetQuantity_KGM { get; set; }
|
||||||
@ -80,10 +88,13 @@ namespace bsmd.database
|
|||||||
[ShowReport]
|
[ShowReport]
|
||||||
public string VehicleLicenseNumber { get; set; }
|
public string VehicleLicenseNumber { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string StowagePosition { get; set; }
|
public string StowagePosition { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.LOCODE)]
|
||||||
public string PortOfLoading { get; set; }
|
public string PortOfLoading { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.LOCODE)]
|
||||||
public string PortOfDischarge { get; set; }
|
public string PortOfDischarge { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
public string Remarks { get; set; }
|
public string Remarks { get; set; }
|
||||||
@ -250,5 +261,24 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Validation
|
||||||
|
|
||||||
|
public override void Validate(List<MessageError> errors, List<MessageViolation> violations)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!this.NetQuantity_KGM.HasValue && !this.GrossQuantity_KGM.HasValue && !this.Volume_MTQ.HasValue)
|
||||||
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.V802,
|
||||||
|
"at least on of NetQuantity, Grossquantity or Volume_MTQ has to be provided", null));
|
||||||
|
|
||||||
|
if ((this.GeneralCargoIBC ?? false) && this.ContainerNumber.IsNullOrEmpty() && this.VehicleLicenseNumber.IsNullOrEmpty())
|
||||||
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.V808,
|
||||||
|
"at least Container number or Vehicle license number has to be provided for GeneralCargoIBC", null));
|
||||||
|
|
||||||
|
foreach (SubsidiaryRisks sr in this.SubsidiaryRiskList)
|
||||||
|
RuleEngine.ValidateProperties(sr, errors);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,20 +26,26 @@ namespace bsmd.database
|
|||||||
|
|
||||||
public HAZ HAZ { get; set; }
|
public HAZ HAZ { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string BulkCargoShippingName { get; set; }
|
public string BulkCargoShippingName { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public bool? MHB { get; set; }
|
public bool? MHB { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
public string UNNumber { get; set; }
|
public string UNNumber { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
public string IMOClass { get; set; }
|
public string IMOClass { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.DOUBLE_GT_ZERO)]
|
||||||
public double? Quantity_KGM { get; set; }
|
public double? Quantity_KGM { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string StowagePosition { get; set; }
|
public string StowagePosition { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.LOCODE)]
|
||||||
public string PortOfLoading { get; set; }
|
public string PortOfLoading { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.LOCODE)]
|
||||||
public string PortOfDischarge { get; set; }
|
public string PortOfDischarge { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
public string Remarks { get; set; }
|
public string Remarks { get; set; }
|
||||||
@ -47,6 +53,8 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region DatabaseEntity implementation
|
||||||
|
|
||||||
public override void PrepareSave(IDbCommand cmd)
|
public override void PrepareSave(IDbCommand cmd)
|
||||||
{
|
{
|
||||||
SqlCommand scmd = cmd as SqlCommand;
|
SqlCommand scmd = cmd as SqlCommand;
|
||||||
@ -123,5 +131,8 @@ namespace bsmd.database
|
|||||||
reader.Close();
|
reader.Close();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,9 +25,11 @@ namespace bsmd.database
|
|||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public byte? ShippingArea { get; set; }
|
public byte? ShippingArea { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string RequestedPositionInPortOfCall { get; set; }
|
public string RequestedPositionInPortOfCall { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
@ -37,6 +39,7 @@ namespace bsmd.database
|
|||||||
public string ConstructionCharacteristicsOfShip { get; set; }
|
public string ConstructionCharacteristicsOfShip { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public byte? FumigatedBulkCargo { get; set; }
|
public byte? FumigatedBulkCargo { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
|||||||
@ -25,15 +25,18 @@ namespace bsmd.database
|
|||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public byte? CargoHandlingType { get; set; }
|
public byte? CargoHandlingType { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.TWO_DIGIT)]
|
||||||
public string CargoCodeNST { get; set; }
|
public string CargoCodeNST { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
public int? CargoNumberOfItems { get; set; }
|
public int? CargoNumberOfItems { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.DOUBLE_GT_ZERO)]
|
||||||
public double? CargoGrossQuantity_TNE { get; set; }
|
public double? CargoGrossQuantity_TNE { get; set; }
|
||||||
|
|
||||||
public string Identifier { get; set; }
|
public string Identifier { get; set; }
|
||||||
@ -117,5 +120,18 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Validation
|
||||||
|
|
||||||
|
public override void Validate(List<MessageError> errors, List<MessageViolation> violations)
|
||||||
|
{
|
||||||
|
if ((this.CargoCodeNST != null) &&
|
||||||
|
(this.CargoCodeNST.Equals("11") || this.CargoCodeNST.Equals("12") || this.CargoCodeNST.Equals("16") ||
|
||||||
|
this.CargoCodeNST.Equals("19")) &&
|
||||||
|
!this.CargoNumberOfItems.HasValue)
|
||||||
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.V721, "If cargo code is 11/12/16/19 number of items must be given!", null));
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -32,14 +32,18 @@ namespace bsmd.database
|
|||||||
[ShowReport]
|
[ShowReport]
|
||||||
public string PortFacilityPortLoCode { get; set; }
|
public string PortFacilityPortLoCode { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
public DateTime? PortFacilityDateOfArrival { get; set; }
|
public DateTime? PortFacilityDateOfArrival { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
public DateTime? PortFacilityDateOfDeparture { get; set; }
|
public DateTime? PortFacilityDateOfDeparture { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
public byte? PortFacilityShipSecurityLevel { get; set; }
|
public byte? PortFacilityShipSecurityLevel { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
public string PortFacilitySecurityMattersToReport { get; set; }
|
public string PortFacilitySecurityMattersToReport { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
public string PortFacilityGISISCode { get; set; }
|
public string PortFacilityGISISCode { get; set; }
|
||||||
|
|
||||||
public string Identifier { get; set; }
|
public string Identifier { get; set; }
|
||||||
@ -130,6 +134,19 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Validate
|
||||||
|
|
||||||
|
public override void Validate(List<MessageError> errors, List<MessageViolation> violations)
|
||||||
|
{
|
||||||
|
bool locationOK = !this.PortFacilityPortLoCode.IsNullOrEmpty() ||
|
||||||
|
(!this.PortFacilityPortName.IsNullOrEmpty() && !this.PortFacilityPortCountry.IsNullOrEmpty());
|
||||||
|
|
||||||
|
if(!locationOK)
|
||||||
|
RuleEngine.CreateViolation(ValidationCode.V703, "Either LoCode or Country + Name must be given", null);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -26,18 +26,24 @@ namespace bsmd.database
|
|||||||
|
|
||||||
public HAZ HAZ { get; set; }
|
public HAZ HAZ { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public byte? FlashpointInformation { get; set; }
|
public byte? FlashpointInformation { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
public string Flashpoint_CEL { get; set; }
|
public string Flashpoint_CEL { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.DOUBLE_GT_ZERO)]
|
||||||
public double? Quantity_KGM { get; set; }
|
public double? Quantity_KGM { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string StowagePosition { get; set; }
|
public string StowagePosition { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.LOCODE)]
|
||||||
public string PortOfLoading { get; set; }
|
public string PortOfLoading { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.LOCODE)]
|
||||||
public string PortOfDischarge { get; set; }
|
public string PortOfDischarge { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
public string Remarks { get; set; }
|
public string Remarks { get; set; }
|
||||||
@ -126,5 +132,16 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Validation
|
||||||
|
|
||||||
|
public override void Validate(List<MessageError> errors, List<MessageViolation> violations)
|
||||||
|
{
|
||||||
|
if (this.FlashpointInformation.HasValue && (this.FlashpointInformation.Value == 2) &&
|
||||||
|
this.Flashpoint_CEL.IsNullOrEmpty())
|
||||||
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.V804, "flashpoint information missing", null));
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,26 +28,35 @@ namespace bsmd.database
|
|||||||
|
|
||||||
public List<PortOfCallLast30Days> PortOfCallLast30Days { get { return this.portOfCallLast30Days; } }
|
public List<PortOfCallLast30Days> PortOfCallLast30Days { get { return this.portOfCallLast30Days; } }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation1(ValidationCode.NOT_NULL)]
|
||||||
public bool? MDHSimplification { get; set; }
|
public bool? MDHSimplification { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation1(ValidationCode.LOCODE_GER)]
|
||||||
public string PortOfCallWhereCompleteMDHNotified { get; set; }
|
public string PortOfCallWhereCompleteMDHNotified { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
public bool? NonAccidentalDeathsDuringVoyage { get; set; }
|
public bool? NonAccidentalDeathsDuringVoyage { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
public int? NonAccidentalDeathsDuringVoyageCount { get; set; }
|
public int? NonAccidentalDeathsDuringVoyageCount { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
public bool? SuspisionInfectiousNature { get; set; }
|
public bool? SuspisionInfectiousNature { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
public bool? NumberOfIllPersonsHigherThanExpected { get; set; }
|
public bool? NumberOfIllPersonsHigherThanExpected { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
public int? NumberOfIllPersons { get; set; }
|
public int? NumberOfIllPersons { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
public bool? SickPersonsOnBoard { get; set; }
|
public bool? SickPersonsOnBoard { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
public bool? MedicalConsulted { get; set; }
|
public bool? MedicalConsulted { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
public bool? AwareOfFurtherInfections { get; set; }
|
public bool? AwareOfFurtherInfections { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
public bool? SanitaryMeasuresApplied { get; set; }
|
public bool? SanitaryMeasuresApplied { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
public string SanitaryMeasuresType { get; set; }
|
public string SanitaryMeasuresType { get; set; }
|
||||||
@ -56,20 +65,25 @@ namespace bsmd.database
|
|||||||
[ShowReport]
|
[ShowReport]
|
||||||
public DateTime? SanitaryMeasuresDate { get; set; }
|
public DateTime? SanitaryMeasuresDate { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
public bool? StowawaysDetected { get; set; }
|
public bool? StowawaysDetected { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
public string StowawaysJoiningLocation { get; set; }
|
public string StowawaysJoiningLocation { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
public bool? SickAnimalOrPetOnBoard { get; set; }
|
public bool? SickAnimalOrPetOnBoard { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
public bool? ValidSanitaryControlExemptionOrCertificateOnBoard { get; set; }
|
public bool? ValidSanitaryControlExemptionOrCertificateOnBoard { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
public string PlaceOfIssue { get; set; }
|
public string PlaceOfIssue { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
public DateTime? DateOfIssue { get; set; }
|
public DateTime? DateOfIssue { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
public bool? SanitaryControlReinspectionRequired { get; set; }
|
public bool? SanitaryControlReinspectionRequired { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
public bool? InfectedAreaVisited { get; set; }
|
public bool? InfectedAreaVisited { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
public string InfectedAreaPort { get; set; }
|
public string InfectedAreaPort { get; set; }
|
||||||
@ -239,5 +253,56 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Validation
|
||||||
|
|
||||||
|
public override DatabaseEntity.ValidationBlock GetValidationBlock()
|
||||||
|
{
|
||||||
|
return (this.MDHSimplification ?? false) ? DatabaseEntity.ValidationBlock.BLOCK1 : DatabaseEntity.ValidationBlock.BLOCK2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Validate(List<MessageError> errors, List<MessageViolation> violations)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (this.GetValidationBlock() == ValidationBlock.BLOCK1)
|
||||||
|
{
|
||||||
|
if (this.PortOfCallWhereCompleteMDHNotified.IsNullOrEmpty())
|
||||||
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.V768, "PortOfCallWhereCompleteMDHNotified missing", null));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if((this.NonAccidentalDeathsDuringVoyage ?? false) && ((this.NonAccidentalDeathsDuringVoyageCount ?? 0) == 0))
|
||||||
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.V761, "NonAccidentalDeathsDuringVoyageCount missing", null));
|
||||||
|
|
||||||
|
if((this.NumberOfIllPersonsHigherThanExpected ?? false) && ((this.NumberOfIllPersons ?? 0) == 0))
|
||||||
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.V762, "Number of ill persons missing", null));
|
||||||
|
|
||||||
|
if ((this.SanitaryMeasuresApplied ?? false) && (
|
||||||
|
this.SanitaryMeasuresType.IsNullOrEmpty() ||
|
||||||
|
!this.SanitaryMeasuresDate.HasValue ||
|
||||||
|
this.SanitaryMeasuresLocation.IsNullOrEmpty()))
|
||||||
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.V763, "Sanitary measure details missing", null));
|
||||||
|
|
||||||
|
if ((this.StowawaysDetected ?? false) && this.StowawaysJoiningLocation.IsNullOrEmpty())
|
||||||
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.V764, "Stowaways joining location missing", null));
|
||||||
|
|
||||||
|
if ((this.ValidSanitaryControlExemptionOrCertificateOnBoard ?? false) &&
|
||||||
|
(this.PlaceOfIssue.IsNullOrEmpty() || !this.DateOfIssue.HasValue))
|
||||||
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.V765, "Cert. Place or Date of issue missing", null));
|
||||||
|
|
||||||
|
if ((this.InfectedAreaVisited ?? false) &&
|
||||||
|
(!this.InfectedAreaDate.HasValue || this.InfectedAreaPort.IsNullOrEmpty()))
|
||||||
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.V766, "Infected area date or port missing", null));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (PortOfCallLast30Days poc30d in this.portOfCallLast30Days)
|
||||||
|
{
|
||||||
|
RuleEngine.ValidateProperties(poc30d, errors);
|
||||||
|
poc30d.Validate(errors, violations);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
|
||||||
namespace bsmd.database
|
namespace bsmd.database
|
||||||
{
|
{
|
||||||
@ -26,6 +27,39 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region ANSWSortList
|
||||||
|
|
||||||
|
public static IList<NotificationClass> ANSWSortList = new ReadOnlyCollection<NotificationClass>(
|
||||||
|
new List<NotificationClass>{
|
||||||
|
NotificationClass.TIEFA,
|
||||||
|
NotificationClass.POBA,
|
||||||
|
NotificationClass.BKRA,
|
||||||
|
NotificationClass.TOWA,
|
||||||
|
NotificationClass.NOA_NOD,
|
||||||
|
NotificationClass.STAT,
|
||||||
|
NotificationClass.NAME,
|
||||||
|
NotificationClass.INFO,
|
||||||
|
NotificationClass.SERV,
|
||||||
|
NotificationClass.LADG,
|
||||||
|
NotificationClass.TIEFD,
|
||||||
|
NotificationClass.POBD,
|
||||||
|
NotificationClass.BKRD,
|
||||||
|
NotificationClass.TOWD,
|
||||||
|
NotificationClass.SEC,
|
||||||
|
NotificationClass.PRE72H,
|
||||||
|
NotificationClass.BPOL,
|
||||||
|
NotificationClass.CREW,
|
||||||
|
NotificationClass.PAS,
|
||||||
|
NotificationClass.MDH,
|
||||||
|
NotificationClass.HAZA,
|
||||||
|
NotificationClass.HAZD,
|
||||||
|
NotificationClass.WAS,
|
||||||
|
NotificationClass.ATA,
|
||||||
|
NotificationClass.ATD
|
||||||
|
});
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region Enumerations
|
#region Enumerations
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -478,7 +512,7 @@ namespace bsmd.database
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,6 +25,7 @@ namespace bsmd.database
|
|||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string NameOfMaster { get; set; }
|
public string NameOfMaster { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -25,21 +25,28 @@ namespace bsmd.database
|
|||||||
}
|
}
|
||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation1(ValidationCode.NOT_NULL)]
|
||||||
public DateTime? ETAToPortOfCall { get; set; }
|
public DateTime? ETAToPortOfCall { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation1(ValidationCode.NOT_NULL)]
|
||||||
public DateTime? ETDFromPortOfCall { get; set; }
|
public DateTime? ETDFromPortOfCall { get; set; }
|
||||||
|
[Validation1(ValidationCode.NOT_NULL)]
|
||||||
public List<CallPurpose> CallPurposes { get { return this.callPurposes; } }
|
public List<CallPurpose> CallPurposes { get { return this.callPurposes; } }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
public DateTime? ETAToKielCanal { get; set; }
|
public DateTime? ETAToKielCanal { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
public DateTime? ETDFromKielCanal { get; set; }
|
public DateTime? ETDFromKielCanal { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string LastPort { get; set; }
|
public string LastPort { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
public DateTime? ETDFromLastPort { get; set; }
|
public DateTime? ETDFromLastPort { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string NextPort { get; set; }
|
public string NextPort { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
public DateTime? ETAToNextPort { get; set; }
|
public DateTime? ETAToNextPort { get; set; }
|
||||||
@ -158,5 +165,42 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Validation
|
||||||
|
|
||||||
|
public override void Validate(List<MessageError> errors, List<MessageViolation> violations)
|
||||||
|
{
|
||||||
|
if (this.GetValidationBlock() == ValidationBlock.BLOCK1)
|
||||||
|
{
|
||||||
|
if(this.ETDFromPortOfCall.HasValue && this.ETAToPortOfCall.HasValue &&
|
||||||
|
(this.ETDFromPortOfCall < this.ETAToPortOfCall))
|
||||||
|
errors.Add(RuleEngine.CreateError(ValidationCode.E121, "Departure time before arrival time!", null));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (this.ETDFromKielCanal.HasValue && this.ETAToKielCanal.HasValue &&
|
||||||
|
(this.ETDFromKielCanal < this.ETAToKielCanal))
|
||||||
|
errors.Add(RuleEngine.CreateError(ValidationCode.E123, "Departure time before arrival time!", null));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!this.LastPort.Equals("ZZUKN") && !this.ETDFromLastPort.HasValue)
|
||||||
|
errors.Add(RuleEngine.CreateError(ValidationCode.E125, "ETD last port must be set!", null));
|
||||||
|
|
||||||
|
if (this.ETDFromPortOfCall.HasValue && this.ETAToNextPort.HasValue &&
|
||||||
|
this.ETAToNextPort < ETDFromPortOfCall)
|
||||||
|
errors.Add(RuleEngine.CreateError(ValidationCode.E122, "ETD PoC must be before ETA next port!", null));
|
||||||
|
|
||||||
|
if (!this.NextPort.Equals("ZZUKN") && !this.ETAToNextPort.HasValue)
|
||||||
|
errors.Add(RuleEngine.CreateError(ValidationCode.E124, "ETA next port must be set!", null));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override DatabaseEntity.ValidationBlock GetValidationBlock()
|
||||||
|
{
|
||||||
|
if (this.MessageCore.IsTransit) return ValidationBlock.BLOCK2;
|
||||||
|
return ValidationBlock.BLOCK1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,14 +25,18 @@ namespace bsmd.database
|
|||||||
#region Properties
|
#region Properties
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[ReportDisplayName("Last name")]
|
[ReportDisplayName("Last name")]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string PassengerLastName { get; set; }
|
public string PassengerLastName { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[ReportDisplayName("First name")]
|
[ReportDisplayName("First name")]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string PassengerFirstName { get; set; }
|
public string PassengerFirstName { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[ReportDisplayName("Place of birth")]
|
[ReportDisplayName("Place of birth")]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string PassengerPlaceOfBirth { get; set; }
|
public string PassengerPlaceOfBirth { get; set; }
|
||||||
|
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public DateTime? PassengerDateOfBirth { get; set; }
|
public DateTime? PassengerDateOfBirth { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
@ -54,8 +58,10 @@ namespace bsmd.database
|
|||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[ReportDisplayName("Nationality")]
|
[ReportDisplayName("Nationality")]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string PassengerNationality { get; set; }
|
public string PassengerNationality { get; set; }
|
||||||
|
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public byte? PassengerIdentityDocumentType { get; set; }
|
public byte? PassengerIdentityDocumentType { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
@ -64,18 +70,22 @@ namespace bsmd.database
|
|||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[ReportDisplayName("Identity document id")]
|
[ReportDisplayName("Identity document id")]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string PassengerIdentityDocumentId { get; set; }
|
public string PassengerIdentityDocumentId { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[ReportDisplayName("Visa number")]
|
[ReportDisplayName("Visa number")]
|
||||||
public string PassengerVisaNumber { get; set; }
|
public string PassengerVisaNumber { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[ReportDisplayName("Port of embarkation")]
|
[ReportDisplayName("Port of embarkation")]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string PassengerPortOfEmbarkation { get; set; }
|
public string PassengerPortOfEmbarkation { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[ReportDisplayName("Port od disembarkation")]
|
[ReportDisplayName("Port od disembarkation")]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string PassengerPortOfDisembarkation { get; set; }
|
public string PassengerPortOfDisembarkation { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[ReportDisplayName("In transit")]
|
[ReportDisplayName("In transit")]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public bool? PassengerInTransit { get; set; }
|
public bool? PassengerInTransit { get; set; }
|
||||||
|
|
||||||
public string Identifier { get; set; }
|
public string Identifier { get; set; }
|
||||||
|
|||||||
@ -24,12 +24,16 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.INT_GT_ZERO)]
|
||||||
public int? TotalPersonsOnBoardUponArrival { get; set; }
|
public int? TotalPersonsOnBoardUponArrival { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.INT_GT_ZERO)]
|
||||||
public int? TotalCrewMembersOnBoardUponArrival { get; set; }
|
public int? TotalCrewMembersOnBoardUponArrival { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public int? TotalPassengersOnBoardUponArrival { get; set; }
|
public int? TotalPassengersOnBoardUponArrival { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public int? TotalStowawaysOnBoardUponArrival { get; set; }
|
public int? TotalStowawaysOnBoardUponArrival { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -24,12 +24,16 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.INT_GT_ZERO)]
|
||||||
public int? TotalPersonsOnBoardUponDeparture { get; set; }
|
public int? TotalPersonsOnBoardUponDeparture { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.INT_GT_ZERO)]
|
||||||
public int? TotalCrewMembersOnBoardUponDeparture { get; set; }
|
public int? TotalCrewMembersOnBoardUponDeparture { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public int? TotalPassengersOnBoardUponDeparture { get; set; }
|
public int? TotalPassengersOnBoardUponDeparture { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public int? TotalStowawaysOnBoardUponDeparture { get; set; }
|
public int? TotalStowawaysOnBoardUponDeparture { get; set; }
|
||||||
|
|
||||||
public override string Subtitle
|
public override string Subtitle
|
||||||
|
|||||||
@ -23,7 +23,9 @@ namespace bsmd.database
|
|||||||
}
|
}
|
||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public bool? Tanker { get; set; }
|
public bool? Tanker { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
public byte? TankerHullConfiguration { get; set; }
|
public byte? TankerHullConfiguration { get; set; }
|
||||||
@ -34,12 +36,16 @@ namespace bsmd.database
|
|||||||
[ShowReport]
|
[ShowReport]
|
||||||
public double? VolumeOfCargo { get; set; }
|
public double? VolumeOfCargo { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string PlannedOperations { get; set; }
|
public string PlannedOperations { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string PlannedWorks { get; set; }
|
public string PlannedWorks { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public DateTime? DateOfLastExpandedInspection { get; set; }
|
public DateTime? DateOfLastExpandedInspection { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.DOUBLE_GT_ZERO)]
|
||||||
public double? PlannedPeriodOfStay_HUR { get; set; }
|
public double? PlannedPeriodOfStay_HUR { get; set; }
|
||||||
|
|
||||||
public override string Subtitle
|
public override string Subtitle
|
||||||
@ -134,5 +140,20 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Validation
|
||||||
|
|
||||||
|
public override void Validate(List<MessageError> errors, List<MessageViolation> violations)
|
||||||
|
{
|
||||||
|
if (this.Tanker ?? false)
|
||||||
|
{
|
||||||
|
if (!this.TankerHullConfiguration.HasValue)
|
||||||
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.V741, "Tanker hull configuration must be set for tanker", null));
|
||||||
|
if (!this.ConditionCargoBallastTanks.HasValue)
|
||||||
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.V741, "ConditionCargoBallastTanks must be set for tanker", null));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,10 +30,13 @@ namespace bsmd.database
|
|||||||
|
|
||||||
public List<PortOfCallLast30DaysCrewJoinedShip> CrewJoinedShip { get { return this.poc30Crew; } }
|
public List<PortOfCallLast30DaysCrewJoinedShip> CrewJoinedShip { get { return this.poc30Crew; } }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation2(ValidationCode.LOCODE)]
|
||||||
public string PortOfCallLast30DaysLocode { get; set; }
|
public string PortOfCallLast30DaysLocode { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
public DateTime? PortOfCallLast30DaysDateOfDeparture { get; set; }
|
public DateTime? PortOfCallLast30DaysDateOfDeparture { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
public bool? PortOfCallLast30DaysCrewMembersJoined { get; set; }
|
public bool? PortOfCallLast30DaysCrewMembersJoined { get; set; }
|
||||||
|
|
||||||
public string Identifier { get; set; }
|
public string Identifier { get; set; }
|
||||||
@ -133,6 +136,26 @@ namespace bsmd.database
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Validation
|
||||||
|
|
||||||
|
public override void Validate(List<MessageError> errors, List<MessageViolation> violations)
|
||||||
|
{
|
||||||
|
if((this.PortOfCallLast30DaysCrewMembersJoined ?? false) && (this.CrewJoinedShip.Count == 0))
|
||||||
|
RuleEngine.CreateViolation(ValidationCode.V767, "Joined crew members", null);
|
||||||
|
|
||||||
|
foreach (PortOfCallLast30DaysCrewJoinedShip poc30Crew in this.CrewJoinedShip)
|
||||||
|
{
|
||||||
|
RuleEngine.ValidateProperties(poc30Crew, errors);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override DatabaseEntity.ValidationBlock GetValidationBlock()
|
||||||
|
{
|
||||||
|
return ValidationBlock.BLOCK2;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,6 +26,7 @@ namespace bsmd.database
|
|||||||
|
|
||||||
public PortOfCallLast30Days PortOfCallLast30Days { get; set; }
|
public PortOfCallLast30Days PortOfCallLast30Days { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
public string PortOfCallLast30DaysCrewJoinedShipName { get; set; }
|
public string PortOfCallLast30DaysCrewJoinedShipName { get; set; }
|
||||||
|
|
||||||
public string Identifier { get; set; }
|
public string Identifier { get; set; }
|
||||||
@ -96,5 +97,9 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
public override DatabaseEntity.ValidationBlock GetValidationBlock()
|
||||||
|
{
|
||||||
|
return ValidationBlock.BLOCK2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,8 +26,10 @@ namespace bsmd.database
|
|||||||
|
|
||||||
public BPOL BPOL { get; set; }
|
public BPOL BPOL { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string PortOfItineraryName { get; set; }
|
public string PortOfItineraryName { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public DateTime? PortOfItineraryETA { get; set; }
|
public DateTime? PortOfItineraryETA { get; set; }
|
||||||
|
|
||||||
public string Identifier { get; set; }
|
public string Identifier { get; set; }
|
||||||
|
|||||||
@ -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.1.0")]
|
[assembly: AssemblyInformationalVersion("2.2.0")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2014-2015 Informatikbüro Daniel Schick. All rights reserved.")]
|
[assembly: AssemblyCopyright("Copyright © 2014-2015 Informatikbüro Daniel Schick. All rights reserved.")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
@ -4,6 +4,6 @@
|
|||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
|
||||||
[assembly: AssemblyVersion("2.1.0.*")]
|
[assembly: AssemblyVersion("2.2.0.*")]
|
||||||
// wenn das nicht auskommentiert wird erhalten wir eine Warnung
|
// wenn das nicht auskommentiert wird erhalten wir eine Warnung
|
||||||
// [assembly: AssemblyFileVersion("1.0.0.*")]
|
// [assembly: AssemblyFileVersion("1.0.0.*")]
|
||||||
|
|||||||
241
nsw/Source/bsmd.database/RuleEngine.cs
Normal file
241
nsw/Source/bsmd.database/RuleEngine.cs
Normal file
@ -0,0 +1,241 @@
|
|||||||
|
//
|
||||||
|
// Class: RuleEngine
|
||||||
|
// Current CLR: 4.0.30319.34209
|
||||||
|
// System: Microsoft Visual Studio 10.0
|
||||||
|
// Author: dani
|
||||||
|
// Created: 9/7/2015 8:16:42 AM
|
||||||
|
//
|
||||||
|
// Copyright (c) 2015 Informatikbüro Daniel Schick. All rights reserved.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using log4net;
|
||||||
|
|
||||||
|
namespace bsmd.database
|
||||||
|
{
|
||||||
|
public class RuleEngine
|
||||||
|
{
|
||||||
|
private static ILog log = LogManager.GetLogger(typeof(RuleEngine));
|
||||||
|
private static Dictionary<int, string> errorTextList = null;
|
||||||
|
private static Dictionary<int, string> violationTextList = null;
|
||||||
|
|
||||||
|
private Dictionary<DatabaseEntity, List<MessageError>> errorDict = new Dictionary<DatabaseEntity, List<MessageError>>();
|
||||||
|
private Dictionary<DatabaseEntity, List<MessageViolation>> violationDict = new Dictionary<DatabaseEntity, List<MessageViolation>>();
|
||||||
|
|
||||||
|
public RuleEngine()
|
||||||
|
{
|
||||||
|
if (RuleEngine.errorTextList == null)
|
||||||
|
RuleEngine.errorTextList = DBManager.Instance.LoadErrorTexts();
|
||||||
|
if (RuleEngine.violationTextList == null)
|
||||||
|
RuleEngine.violationTextList = DBManager.Instance.LoadViolationTexts();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dictionary<DatabaseEntity, List<MessageError>> ErrorDict { get { return this.errorDict; } }
|
||||||
|
public Dictionary<DatabaseEntity, List<MessageViolation>> ViolationDict { get { return this.violationDict; } }
|
||||||
|
|
||||||
|
#region public static property validation
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test function checks decorated properties on an entity for errors (only errors, violations cannot
|
||||||
|
/// happen here)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entity"></param>
|
||||||
|
/// <param name="errors"></param>
|
||||||
|
public static void ValidateProperties(DatabaseEntity entity, List<MessageError> errors)
|
||||||
|
{
|
||||||
|
|
||||||
|
Type objType = entity.GetType();
|
||||||
|
|
||||||
|
Type attribType = typeof(Validation1Attribute);
|
||||||
|
if (entity.GetValidationBlock() == DatabaseEntity.ValidationBlock.BLOCK2)
|
||||||
|
attribType = typeof(Validation2Attribute);
|
||||||
|
|
||||||
|
List<PropertyInfo> props = new List<PropertyInfo>();
|
||||||
|
|
||||||
|
// add "generic" validation properties to check list
|
||||||
|
props.AddRange(objType.GetProperties().Where(prop => Attribute.IsDefined(prop, typeof(ValidationAttribute))));
|
||||||
|
// add "block" validation properties to check list
|
||||||
|
props.AddRange(objType.GetProperties().Where( prop => Attribute.IsDefined(prop, attribType)) );
|
||||||
|
|
||||||
|
foreach (PropertyInfo property in props)
|
||||||
|
{
|
||||||
|
object propValue = property.GetValue(entity, null);
|
||||||
|
string value = (propValue == null) ? string.Empty : propValue.ToString();
|
||||||
|
ValidationCode validationCode = ValidationCode.NONE;
|
||||||
|
if (Attribute.IsDefined(property, attribType))
|
||||||
|
{
|
||||||
|
if (entity.GetValidationBlock() == DatabaseEntity.ValidationBlock.BLOCK1)
|
||||||
|
{
|
||||||
|
Validation1Attribute validationAttribute = Attribute.GetCustomAttribute(property, typeof(Validation1Attribute))
|
||||||
|
as Validation1Attribute;
|
||||||
|
validationCode = validationAttribute.Code;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Validation2Attribute validationAttribute = Attribute.GetCustomAttribute(property, typeof(Validation2Attribute))
|
||||||
|
as Validation2Attribute;
|
||||||
|
validationCode = validationAttribute.Code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (validationCode == ValidationCode.NONE)
|
||||||
|
{
|
||||||
|
if (Attribute.IsDefined(property, typeof(ValidationAttribute)))
|
||||||
|
{
|
||||||
|
ValidationAttribute validationAttribute = Attribute.GetCustomAttribute(property, typeof(ValidationAttribute))
|
||||||
|
as ValidationAttribute;
|
||||||
|
validationCode = validationAttribute.Code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// check properties
|
||||||
|
|
||||||
|
switch (validationCode)
|
||||||
|
{
|
||||||
|
case ValidationCode.NOT_NULL:
|
||||||
|
if (value.Length == 0) errors.Add(RuleEngine.CreateError(validationCode, property.Name, value));
|
||||||
|
break;
|
||||||
|
case ValidationCode.LOCODE:
|
||||||
|
{
|
||||||
|
Regex rgx = new Regex("[A-Z]{2}[A-Z0-9]{3}");
|
||||||
|
if (!rgx.IsMatch(value)) errors.Add(RuleEngine.CreateError(validationCode, property.Name, value));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ValidationCode.LOCODE_GER:
|
||||||
|
{
|
||||||
|
// TODO: Jan nach der Liste anhauen
|
||||||
|
Regex rgx = new Regex("[A-Z]{2}[A-Z0-9]{3}");
|
||||||
|
if (!rgx.IsMatch(value)) errors.Add(RuleEngine.CreateError(validationCode, property.Name, value));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ValidationCode.INT_GT_ZERO:
|
||||||
|
{
|
||||||
|
int intVal = 0;
|
||||||
|
if (!Int32.TryParse(value, out intVal) || intVal <= 0)
|
||||||
|
errors.Add(RuleEngine.CreateError(validationCode, property.Name, value));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ValidationCode.DOUBLE_GT_ZERO:
|
||||||
|
{
|
||||||
|
double dVal = 0;
|
||||||
|
if (!Double.TryParse(value, out dVal) || dVal <= 0)
|
||||||
|
errors.Add(RuleEngine.CreateError(validationCode, property.Name, value));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ValidationCode.GISIS:
|
||||||
|
{
|
||||||
|
Regex rgx = new Regex("[0-9]{4}");
|
||||||
|
if (!rgx.IsMatch(value)) errors.Add(RuleEngine.CreateError(validationCode, property.Name, value));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ValidationCode.FLAG_CODE:
|
||||||
|
{
|
||||||
|
Regex rgx = new Regex("[A-Z]{2}");
|
||||||
|
if(!rgx.IsMatch(value)) errors.Add(RuleEngine.CreateError(validationCode, property.Name, value));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ValidationCode.TWO_DIGIT:
|
||||||
|
{
|
||||||
|
Regex rgx = new Regex("[0-9]{2}");
|
||||||
|
if (!rgx.IsMatch(value)) errors.Add(RuleEngine.CreateError(validationCode, property.Name, value));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region public methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Diese Funktion wird für Nachrichtenklassen (MDH, SEC,.. usw.) aufgerufen. Error in eingebetteten
|
||||||
|
/// Klassen werden dann der Nachrichtenklasse zugeordnet (können dann logischerweise mehrfach auftreten)
|
||||||
|
/// </summary>
|
||||||
|
public void Validate(DatabaseEntity entity)
|
||||||
|
{
|
||||||
|
if (!(entity is Message)) return;
|
||||||
|
|
||||||
|
List<MessageError> errors = new List<MessageError>();
|
||||||
|
List<MessageViolation> violations = new List<MessageViolation>();
|
||||||
|
this.errorDict[entity] = errors;
|
||||||
|
this.violationDict[entity] = violations;
|
||||||
|
|
||||||
|
foreach (DatabaseEntity derivedEntity in ((Message)entity).Elements)
|
||||||
|
{
|
||||||
|
// individuelle Fehler nach Nachrichtenklasse prüfen
|
||||||
|
derivedEntity.MessageCore = entity.MessageCore; // some instance we need info from core (NOA / Transit)
|
||||||
|
RuleEngine.ValidateProperties(derivedEntity, errors);
|
||||||
|
derivedEntity.Validate(errors, violations);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (MessageError error in errors)
|
||||||
|
{
|
||||||
|
error.MessageHeaderId = entity.Id.Value;
|
||||||
|
DBManager.Instance.Save(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (MessageViolation violation in violations)
|
||||||
|
{
|
||||||
|
violation.MessageHeaderId = entity.Id.Value;
|
||||||
|
DBManager.Instance.Save(violation);
|
||||||
|
}
|
||||||
|
|
||||||
|
log.InfoFormat("Msg Id {0} Type {1} has {2} errors and {3} violations",
|
||||||
|
entity.Id, entity.MessageNotificationClass, errors.Count, violations.Count);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region private helper
|
||||||
|
|
||||||
|
internal static MessageError CreateError(ValidationCode validationCode, string p, string value)
|
||||||
|
{
|
||||||
|
|
||||||
|
MessageError error = new MessageError();
|
||||||
|
|
||||||
|
error.ErrorCode = (int)validationCode;
|
||||||
|
if (errorTextList.ContainsKey((int)validationCode))
|
||||||
|
{
|
||||||
|
error.ErrorText = string.Format(errorTextList[(int)validationCode], p, value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
error.ErrorText = p;
|
||||||
|
if (value != null)
|
||||||
|
error.ErrorText += " - " + value;
|
||||||
|
}
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static MessageViolation CreateViolation(ValidationCode validationCode, string p, string value)
|
||||||
|
{
|
||||||
|
|
||||||
|
MessageViolation violation = new MessageViolation();
|
||||||
|
|
||||||
|
violation.ViolationCode = (int)validationCode;
|
||||||
|
if (violationTextList.ContainsKey((int)validationCode))
|
||||||
|
{
|
||||||
|
violation.ViolationText = string.Format(violationTextList[(int)validationCode], p, value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
violation.ViolationText = p;
|
||||||
|
if (value != null)
|
||||||
|
violation.ViolationText += " - " + value;
|
||||||
|
}
|
||||||
|
return violation;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -28,38 +28,50 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation1(ValidationCode.NOT_NULL)]
|
||||||
public bool? SECSimplification { get; set; }
|
public bool? SECSimplification { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation1(ValidationCode.LOCODE_GER)]
|
||||||
public string PortOfCallWhereCompleteSECNotified { get; set; }
|
public string PortOfCallWhereCompleteSECNotified { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
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)]
|
||||||
public string CSOPhone { get; set; }
|
public string CSOPhone { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
public string CSOFax { get; set; }
|
public string CSOFax { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
public string CSOEMail { get; set; }
|
public string CSOEMail { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
public bool? ValidISSCOnBoard { get; set; }
|
public bool? ValidISSCOnBoard { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
public string ReasonsForNoValidISSC { get; set; }
|
public string ReasonsForNoValidISSC { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
public byte? ISSCType { get; set; }
|
public byte? ISSCType { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
public byte? ISSCIssuerType { get; set; }
|
public byte? ISSCIssuerType { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
public string ISSCIssuerName { get; set; }
|
public string ISSCIssuerName { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
public DateTime? ISSCDateOfExpiration { get; set; }
|
public DateTime? ISSCDateOfExpiration { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
public bool? ApprovedSecurityPlanOnBoard { get; set; }
|
public bool? ApprovedSecurityPlanOnBoard { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
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)]
|
||||||
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; } }
|
||||||
@ -220,5 +232,43 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Validation
|
||||||
|
|
||||||
|
public override DatabaseEntity.ValidationBlock GetValidationBlock()
|
||||||
|
{
|
||||||
|
return (this.SECSimplification ?? false) ? DatabaseEntity.ValidationBlock.BLOCK1 : DatabaseEntity.ValidationBlock.BLOCK2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Validate(List<MessageError> errors, List<MessageViolation> violations)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (this.GetValidationBlock() == ValidationBlock.BLOCK1)
|
||||||
|
{
|
||||||
|
if (this.PortOfCallWhereCompleteSECNotified.IsNullOrEmpty())
|
||||||
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.V704, "PortOfCallWhereCompleteSECNotified", null));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if((!this.ValidISSCOnBoard ?? true) && this.ReasonsForNoValidISSC.IsNullOrEmpty())
|
||||||
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.V702, "Reasons missing", null));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (LastTenPortFacilitiesCalled L10Called in this.LastTenPortFacilitesCalled)
|
||||||
|
{
|
||||||
|
RuleEngine.ValidateProperties(L10Called, errors);
|
||||||
|
L10Called.Validate(errors, violations);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(ShipToShipActivitiesDuringLastTenPortFacilitiesCalled s2s in this.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled)
|
||||||
|
{
|
||||||
|
RuleEngine.ValidateProperties(s2s, errors);
|
||||||
|
s2s.Validate(errors, violations);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,8 +26,10 @@ namespace bsmd.database
|
|||||||
[ShowReport]
|
[ShowReport]
|
||||||
public string ServiceName { get; set; }
|
public string ServiceName { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation1(ValidationCode.NOT_NULL)]
|
||||||
public string ServiceBeneficiary { get; set; }
|
public string ServiceBeneficiary { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation1(ValidationCode.NOT_NULL)]
|
||||||
public string ServiceInvoiceRecipient { get; set; }
|
public string ServiceInvoiceRecipient { get; set; }
|
||||||
|
|
||||||
public string Identifier { get; set; }
|
public string Identifier { get; set; }
|
||||||
|
|||||||
@ -25,33 +25,42 @@ namespace bsmd.database
|
|||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string ShipName { get; set; }
|
public string ShipName { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string CallSign { get; set; }
|
public string CallSign { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string MMSINumber { get; set; }
|
public string MMSINumber { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.FLAG_CODE)]
|
||||||
public string Flag { get; set; }
|
public string Flag { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.DOUBLE_GT_ZERO)]
|
||||||
public double? LengthOverall_MTR { get; set; }
|
public double? LengthOverall_MTR { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.DOUBLE_GT_ZERO)]
|
||||||
public double? Beam_MTR { get; set; }
|
public double? Beam_MTR { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.DOUBLE_GT_ZERO)]
|
||||||
public int? GrossTonnage { get; set; }
|
public int? GrossTonnage { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.LOCODE)]
|
||||||
public string PortOfRegistry { get; set; }
|
public string PortOfRegistry { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
public string InmarsatCallNumber { get; set; }
|
public string InmarsatCallNumber { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string ShipType { get; set; }
|
public string ShipType { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
@ -196,6 +205,15 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Validation
|
||||||
|
|
||||||
|
public override void Validate(List<MessageError> errors, List<MessageViolation> violations)
|
||||||
|
{
|
||||||
|
if (this.ISMCompanyName.IsNullOrEmpty() || this.ISMCompanyId.IsNullOrEmpty())
|
||||||
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.V821, "For BRZ > 500 ISM company information must be provider", null));
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,10 +34,13 @@ namespace bsmd.database
|
|||||||
[ShowReport]
|
[ShowReport]
|
||||||
public int? ShipToShipActivityLocationCoordinatesLongitude { get; set; }
|
public int? ShipToShipActivityLocationCoordinatesLongitude { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
public DateTime? ShipToShipActivityDateFrom { get; set; }
|
public DateTime? ShipToShipActivityDateFrom { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
public DateTime? ShipToShipActivityDateTo { get; set; }
|
public DateTime? ShipToShipActivityDateTo { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
public string ShipToShipActivityType { get; set; }
|
public string ShipToShipActivityType { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
public string ShipToShipActivitySecurityMattersToReport { get; set; }
|
public string ShipToShipActivitySecurityMattersToReport { get; set; }
|
||||||
@ -130,5 +133,23 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Validate
|
||||||
|
|
||||||
|
public override void Validate(List<MessageError> errors, List<MessageViolation> violations)
|
||||||
|
{
|
||||||
|
|
||||||
|
// check violation 701
|
||||||
|
|
||||||
|
bool locationOK = !this.ShipToShipActivityLocationName.IsNullOrEmpty() ||
|
||||||
|
!this.ShipToShipActivityLocationLoCode.IsNullOrEmpty() ||
|
||||||
|
(this.ShipToShipActivityLocationCoordinatesLatitude.HasValue &&
|
||||||
|
this.ShipToShipActivityLocationCoordinatesLongitude.HasValue);
|
||||||
|
|
||||||
|
if (!locationOK)
|
||||||
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.V701, "Either LoCode, Name or Coordinates must be given", null));
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -24,6 +24,7 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.DOUBLE_GT_ZERO)]
|
||||||
public double? DraughtUponArrival_DMT { get; set; }
|
public double? DraughtUponArrival_DMT { get; set; }
|
||||||
|
|
||||||
public override string Subtitle
|
public override string Subtitle
|
||||||
|
|||||||
@ -24,6 +24,7 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.DOUBLE_GT_ZERO)]
|
||||||
public double? DraughtUponDeparture_DMT { get; set; }
|
public double? DraughtUponDeparture_DMT { get; set; }
|
||||||
|
|
||||||
public override string Subtitle
|
public override string Subtitle
|
||||||
|
|||||||
@ -24,9 +24,11 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string TowageOnArrivalName { get; set; }
|
public string TowageOnArrivalName { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.FLAG_CODE)]
|
||||||
public string TowageOnArrivalFlag { get; set; }
|
public string TowageOnArrivalFlag { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
@ -54,18 +56,23 @@ namespace bsmd.database
|
|||||||
public string TowageOnArrivalOperatorEmail { get; set; }
|
public string TowageOnArrivalOperatorEmail { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.INT_GT_ZERO)]
|
||||||
public int? TowageOnArrivalGrossTonnage { get; set; }
|
public int? TowageOnArrivalGrossTonnage { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.DOUBLE_GT_ZERO)]
|
||||||
public double? TowageOnArrivalLengthOverall_MTR { get; set; }
|
public double? TowageOnArrivalLengthOverall_MTR { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.DOUBLE_GT_ZERO)]
|
||||||
public double? TowageOnArrivalBeam_MTR { get; set; }
|
public double? TowageOnArrivalBeam_MTR { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string TowageOnArrivalPurposeOfCall { get; set; }
|
public string TowageOnArrivalPurposeOfCall { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.DOUBLE_GT_ZERO)]
|
||||||
public double? TowageOnArrivalDraught_DMT { get; set; }
|
public double? TowageOnArrivalDraught_DMT { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
|||||||
@ -25,6 +25,7 @@ namespace bsmd.database
|
|||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public string TowageOnDepartureName { get; set; }
|
public string TowageOnDepartureName { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
@ -61,6 +62,7 @@ namespace bsmd.database
|
|||||||
public double? TowageOnDepartureBeam_MTR { get; set; }
|
public double? TowageOnDepartureBeam_MTR { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.DOUBLE_GT_ZERO)]
|
||||||
public double? TowageOnDepartureDraught_DMT { get; set; }
|
public double? TowageOnDepartureDraught_DMT { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
|||||||
130
nsw/Source/bsmd.database/ValidationAttribute.cs
Normal file
130
nsw/Source/bsmd.database/ValidationAttribute.cs
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
//
|
||||||
|
// Class: ValidationAttribute
|
||||||
|
// Current CLR: 4.0.30319.34209
|
||||||
|
// System: Microsoft Visual Studio 10.0
|
||||||
|
// Author: dani
|
||||||
|
// Created: 9/7/2015 8:32:30 AM
|
||||||
|
//
|
||||||
|
// Copyright (c) 2015 Informatikbüro Daniel Schick. All rights reserved.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace bsmd.database
|
||||||
|
{
|
||||||
|
|
||||||
|
#region ValidationCode
|
||||||
|
|
||||||
|
public enum ValidationCode
|
||||||
|
{
|
||||||
|
|
||||||
|
NONE,
|
||||||
|
NOT_NULL,
|
||||||
|
LOCODE,
|
||||||
|
LOCODE_GER,
|
||||||
|
GISIS,
|
||||||
|
INT_GT_ZERO,
|
||||||
|
DOUBLE_GT_ZERO,
|
||||||
|
FLAG_CODE,
|
||||||
|
TWO_DIGIT,
|
||||||
|
E121 = 121,
|
||||||
|
E122 = 122,
|
||||||
|
E123 = 123,
|
||||||
|
E124 = 124,
|
||||||
|
E125 = 125,
|
||||||
|
V701 = 701,
|
||||||
|
V702 = 702,
|
||||||
|
V703 = 703,
|
||||||
|
V704 = 704,
|
||||||
|
V721 = 721,
|
||||||
|
V741 = 741,
|
||||||
|
V761 = 761,
|
||||||
|
V762 = 762,
|
||||||
|
V763 = 763,
|
||||||
|
V764 = 764,
|
||||||
|
V765 = 765,
|
||||||
|
V766 = 766,
|
||||||
|
V767 = 767,
|
||||||
|
V768 = 768,
|
||||||
|
V781 = 781,
|
||||||
|
V782 = 782,
|
||||||
|
V783 = 783,
|
||||||
|
V801 = 801,
|
||||||
|
V802 = 802,
|
||||||
|
V803 = 803,
|
||||||
|
V804 = 804,
|
||||||
|
V805 = 805,
|
||||||
|
V806 = 806,
|
||||||
|
V807 = 807,
|
||||||
|
V808 = 808,
|
||||||
|
V821 = 821,
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region allg. ValidationAttribute (wird immer geprüft)
|
||||||
|
|
||||||
|
[AttributeUsage(AttributeTargets.Property)]
|
||||||
|
public class ValidationAttribute : Attribute
|
||||||
|
{
|
||||||
|
private ValidationCode validationCode;
|
||||||
|
|
||||||
|
public ValidationAttribute(ValidationCode code)
|
||||||
|
{
|
||||||
|
this.validationCode = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ValidationCode Code
|
||||||
|
{
|
||||||
|
get { return this.validationCode; }
|
||||||
|
set { this.validationCode = value; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Block 1 (entweder-oder Sektion) Attribut wird nur im Fall Block 1 geprüft
|
||||||
|
|
||||||
|
[AttributeUsage(AttributeTargets.Property)]
|
||||||
|
public class Validation1Attribute : Attribute
|
||||||
|
{
|
||||||
|
private ValidationCode validationCode;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public Validation1Attribute(ValidationCode code)
|
||||||
|
{
|
||||||
|
this.validationCode = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ValidationCode Code
|
||||||
|
{
|
||||||
|
get { return this.validationCode; }
|
||||||
|
set { this.validationCode = value; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Block 2 (entweder-oder Sektion) Attribut wird nur im Fall Block 2 geprüft
|
||||||
|
|
||||||
|
[AttributeUsage(AttributeTargets.Property)]
|
||||||
|
public class Validation2Attribute : Attribute
|
||||||
|
{
|
||||||
|
private ValidationCode validationCode;
|
||||||
|
|
||||||
|
public Validation2Attribute(ValidationCode code)
|
||||||
|
{
|
||||||
|
this.validationCode = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ValidationCode Code
|
||||||
|
{
|
||||||
|
get { return this.validationCode; }
|
||||||
|
set { this.validationCode = value; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
@ -30,12 +30,16 @@ namespace bsmd.database
|
|||||||
[ShowReport]
|
[ShowReport]
|
||||||
public bool? WasteDisposalValidExemption { get; set; }
|
public bool? WasteDisposalValidExemption { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
public string LastWasteDisposalPort { get; set; }
|
public string LastWasteDisposalPort { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
public bool? ConfirmationOfCorrectness { get; set; }
|
public bool? ConfirmationOfCorrectness { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
public DateTime? LastWasteDisposalDate { get; set; }
|
public DateTime? LastWasteDisposalDate { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation2(ValidationCode.NOT_NULL)]
|
||||||
public byte? WasteDisposalDelivery { get; set; }
|
public byte? WasteDisposalDelivery { get; set; }
|
||||||
|
|
||||||
public List<Waste> Waste { get { return this.waste; } }
|
public List<Waste> Waste { get { return this.waste; } }
|
||||||
@ -154,5 +158,48 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Validation
|
||||||
|
|
||||||
|
public override DatabaseEntity.ValidationBlock GetValidationBlock()
|
||||||
|
{
|
||||||
|
return (this.WasteDisposalValidExemption ?? false) ? ValidationBlock.BLOCK1 : ValidationBlock.BLOCK2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Validate(List<MessageError> errors, List<MessageViolation> violations)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(this.GetValidationBlock() == ValidationBlock.BLOCK2)
|
||||||
|
{
|
||||||
|
bool allWasteTypesPresent = true;
|
||||||
|
for(int i=1;i<=9;i++) {
|
||||||
|
bool foundIndex = false;
|
||||||
|
foreach(Waste waste in this.Waste) {
|
||||||
|
if((waste.WasteType ?? 0) == i) {
|
||||||
|
foundIndex = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!foundIndex)
|
||||||
|
{
|
||||||
|
allWasteTypesPresent = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!allWasteTypesPresent)
|
||||||
|
{
|
||||||
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.V783, "not all waste types present!", null));
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (Waste waste in this.Waste)
|
||||||
|
{
|
||||||
|
RuleEngine.ValidateProperties(waste, errors);
|
||||||
|
waste.Validate(errors, violations);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -47,11 +47,13 @@ namespace bsmd.database
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public byte? WasteType { get; set; }
|
public byte? WasteType { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
public string WasteDescription { get; set; }
|
public string WasteDescription { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public double? WasteDisposalAmount_MTQ { get; set; }
|
public double? WasteDisposalAmount_MTQ { get; set; }
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
public double? WasteCapacity_MTQ { get; set; }
|
public double? WasteCapacity_MTQ { get; set; }
|
||||||
@ -147,5 +149,19 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Validation
|
||||||
|
|
||||||
|
public override void Validate(List<MessageError> errors, List<MessageViolation> violations)
|
||||||
|
{
|
||||||
|
if (this.WasteType.HasValue &&
|
||||||
|
((this.WasteType.Value == (int)3) || (this.WasteType.Value == (int)8) || (this.WasteType.Value == (int)9)) &&
|
||||||
|
this.WasteDescription.IsNullOrEmpty())
|
||||||
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.V781, "Waste description missing!", null));
|
||||||
|
|
||||||
|
// TODO 782: die verstehe ich nicht richtig
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -95,6 +95,7 @@
|
|||||||
<Compile Include="PRE72H.cs" />
|
<Compile Include="PRE72H.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="ReportingParty.cs" />
|
<Compile Include="ReportingParty.cs" />
|
||||||
|
<Compile Include="RuleEngine.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" />
|
||||||
@ -107,6 +108,7 @@
|
|||||||
<Compile Include="TOWA.cs" />
|
<Compile Include="TOWA.cs" />
|
||||||
<Compile Include="TOWD.cs" />
|
<Compile Include="TOWD.cs" />
|
||||||
<Compile Include="Util.cs" />
|
<Compile Include="Util.cs" />
|
||||||
|
<Compile Include="ValidationAttribute.cs" />
|
||||||
<Compile Include="WAS.cs" />
|
<Compile Include="WAS.cs" />
|
||||||
<Compile Include="Waste.cs" />
|
<Compile Include="Waste.cs" />
|
||||||
<Compile Include="WasteDisposalServiceProvider.cs" />
|
<Compile Include="WasteDisposalServiceProvider.cs" />
|
||||||
|
|||||||
@ -562,6 +562,10 @@ namespace bsmd.dbh
|
|||||||
rootInfo.ShippingArea = (RootINFOShippingArea)info.ShippingArea.Value;
|
rootInfo.ShippingArea = (RootINFOShippingArea)info.ShippingArea.Value;
|
||||||
rootInfo.RequestedPositionInPortOfCall = info.RequestedPositionInPortOfCall;
|
rootInfo.RequestedPositionInPortOfCall = info.RequestedPositionInPortOfCall;
|
||||||
rootInfo.SpecialRequirementsOfShipAtBerth = info.SpecialRequirementsOfShipAtBerth;
|
rootInfo.SpecialRequirementsOfShipAtBerth = info.SpecialRequirementsOfShipAtBerth;
|
||||||
|
if(info.SpecialRequirementsOfShipAtBerth.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
// Name des Agenten eintragen
|
||||||
|
}
|
||||||
rootInfo.ConstructionCharacteristicsOfShip = info.ConstructionCharacteristicsOfShip;
|
rootInfo.ConstructionCharacteristicsOfShip = info.ConstructionCharacteristicsOfShip;
|
||||||
if (info.FumigatedBulkCargo.HasValue)
|
if (info.FumigatedBulkCargo.HasValue)
|
||||||
rootInfo.FumigatedBulkCargo = (info.FumigatedBulkCargo.Value == 0) ? RootINFOFumigatedBulkCargo.Y : RootINFOFumigatedBulkCargo.N;
|
rootInfo.FumigatedBulkCargo = (info.FumigatedBulkCargo.Value == 0) ? RootINFOFumigatedBulkCargo.Y : RootINFOFumigatedBulkCargo.N;
|
||||||
|
|||||||
@ -14,6 +14,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{6CC93F
|
|||||||
.nuget\NuGet.targets = .nuget\NuGet.targets
|
.nuget\NuGet.targets = .nuget\NuGet.targets
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bsmd.Tool", "bsmd.Tool\bsmd.Tool.csproj", "{5F5E65EE-9351-4F30-817A-9C6C6D6835AE}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@ -28,6 +30,10 @@ Global
|
|||||||
{19945AF2-379B-46A5-B27A-303B5EC1D557}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{19945AF2-379B-46A5-B27A-303B5EC1D557}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{19945AF2-379B-46A5-B27A-303B5EC1D557}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{19945AF2-379B-46A5-B27A-303B5EC1D557}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{19945AF2-379B-46A5-B27A-303B5EC1D557}.Release|Any CPU.Build.0 = Release|Any CPU
|
{19945AF2-379B-46A5-B27A-303B5EC1D557}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{5F5E65EE-9351-4F30-817A-9C6C6D6835AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{5F5E65EE-9351-4F30-817A-9C6C6D6835AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{5F5E65EE-9351-4F30-817A-9C6C6D6835AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{5F5E65EE-9351-4F30-817A-9C6C6D6835AE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@ -161,7 +161,7 @@ namespace bsmd.herberg.FormService
|
|||||||
_log.InfoFormat("Updating form data for IMO {0}", formResponse.imoNumber);
|
_log.InfoFormat("Updating form data for IMO {0}", formResponse.imoNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
Util.UpdateFormCore(aMessageCore, formResponse);
|
Util.UpdateFormCore(aMessageCore, formResponse);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -23,6 +23,7 @@ namespace bsmd.herberg.FormService
|
|||||||
|
|
||||||
internal static void UpdateFormCore(MessageCore aMessageCore, WebReference.GetFormDataResponseData formResponse)
|
internal static void UpdateFormCore(MessageCore aMessageCore, WebReference.GetFormDataResponseData formResponse)
|
||||||
{
|
{
|
||||||
|
RuleEngine ruleEngine = new RuleEngine(); // das brauchen wir noch weiter unten..
|
||||||
ReportingParty bsmdParty = null;
|
ReportingParty bsmdParty = null;
|
||||||
Dictionary<Guid, ReportingParty> repDict = DBManager.Instance.GetReportingPartyDict();
|
Dictionary<Guid, ReportingParty> repDict = DBManager.Instance.GetReportingPartyDict();
|
||||||
foreach (Guid key in repDict.Keys)
|
foreach (Guid key in repDict.Keys)
|
||||||
@ -976,7 +977,7 @@ namespace bsmd.herberg.FormService
|
|||||||
|
|
||||||
if (sDict.ContainsKey("PortFacilityPortName")) { poc.PortFacilityPortName = sDict["PortFacilityPortName"]; changedPfC = true; }
|
if (sDict.ContainsKey("PortFacilityPortName")) { poc.PortFacilityPortName = sDict["PortFacilityPortName"]; changedPfC = true; }
|
||||||
if (sDict.ContainsKey("PortFacilityPortCountry")) { poc.PortFacilityPortCountry = sDict["PortFacilityPortCountry"]; changedPfC = true; }
|
if (sDict.ContainsKey("PortFacilityPortCountry")) { poc.PortFacilityPortCountry = sDict["PortFacilityPortCountry"]; changedPfC = true; }
|
||||||
if (sDict.ContainsKey("PortFacilityPortLoCode") && sDict.ContainsKey("PortFacilityPortCountryCode"))
|
if (sDict.ContainsKey("PortFacilityPortLoCode") && sDict.ContainsKey("PortFacilityPortCountryCode") && (sDict["PortFacilityPortLoCode"].Length < 4))
|
||||||
{
|
{
|
||||||
poc.PortFacilityPortLoCode = sDict["PortFacilityPortCountryCode"] + sDict["PortFacilityPortLoCode"];
|
poc.PortFacilityPortLoCode = sDict["PortFacilityPortCountryCode"] + sDict["PortFacilityPortLoCode"];
|
||||||
changedPfC = true;
|
changedPfC = true;
|
||||||
@ -993,7 +994,7 @@ namespace bsmd.herberg.FormService
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (sDict.ContainsKey("ShipToShipActivityLocationName")) { sts.ShipToShipActivityLocationName = sDict["ShipToShipActivityLocationName"]; changedStS = true; }
|
if (sDict.ContainsKey("ShipToShipActivityLocationName")) { sts.ShipToShipActivityLocationName = sDict["ShipToShipActivityLocationName"]; changedStS = true; }
|
||||||
if (sDict.ContainsKey("ShipToShipActivityLocationLoCode") && sDict.ContainsKey("ShipToShipActivityCountryCode"))
|
if (sDict.ContainsKey("ShipToShipActivityLocationLoCode") && sDict.ContainsKey("ShipToShipActivityCountryCode") && (sDict["ShipToShipActivityLocationLoCode"].Length < 4))
|
||||||
{
|
{
|
||||||
sts.ShipToShipActivityLocationLoCode = sDict["ShipToShipActivityCountryCode"] + sDict["ShipToShipActivityLocationLoCode"];
|
sts.ShipToShipActivityLocationLoCode = sDict["ShipToShipActivityCountryCode"] + sDict["ShipToShipActivityLocationLoCode"];
|
||||||
changedStS = true;
|
changedStS = true;
|
||||||
@ -1435,7 +1436,18 @@ namespace bsmd.herberg.FormService
|
|||||||
(saveMessages.Count > 0)
|
(saveMessages.Count > 0)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
// clear validation info for this message
|
||||||
|
if (!theMessage.IsNew)
|
||||||
|
{
|
||||||
|
DBManager.Instance.DeleteMessageErrors(theMessage);
|
||||||
|
DBManager.Instance.DeleteMessageViolations(theMessage);
|
||||||
|
}
|
||||||
|
|
||||||
DBManager.Instance.Save(theMessage);
|
DBManager.Instance.Save(theMessage);
|
||||||
|
theMessage.MessageCore = aMessageCore;
|
||||||
|
// now let's validate the message
|
||||||
|
ruleEngine.Validate(theMessage);
|
||||||
|
|
||||||
if (derivedMessage != null)
|
if (derivedMessage != null)
|
||||||
DBManager.Instance.Save(derivedMessage);
|
DBManager.Instance.Save(derivedMessage);
|
||||||
foreach (DatabaseEntity saveEntity in saveMessages)
|
foreach (DatabaseEntity saveEntity in saveMessages)
|
||||||
|
|||||||
@ -82,5 +82,17 @@ namespace bsmd.hisnord.Properties {
|
|||||||
this["AnswerDir"] = value;
|
this["AnswerDir"] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Configuration.DefaultSettingValueAttribute("E:\\work\\bsmd\\nsw\\HIS-NORD\\Transmitter-Tool\\ANSWERS_DONE")]
|
||||||
|
public string AnswerArchiveDir {
|
||||||
|
get {
|
||||||
|
return ((string)(this["AnswerArchiveDir"]));
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
this["AnswerArchiveDir"] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,5 +17,8 @@
|
|||||||
<Setting Name="AnswerDir" Type="System.String" Scope="User">
|
<Setting Name="AnswerDir" Type="System.String" Scope="User">
|
||||||
<Value Profile="(Default)">E:\work\bsmd\nsw\HIS-NORD\Transmitter-Tool\ANSWERS</Value>
|
<Value Profile="(Default)">E:\work\bsmd\nsw\HIS-NORD\Transmitter-Tool\ANSWERS</Value>
|
||||||
</Setting>
|
</Setting>
|
||||||
|
<Setting Name="AnswerArchiveDir" Type="System.String" Scope="User">
|
||||||
|
<Value Profile="(Default)">E:\work\bsmd\nsw\HIS-NORD\Transmitter-Tool\ANSWERS_DONE</Value>
|
||||||
|
</Setting>
|
||||||
</Settings>
|
</Settings>
|
||||||
</SettingsFile>
|
</SettingsFile>
|
||||||
@ -845,7 +845,7 @@ namespace bsmd.hisnord
|
|||||||
|
|
||||||
#region send message and store result
|
#region send message and store result
|
||||||
|
|
||||||
transmitter.result theResult = transmitter.transmit(filePath);
|
transmitter.result theResult = transmitter.UseHisNordTransmitter(filePath);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -858,5 +858,41 @@ namespace bsmd.hisnord
|
|||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region ReadAnswers()
|
||||||
|
|
||||||
|
public static void ReadAnswers()
|
||||||
|
{
|
||||||
|
foreach(string answerFile in Directory.GetFiles(Properties.Settings.Default.AnswerDir))
|
||||||
|
{
|
||||||
|
VisitId aVisitId = VisitId.ReadVisitId(answerFile);
|
||||||
|
if (aVisitId != null)
|
||||||
|
{
|
||||||
|
_log.InfoFormat("HIS-NORD: Visit-ID {0} delivered for Core {1}", aVisitId.Value, aVisitId.MessageCoreId);
|
||||||
|
// update MessageCore
|
||||||
|
if (aVisitId.MessageCoreId.HasValue)
|
||||||
|
{
|
||||||
|
MessageCore answerCore = DBManager.Instance.GetMessageCoreById(aVisitId.MessageCoreId.Value);
|
||||||
|
if(!answerCore.IsTransit)
|
||||||
|
answerCore.VisitId = aVisitId.Value;
|
||||||
|
else
|
||||||
|
answerCore.TransitId = aVisitId.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),
|
||||||
|
aVisitId.ConveyanceCode);
|
||||||
|
}
|
||||||
|
// archive file
|
||||||
|
File.Move(answerFile, Path.Combine(Properties.Settings.Default.AnswerArchiveDir, Path.GetFileName(answerFile)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
30
nsw/Source/bsmd.hisnord/app.config
Normal file
30
nsw/Source/bsmd.hisnord/app.config
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<configuration>
|
||||||
|
<configSections>
|
||||||
|
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
|
||||||
|
<section name="bsmd.hisnord.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||||
|
</sectionGroup>
|
||||||
|
</configSections>
|
||||||
|
<userSettings>
|
||||||
|
<bsmd.hisnord.Properties.Settings>
|
||||||
|
<setting name="OutputDir" serializeAs="String">
|
||||||
|
<value>E:\work\bsmd\nsw\HIS-NORD\Transmitter-Tool\IMP</value>
|
||||||
|
</setting>
|
||||||
|
<setting name="Transmitter" serializeAs="String">
|
||||||
|
<value>E:\work\bsmd\nsw\HIS-NORD\Transmitter-Tool\client.bat</value>
|
||||||
|
</setting>
|
||||||
|
<setting name="BatchTimeoutMins" serializeAs="String">
|
||||||
|
<value>5</value>
|
||||||
|
</setting>
|
||||||
|
<setting name="ResultDir" serializeAs="String">
|
||||||
|
<value>E:\work\bsmd\nsw\HIS-NORD\Transmitter-Tool\RESULTS</value>
|
||||||
|
</setting>
|
||||||
|
<setting name="AnswerDir" serializeAs="String">
|
||||||
|
<value>E:\work\bsmd\nsw\HIS-NORD\Transmitter-Tool\ANSWERS</value>
|
||||||
|
</setting>
|
||||||
|
<setting name="AnswerArchiveDir" serializeAs="String">
|
||||||
|
<value>E:\work\bsmd\nsw\HIS-NORD\Transmitter-Tool\ANSWERS_DONE</value>
|
||||||
|
</setting>
|
||||||
|
</bsmd.hisnord.Properties.Settings>
|
||||||
|
</userSettings>
|
||||||
|
</configuration>
|
||||||
@ -66,6 +66,7 @@
|
|||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Request.cs" />
|
<Compile Include="Request.cs" />
|
||||||
<Compile Include="transmitter.cs" />
|
<Compile Include="transmitter.cs" />
|
||||||
|
<Compile Include="VisitId.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\bsmd.database\bsmd.database.csproj">
|
<ProjectReference Include="..\bsmd.database\bsmd.database.csproj">
|
||||||
|
|||||||
@ -22,7 +22,7 @@ namespace bsmd.hisnord
|
|||||||
{
|
{
|
||||||
private static ILog _log = LogManager.GetLogger(typeof(transmitter));
|
private static ILog _log = LogManager.GetLogger(typeof(transmitter));
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
public static result UseHisNordTransmitter(string filenameFullPath)
|
public static result UseHisNordTransmitter(string filenameFullPath)
|
||||||
{
|
{
|
||||||
@ -51,7 +51,7 @@ namespace bsmd.hisnord
|
|||||||
return result.ReadResult(resultFullPath);
|
return result.ReadResult(resultFullPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// class to read transmitter result xml files
|
/// class to read transmitter result xml files
|
||||||
|
|||||||
@ -10,5 +10,6 @@
|
|||||||
<repository path="..\bsmd.herberg.FormService\packages.config" />
|
<repository path="..\bsmd.herberg.FormService\packages.config" />
|
||||||
<repository path="..\bsmd.hisnord\packages.config" />
|
<repository path="..\bsmd.hisnord\packages.config" />
|
||||||
<repository path="..\bsmd.ReportGenerator\packages.config" />
|
<repository path="..\bsmd.ReportGenerator\packages.config" />
|
||||||
|
<repository path="..\bsmd.Tool\packages.config" />
|
||||||
<repository path="..\SendNSWMessageService\packages.config" />
|
<repository path="..\SendNSWMessageService\packages.config" />
|
||||||
</repositories>
|
</repositories>
|
||||||
@ -17,6 +17,7 @@ Zugangsdaten NSW Server:
|
|||||||
https://bscw.dlz-it.de/bscw/bscw.cgi
|
https://bscw.dlz-it.de/bscw/bscw.cgi
|
||||||
Benutzer: mippel
|
Benutzer: mippel
|
||||||
PW: baffi1234!
|
PW: baffi1234!
|
||||||
|
PW: lkDDXd1321?
|
||||||
|
|
||||||
|
|
||||||
NSW Test E-Mail Account:
|
NSW Test E-Mail Account:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user