diff --git a/Stundensheet.xlsx b/Stundensheet.xlsx index d84cdffa..681bd137 100644 Binary files a/Stundensheet.xlsx and b/Stundensheet.xlsx differ diff --git a/nsw/NSW Schnittstelle Meldetypen und Attribute V3.0.xlsx b/nsw/NSW Schnittstelle Meldetypen und Attribute V3.0.xlsx new file mode 100644 index 00000000..d0214f2a Binary files /dev/null and b/nsw/NSW Schnittstelle Meldetypen und Attribute V3.0.xlsx differ diff --git a/nsw/NSW Schnittstelle Validierungsregeln V3.0.xlsx b/nsw/NSW Schnittstelle Validierungsregeln V3.0.xlsx new file mode 100644 index 00000000..ca26a497 Binary files /dev/null and b/nsw/NSW Schnittstelle Validierungsregeln V3.0.xlsx differ diff --git a/nsw/Source/SQL/ErrorText.sql b/nsw/Source/SQL/ErrorText.sql new file mode 100644 index 00000000..ced8a817 --- /dev/null +++ b/nsw/Source/SQL/ErrorText.sql @@ -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 \ No newline at end of file diff --git a/nsw/Source/SQL/Update_1.9_To_2.0.sql b/nsw/Source/SQL/Update_1.9_To_2.0.sql new file mode 100644 index 00000000..2144a74e --- /dev/null +++ b/nsw/Source/SQL/Update_1.9_To_2.0.sql @@ -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 diff --git a/nsw/Source/SendNSWMessageService/NSWSendService.cs b/nsw/Source/SendNSWMessageService/NSWSendService.cs index 75d0a93c..fc82ae6b 100644 --- a/nsw/Source/SendNSWMessageService/NSWSendService.cs +++ b/nsw/Source/SendNSWMessageService/NSWSendService.cs @@ -180,6 +180,9 @@ namespace SendNSWMessageService } } + // Auf erhaltene Visit-Ids prüfen (HIS-NORD) + bsmd.hisnord.Request.ReadAnswers(); + DBManager.Instance.Disconnect(); } diff --git a/nsw/Source/bsmd.ReportGenerator/BSMDDocument.cs b/nsw/Source/bsmd.ReportGenerator/BSMDDocument.cs index 33605406..5c9111a4 100644 --- a/nsw/Source/bsmd.ReportGenerator/BSMDDocument.cs +++ b/nsw/Source/bsmd.ReportGenerator/BSMDDocument.cs @@ -142,7 +142,7 @@ namespace bsmd.ReportGenerator Section section = document.AddSection(); Paragraph paragraph = section.AddParagraph(); - paragraph.Format.SpaceAfter = "3cm"; + paragraph.Format.SpaceAfter = "2cm"; Image image = section.AddImage(Properties.Settings.Default.LogoPath); image.Width = "3cm"; @@ -156,9 +156,9 @@ namespace bsmd.ReportGenerator paragraph.Format.Font.Color = Colors.DarkRed; paragraph.Format.SpaceBefore = Unit.FromCentimeter(4); - paragraph = section.AddParagraph("Rendering date: "); - paragraph.Format.SpaceAfter = Unit.FromCentimeter(3); + paragraph = section.AddParagraph("Rendering date: "); paragraph.AddDateField(); + paragraph.Format.SpaceAfter = Unit.FromCentimeter(2); Table table = document.LastSection.AddTable(); table.Format.Font.Size = 14; diff --git a/nsw/Source/bsmd.ReportGenerator/ReportService.cs b/nsw/Source/bsmd.ReportGenerator/ReportService.cs index 1afbce3a..84f44deb 100644 --- a/nsw/Source/bsmd.ReportGenerator/ReportService.cs +++ b/nsw/Source/bsmd.ReportGenerator/ReportService.cs @@ -103,6 +103,7 @@ namespace bsmd.ReportGenerator private void CreateReport(MessageCore reportCore) { List messages = DBManager.Instance.GetMessagesForCore(reportCore); + messages.Sort(new ANSWMessageComparer()); Dictionary coverInfos = new Dictionary(); 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); DateTime eta = reportCore.ETA ?? (reportCore.ETAKielCanal ?? new DateTime(0)); coverInfos.Add("ETA", eta.ToShortDateString()); diff --git a/nsw/Source/bsmd.ReportGenerator/bsmd.ReportGenerator.csproj b/nsw/Source/bsmd.ReportGenerator/bsmd.ReportGenerator.csproj index 3076bb4f..30ad251b 100644 --- a/nsw/Source/bsmd.ReportGenerator/bsmd.ReportGenerator.csproj +++ b/nsw/Source/bsmd.ReportGenerator/bsmd.ReportGenerator.csproj @@ -80,6 +80,7 @@ Properties\AssemblyProjectKeyInfo.cs + diff --git a/nsw/Source/bsmd.Tool/App.config b/nsw/Source/bsmd.Tool/App.config new file mode 100644 index 00000000..51a63b68 --- /dev/null +++ b/nsw/Source/bsmd.Tool/App.config @@ -0,0 +1,18 @@ + + + + +
+ + + + + + + + + replace me! + + + + \ No newline at end of file diff --git a/nsw/Source/bsmd.Tool/CheckRules.cs b/nsw/Source/bsmd.Tool/CheckRules.cs new file mode 100644 index 00000000..ccb677aa --- /dev/null +++ b/nsw/Source/bsmd.Tool/CheckRules.cs @@ -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 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"); + } + } + } +} diff --git a/nsw/Source/bsmd.Tool/Options.cs b/nsw/Source/bsmd.Tool/Options.cs new file mode 100644 index 00000000..0d8a6a9f --- /dev/null +++ b/nsw/Source/bsmd.Tool/Options.cs @@ -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)); + } + + + } +} diff --git a/nsw/Source/bsmd.Tool/Program.cs b/nsw/Source/bsmd.Tool/Program.cs new file mode 100644 index 00000000..748259e9 --- /dev/null +++ b/nsw/Source/bsmd.Tool/Program.cs @@ -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; + } + } + } +} diff --git a/nsw/Source/bsmd.Tool/Properties/AssemblyInfo.cs b/nsw/Source/bsmd.Tool/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..db552c13 --- /dev/null +++ b/nsw/Source/bsmd.Tool/Properties/AssemblyInfo.cs @@ -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")] diff --git a/nsw/Source/bsmd.Tool/Properties/Settings.Designer.cs b/nsw/Source/bsmd.Tool/Properties/Settings.Designer.cs new file mode 100644 index 00000000..9607f28a --- /dev/null +++ b/nsw/Source/bsmd.Tool/Properties/Settings.Designer.cs @@ -0,0 +1,38 @@ +//------------------------------------------------------------------------------ +// +// 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. +// +//------------------------------------------------------------------------------ + +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; + } + } + } +} diff --git a/nsw/Source/bsmd.Tool/Properties/Settings.settings b/nsw/Source/bsmd.Tool/Properties/Settings.settings new file mode 100644 index 00000000..07cf4d90 --- /dev/null +++ b/nsw/Source/bsmd.Tool/Properties/Settings.settings @@ -0,0 +1,9 @@ + + + + + + replace me! + + + \ No newline at end of file diff --git a/nsw/Source/bsmd.Tool/bsmd.Tool.csproj b/nsw/Source/bsmd.Tool/bsmd.Tool.csproj new file mode 100644 index 00000000..70b41490 --- /dev/null +++ b/nsw/Source/bsmd.Tool/bsmd.Tool.csproj @@ -0,0 +1,98 @@ + + + + + Debug + AnyCPU + {5F5E65EE-9351-4F30-817A-9C6C6D6835AE} + Exe + Properties + bsmd.Tool + bsmd.Tool + v4.5 + 512 + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + true + + + ..\bsmdKey.snk + + + + ..\packages\CommandLineParser.1.9.71\lib\net45\CommandLine.dll + + + ..\packages\log4net.2.0.3\lib\net40-full\log4net.dll + + + + + + + + + + + + Properties\AssemblyProductInfo.cs + + + Properties\AssemblyProjectInfo.cs + + + Properties\AssemblyProjectKeyInfo.cs + + + + + + + True + True + Settings.settings + + + + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + {19945af2-379b-46a5-b27a-303b5ec1d557} + bsmd.database + + + + + \ No newline at end of file diff --git a/nsw/Source/bsmd.Tool/bsmd.Tool.csproj.user b/nsw/Source/bsmd.Tool/bsmd.Tool.csproj.user new file mode 100644 index 00000000..2fb2e4dd --- /dev/null +++ b/nsw/Source/bsmd.Tool/bsmd.Tool.csproj.user @@ -0,0 +1,6 @@ + + + + -r -c "AA9074D7-2607-445E-A0B9-D07890B6DC23" + + \ No newline at end of file diff --git a/nsw/Source/bsmd.Tool/packages.config b/nsw/Source/bsmd.Tool/packages.config new file mode 100644 index 00000000..d887743b --- /dev/null +++ b/nsw/Source/bsmd.Tool/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/nsw/Source/bsmd.database/ATA.cs b/nsw/Source/bsmd.database/ATA.cs index c5255736..b6f2fa47 100644 --- a/nsw/Source/bsmd.database/ATA.cs +++ b/nsw/Source/bsmd.database/ATA.cs @@ -25,6 +25,7 @@ namespace bsmd.database #region Properties [ShowReport] + [Validation(ValidationCode.DOUBLE_GT_ZERO)] public DateTime? ATAPortOfCall { get; set; } #endregion diff --git a/nsw/Source/bsmd.database/ATD.cs b/nsw/Source/bsmd.database/ATD.cs index 5e44091d..26b307c7 100644 --- a/nsw/Source/bsmd.database/ATD.cs +++ b/nsw/Source/bsmd.database/ATD.cs @@ -25,6 +25,7 @@ namespace bsmd.database #region Properties [ShowReport] + [Validation(ValidationCode.DOUBLE_GT_ZERO)] public DateTime? ATDPortOfCall { get; set; } #endregion diff --git a/nsw/Source/bsmd.database/BKRA.cs b/nsw/Source/bsmd.database/BKRA.cs index 17fba9ce..05c6c526 100644 --- a/nsw/Source/bsmd.database/BKRA.cs +++ b/nsw/Source/bsmd.database/BKRA.cs @@ -25,9 +25,11 @@ namespace bsmd.database #region Properties [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public string BunkerFuelType { get; set; } [ShowReport] + [Validation(ValidationCode.DOUBLE_GT_ZERO)] public double? BunkerFuelQuantity_TNE { get; set; } public string Identifier { get; set; } diff --git a/nsw/Source/bsmd.database/BPOL.cs b/nsw/Source/bsmd.database/BPOL.cs index f8023e6a..1f7e8d4f 100644 --- a/nsw/Source/bsmd.database/BPOL.cs +++ b/nsw/Source/bsmd.database/BPOL.cs @@ -27,6 +27,7 @@ namespace bsmd.database #region Properties [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public bool? StowawaysOnBoard { get; set; } public List PortOfItineraries { get { return this.poi; } } @@ -129,6 +130,16 @@ namespace bsmd.database #endregion + #region Validation + + public override void Validate(List errors, List violations) + { + foreach (PortOfItinerary poi in this.PortOfItineraries) + RuleEngine.ValidateProperties(poi, errors); + } + + #endregion + } } diff --git a/nsw/Source/bsmd.database/BRKD.cs b/nsw/Source/bsmd.database/BRKD.cs index 10122b5c..aefba44e 100644 --- a/nsw/Source/bsmd.database/BRKD.cs +++ b/nsw/Source/bsmd.database/BRKD.cs @@ -25,9 +25,11 @@ namespace bsmd.database #region Properties [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public string BunkerFuelType { get; set; } [ShowReport] + [Validation(ValidationCode.DOUBLE_GT_ZERO)] public double? BunkerFuelQuantity_TNE { get; set; } public string Identifier { get; set; } diff --git a/nsw/Source/bsmd.database/CREW.cs b/nsw/Source/bsmd.database/CREW.cs index 2f632ff9..df5e2800 100644 --- a/nsw/Source/bsmd.database/CREW.cs +++ b/nsw/Source/bsmd.database/CREW.cs @@ -26,16 +26,20 @@ namespace bsmd.database [ShowReport] [ReportDisplayName("Last name")] + [Validation(ValidationCode.NOT_NULL)] public string CrewMemberLastName { get; set; } [ShowReport] [ReportDisplayName("First name")] + [Validation(ValidationCode.NOT_NULL)] public string CrewMemberFirstName { get; set; } [ShowReport] [ReportDisplayName("Place of birth")] + [Validation(ValidationCode.NOT_NULL)] public string CrewMemberPlaceOfBirth { get; set; } - + + [Validation(ValidationCode.NOT_NULL)] public DateTime? CrewMemberDateOfBirth { get; set; } [ShowReport] @@ -58,8 +62,10 @@ namespace bsmd.database [ShowReport] [ReportDisplayName("Nationality")] + [Validation(ValidationCode.NOT_NULL)] public string CrewMemberNationality { get; set; } + [Validation(ValidationCode.NOT_NULL)] public byte? CrewMemberIdentityDocumentType { get; set; } [ShowReport] @@ -68,6 +74,7 @@ namespace bsmd.database [ShowReport] [ReportDisplayName("Identity document id")] + [Validation(ValidationCode.NOT_NULL)] public string CrewMemberIdentityDocumentId { get; set; } [ShowReport] @@ -76,6 +83,7 @@ namespace bsmd.database [ShowReport] [ReportDisplayName("Duty")] + [Validation(ValidationCode.NOT_NULL)] public string CrewMemberDuty { get; set; } public string Identifier { get; set; } diff --git a/nsw/Source/bsmd.database/DBManager.cs b/nsw/Source/bsmd.database/DBManager.cs index 42afeb92..52cdd6e2 100644 --- a/nsw/Source/bsmd.database/DBManager.cs +++ b/nsw/Source/bsmd.database/DBManager.cs @@ -252,17 +252,7 @@ namespace bsmd.database SqlCommand cmd = new SqlCommand(); entity.PrepareSave(cmd); int queryResult = this.PerformNonQuery(cmd); - switch(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; - } + this.LogNonQueryResult(cmd.CommandText, queryResult); } public void Delete(DatabaseEntity entity) @@ -270,19 +260,24 @@ namespace bsmd.database SqlCommand cmd = new SqlCommand(); entity.PrepareDelete(cmd); int queryResult = this.PerformNonQuery(cmd); - switch(queryResult) - { - case 1: - _log.DebugFormat("Entity {0} deleted", entity.Id); break; - case 0: - _log.DebugFormat("Entity {0} delete affected no rows", entity.Id); break; - case -1: - _log.DebugFormat("Entity {0} delete: error occurred", entity.Id); break; - default: - _log.DebugFormat("Entity {0} delete affected {1} rows", entity.Id, queryResult); break; - } + this.LogNonQueryResult(cmd.CommandText, queryResult); + } + + public void DeleteMessageErrors(Message message) + { + SqlCommand cmd = new SqlCommand(); + cmd.CommandText = string.Format("DELETE FROM Error WHERE MessageHeaderId='{0}'", message.Id); + int queryResult = this.PerformNonQuery(cmd); + this.LogNonQueryResult(cmd.CommandText, queryResult); } + 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) { @@ -297,16 +292,26 @@ namespace bsmd.database SqlCommand cmd = new SqlCommand(); core.PrepareSave(cmd); int queryResult = this.PerformNonQuery(cmd); - if (queryResult == 1) - _log.DebugFormat("MessageCore {0} saved", core.Id); - else - _log.WarnFormat("MessageCore {0} save affected {1} rows", core.Id, queryResult); + this.LogNonQueryResult(cmd.CommandText, queryResult); } #endregion #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 messageList) { // Dictionary messageCoreDict = this.GetToSendMessageCoreList(); @@ -656,6 +661,38 @@ namespace bsmd.database } } + internal Dictionary LoadErrorTexts() + { + SqlCommand cmd = new SqlCommand(); + cmd.CommandText = "SELECT ErrorCode, ErrorText FROM ErrorText"; + SqlDataReader reader = this.PerformCommand(cmd); + Dictionary result = new Dictionary(); + while (reader.Read()) + { + int errorCode = reader.GetInt32(0); + string errorText = reader.GetString(1); + result[errorCode] = errorText; + } + reader.Close(); + return result; + } + + internal Dictionary LoadViolationTexts() + { + SqlCommand cmd = new SqlCommand(); + cmd.CommandText = "SELECT ViolationCode, ViolationText FROM ViolationText"; + SqlDataReader reader = this.PerformCommand(cmd); + Dictionary result = new Dictionary(); + while (reader.Read()) + { + int violationCode = reader.GetInt32(0); + string violationText = reader.GetString(1); + result[violationCode] = violationText; + } + reader.Close(); + return result; + } + #region DB access methods internal SqlDataReader PerformCommand(SqlCommand cmd) @@ -663,11 +700,11 @@ namespace bsmd.database try { cmd.Connection = this._con; - Stopwatch sw = new Stopwatch(); - sw.Start(); + // Stopwatch sw = new Stopwatch(); + // sw.Start(); SqlDataReader reader = cmd.ExecuteReader(); - sw.Stop(); - _log.DebugFormat("{1}ms: {0}", cmd.CommandText, sw.ElapsedMilliseconds); + // sw.Stop(); + // _log.DebugFormat("{1}ms: {0}", cmd.CommandText, sw.ElapsedMilliseconds); return reader; } catch (SqlException ex) diff --git a/nsw/Source/bsmd.database/DatabaseEntity.cs b/nsw/Source/bsmd.database/DatabaseEntity.cs index 7fb16d4a..4b246278 100644 --- a/nsw/Source/bsmd.database/DatabaseEntity.cs +++ b/nsw/Source/bsmd.database/DatabaseEntity.cs @@ -21,7 +21,15 @@ namespace bsmd.database public abstract class DatabaseEntity : IMessageParagraph { protected Guid? id; - protected string tablename; + protected string tablename; + + public enum ValidationBlock + { + BLOCK1, + BLOCK2 + } + + #region Properties /// /// Nachrichtentyp der abgeleiteten Meldeklassen @@ -53,6 +61,10 @@ namespace bsmd.database /// public bool IsNew { get { return !this.id.HasValue; } } + #endregion + + #region public funcs + /// /// when it's time (during save), create id /// @@ -71,6 +83,19 @@ namespace bsmd.database public abstract List LoadList(IDataReader reader); + public virtual void Validate(List errors, List violations) + { + errors = new List(); + violations = new List(); + } + + public virtual ValidationBlock GetValidationBlock() + { + return ValidationBlock.BLOCK1; + } + + #endregion + #region IMessageParagraph implementation public virtual string Title diff --git a/nsw/Source/bsmd.database/HAZ.cs b/nsw/Source/bsmd.database/HAZ.cs index 1980d948..e7378c79 100644 --- a/nsw/Source/bsmd.database/HAZ.cs +++ b/nsw/Source/bsmd.database/HAZ.cs @@ -235,5 +235,53 @@ namespace bsmd.database #endregion + #region Validation + + public override DatabaseEntity.ValidationBlock GetValidationBlock() + { + return (this.NoDPGOnBoardOnArrival ?? false) ? ValidationBlock.BLOCK1 : ValidationBlock.BLOCK2; + } + + public override void Validate(List errors, List 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 + } } diff --git a/nsw/Source/bsmd.database/IBCPosition.cs b/nsw/Source/bsmd.database/IBCPosition.cs index 9e4f08cc..7372f5d0 100644 --- a/nsw/Source/bsmd.database/IBCPosition.cs +++ b/nsw/Source/bsmd.database/IBCPosition.cs @@ -26,22 +26,29 @@ namespace bsmd.database public HAZ HAZ { get; set; } [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public string ProductName { get; set; } [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public byte? PollutionCategory { get; set; } [ShowReport] public byte? Hazards { get; set; } [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public byte? FlashpointInformation { get; set; } [ShowReport] public string Flashpoint_CEL { get; set; } [ShowReport] + [Validation(ValidationCode.DOUBLE_GT_ZERO)] public double? Quantity_KGM { get; set; } [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public string StowagePosition { get; set; } [ShowReport] + [Validation(ValidationCode.LOCODE)] public string PortOfLoading { get; set; } [ShowReport] + [Validation(ValidationCode.LOCODE)] public string PortOfDischarge { get; set; } [ShowReport] public bool? SpecRef15_19 { get; set; } @@ -139,5 +146,16 @@ namespace bsmd.database #endregion + #region Validation + + public override void Validate(List errors, List violations) + { + if (this.FlashpointInformation.HasValue && (this.FlashpointInformation.Value == 2) && + this.Flashpoint_CEL.IsNullOrEmpty()) + violations.Add(RuleEngine.CreateViolation(ValidationCode.V804, "flashpoint information missing", null)); + } + + #endregion + } } diff --git a/nsw/Source/bsmd.database/IGCPosition.cs b/nsw/Source/bsmd.database/IGCPosition.cs index f2978824..e9d85d23 100644 --- a/nsw/Source/bsmd.database/IGCPosition.cs +++ b/nsw/Source/bsmd.database/IGCPosition.cs @@ -30,14 +30,19 @@ namespace bsmd.database [ShowReport] public string IMOClass { get; set; } [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public string ProductName { get; set; } [ShowReport] + [Validation(ValidationCode.DOUBLE_GT_ZERO)] public double? Quantity_KGM { get; set; } [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public string StowagePosition { get; set; } [ShowReport] + [Validation(ValidationCode.LOCODE)] public string PortOfLoading { get; set; } [ShowReport] + [Validation(ValidationCode.LOCODE)] public string PortOfDischarge { get; set; } [ShowReport] public string Remarks { get; set; } diff --git a/nsw/Source/bsmd.database/IMDGPosition.cs b/nsw/Source/bsmd.database/IMDGPosition.cs index da09c318..37a0a971 100644 --- a/nsw/Source/bsmd.database/IMDGPosition.cs +++ b/nsw/Source/bsmd.database/IMDGPosition.cs @@ -28,12 +28,15 @@ namespace bsmd.database public HAZ HAZ { get; set; } [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public string UNNumber { get; set; } [ShowReport] public byte? PackingGroup { get; set; } [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public string ProperShippingName { get; set; } [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public string IMOClass { get; set; } [ShowReport] public string CompatibilityGroup { get; set; } @@ -58,14 +61,19 @@ namespace bsmd.database [ShowReport] public double? EmergencyTemperature_CEL { get; set; } [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public bool? MarinePollutant { get; set; } [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public int? NumberOfPackages { get; set; } [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public string PackageType { get; set; } [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public bool? LimitedQuantities { get; set; } [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public bool? ExceptedQuantities { get; set; } [ShowReport] public double? NetQuantity_KGM { get; set; } @@ -80,10 +88,13 @@ namespace bsmd.database [ShowReport] public string VehicleLicenseNumber { get; set; } [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public string StowagePosition { get; set; } [ShowReport] + [Validation(ValidationCode.LOCODE)] public string PortOfLoading { get; set; } [ShowReport] + [Validation(ValidationCode.LOCODE)] public string PortOfDischarge { get; set; } [ShowReport] public string Remarks { get; set; } @@ -250,5 +261,24 @@ namespace bsmd.database #endregion + #region Validation + + public override void Validate(List errors, List 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 + } } diff --git a/nsw/Source/bsmd.database/IMSBCPosition.cs b/nsw/Source/bsmd.database/IMSBCPosition.cs index f7ebff83..fef6a4f1 100644 --- a/nsw/Source/bsmd.database/IMSBCPosition.cs +++ b/nsw/Source/bsmd.database/IMSBCPosition.cs @@ -26,20 +26,26 @@ namespace bsmd.database public HAZ HAZ { get; set; } [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public string BulkCargoShippingName { get; set; } [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public bool? MHB { get; set; } [ShowReport] public string UNNumber { get; set; } [ShowReport] public string IMOClass { get; set; } [ShowReport] + [Validation(ValidationCode.DOUBLE_GT_ZERO)] public double? Quantity_KGM { get; set; } [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public string StowagePosition { get; set; } [ShowReport] + [Validation(ValidationCode.LOCODE)] public string PortOfLoading { get; set; } [ShowReport] + [Validation(ValidationCode.LOCODE)] public string PortOfDischarge { get; set; } [ShowReport] public string Remarks { get; set; } @@ -47,6 +53,8 @@ namespace bsmd.database #endregion + #region DatabaseEntity implementation + public override void PrepareSave(IDbCommand cmd) { SqlCommand scmd = cmd as SqlCommand; @@ -123,5 +131,8 @@ namespace bsmd.database reader.Close(); return result; } + + #endregion + } } diff --git a/nsw/Source/bsmd.database/INFO.cs b/nsw/Source/bsmd.database/INFO.cs index e151709f..0cdd98d8 100644 --- a/nsw/Source/bsmd.database/INFO.cs +++ b/nsw/Source/bsmd.database/INFO.cs @@ -25,9 +25,11 @@ namespace bsmd.database #region Properties [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public byte? ShippingArea { get; set; } [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public string RequestedPositionInPortOfCall { get; set; } [ShowReport] @@ -37,6 +39,7 @@ namespace bsmd.database public string ConstructionCharacteristicsOfShip { get; set; } [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public byte? FumigatedBulkCargo { get; set; } [ShowReport] diff --git a/nsw/Source/bsmd.database/LADG.cs b/nsw/Source/bsmd.database/LADG.cs index 20381f88..c6f718b6 100644 --- a/nsw/Source/bsmd.database/LADG.cs +++ b/nsw/Source/bsmd.database/LADG.cs @@ -25,15 +25,18 @@ namespace bsmd.database #region Properties [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public byte? CargoHandlingType { get; set; } [ShowReport] + [Validation(ValidationCode.TWO_DIGIT)] public string CargoCodeNST { get; set; } [ShowReport] public int? CargoNumberOfItems { get; set; } [ShowReport] + [Validation(ValidationCode.DOUBLE_GT_ZERO)] public double? CargoGrossQuantity_TNE { get; set; } public string Identifier { get; set; } @@ -117,5 +120,18 @@ namespace bsmd.database #endregion + #region Validation + + public override void Validate(List errors, List 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 + } } \ No newline at end of file diff --git a/nsw/Source/bsmd.database/LastTenPortFacilitiesCalled.cs b/nsw/Source/bsmd.database/LastTenPortFacilitiesCalled.cs index 52e705b5..6cf4bf3d 100644 --- a/nsw/Source/bsmd.database/LastTenPortFacilitiesCalled.cs +++ b/nsw/Source/bsmd.database/LastTenPortFacilitiesCalled.cs @@ -32,14 +32,18 @@ namespace bsmd.database [ShowReport] public string PortFacilityPortLoCode { get; set; } [ShowReport] + [Validation2(ValidationCode.NOT_NULL)] public DateTime? PortFacilityDateOfArrival { get; set; } [ShowReport] + [Validation2(ValidationCode.NOT_NULL)] public DateTime? PortFacilityDateOfDeparture { get; set; } [ShowReport] + [Validation2(ValidationCode.NOT_NULL)] public byte? PortFacilityShipSecurityLevel { get; set; } [ShowReport] public string PortFacilitySecurityMattersToReport { get; set; } [ShowReport] + [Validation2(ValidationCode.NOT_NULL)] public string PortFacilityGISISCode { get; set; } public string Identifier { get; set; } @@ -130,6 +134,19 @@ namespace bsmd.database #endregion + #region Validate + + public override void Validate(List errors, List 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 + } } diff --git a/nsw/Source/bsmd.database/MARPOL_Annex_I_Position.cs b/nsw/Source/bsmd.database/MARPOL_Annex_I_Position.cs index 6b8067bb..138a1b2a 100644 --- a/nsw/Source/bsmd.database/MARPOL_Annex_I_Position.cs +++ b/nsw/Source/bsmd.database/MARPOL_Annex_I_Position.cs @@ -26,18 +26,24 @@ namespace bsmd.database public HAZ HAZ { get; set; } [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public string Name { get; set; } [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public byte? FlashpointInformation { get; set; } [ShowReport] public string Flashpoint_CEL { get; set; } [ShowReport] + [Validation(ValidationCode.DOUBLE_GT_ZERO)] public double? Quantity_KGM { get; set; } [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public string StowagePosition { get; set; } [ShowReport] + [Validation(ValidationCode.LOCODE)] public string PortOfLoading { get; set; } [ShowReport] + [Validation(ValidationCode.LOCODE)] public string PortOfDischarge { get; set; } [ShowReport] public string Remarks { get; set; } @@ -126,5 +132,16 @@ namespace bsmd.database #endregion + #region Validation + + public override void Validate(List errors, List violations) + { + if (this.FlashpointInformation.HasValue && (this.FlashpointInformation.Value == 2) && + this.Flashpoint_CEL.IsNullOrEmpty()) + violations.Add(RuleEngine.CreateViolation(ValidationCode.V804, "flashpoint information missing", null)); + } + + #endregion + } } diff --git a/nsw/Source/bsmd.database/MDH.cs b/nsw/Source/bsmd.database/MDH.cs index 79acf075..f1a5ebb5 100644 --- a/nsw/Source/bsmd.database/MDH.cs +++ b/nsw/Source/bsmd.database/MDH.cs @@ -28,26 +28,35 @@ namespace bsmd.database public List PortOfCallLast30Days { get { return this.portOfCallLast30Days; } } [ShowReport] + [Validation1(ValidationCode.NOT_NULL)] public bool? MDHSimplification { get; set; } [ShowReport] + [Validation1(ValidationCode.LOCODE_GER)] public string PortOfCallWhereCompleteMDHNotified { get; set; } [ShowReport] + [Validation2(ValidationCode.NOT_NULL)] public bool? NonAccidentalDeathsDuringVoyage { get; set; } [ShowReport] public int? NonAccidentalDeathsDuringVoyageCount { get; set; } [ShowReport] + [Validation2(ValidationCode.NOT_NULL)] public bool? SuspisionInfectiousNature { get; set; } [ShowReport] + [Validation2(ValidationCode.NOT_NULL)] public bool? NumberOfIllPersonsHigherThanExpected { get; set; } [ShowReport] public int? NumberOfIllPersons { get; set; } [ShowReport] + [Validation2(ValidationCode.NOT_NULL)] public bool? SickPersonsOnBoard { get; set; } [ShowReport] + [Validation2(ValidationCode.NOT_NULL)] public bool? MedicalConsulted { get; set; } [ShowReport] + [Validation2(ValidationCode.NOT_NULL)] public bool? AwareOfFurtherInfections { get; set; } [ShowReport] + [Validation2(ValidationCode.NOT_NULL)] public bool? SanitaryMeasuresApplied { get; set; } [ShowReport] public string SanitaryMeasuresType { get; set; } @@ -56,20 +65,25 @@ namespace bsmd.database [ShowReport] public DateTime? SanitaryMeasuresDate { get; set; } [ShowReport] + [Validation2(ValidationCode.NOT_NULL)] public bool? StowawaysDetected { get; set; } [ShowReport] public string StowawaysJoiningLocation { get; set; } [ShowReport] + [Validation2(ValidationCode.NOT_NULL)] public bool? SickAnimalOrPetOnBoard { get; set; } [ShowReport] + [Validation2(ValidationCode.NOT_NULL)] public bool? ValidSanitaryControlExemptionOrCertificateOnBoard { get; set; } [ShowReport] public string PlaceOfIssue { get; set; } [ShowReport] public DateTime? DateOfIssue { get; set; } [ShowReport] + [Validation2(ValidationCode.NOT_NULL)] public bool? SanitaryControlReinspectionRequired { get; set; } [ShowReport] + [Validation2(ValidationCode.NOT_NULL)] public bool? InfectedAreaVisited { get; set; } [ShowReport] public string InfectedAreaPort { get; set; } @@ -239,5 +253,56 @@ namespace bsmd.database #endregion + #region Validation + + public override DatabaseEntity.ValidationBlock GetValidationBlock() + { + return (this.MDHSimplification ?? false) ? DatabaseEntity.ValidationBlock.BLOCK1 : DatabaseEntity.ValidationBlock.BLOCK2; + } + + public override void Validate(List errors, List 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 + } } diff --git a/nsw/Source/bsmd.database/Message.cs b/nsw/Source/bsmd.database/Message.cs index 0f7d0c81..f0267fee 100644 --- a/nsw/Source/bsmd.database/Message.cs +++ b/nsw/Source/bsmd.database/Message.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Collections.ObjectModel; namespace bsmd.database { @@ -26,6 +27,39 @@ namespace bsmd.database #endregion + #region ANSWSortList + + public static IList ANSWSortList = new ReadOnlyCollection( + new List{ + 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 /// @@ -478,7 +512,7 @@ namespace bsmd.database } } - #endregion - + #endregion + } } diff --git a/nsw/Source/bsmd.database/NAME.cs b/nsw/Source/bsmd.database/NAME.cs index 05fa8ddf..7536d06a 100644 --- a/nsw/Source/bsmd.database/NAME.cs +++ b/nsw/Source/bsmd.database/NAME.cs @@ -25,6 +25,7 @@ namespace bsmd.database #region Properties [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public string NameOfMaster { get; set; } #endregion diff --git a/nsw/Source/bsmd.database/NOA_NOD.cs b/nsw/Source/bsmd.database/NOA_NOD.cs index ee0f890a..3222fb8a 100644 --- a/nsw/Source/bsmd.database/NOA_NOD.cs +++ b/nsw/Source/bsmd.database/NOA_NOD.cs @@ -25,21 +25,28 @@ namespace bsmd.database } #region Properties + [ShowReport] + [Validation1(ValidationCode.NOT_NULL)] public DateTime? ETAToPortOfCall { get; set; } [ShowReport] + [Validation1(ValidationCode.NOT_NULL)] public DateTime? ETDFromPortOfCall { get; set; } - + [Validation1(ValidationCode.NOT_NULL)] public List CallPurposes { get { return this.callPurposes; } } [ShowReport] + [Validation2(ValidationCode.NOT_NULL)] public DateTime? ETAToKielCanal { get; set; } [ShowReport] + [Validation2(ValidationCode.NOT_NULL)] public DateTime? ETDFromKielCanal { get; set; } [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public string LastPort { get; set; } [ShowReport] public DateTime? ETDFromLastPort { get; set; } [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public string NextPort { get; set; } [ShowReport] public DateTime? ETAToNextPort { get; set; } @@ -158,5 +165,42 @@ namespace bsmd.database #endregion + #region Validation + + public override void Validate(List errors, List 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 + } } diff --git a/nsw/Source/bsmd.database/PAS.cs b/nsw/Source/bsmd.database/PAS.cs index a5248c3e..52651e37 100644 --- a/nsw/Source/bsmd.database/PAS.cs +++ b/nsw/Source/bsmd.database/PAS.cs @@ -25,14 +25,18 @@ namespace bsmd.database #region Properties [ShowReport] [ReportDisplayName("Last name")] + [Validation(ValidationCode.NOT_NULL)] public string PassengerLastName { get; set; } [ShowReport] [ReportDisplayName("First name")] + [Validation(ValidationCode.NOT_NULL)] public string PassengerFirstName { get; set; } [ShowReport] [ReportDisplayName("Place of birth")] + [Validation(ValidationCode.NOT_NULL)] public string PassengerPlaceOfBirth { get; set; } - + + [Validation(ValidationCode.NOT_NULL)] public DateTime? PassengerDateOfBirth { get; set; } [ShowReport] @@ -54,8 +58,10 @@ namespace bsmd.database [ShowReport] [ReportDisplayName("Nationality")] + [Validation(ValidationCode.NOT_NULL)] public string PassengerNationality { get; set; } - + + [Validation(ValidationCode.NOT_NULL)] public byte? PassengerIdentityDocumentType { get; set; } [ShowReport] @@ -64,18 +70,22 @@ namespace bsmd.database [ShowReport] [ReportDisplayName("Identity document id")] + [Validation(ValidationCode.NOT_NULL)] public string PassengerIdentityDocumentId { get; set; } [ShowReport] [ReportDisplayName("Visa number")] public string PassengerVisaNumber { get; set; } [ShowReport] [ReportDisplayName("Port of embarkation")] + [Validation(ValidationCode.NOT_NULL)] public string PassengerPortOfEmbarkation { get; set; } [ShowReport] [ReportDisplayName("Port od disembarkation")] + [Validation(ValidationCode.NOT_NULL)] public string PassengerPortOfDisembarkation { get; set; } [ShowReport] [ReportDisplayName("In transit")] + [Validation(ValidationCode.NOT_NULL)] public bool? PassengerInTransit { get; set; } public string Identifier { get; set; } diff --git a/nsw/Source/bsmd.database/POBA.cs b/nsw/Source/bsmd.database/POBA.cs index cd154484..f1f49893 100644 --- a/nsw/Source/bsmd.database/POBA.cs +++ b/nsw/Source/bsmd.database/POBA.cs @@ -24,12 +24,16 @@ namespace bsmd.database #region Properties [ShowReport] + [Validation(ValidationCode.INT_GT_ZERO)] public int? TotalPersonsOnBoardUponArrival { get; set; } [ShowReport] + [Validation(ValidationCode.INT_GT_ZERO)] public int? TotalCrewMembersOnBoardUponArrival { get; set; } [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public int? TotalPassengersOnBoardUponArrival { get; set; } [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public int? TotalStowawaysOnBoardUponArrival { get; set; } #endregion diff --git a/nsw/Source/bsmd.database/POBD.cs b/nsw/Source/bsmd.database/POBD.cs index 61f2491c..4e21320d 100644 --- a/nsw/Source/bsmd.database/POBD.cs +++ b/nsw/Source/bsmd.database/POBD.cs @@ -24,12 +24,16 @@ namespace bsmd.database #region Properties [ShowReport] + [Validation(ValidationCode.INT_GT_ZERO)] public int? TotalPersonsOnBoardUponDeparture { get; set; } [ShowReport] + [Validation(ValidationCode.INT_GT_ZERO)] public int? TotalCrewMembersOnBoardUponDeparture { get; set; } [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public int? TotalPassengersOnBoardUponDeparture { get; set; } [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public int? TotalStowawaysOnBoardUponDeparture { get; set; } public override string Subtitle diff --git a/nsw/Source/bsmd.database/PRE72H.cs b/nsw/Source/bsmd.database/PRE72H.cs index 7a1af67d..b191efa7 100644 --- a/nsw/Source/bsmd.database/PRE72H.cs +++ b/nsw/Source/bsmd.database/PRE72H.cs @@ -23,7 +23,9 @@ namespace bsmd.database } #region Properties + [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public bool? Tanker { get; set; } [ShowReport] public byte? TankerHullConfiguration { get; set; } @@ -34,12 +36,16 @@ namespace bsmd.database [ShowReport] public double? VolumeOfCargo { get; set; } [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public string PlannedOperations { get; set; } [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public string PlannedWorks { get; set; } [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public DateTime? DateOfLastExpandedInspection { get; set; } [ShowReport] + [Validation(ValidationCode.DOUBLE_GT_ZERO)] public double? PlannedPeriodOfStay_HUR { get; set; } public override string Subtitle @@ -134,5 +140,20 @@ namespace bsmd.database #endregion + #region Validation + + public override void Validate(List errors, List 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 + } } diff --git a/nsw/Source/bsmd.database/PortOfCallLast30Days.cs b/nsw/Source/bsmd.database/PortOfCallLast30Days.cs index fad79e0e..939a961d 100644 --- a/nsw/Source/bsmd.database/PortOfCallLast30Days.cs +++ b/nsw/Source/bsmd.database/PortOfCallLast30Days.cs @@ -30,10 +30,13 @@ namespace bsmd.database public List CrewJoinedShip { get { return this.poc30Crew; } } [ShowReport] + [Validation2(ValidationCode.LOCODE)] public string PortOfCallLast30DaysLocode { get; set; } [ShowReport] + [Validation2(ValidationCode.NOT_NULL)] public DateTime? PortOfCallLast30DaysDateOfDeparture { get; set; } [ShowReport] + [Validation2(ValidationCode.NOT_NULL)] public bool? PortOfCallLast30DaysCrewMembersJoined { get; set; } public string Identifier { get; set; } @@ -133,6 +136,26 @@ namespace bsmd.database } } + #endregion + + #region Validation + + public override void Validate(List errors, List 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 } diff --git a/nsw/Source/bsmd.database/PortOfCallLast30DaysCrewJoinedShip.cs b/nsw/Source/bsmd.database/PortOfCallLast30DaysCrewJoinedShip.cs index 39a43a69..c30ede1a 100644 --- a/nsw/Source/bsmd.database/PortOfCallLast30DaysCrewJoinedShip.cs +++ b/nsw/Source/bsmd.database/PortOfCallLast30DaysCrewJoinedShip.cs @@ -26,6 +26,7 @@ namespace bsmd.database public PortOfCallLast30Days PortOfCallLast30Days { get; set; } [ShowReport] + [Validation2(ValidationCode.NOT_NULL)] public string PortOfCallLast30DaysCrewJoinedShipName { get; set; } public string Identifier { get; set; } @@ -96,5 +97,9 @@ namespace bsmd.database #endregion + public override DatabaseEntity.ValidationBlock GetValidationBlock() + { + return ValidationBlock.BLOCK2; + } } } diff --git a/nsw/Source/bsmd.database/PortOfItinerary.cs b/nsw/Source/bsmd.database/PortOfItinerary.cs index 7de773ae..08e524b1 100644 --- a/nsw/Source/bsmd.database/PortOfItinerary.cs +++ b/nsw/Source/bsmd.database/PortOfItinerary.cs @@ -26,8 +26,10 @@ namespace bsmd.database public BPOL BPOL { get; set; } [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public string PortOfItineraryName { get; set; } [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public DateTime? PortOfItineraryETA { get; set; } public string Identifier { get; set; } diff --git a/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs b/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs index 8a727b78..eeaed8ea 100644 --- a/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs +++ b/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs @@ -2,6 +2,6 @@ [assembly: AssemblyCompany("Informatikbüro Daniel Schick")] [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: AssemblyTrademark("")] \ No newline at end of file diff --git a/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs b/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs index c714c609..f82e0dd5 100644 --- a/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs +++ b/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs @@ -4,6 +4,6 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.1.0.*")] +[assembly: AssemblyVersion("2.2.0.*")] // wenn das nicht auskommentiert wird erhalten wir eine Warnung // [assembly: AssemblyFileVersion("1.0.0.*")] diff --git a/nsw/Source/bsmd.database/RuleEngine.cs b/nsw/Source/bsmd.database/RuleEngine.cs new file mode 100644 index 00000000..4567ea48 --- /dev/null +++ b/nsw/Source/bsmd.database/RuleEngine.cs @@ -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 errorTextList = null; + private static Dictionary violationTextList = null; + + private Dictionary> errorDict = new Dictionary>(); + private Dictionary> violationDict = new Dictionary>(); + + public RuleEngine() + { + if (RuleEngine.errorTextList == null) + RuleEngine.errorTextList = DBManager.Instance.LoadErrorTexts(); + if (RuleEngine.violationTextList == null) + RuleEngine.violationTextList = DBManager.Instance.LoadViolationTexts(); + } + + public Dictionary> ErrorDict { get { return this.errorDict; } } + public Dictionary> ViolationDict { get { return this.violationDict; } } + + #region public static property validation + + /// + /// Test function checks decorated properties on an entity for errors (only errors, violations cannot + /// happen here) + /// + /// + /// + public static void ValidateProperties(DatabaseEntity entity, List errors) + { + + Type objType = entity.GetType(); + + Type attribType = typeof(Validation1Attribute); + if (entity.GetValidationBlock() == DatabaseEntity.ValidationBlock.BLOCK2) + attribType = typeof(Validation2Attribute); + + List props = new List(); + + // 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 + + /// + /// 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) + /// + public void Validate(DatabaseEntity entity) + { + if (!(entity is Message)) return; + + List errors = new List(); + List violations = new List(); + 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 + + } +} diff --git a/nsw/Source/bsmd.database/SEC.cs b/nsw/Source/bsmd.database/SEC.cs index 7f69b284..d5513557 100644 --- a/nsw/Source/bsmd.database/SEC.cs +++ b/nsw/Source/bsmd.database/SEC.cs @@ -28,38 +28,50 @@ namespace bsmd.database #region Properties [ShowReport] + [Validation1(ValidationCode.NOT_NULL)] public bool? SECSimplification { get; set; } [ShowReport] + [Validation1(ValidationCode.LOCODE_GER)] public string PortOfCallWhereCompleteSECNotified { get; set; } [ShowReport] + [Validation2(ValidationCode.NOT_NULL)] public string CSOLastName { get; set; } [ShowReport] public string CSOFirstName { get; set; } [ShowReport] + [Validation2(ValidationCode.NOT_NULL)] public string CSOPhone { get; set; } [ShowReport] public string CSOFax { get; set; } [ShowReport] public string CSOEMail { get; set; } [ShowReport] + [Validation2(ValidationCode.NOT_NULL)] public bool? ValidISSCOnBoard { get; set; } [ShowReport] public string ReasonsForNoValidISSC { get; set; } [ShowReport] + [Validation2(ValidationCode.NOT_NULL)] public byte? ISSCType { get; set; } [ShowReport] + [Validation2(ValidationCode.NOT_NULL)] public byte? ISSCIssuerType { get; set; } [ShowReport] + [Validation2(ValidationCode.NOT_NULL)] public string ISSCIssuerName { get; set; } [ShowReport] + [Validation2(ValidationCode.NOT_NULL)] public DateTime? ISSCDateOfExpiration { get; set; } [ShowReport] + [Validation2(ValidationCode.NOT_NULL)] public bool? ApprovedSecurityPlanOnBoard { get; set; } [ShowReport] + [Validation2(ValidationCode.NOT_NULL)] public byte? CurrentShipSecurityLevel { get; set; } [ShowReport] public string PortFacilityOfArrival { get; set; } [ShowReport] + [Validation2(ValidationCode.NOT_NULL)] public byte? GeneralDescriptionOfCargo { get; set; } public List LastTenPortFacilitesCalled { get { return this.ltpfc; } } @@ -220,5 +232,43 @@ namespace bsmd.database #endregion + #region Validation + + public override DatabaseEntity.ValidationBlock GetValidationBlock() + { + return (this.SECSimplification ?? false) ? DatabaseEntity.ValidationBlock.BLOCK1 : DatabaseEntity.ValidationBlock.BLOCK2; + } + + public override void Validate(List errors, List 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 + } } diff --git a/nsw/Source/bsmd.database/SERV.cs b/nsw/Source/bsmd.database/SERV.cs index 491920b0..287c79b0 100644 --- a/nsw/Source/bsmd.database/SERV.cs +++ b/nsw/Source/bsmd.database/SERV.cs @@ -26,8 +26,10 @@ namespace bsmd.database [ShowReport] public string ServiceName { get; set; } [ShowReport] + [Validation1(ValidationCode.NOT_NULL)] public string ServiceBeneficiary { get; set; } [ShowReport] + [Validation1(ValidationCode.NOT_NULL)] public string ServiceInvoiceRecipient { get; set; } public string Identifier { get; set; } diff --git a/nsw/Source/bsmd.database/STAT.cs b/nsw/Source/bsmd.database/STAT.cs index d1b875bc..b68ed05a 100644 --- a/nsw/Source/bsmd.database/STAT.cs +++ b/nsw/Source/bsmd.database/STAT.cs @@ -25,33 +25,42 @@ namespace bsmd.database #region Properties [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public string ShipName { get; set; } [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public string CallSign { get; set; } [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public string MMSINumber { get; set; } [ShowReport] + [Validation(ValidationCode.FLAG_CODE)] public string Flag { get; set; } [ShowReport] + [Validation(ValidationCode.DOUBLE_GT_ZERO)] public double? LengthOverall_MTR { get; set; } [ShowReport] + [Validation(ValidationCode.DOUBLE_GT_ZERO)] public double? Beam_MTR { get; set; } [ShowReport] + [Validation(ValidationCode.DOUBLE_GT_ZERO)] public int? GrossTonnage { get; set; } [ShowReport] + [Validation(ValidationCode.LOCODE)] public string PortOfRegistry { get; set; } [ShowReport] public string InmarsatCallNumber { get; set; } [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public string ShipType { get; set; } [ShowReport] @@ -196,6 +205,15 @@ namespace bsmd.database #endregion + #region Validation + + public override void Validate(List errors, List 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 } } diff --git a/nsw/Source/bsmd.database/ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.cs b/nsw/Source/bsmd.database/ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.cs index e2b746ac..331b970b 100644 --- a/nsw/Source/bsmd.database/ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.cs +++ b/nsw/Source/bsmd.database/ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.cs @@ -34,10 +34,13 @@ namespace bsmd.database [ShowReport] public int? ShipToShipActivityLocationCoordinatesLongitude { get; set; } [ShowReport] + [Validation2(ValidationCode.NOT_NULL)] public DateTime? ShipToShipActivityDateFrom { get; set; } [ShowReport] + [Validation2(ValidationCode.NOT_NULL)] public DateTime? ShipToShipActivityDateTo { get; set; } [ShowReport] + [Validation2(ValidationCode.NOT_NULL)] public string ShipToShipActivityType { get; set; } [ShowReport] public string ShipToShipActivitySecurityMattersToReport { get; set; } @@ -130,5 +133,23 @@ namespace bsmd.database #endregion + #region Validate + + public override void Validate(List errors, List 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 + } } \ No newline at end of file diff --git a/nsw/Source/bsmd.database/TIEFA.cs b/nsw/Source/bsmd.database/TIEFA.cs index d8f160cc..57791fe4 100644 --- a/nsw/Source/bsmd.database/TIEFA.cs +++ b/nsw/Source/bsmd.database/TIEFA.cs @@ -24,6 +24,7 @@ namespace bsmd.database #region Properties [ShowReport] + [Validation(ValidationCode.DOUBLE_GT_ZERO)] public double? DraughtUponArrival_DMT { get; set; } public override string Subtitle diff --git a/nsw/Source/bsmd.database/TIEFD.cs b/nsw/Source/bsmd.database/TIEFD.cs index 46ae23b1..3bc87368 100644 --- a/nsw/Source/bsmd.database/TIEFD.cs +++ b/nsw/Source/bsmd.database/TIEFD.cs @@ -24,6 +24,7 @@ namespace bsmd.database #region Properties [ShowReport] + [Validation(ValidationCode.DOUBLE_GT_ZERO)] public double? DraughtUponDeparture_DMT { get; set; } public override string Subtitle diff --git a/nsw/Source/bsmd.database/TOWA.cs b/nsw/Source/bsmd.database/TOWA.cs index 652633c3..eb6c7689 100644 --- a/nsw/Source/bsmd.database/TOWA.cs +++ b/nsw/Source/bsmd.database/TOWA.cs @@ -24,9 +24,11 @@ namespace bsmd.database #region Properties [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public string TowageOnArrivalName { get; set; } [ShowReport] + [Validation(ValidationCode.FLAG_CODE)] public string TowageOnArrivalFlag { get; set; } [ShowReport] @@ -54,18 +56,23 @@ namespace bsmd.database public string TowageOnArrivalOperatorEmail { get; set; } [ShowReport] + [Validation(ValidationCode.INT_GT_ZERO)] public int? TowageOnArrivalGrossTonnage { get; set; } [ShowReport] + [Validation(ValidationCode.DOUBLE_GT_ZERO)] public double? TowageOnArrivalLengthOverall_MTR { get; set; } [ShowReport] + [Validation(ValidationCode.DOUBLE_GT_ZERO)] public double? TowageOnArrivalBeam_MTR { get; set; } [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public string TowageOnArrivalPurposeOfCall { get; set; } [ShowReport] + [Validation(ValidationCode.DOUBLE_GT_ZERO)] public double? TowageOnArrivalDraught_DMT { get; set; } [ShowReport] diff --git a/nsw/Source/bsmd.database/TOWD.cs b/nsw/Source/bsmd.database/TOWD.cs index dbb105c4..0d55e472 100644 --- a/nsw/Source/bsmd.database/TOWD.cs +++ b/nsw/Source/bsmd.database/TOWD.cs @@ -25,6 +25,7 @@ namespace bsmd.database #region Properties [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public string TowageOnDepartureName { get; set; } [ShowReport] @@ -61,6 +62,7 @@ namespace bsmd.database public double? TowageOnDepartureBeam_MTR { get; set; } [ShowReport] + [Validation(ValidationCode.DOUBLE_GT_ZERO)] public double? TowageOnDepartureDraught_DMT { get; set; } [ShowReport] diff --git a/nsw/Source/bsmd.database/ValidationAttribute.cs b/nsw/Source/bsmd.database/ValidationAttribute.cs new file mode 100644 index 00000000..27faccb4 --- /dev/null +++ b/nsw/Source/bsmd.database/ValidationAttribute.cs @@ -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 + +} diff --git a/nsw/Source/bsmd.database/WAS.cs b/nsw/Source/bsmd.database/WAS.cs index da4ef4ea..145b6e4c 100644 --- a/nsw/Source/bsmd.database/WAS.cs +++ b/nsw/Source/bsmd.database/WAS.cs @@ -30,12 +30,16 @@ namespace bsmd.database [ShowReport] public bool? WasteDisposalValidExemption { get; set; } [ShowReport] + [Validation2(ValidationCode.NOT_NULL)] public string LastWasteDisposalPort { get; set; } [ShowReport] + [Validation2(ValidationCode.NOT_NULL)] public bool? ConfirmationOfCorrectness { get; set; } [ShowReport] + [Validation2(ValidationCode.NOT_NULL)] public DateTime? LastWasteDisposalDate { get; set; } [ShowReport] + [Validation2(ValidationCode.NOT_NULL)] public byte? WasteDisposalDelivery { get; set; } public List Waste { get { return this.waste; } } @@ -154,5 +158,48 @@ namespace bsmd.database #endregion + #region Validation + + public override DatabaseEntity.ValidationBlock GetValidationBlock() + { + return (this.WasteDisposalValidExemption ?? false) ? ValidationBlock.BLOCK1 : ValidationBlock.BLOCK2; + } + + public override void Validate(List errors, List 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 + } } diff --git a/nsw/Source/bsmd.database/Waste.cs b/nsw/Source/bsmd.database/Waste.cs index 58f36680..f6ef7d66 100644 --- a/nsw/Source/bsmd.database/Waste.cs +++ b/nsw/Source/bsmd.database/Waste.cs @@ -47,11 +47,13 @@ namespace bsmd.database } } } - + + [Validation(ValidationCode.NOT_NULL)] public byte? WasteType { get; set; } [ShowReport] public string WasteDescription { get; set; } [ShowReport] + [Validation(ValidationCode.NOT_NULL)] public double? WasteDisposalAmount_MTQ { get; set; } [ShowReport] public double? WasteCapacity_MTQ { get; set; } @@ -147,5 +149,19 @@ namespace bsmd.database #endregion + #region Validation + + public override void Validate(List errors, List 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 + } } diff --git a/nsw/Source/bsmd.database/bsmd.database.csproj b/nsw/Source/bsmd.database/bsmd.database.csproj index c619042f..00a53a1d 100644 --- a/nsw/Source/bsmd.database/bsmd.database.csproj +++ b/nsw/Source/bsmd.database/bsmd.database.csproj @@ -95,6 +95,7 @@ + @@ -107,6 +108,7 @@ + diff --git a/nsw/Source/bsmd.dbh/Request.cs b/nsw/Source/bsmd.dbh/Request.cs index 0e587606..a34938bc 100644 --- a/nsw/Source/bsmd.dbh/Request.cs +++ b/nsw/Source/bsmd.dbh/Request.cs @@ -562,6 +562,10 @@ namespace bsmd.dbh rootInfo.ShippingArea = (RootINFOShippingArea)info.ShippingArea.Value; rootInfo.RequestedPositionInPortOfCall = info.RequestedPositionInPortOfCall; rootInfo.SpecialRequirementsOfShipAtBerth = info.SpecialRequirementsOfShipAtBerth; + if(info.SpecialRequirementsOfShipAtBerth.IsNullOrEmpty()) + { + // Name des Agenten eintragen + } rootInfo.ConstructionCharacteristicsOfShip = info.ConstructionCharacteristicsOfShip; if (info.FumigatedBulkCargo.HasValue) rootInfo.FumigatedBulkCargo = (info.FumigatedBulkCargo.Value == 0) ? RootINFOFumigatedBulkCargo.Y : RootINFOFumigatedBulkCargo.N; diff --git a/nsw/Source/bsmd.herberg.FormService.sln b/nsw/Source/bsmd.herberg.FormService.sln index 9bcdd761..6af6839f 100644 --- a/nsw/Source/bsmd.herberg.FormService.sln +++ b/nsw/Source/bsmd.herberg.FormService.sln @@ -14,6 +14,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{6CC93F .nuget\NuGet.targets = .nuget\NuGet.targets EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bsmd.Tool", "bsmd.Tool\bsmd.Tool.csproj", "{5F5E65EE-9351-4F30-817A-9C6C6D6835AE}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution 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}.Release|Any CPU.ActiveCfg = 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 GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/nsw/Source/bsmd.herberg.FormService/FormService.cs b/nsw/Source/bsmd.herberg.FormService/FormService.cs index 4a235bba..62efd76a 100644 --- a/nsw/Source/bsmd.herberg.FormService/FormService.cs +++ b/nsw/Source/bsmd.herberg.FormService/FormService.cs @@ -161,7 +161,7 @@ namespace bsmd.herberg.FormService _log.InfoFormat("Updating form data for IMO {0}", formResponse.imoNumber); } - Util.UpdateFormCore(aMessageCore, formResponse); + Util.UpdateFormCore(aMessageCore, formResponse); } else { diff --git a/nsw/Source/bsmd.herberg.FormService/Util.cs b/nsw/Source/bsmd.herberg.FormService/Util.cs index 98234d0b..fdb7c1ae 100644 --- a/nsw/Source/bsmd.herberg.FormService/Util.cs +++ b/nsw/Source/bsmd.herberg.FormService/Util.cs @@ -23,6 +23,7 @@ namespace bsmd.herberg.FormService internal static void UpdateFormCore(MessageCore aMessageCore, WebReference.GetFormDataResponseData formResponse) { + RuleEngine ruleEngine = new RuleEngine(); // das brauchen wir noch weiter unten.. ReportingParty bsmdParty = null; Dictionary repDict = DBManager.Instance.GetReportingPartyDict(); 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("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"]; changedPfC = true; @@ -993,7 +994,7 @@ namespace bsmd.herberg.FormService } 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"]; changedStS = true; @@ -1435,7 +1436,18 @@ namespace bsmd.herberg.FormService (saveMessages.Count > 0) ) { + // clear validation info for this message + if (!theMessage.IsNew) + { + DBManager.Instance.DeleteMessageErrors(theMessage); + DBManager.Instance.DeleteMessageViolations(theMessage); + } + DBManager.Instance.Save(theMessage); + theMessage.MessageCore = aMessageCore; + // now let's validate the message + ruleEngine.Validate(theMessage); + if (derivedMessage != null) DBManager.Instance.Save(derivedMessage); foreach (DatabaseEntity saveEntity in saveMessages) diff --git a/nsw/Source/bsmd.hisnord/Properties/Settings.Designer.cs b/nsw/Source/bsmd.hisnord/Properties/Settings.Designer.cs index 2acf3c72..e6a2ed58 100644 --- a/nsw/Source/bsmd.hisnord/Properties/Settings.Designer.cs +++ b/nsw/Source/bsmd.hisnord/Properties/Settings.Designer.cs @@ -82,5 +82,17 @@ namespace bsmd.hisnord.Properties { 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; + } + } } } diff --git a/nsw/Source/bsmd.hisnord/Properties/Settings.settings b/nsw/Source/bsmd.hisnord/Properties/Settings.settings index 5ba5c68d..2920ec5c 100644 --- a/nsw/Source/bsmd.hisnord/Properties/Settings.settings +++ b/nsw/Source/bsmd.hisnord/Properties/Settings.settings @@ -17,5 +17,8 @@ E:\work\bsmd\nsw\HIS-NORD\Transmitter-Tool\ANSWERS + + E:\work\bsmd\nsw\HIS-NORD\Transmitter-Tool\ANSWERS_DONE + \ No newline at end of file diff --git a/nsw/Source/bsmd.hisnord/Request.cs b/nsw/Source/bsmd.hisnord/Request.cs index eb59e45b..d36b2bb5 100644 --- a/nsw/Source/bsmd.hisnord/Request.cs +++ b/nsw/Source/bsmd.hisnord/Request.cs @@ -845,7 +845,7 @@ namespace bsmd.hisnord #region send message and store result - transmitter.result theResult = transmitter.transmit(filePath); + transmitter.result theResult = transmitter.UseHisNordTransmitter(filePath); #endregion @@ -858,5 +858,41 @@ namespace bsmd.hisnord 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 + } } diff --git a/nsw/Source/bsmd.hisnord/app.config b/nsw/Source/bsmd.hisnord/app.config new file mode 100644 index 00000000..334ced28 --- /dev/null +++ b/nsw/Source/bsmd.hisnord/app.config @@ -0,0 +1,30 @@ + + + + +
+ + + + + + E:\work\bsmd\nsw\HIS-NORD\Transmitter-Tool\IMP + + + E:\work\bsmd\nsw\HIS-NORD\Transmitter-Tool\client.bat + + + 5 + + + E:\work\bsmd\nsw\HIS-NORD\Transmitter-Tool\RESULTS + + + E:\work\bsmd\nsw\HIS-NORD\Transmitter-Tool\ANSWERS + + + E:\work\bsmd\nsw\HIS-NORD\Transmitter-Tool\ANSWERS_DONE + + + + \ No newline at end of file diff --git a/nsw/Source/bsmd.hisnord/bsmd.hisnord.csproj b/nsw/Source/bsmd.hisnord/bsmd.hisnord.csproj index 3feb2723..ae4196dd 100644 --- a/nsw/Source/bsmd.hisnord/bsmd.hisnord.csproj +++ b/nsw/Source/bsmd.hisnord/bsmd.hisnord.csproj @@ -66,6 +66,7 @@ + diff --git a/nsw/Source/bsmd.hisnord/transmitter.cs b/nsw/Source/bsmd.hisnord/transmitter.cs index c379c7f2..937ff917 100644 --- a/nsw/Source/bsmd.hisnord/transmitter.cs +++ b/nsw/Source/bsmd.hisnord/transmitter.cs @@ -22,7 +22,7 @@ namespace bsmd.hisnord { private static ILog _log = LogManager.GetLogger(typeof(transmitter)); - /* + public static result UseHisNordTransmitter(string filenameFullPath) { @@ -51,7 +51,7 @@ namespace bsmd.hisnord return result.ReadResult(resultFullPath); } - */ + /// /// class to read transmitter result xml files diff --git a/nsw/Source/packages/repositories.config b/nsw/Source/packages/repositories.config index 47b257c1..969ac3e1 100644 --- a/nsw/Source/packages/repositories.config +++ b/nsw/Source/packages/repositories.config @@ -10,5 +10,6 @@ + \ No newline at end of file diff --git a/server.txt b/server.txt index 8ec40ce8..ca2c3646 100644 --- a/server.txt +++ b/server.txt @@ -17,6 +17,7 @@ Zugangsdaten NSW Server: https://bscw.dlz-it.de/bscw/bscw.cgi Benutzer: mippel PW: baffi1234! +PW: lkDDXd1321? NSW Test E-Mail Account: