2.0.0, Stand Anfang Juli

This commit is contained in:
Daniel Schick 2015-07-05 19:14:22 +00:00
parent 8de5ee810d
commit f2825a95f3
104 changed files with 3449 additions and 384 deletions

Binary file not shown.

View File

@ -20,3 +20,5 @@ SMSPLASH01 [Dashface-Server], 192.168.2.5, vorher: www.schiffsmelder.com:41625
für alle Server:
User: Administrator
PW: $chegVAN99!
hallo12345

Binary file not shown.

View File

@ -75,7 +75,9 @@
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="App.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\bsmd.database\bsmd.database.csproj">

View File

@ -11,6 +11,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bsmd.database", "bsmd.datab
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bsmd.dakosy", "bsmd.dakosy\bsmd.dakosy.csproj", "{6255F8C4-B0B5-4E77-860E-10EBCD7B368F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bsmd.hisnord", "bsmd.hisnord\bsmd.hisnord.csproj", "{E7E48971-E879-4E6A-B316-70AC0A6F4C95}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -33,6 +35,10 @@ Global
{6255F8C4-B0B5-4E77-860E-10EBCD7B368F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6255F8C4-B0B5-4E77-860E-10EBCD7B368F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6255F8C4-B0B5-4E77-860E-10EBCD7B368F}.Release|Any CPU.Build.0 = Release|Any CPU
{E7E48971-E879-4E6A-B316-70AC0A6F4C95}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E7E48971-E879-4E6A-B316-70AC0A6F4C95}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E7E48971-E879-4E6A-B316-70AC0A6F4C95}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E7E48971-E879-4E6A-B316-70AC0A6F4C95}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -120,7 +120,9 @@ namespace SendNSWMessageService
_log.InfoFormat("Sending {0} message to {1}",
message.MessageNotificationClass.ToString(), message.HIS.ToString());
bool sendSucceeded = false;
bool sendSucceeded = false;
// switch über passendes HIS / Schnittstelle
switch (message.HIS)
{
@ -129,7 +131,7 @@ namespace SendNSWMessageService
if (!sendSucceeded)
{
message.InternalStatus = Message.BSMDStatus.SEND_FAILED;
}
}
break;
case Message.NSWProvider.DAKOSY:
sendSucceeded = bsmd.dakosy.Request.Send(message);
@ -146,6 +148,14 @@ namespace SendNSWMessageService
if (sendSucceeded)
{
// alte Fehlerliste entfernen (die Antwort kann praktisch noch nicht da sein)
// vor dem Versenden zu entfernen halte ich für doof, wenn das Versenden scheitert
foreach (MessageError messageError in message.ErrorList)
DBManager.Instance.Delete(messageError);
foreach (MessageViolation messageViolation in message.ViolationList)
DBManager.Instance.Delete(messageViolation);
_log.Info("send successful, saving message.");
message.InternalStatus = Message.BSMDStatus.SENT;
message.SentAt = DateTime.Now;
@ -166,6 +176,7 @@ namespace SendNSWMessageService
}
else
{
_log.Fatal("database connection failure, stopping service");
this.EventLog.WriteEntry("NSW Send Service stopped: DB connection failed", EventLogEntryType.Error);
this.Stop();
}

View File

@ -0,0 +1,34 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bsmd.ExcelReadService", "bsmd.ExcelReadService\bsmd.ExcelReadService.csproj", "{9475E638-DCFB-49E8-BD4E-3513D106C82A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bsmd.database", "bsmd.database\bsmd.database.csproj", "{19945AF2-379B-46A5-B27A-303B5EC1D557}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bsmd.email", "bsmd.email\bsmd.email.csproj", "{4B48A8AD-926D-4E0C-BEB3-59E040928137}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{9475E638-DCFB-49E8-BD4E-3513D106C82A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9475E638-DCFB-49E8-BD4E-3513D106C82A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9475E638-DCFB-49E8-BD4E-3513D106C82A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9475E638-DCFB-49E8-BD4E-3513D106C82A}.Release|Any CPU.Build.0 = Release|Any CPU
{19945AF2-379B-46A5-B27A-303B5EC1D557}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{19945AF2-379B-46A5-B27A-303B5EC1D557}.Debug|Any CPU.Build.0 = Debug|Any CPU
{19945AF2-379B-46A5-B27A-303B5EC1D557}.Release|Any CPU.ActiveCfg = Release|Any CPU
{19945AF2-379B-46A5-B27A-303B5EC1D557}.Release|Any CPU.Build.0 = Release|Any CPU
{4B48A8AD-926D-4E0C-BEB3-59E040928137}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4B48A8AD-926D-4E0C-BEB3-59E040928137}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4B48A8AD-926D-4E0C-BEB3-59E040928137}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4B48A8AD-926D-4E0C-BEB3-59E040928137}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="bsmd.ExcelReadService.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<applicationSettings>
<bsmd.ExcelReadService.Properties.Settings>
<setting name="ConnectionString" serializeAs="String">
<value>replace me!</value>
</setting>
<setting name="ArchiveFolder" serializeAs="String">
<value>E:\temp\SietasSheets</value>
</setting>
<setting name="POP3Server" serializeAs="String">
<value />
</setting>
<setting name="POP3User" serializeAs="String">
<value />
</setting>
<setting name="POP3Password" serializeAs="String">
<value />
</setting>
<setting name="SleepSeconds" serializeAs="String">
<value>300</value>
</setting>
</bsmd.ExcelReadService.Properties.Settings>
</applicationSettings>
</configuration>

View File

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

View File

@ -0,0 +1,136 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.IO;
using System.ServiceProcess;
using System.Text;
using System.Threading.Tasks;
using System.Timers;
using log4net;
using bsmd.database;
using bsmd.email;
namespace bsmd.ExcelReadService
{
public partial class ExcelReadService : ServiceBase
{
private Timer _timer;
private object _timerlock = new object();
private bool processRunning = false;
private ILog _log = LogManager.GetLogger(typeof(ExcelReadService));
public ExcelReadService()
{
Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);
InitializeComponent();
}
protected override void OnStart(string[] args)
{
this.EventLog.Source = this.ServiceName;
this.EventLog.Log = "Application";
this.Init(args);
this.EventLog.WriteEntry("EU-NOAD Excel Read Service started.", EventLogEntryType.Information);
this.DoOnce();
}
private void Init(string[] args)
{
this._timer = new Timer();
this._timer.Interval = Properties.Settings.Default.SleepSeconds * 1000;
this._timer.Elapsed += _timer_Elapsed;
this._timer.Enabled = true;
}
private void _timer_Elapsed(object sender, ElapsedEventArgs e)
{
lock (this._timerlock)
{
if (this.processRunning) return;
else this.processRunning = true;
}
if (DBManager.Instance.Connect(Properties.Settings.Default.ConnectionString))
{
try
{
string messageId = "";
string attachmentLocalPath = "";
string mailSender = "";
using (BSMDPopClient bsmdPopClient = new BSMDPopClient())
{
if (!bsmdPopClient.IsConnected)
{
_log.Error("cannot connect to pop3 server, aborting!");
this.Stop();
}
// check and download next e-Mail, saving attachment
while (bsmdPopClient.ReceiveSingleMail(out attachmentLocalPath, out messageId, out mailSender))
{
bool readResult;
string readMessage = "";
MessageCore messageCore = null;
// try to read/import attachment
using(ExcelReader reader = new ExcelReader(attachmentLocalPath))
{
readResult = Util.ProcessSheet(reader, out readMessage, out messageCore);
if(!readResult)
_log.Error("Excel sheet could not be interpreted");
}
// set messagecore to createreport and let reportGenerator create a reply
// remove e-Mail
_log.InfoFormat("deleting mail with messageId {0}", messageId);
_log.InfoFormat("mail delete {0}", bsmdPopClient.DeleteMessageByMessageId(messageId) ? "successful" : "failed");
// remove attachment
_log.InfoFormat("removing local file {0}", attachmentLocalPath);
// File.Delete(attachmentLocalPath);
}
}
DBManager.Instance.Disconnect();
}
catch (Exception ex)
{
_log.ErrorFormat("Exception occurred: {0}", ex.ToString());
}
}
else
{
this.EventLog.WriteEntry("ReportService stopped: DB connection failed", EventLogEntryType.Error);
this.Stop();
}
lock (this._timerlock)
{
this.processRunning = false;
}
}
protected override void OnStop()
{
}
internal void DoOnce()
{
this._timer_Elapsed(null, null);
}
}
}

View File

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

View File

@ -0,0 +1,57 @@
//
// Class: ExcelReader
// Current CLR: 4.0.30319.34209
// System: Microsoft Visual Studio 10.0
// Author: dani
// Created: 6/15/2015 10:03:40 PM
//
// Copyright (c) 2015 Informatikbüro Daniel Schick. All rights reserved.
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using log4net;
using Excel.Core;
using Excel;
namespace bsmd.ExcelReadService
{
public class ExcelReader : IDisposable
{
private IExcelDataReader dataReader;
private ILog _log = LogManager.GetLogger(typeof(ExcelReader));
public ExcelReader(string filePath)
{
using (FileStream fs = File.Open(filePath, FileMode.Open, FileAccess.Read))
{
if (filePath.EndsWith(".xls", StringComparison.InvariantCultureIgnoreCase))
dataReader = ExcelReaderFactory.CreateBinaryReader(fs);
else if (filePath.EndsWith(".xlsx", StringComparison.InvariantCultureIgnoreCase))
dataReader = ExcelReaderFactory.CreateOpenXmlReader(fs);
else
throw new ArgumentException(string.Format("saved file {0} is not an excel file", filePath));
}
}
public object GetCell(string workSheetName, int row, int col)
{
this.dataReader.IsFirstRowAsColumnNames = false;
DataSet dataSet = dataReader.AsDataSet();
DataTable workSheet = dataSet.Tables[workSheetName];
var cellValue = workSheet.Rows[row][col];
return cellValue;
}
public void Dispose()
{
if (this.dataReader != null)
this.dataReader.Dispose();
}
}
}

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,18 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("bsmd.ExcelReadService")]
[assembly: AssemblyDescription("Imports Sietas Style Excel Sheets into NSW DB")]
[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("eda620d4-a872-4c8c-8d4e-6bdd447ee386")]

View File

@ -0,0 +1,80 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34209
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace bsmd.ExcelReadService.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.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("replace me!")]
public string ConnectionString {
get {
return ((string)(this["ConnectionString"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("E:\\temp\\SietasSheets")]
public string ArchiveFolder {
get {
return ((string)(this["ArchiveFolder"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string POP3Server {
get {
return ((string)(this["POP3Server"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string POP3User {
get {
return ((string)(this["POP3User"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string POP3Password {
get {
return ((string)(this["POP3Password"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("300")]
public int SleepSeconds {
get {
return ((int)(this["SleepSeconds"]));
}
}
}
}

View File

@ -0,0 +1,24 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="bsmd.ExcelReadService.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="ConnectionString" Type="System.String" Scope="Application">
<Value Profile="(Default)">replace me!</Value>
</Setting>
<Setting Name="ArchiveFolder" Type="System.String" Scope="Application">
<Value Profile="(Default)">E:\temp\SietasSheets</Value>
</Setting>
<Setting Name="POP3Server" Type="System.String" Scope="Application">
<Value Profile="(Default)" />
</Setting>
<Setting Name="POP3User" Type="System.String" Scope="Application">
<Value Profile="(Default)" />
</Setting>
<Setting Name="POP3Password" Type="System.String" Scope="Application">
<Value Profile="(Default)" />
</Setting>
<Setting Name="SleepSeconds" Type="System.Int32" Scope="Application">
<Value Profile="(Default)">300</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@ -0,0 +1,86 @@
//
// Class: Util
// Current CLR: 4.0.30319.34209
// System: Microsoft Visual Studio 10.0
// Author: dani
// Created: 6/17/2015 7:12:38 AM
//
// Copyright (c) 2015 Informatikbüro Daniel Schick. All rights reserved.
using System;
using System.Collections.Generic;
using log4net;
using bsmd.database;
namespace bsmd.ExcelReadService
{
public class Util
{
private static ILog _log = LogManager.GetLogger(typeof(Util));
public static bool ProcessSheet(ExcelReader reader, out string readMessage, out MessageCore messageCore)
{
readMessage = "ok";
messageCore = Util.LookupMessageCore(reader);
// start parsing fields
string sheetVersion = reader.GetCell("Portcall", 2, 1) as string;
messageCore.SietasSheetVersion = sheetVersion;
DBManager.Instance.Save(messageCore);
return true;
}
/// <summary>
/// Check with cell values if this message core is already in our DB
/// </summary>
private static MessageCore LookupMessageCore(ExcelReader reader)
{
// lookup using field values
double imoDouble = (double) reader.GetCell("SHIP", 13, 6);
string imo = Convert.ToInt32(imoDouble).ToString();
string etaDateString = reader.GetCell("Portcall", 16, 8).ToString();
string etaTime = reader.GetCell("Portcall", 16, 10).ToString();
DateTime dt = Util.ConstructDate(etaDateString, etaTime);
string poc = reader.GetCell("Portcall", 16, 1) as string;
MessageCore result = null;
if (DBManager.Instance.GetMessageCoreByShipInfos(imo, dt, poc) == null)
{
result = new MessageCore();
result.IMO = imo;
result.ReportStatus = MessageCore.ReportStatusEnum.COMPLETE;
result.Portname = poc;
result.ETA = dt;
if (result.IMO.Length > 7)
{
_log.WarnFormat("IMO {0} is longer than 7 chars, truncating!", result.IMO);
result.IMO = result.IMO.Substring(0, 7);
}
DBManager.Instance.Save(result);
}
return result;
}
private static DateTime ConstructDate(string etaDateString, string etaTime)
{
DateTime result = DateTime.Now;
if (DateTime.TryParse(etaDateString, out result))
{
TimeSpan sp;
if (TimeSpan.TryParse(etaTime, out sp))
result += sp;
}
return result;
}
}
}

View File

@ -0,0 +1,124 @@
<?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>{9475E638-DCFB-49E8-BD4E-3513D106C82A}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>bsmd.ExcelReadService</RootNamespace>
<AssemblyName>bsmd.ExcelReadService</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>
<ItemGroup>
<Reference Include="Excel">
<HintPath>..\packages\ExcelDataReader.2.1.2.3\lib\net45\Excel.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.SharpZipLib">
<HintPath>..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.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.Configuration.Install" />
<Reference Include="System.Core" />
<Reference Include="System.Management" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\bsmd.database\Properties\AssemblyProductInfo.cs">
<Link>Properties\AssemblyProductInfo.cs</Link>
</Compile>
<Compile Include="..\bsmd.database\Properties\AssemblyProjectInfo.cs">
<Link>Properties\AssemblyProjectInfo.cs</Link>
</Compile>
<Compile Include="..\bsmd.database\Properties\AssemblyProjectKeyInfo.cs">
<Link>Properties\AssemblyProjectKeyInfo.cs</Link>
</Compile>
<Compile Include="ExcelReader.cs" />
<Compile Include="ExcelReadService.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ExcelReadService.Designer.cs">
<DependentUpon>ExcelReadService.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="ProjectInstaller.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ProjectInstaller.Designer.cs">
<DependentUpon>ProjectInstaller.cs</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<Compile Include="Util.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="ExcelReadService.resx">
<DependentUpon>ExcelReadService.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="ProjectInstaller.resx">
<DependentUpon>ProjectInstaller.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\bsmd.database\bsmd.database.csproj">
<Project>{19945af2-379b-46a5-b27a-303b5ec1d557}</Project>
<Name>bsmd.database</Name>
</ProjectReference>
<ProjectReference Include="..\bsmd.email\bsmd.email.csproj">
<Project>{4b48a8ad-926d-4e0c-beb3-59e040928137}</Project>
<Name>bsmd.email</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Service References\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ExcelDataReader" version="2.1.2.3" targetFramework="net45" />
<package id="log4net" version="2.0.3" targetFramework="net45" />
<package id="OpenPop.NET" version="2.0.6.1112" targetFramework="net45" />
<package id="SharpZipLib" version="0.86.0" targetFramework="net45" />
</packages>

View File

@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bsmd.ReportGenerator", "bsm
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bsmd.database", "bsmd.database\bsmd.database.csproj", "{19945AF2-379B-46A5-B27A-303B5EC1D557}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bsmd.email", "bsmd.email\bsmd.email.csproj", "{4B48A8AD-926D-4E0C-BEB3-59E040928137}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -21,6 +23,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
{4B48A8AD-926D-4E0C-BEB3-59E040928137}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4B48A8AD-926D-4E0C-BEB3-59E040928137}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4B48A8AD-926D-4E0C-BEB3-59E040928137}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4B48A8AD-926D-4E0C-BEB3-59E040928137}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -26,7 +26,8 @@ namespace bsmd.ReportGenerator
#region create document
public static Document CreateDocument(string title, string subject, string author)
public static Document CreateDocument(string title, string subject, string author,
Dictionary<string, string> coverInfos)
{
// Create a new MigraDoc document
Document document = new Document();
@ -36,7 +37,7 @@ namespace bsmd.ReportGenerator
BSMDDocument.DefineStyles(document);
BSMDDocument.DefineCover(document);
BSMDDocument.DefineCover(document, coverInfos);
BSMDDocument.DefineContentSection(document);
//TableOfContents.DefineTableOfContents(document);
@ -136,7 +137,7 @@ namespace bsmd.ReportGenerator
/// <summary>
/// Defines the cover page.
/// </summary>
public static void DefineCover(Document document)
public static void DefineCover(Document document, Dictionary<string, string> coverInfos)
{
Section section = document.AddSection();
@ -150,10 +151,16 @@ namespace bsmd.ReportGenerator
paragraph.Format.Font.Size = 16;
paragraph.Format.Font.Color = Colors.DarkRed;
paragraph.Format.SpaceBefore = "8cm";
paragraph.Format.SpaceAfter = "3cm";
paragraph = section.AddParagraph("Rendering date: ");
paragraph.Format.SpaceAfter = "2cm";
paragraph.AddDateField();
paragraph = section.AddParagraph();
paragraph.Format.Font.Size = 14;
foreach (string key in coverInfos.Keys)
paragraph.AddText(string.Format("{0}:\t\t{1}\n", key, coverInfos[key]));
}
#endregion
@ -193,17 +200,27 @@ namespace bsmd.ReportGenerator
public static void AddNSWMessageParagraph(Document document, IMessageParagraph messageParagraph)
{
Paragraph paragraph = document.LastSection.AddParagraph(messageParagraph.Title, "Heading2");
document.LastSection.AddParagraph(messageParagraph.Title, "Heading2");
document.LastSection.AddParagraph(messageParagraph.Subtitle, "Heading3");
if (messageParagraph.MessageText != null) // 1:n message (CREW, PAS,..)
BSMDDocument.AddActualTableParagraph(document, messageParagraph.MessageText, false);
if (messageParagraph.ChildParagraphs != null)
{
foreach (IMessageParagraph childParagraph in messageParagraph.ChildParagraphs)
{
BSMDDocument.AddActualTableParagraph(document, childParagraph.MessageText, true);
}
// TODO: Adäquate Tabellendarstellung designen
//if (messageParagraph.ShowChildrenAsTable)
//{
//}
//else
//{
foreach (IMessageParagraph childParagraph in messageParagraph.ChildParagraphs)
{
BSMDDocument.AddActualTableParagraph(document, childParagraph.MessageText, true);
}
//}
}
}

View File

@ -1,20 +1,16 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading.Tasks;
using System.Timers;
using MigraDoc;
using MigraDoc.DocumentObjectModel;
using log4net;
using MigraDoc.DocumentObjectModel;
using bsmd.database;
using bsmd.email;
namespace bsmd.ReportGenerator
{
@ -38,6 +34,7 @@ namespace bsmd.ReportGenerator
this.EventLog.Log = "Application";
this.Init(args);
this.EventLog.WriteEntry("Report Service started.", EventLogEntryType.Information);
_log.Info("Report Service started.");
this.DoOnce();
}
@ -63,17 +60,38 @@ namespace bsmd.ReportGenerator
try
{
// load all messages with report flag set
List<MessageCore> reportCores = DBManager.Instance.GetMessageCoresByStatus(MessageCore.BSMDStatus.CREATE_RECEIVE_RECEIPT);
List<MessageCore> reportCores = DBManager.Instance.GetMessageCoresByReportStatus(MessageCore.ReportStatusEnum.COMPLETE);
// create report documents for each of the messages
foreach (MessageCore reportCore in reportCores)
{
List<Message> messages = DBManager.Instance.GetMessagesForCore(reportCore);
Dictionary<string, string> coverInfos = new Dictionary<string, string>();
// Schiffsname aus der STAT meldung fischen
foreach (Message msg in messages)
{
if (msg.MessageNotificationClass == Message.NotificationClass.STAT)
{
if (msg.Elements.Count > 0)
{
STAT stat = msg.Elements[0] as STAT;
if (stat != null)
{
coverInfos.Add("Ship", stat.ShipName);
}
}
}
}
coverInfos.Add("IMO", reportCore.IMO);
DateTime eta = reportCore.ETA ?? (reportCore.ETAKielCanal ?? new DateTime(0));
coverInfos.Add("ETA", eta.ToString());
coverInfos.Add("Port", reportCore.Portname);
Document migraDocument = BSMDDocument.CreateDocument(
string.Format("NSW Eingangsdatenübersicht für IMO {0}, ETA {1}", reportCore.IMO, reportCore.ETA),
"NSW Meldung",
Properties.Settings.Default.ReportAuthor);
Properties.Settings.Default.ReportAuthor, coverInfos);
// print header area (with message core data)
@ -88,10 +106,11 @@ namespace bsmd.ReportGenerator
reportCore.Id);
BSMDDocument.RenderDocument(migraDocument, fullPath);
_log.InfoFormat("Document created for MessageCoreId {0}, IMO {1}", reportCore.Id, reportCore.IMO);
BSMDMail.SendNSWReportAsAttachment(reportCore, fullPath);
string subject = string.Format("NSW message report for {0}", reportCore.IMO);
BSMDMail.SendNSWReportAsAttachment(subject, fullPath);
// reset status on core message (get ready to prepare)
reportCore.BSMDStatusInternal = MessageCore.BSMDStatus.PREPARE;
// reset report status
reportCore.ReportStatus = MessageCore.ReportStatusEnum.NONE;
DBManager.Instance.Save(reportCore);
}
@ -117,6 +136,7 @@ namespace bsmd.ReportGenerator
protected override void OnStop()
{
_log.Info("Report Service stopping.");
}
internal void DoOnce()

View File

@ -79,7 +79,6 @@
<Link>Properties\AssemblyProjectKeyInfo.cs</Link>
</Compile>
<Compile Include="BSMDDocument.cs" />
<Compile Include="BSMDMail.cs" />
<Compile Include="ProjectInstaller.cs">
<SubType>Component</SubType>
</Compile>
@ -122,6 +121,10 @@
<Project>{19945af2-379b-46a5-b27a-303b5ec1d557}</Project>
<Name>bsmd.database</Name>
</ProjectReference>
<ProjectReference Include="..\bsmd.email\bsmd.email.csproj">
<Project>{4b48a8ad-926d-4e0c-beb3-59e040928137}</Project>
<Name>bsmd.email</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.

View File

@ -11,7 +11,10 @@
<userSettings>
<bsmd.dakosy.ResponseService.Properties.Settings>
<setting name="ConnectionString" serializeAs="String">
<value>replace me!</value>
<value>Data Source=192.168.2.5\SQLEXPRESS;Initial Catalog=nsw;Integrated Security=False;User ID=dfuser;Password=dfpasswd;Connect Timeout=15;Encrypt=False;TrustServerCertificate=False</value>
</setting>
<setting name="SleepSeconds" serializeAs="String">
<value>300</value>
</setting>
</bsmd.dakosy.ResponseService.Properties.Settings>
</userSettings>

View File

@ -23,8 +23,7 @@ namespace bsmd.dakosy.ResponseService
if (Debugger.IsAttached)
{
((SFTPService)ServicesToRun[0]).Init(null);
while (true) ;
((SFTPService)ServicesToRun[0]).Init(null);
}
else
{

View File

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

View File

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

View File

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

View File

@ -25,7 +25,9 @@ namespace bsmd.dakosy.ResponseService.Properties {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("replace me!")]
[global::System.Configuration.DefaultSettingValueAttribute("Data Source=192.168.2.5\\SQLEXPRESS;Initial Catalog=nsw;Integrated Security=False;" +
"User ID=dfuser;Password=dfpasswd;Connect Timeout=15;Encrypt=False;TrustServerCer" +
"tificate=False")]
public string ConnectionString {
get {
return ((string)(this["ConnectionString"]));
@ -34,5 +36,17 @@ namespace bsmd.dakosy.ResponseService.Properties {
this["ConnectionString"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("300")]
public int SleepSeconds {
get {
return ((int)(this["SleepSeconds"]));
}
set {
this["SleepSeconds"] = value;
}
}
}
}

View File

@ -3,7 +3,10 @@
<Profiles />
<Settings>
<Setting Name="ConnectionString" Type="System.String" Scope="User">
<Value Profile="(Default)">replace me!</Value>
<Value Profile="(Default)">Data Source=192.168.2.5\SQLEXPRESS;Initial Catalog=nsw;Integrated Security=False;User ID=dfuser;Password=dfpasswd;Connect Timeout=15;Encrypt=False;TrustServerCertificate=False</Value>
</Setting>
<Setting Name="SleepSeconds" Type="System.Int32" Scope="User">
<Value Profile="(Default)">300</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@ -28,8 +28,11 @@
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
this.ServiceName = "Service1";
//
// SFTPService
//
this.ServiceName = "Dakosy response service";
}
#endregion

View File

@ -35,15 +35,10 @@ namespace bsmd.dakosy.ResponseService
protected override void OnStart(string[] args)
{
this.EventLog.Source = this.ServiceName;
this.EventLog.Log = "Application";
this.EventLog.BeginInit();
if (!EventLog.SourceExists(this.EventLog.Source, this.EventLog.Log))
EventLog.CreateEventSource(this.EventLog.Source, this.EventLog.Log);
this.EventLog.EndInit();
this.EventLog.Log = "Application";
this.Init(args);
this.EventLog.WriteEntry("NSW SFTP Response Service started.", EventLogEntryType.Information);
this._timer_Elapsed(null, null);
}
protected override void OnStop()
@ -54,7 +49,7 @@ namespace bsmd.dakosy.ResponseService
public void Init(string[] args)
{
this._timer = new Timer();
this._timer.Interval = 600000; // 10 Min, TODO: Settings
this._timer.Interval = Properties.Settings.Default.SleepSeconds * 1000;
this._timer.Elapsed += _timer_Elapsed;
this._timer.Enabled = true;
@ -68,27 +63,13 @@ namespace bsmd.dakosy.ResponseService
{
if (this.processRunning) return;
else this.processRunning = true;
}
string localDir = ""; // TBD
}
if (DBManager.Instance.Connect(Properties.Settings.Default.ConnectionString))
{
try
{
// SFTP verbindung öffnen und alle Dateien herunterladen
sftp.GetAll(localDir);
// lokale Dateien verarbeiten
foreach(string inputFile in Directory.GetFiles(localDir))
{
if (!Response.Read(inputFile))
_log.ErrorFormat("Error reading input file {0}", inputFile);
else
File.Delete(inputFile); // alternativ: move to archive folder
}
Response.ReadAll();
}
catch (Exception ex)

View File

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

View File

@ -42,7 +42,9 @@
<HintPath>..\packages\log4net.2.0.3\lib\net40-full\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration.Install" />
<Reference Include="System.Core" />
<Reference Include="System.Management" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
@ -60,6 +62,12 @@
<Compile Include="..\bsmd.database\Properties\AssemblyProjectKeyInfo.cs">
<Link>Properties\AssemblyProjectKeyInfo.cs</Link>
</Compile>
<Compile Include="ProjectInstaller.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ProjectInstaller.Designer.cs">
<DependentUpon>ProjectInstaller.cs</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
@ -77,6 +85,7 @@
<ItemGroup>
<None Include="App.config" />
<None Include="..\bsmdKey.snk" />
<None Include="ClassDiagram1.cd" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
@ -93,6 +102,14 @@
<Name>bsmd.database</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="ProjectInstaller.resx">
<DependentUpon>ProjectInstaller.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="SFTPService.resx">
<DependentUpon>SFTPService.cs</DependentUpon>
</EmbeddedResource>
</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.

View File

@ -34,7 +34,7 @@ namespace bsmd.dakosy
// fill eDeclaration class
eDeclarationMessage edm = new eDeclarationMessage();
edm.Version = "08.15";
// edm.Version = "08.15"; // entfernt auf Anraten von Fr. Ebeling 30.6.15
edm.InterchangeHeader = new InterchangeHeaderType();
edm.InterchangeHeader.CreationTime = DateTime.UtcNow;
edm.InterchangeHeader.ExchangeNumber = "tbd";
@ -47,7 +47,7 @@ namespace bsmd.dakosy
edm.InterchangeHeader.Recipient.ParticipantCode = new ParticipantCode();
edm.InterchangeHeader.Recipient.ParticipantCode.AgencyID = "DAK";
edm.InterchangeHeader.Recipient.ParticipantCode.Value = "DAK";
eDeclarationMessageInterchangeBody b = new eDeclarationMessageInterchangeBody();
edm.InterchangeBody = b;
@ -64,10 +64,9 @@ namespace bsmd.dakosy
reqList.RequestId = new RequestId[1];
reqList.RequestId[0] = new RequestId();
reqList.RequestId[0].MessageHeader = new MessageHeaderType();
reqList.RequestId[0].MessageHeader.MessageReferenceNumber = aMessage.Id.ToString();
reqList.RequestId[0].MessageHeader = new MessageHeaderType();
reqList.RequestId[0].MessageHeader.CreationTime = DateTime.UtcNow;
reqList.RequestId[0].MessageHeader.CreationTimeSpecified = true;
reqList.RequestId[0].MessageHeader.MessageReferenceNumber = aMessage.Id.Value.ToString("N");
//reqList.RequestId[0].MessageHeader.CreationTime = DateTime.UtcNow;
//reqList.RequestId[0].MessageHeader.CreationTimeSpecified = true;
reqList.RequestId[0].LocalReferenceNumber = aMessage.MessageCore.Id.Value.ToString("N");
reqList.RequestId[0].OriginatorsVoyageNumber = "tbd";
reqList.RequestId[0].MessageHeader.MessageRecipient = new Participant();
@ -183,7 +182,7 @@ namespace bsmd.dakosy
switch (aMessage.MessageNotificationClass)
{
case Message.NotificationClass.NOA_NOD:
bsmd.database.NOA_NOD noa_nod = dbEntity as bsmd.database.NOA_NOD;
bsmd.database.NOA_NOD noa_nod = aMessage.Elements[0] as bsmd.database.NOA_NOD;
if (noa_nod == null) throw new ApplicationException("dbEntity is no NOA_NOD message!");
vList.Visit[0].NOA_NOD = new NOA_NOD();
//vList.Visit[0].NOA_NOD.CallPurpose
@ -214,25 +213,26 @@ namespace bsmd.dakosy
}
break;
case Message.NotificationClass.ATA:
bsmd.database.ATA ata = dbEntity as bsmd.database.ATA;
bsmd.database.ATA ata = aMessage.Elements[0] as bsmd.database.ATA;
vList.Visit[0].ATA = new ATA();
if(ata.ATAPortOfCall.HasValue)
vList.Visit[0].ATA.AtaPortOfCall = ata.ATAPortOfCall.Value;
break;
case Message.NotificationClass.ATD:
bsmd.database.ATD atd = dbEntity as bsmd.database.ATD;
bsmd.database.ATD atd = aMessage.Elements[0] as bsmd.database.ATD;
vList.Visit[0].ATD = new ATD();
if (atd.ATDPortOfCall.HasValue)
vList.Visit[0].ATD.AtdPortOfCall = atd.ATDPortOfCall.Value;
break;
case Message.NotificationClass.BPOL:
bsmd.database.BPOL bpol = dbEntity as bsmd.database.BPOL;
bsmd.database.BPOL bpol = aMessage.Elements[0] as bsmd.database.BPOL;
vList.Visit[0].BPOL = new BPOL();
if (bpol.PortOfItineraries.Count > 0)
{
vList.Visit[0].BPOL.PortOfItinerary = new PortOfItinerary[bpol.PortOfItineraries.Count];
for (int i = 0; i < bpol.PortOfItineraries.Count; i++)
{
vList.Visit[0].BPOL.PortOfItinerary[i] = new PortOfItinerary();
if (bpol.PortOfItineraries[i].PortOfItineraryETA.HasValue)
vList.Visit[0].BPOL.PortOfItinerary[i].PortOfItineraryETA = bpol.PortOfItineraries[i].PortOfItineraryETA.Value;
vList.Visit[0].BPOL.PortOfItinerary[i].PortOfItineraryName = bpol.PortOfItineraries[i].PortOfItineraryName;
@ -326,19 +326,19 @@ namespace bsmd.dakosy
}
break;
case Message.NotificationClass.TIEFA:
bsmd.database.TIEFA tiefa = dbEntity as bsmd.database.TIEFA;
bsmd.database.TIEFA tiefa = aMessage.Elements[0] as bsmd.database.TIEFA;
vList.Visit[0].TIEFA = new TIEFA();
if (tiefa.DraughtUponArrival_DMT.HasValue)
vList.Visit[0].TIEFA.DraughtUponArrivalDMT = tiefa.DraughtUponArrival_DMT.Value;
break;
case Message.NotificationClass.TIEFD:
bsmd.database.TIEFD tiefd = dbEntity as bsmd.database.TIEFD;
bsmd.database.TIEFD tiefd = aMessage.Elements[0] as bsmd.database.TIEFD;
vList.Visit[0].TIEFD = new TIEFD();
if (tiefd.DraughtUponDeparture_DMT.HasValue)
vList.Visit[0].TIEFD.draughtUponDepartureDMT = tiefd.DraughtUponDeparture_DMT.Value;
break;
case Message.NotificationClass.INFO:
bsmd.database.INFO info = dbEntity as bsmd.database.INFO;
bsmd.database.INFO info = aMessage.Elements[0] as bsmd.database.INFO;
vList.Visit[0].INFO = new INFO();
if(info.ShippingArea.HasValue)
vList.Visit[0].INFO.ShippingArea = (ShippingAreaType)info.ShippingArea.Value;
@ -353,7 +353,7 @@ namespace bsmd.dakosy
vList.Visit[0].INFO.DeadWeightSummerTNE = info.DeplacementSummerDraught_TNE.Value;
break;
case Message.NotificationClass.MDH:
bsmd.database.MDH mdh = dbEntity as bsmd.database.MDH;
bsmd.database.MDH mdh = aMessage.Elements[0] as bsmd.database.MDH;
vList.Visit[0].MDH = new MDH();
vList.Visit[0].MDH.MdhSimplificationSpecified = mdh.MDHSimplification.HasValue;
vList.Visit[0].MDH.MdhSimplification = mdh.MDHSimplification ?? false;
@ -425,7 +425,7 @@ namespace bsmd.dakosy
}
break;
case Message.NotificationClass.NAME:
bsmd.database.NAME name = dbEntity as bsmd.database.NAME;
bsmd.database.NAME name = aMessage.Elements[0] as bsmd.database.NAME;
vList.Visit[0].NAME = new NAME();
vList.Visit[0].NAME.NameOfMaster = name.NameOfMaster;
break;
@ -464,7 +464,7 @@ namespace bsmd.dakosy
break;
case Message.NotificationClass.POBA:
{
bsmd.database.POBA poba = dbEntity as bsmd.database.POBA;
bsmd.database.POBA poba = aMessage.Elements[0] as bsmd.database.POBA;
vList.Visit[0].PoBA = new PoBA();
if (poba.TotalCrewMembersOnBoardUponArrival.HasValue)
vList.Visit[0].PoBA.TotalCrewMembersOnBoardUponArrival = poba.TotalCrewMembersOnBoardUponArrival.Value;
@ -478,7 +478,7 @@ namespace bsmd.dakosy
break;
case Message.NotificationClass.POBD:
{
bsmd.database.POBD pobd = dbEntity as bsmd.database.POBD;
bsmd.database.POBD pobd = aMessage.Elements[0] as bsmd.database.POBD;
vList.Visit[0].PoBD = new PoBD();
if (pobd.TotalCrewMembersOnBoardUponDeparture.HasValue)
vList.Visit[0].PoBD.TotalCrewMembersOnBoardUponDeparture = pobd.TotalCrewMembersOnBoardUponDeparture.Value;
@ -492,7 +492,7 @@ namespace bsmd.dakosy
break;
case Message.NotificationClass.PRE72H:
{
bsmd.database.PRE72H pre72h = dbEntity as bsmd.database.PRE72H;
bsmd.database.PRE72H pre72h = aMessage.Elements[0] as bsmd.database.PRE72H;
vList.Visit[0].PRE72H = new PRE72H();
vList.Visit[0].PRE72H.Tanker = pre72h.Tanker ?? false;
if (vList.Visit[0].PRE72H.Tanker)
@ -516,7 +516,7 @@ namespace bsmd.dakosy
break;
case Message.NotificationClass.SEC:
{
bsmd.database.SEC sec = dbEntity as bsmd.database.SEC;
bsmd.database.SEC sec = aMessage.Elements[0] as bsmd.database.SEC;
vList.Visit[0].SEC = new SEC();
vList.Visit[0].SEC.SecSimplificationSpecified = sec.SECSimplification.HasValue;
vList.Visit[0].SEC.SecSimplification = sec.SECSimplification ?? false;
@ -573,6 +573,7 @@ namespace bsmd.dakosy
vList.Visit[0].SEC.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled = new ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Count];
for(int i=0;i<sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Count;i++)
{
vList.Visit[0].SEC.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i] = new ShipToShipActivitiesDuringLastTenPortFacilitiesCalled();
vList.Visit[0].SEC.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].LocationName = sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].ShipToShipActivityLocationName;
vList.Visit[0].SEC.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].LocationCode = sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].ShipToShipActivityLocationLoCode;
vList.Visit[0].SEC.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].LocationCoordinatesLatitudeSpecified = sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].ShipToShipActivityLocationCoordinatesLatitude.HasValue;
@ -680,7 +681,7 @@ namespace bsmd.dakosy
break;
case Message.NotificationClass.STAT:
{
bsmd.database.STAT stat = dbEntity as bsmd.database.STAT;
bsmd.database.STAT stat = aMessage.Elements[0] as bsmd.database.STAT;
vList.Visit[0].STAT = new STAT();
vList.Visit[0].STAT.ShipName = stat.ShipName;
vList.Visit[0].STAT.CallSign = stat.CallSign;
@ -711,7 +712,7 @@ namespace bsmd.dakosy
break;
case Message.NotificationClass.WAS:
{
bsmd.database.WAS was = dbEntity as bsmd.database.WAS;
bsmd.database.WAS was = aMessage.Elements[0] as bsmd.database.WAS;
vList.Visit[0].WAS = new WAS();
vList.Visit[0].WAS.WasteDisposalValidExemptionSpecified = was.WasteDisposalValidExemption.HasValue;
vList.Visit[0].WAS.WasteDisposalValidExemption = was.WasteDisposalValidExemption ?? false;
@ -726,6 +727,7 @@ namespace bsmd.dakosy
vList.Visit[0].WAS.WasteDisposalServiceProviderName = new WasteDisposalServiceProviderName[was.WasteDisposalServiceProvider.Count];
for (int i = 0; i < was.WasteDisposalServiceProvider.Count; i++)
{
vList.Visit[0].WAS.WasteDisposalServiceProviderName[i] = new WasteDisposalServiceProviderName();
vList.Visit[0].WAS.WasteDisposalServiceProviderName[i].ServiceProviderName = was.WasteDisposalServiceProvider[i].WasteDisposalServiceProviderName;
}
}
@ -738,6 +740,7 @@ namespace bsmd.dakosy
for (int i = 0; i < was.Waste.Count; i++)
{
byte wt = was.Waste[i].WasteType ?? 0;
vList.Visit[0].WAS.Waste[i] = new Waste();
vList.Visit[0].WAS.Waste[i].WasteType = (WasteType)wt;
vList.Visit[0].WAS.Waste[i].Description = was.Waste[i].WasteDescription;
vList.Visit[0].WAS.Waste[i].DisposalAmountMTQSpecified = was.Waste[i].WasteDisposalAmount_MTQ.HasValue;
@ -757,7 +760,7 @@ namespace bsmd.dakosy
case Message.NotificationClass.HAZA:
case Message.NotificationClass.HAZD:
{
bsmd.database.HAZ was = dbEntity as bsmd.database.HAZ;
bsmd.database.HAZ was = aMessage.Elements[0] as bsmd.database.HAZ;
_log.InfoFormat("HAZ(A/D) cannot be sent via eDeclaration, skipping message {0}.", was.MessageHeader.Id);
}
break;
@ -768,10 +771,10 @@ namespace bsmd.dakosy
}
// save to temp file
string fileName = string.Format(@"{0}\{1}.xml", Properties.Settings.Default.SFTPOutDir, Guid.NewGuid().ToString());
string fileName = string.Format(".{0}.xml", Guid.NewGuid().ToString());
string filePath = string.Format(@"{0}\{1}", Properties.Settings.Default.SFTPOutDir, fileName);
XmlSerializer serializer = new XmlSerializer(typeof(eDeclarationMessage));
using(TextWriter tw = new StreamWriter(fileName)) {
using(TextWriter tw = new StreamWriter(filePath)) {
serializer.Serialize(tw, edm);
}

View File

@ -12,7 +12,9 @@ using System.Collections.Generic;
using System.IO;
using System.Xml;
using System.Xml.Serialization;
using System.Text;
using log4net;
using bsmd.database;
@ -22,6 +24,31 @@ namespace bsmd.dakosy
{
private static ILog _log = LogManager.GetLogger(typeof(Request));
public static void ReadAll()
{
// SFTP verbindung öffnen und alle Dateien herunterladen
string localDir = Properties.Settings.Default.SFTPInDir;
string remoteDir = Properties.Settings.Default.TestMode ?
Properties.Settings.Default.RemoteTestOutgoingDir : Properties.Settings.Default.RemoteProdOutgoingDir;
sftp.GetAll(remoteDir);
// lokale Dateien verarbeiten
foreach (string inputFile in Directory.GetFiles(localDir))
{
if (!Response.Read(inputFile))
_log.ErrorFormat("Error reading input file {0}", inputFile);
else
File.Delete(inputFile); // alternativ: move to archive folder
// remote Dateien löschen
sftp.RemoveProcessedFile(remoteDir, Path.GetFileName(inputFile));
}
}
public static bool Read(string fullPath)
{
bool retval = true;
@ -29,63 +56,103 @@ namespace bsmd.dakosy
try
{
XmlSerializer serializer = new XmlSerializer(typeof(EdiResponse));
XmlSerializer serializer = new XmlSerializer(typeof(eDeclarationMessage));
FileStream fs = new FileStream(fullPath, FileMode.Open);
using (TextReader reader = new StreamReader(fs))
using (TextReader reader = new StreamReader(fs, System.Text.Encoding.UTF8))
{
EdiResponse ediResponse = (EdiResponse)serializer.Deserialize(reader);
Guid localReferenceId, messageReferenceId;
if (!Guid.TryParseExact(ediResponse.LocalReferenceNumber, "N", out localReferenceId))
eDeclarationMessage eDeclaration = (eDeclarationMessage)serializer.Deserialize(reader);
if (eDeclaration.InterchangeHeader.TestIndicator)
_log.Info("Test response message received");
eDeclarationMessageInterchangeBodyEdiResponseList responseList = eDeclaration.InterchangeBody.Item as eDeclarationMessageInterchangeBodyEdiResponseList;
foreach(EdiResponse ediResponse in responseList.EdiResponse)
{
_log.ErrorFormat("unable to parse local reference number {0}", ediResponse.LocalReferenceNumber);
}
if(!Guid.TryParseExact(ediResponse.MessageHeader.MessageReferenceNumber, "N", out messageReferenceId))
{
_log.ErrorFormat("unable to parse message reference id {0}", ediResponse.MessageHeader.MessageReferenceNumber);
}
// passendes Objekt in der DB finden:
MessageCore core = DBManager.Instance.GetMessageCoreById(localReferenceId);
DatabaseEntity dbEntity = DBManager.Instance.GetMessageById(messageReferenceId);
Guid localReferenceId, messageReferenceId;
if (!Guid.TryParseExact(ediResponse.LocalReferenceNumber, "N", out localReferenceId))
{
_log.ErrorFormat("unable to parse local reference number {0}", ediResponse.LocalReferenceNumber);
}
if (!Guid.TryParseExact(ediResponse.PreviousMessageNumber, "N", out messageReferenceId))
{
_log.ErrorFormat("unable to parse message reference id {0}", ediResponse.MessageHeader.MessageReferenceNumber);
}
// Objekte aktualisieren und speichern
// passendes Objekt in der DB finden:
MessageCore core = DBManager.Instance.GetMessageCoreById(localReferenceId);
DatabaseEntity dbEntity = DBManager.Instance.GetMessageById(messageReferenceId);
Message aMessage = null;
if (dbEntity.GetType().IsAssignableFrom(typeof(Message)))
aMessage = (Message)dbEntity;
else
aMessage = dbEntity.MessageHeader;
// Objekte aktualisieren und speichern
//ediResponse.ResponseSubType == EdiResponseSubType.FUNCTIONAL // TECHNICAL
Message aMessage = null;
if (dbEntity.GetType().IsAssignableFrom(typeof(Message)))
aMessage = (Message)dbEntity;
else
aMessage = dbEntity.MessageHeader;
switch (ediResponse.ResponseType)
{
case EdiResponseType.ACCEPTED:
_log.Info("response message accepted");
//ediResponse.ResponseSubType == EdiResponseSubType.FUNCTIONAL // TECHNICAL
break;
case EdiResponseType.ERROR:
_log.Info("response message error status");
switch (ediResponse.ResponseType)
{
case EdiResponseType.ACCEPTED:
_log.Info("response message accepted");
break;
case EdiResponseType.PART_ACCEPTED:
_log.Info("response message part accepted");
if (aMessage.MessageNotificationClass == Message.NotificationClass.TRANSIT)
{
core.TransitId = ediResponse.TransitID;
DBManager.Instance.Save(core);
}
break;
case EdiResponseType.RECEIVED:
_log.Info("response message received");
if(aMessage.MessageNotificationClass == Message.NotificationClass.VISIT)
{
core.VisitId = ediResponse.VisitID;
DBManager.Instance.Save(core);
}
aMessage.InternalStatus = Message.BSMDStatus.CONFIRMED;
break;
}
break;
case EdiResponseType.ERROR:
_log.Info("response message error status");
//aMessage.Status = Message.MessageStatus.
aMessage.InternalStatus = Message.BSMDStatus.RESPONSE_RECEIVED;
DBManager.Instance.Save(aMessage);
foreach (ResponseError responseError in ediResponse.Errors)
{
MessageError messageError = new MessageError();
int errCode;
if (Int32.TryParse(responseError.ErrorCode, out errCode))
messageError.ErrorCode = errCode;
else
_log.WarnFormat("cannot parse error code [{0}]", responseError.ErrorCode);
StringBuilder sb = new StringBuilder();
foreach(ErrorInfo errorInfo in responseError.ErrorInformations)
{
sb.AppendLine(errorInfo.Text);
}
messageError.ErrorText = sb.ToString();
messageError.MessageHeaderId = aMessage.Id.Value;
aMessage.ErrorList.Add(messageError);
DBManager.Instance.Save(messageError);
}
aMessage.InternalStatus = Message.BSMDStatus.ERROR;
break;
case EdiResponseType.PART_ACCEPTED:
_log.Info("response message part accepted");
// was passiert in diesem Zustand? Kann wahrscheinlich bei uns nicht passieren,
// weil immer nur eine Nachricht versendet wird
aMessage.InternalStatus = Message.BSMDStatus.ERROR;
break;
case EdiResponseType.RECEIVED:
_log.Info("response message received");
aMessage.InternalStatus = Message.BSMDStatus.CONFIRMED; // ? Ok?
break;
}
DBManager.Instance.Save(aMessage);
}
}
fs.Close();
}
catch (Exception ex)
{
@ -95,6 +162,5 @@ namespace bsmd.dakosy
return retval;
}
}
}

View File

@ -26,16 +26,16 @@
<value>E:\Tools\WinScp\WinSCP.exe</value>
</setting>
<setting name="RemoteProdIncomingDir" serializeAs="String">
<value>dakcmn/bsm/ext-dak </value>
<value>out/prod</value>
</setting>
<setting name="RemoteTestIncomingDir" serializeAs="String">
<value>dakcmn/bsm/ext-dak/test </value>
<value>out/test</value>
</setting>
<setting name="RemoteProdOutgoingDir" serializeAs="String">
<value>dakcmn/bsm/dak-ext </value>
<value>in/prod/ed02</value>
</setting>
<setting name="RemoteTestOutgoingDir" serializeAs="String">
<value>dakcmn/bsm/dak-ext/test </value>
<value>in/test/ed02</value>
</setting>
</bsmd.dakosy.Properties.Settings>
</userSettings>

View File

@ -9,6 +9,7 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Xml;
using System.Xml.XPath;
using System.Collections.Generic;
@ -21,7 +22,7 @@ namespace bsmd.dakosy
/// </summary>
public static class sftp
{
public static void Put(string fullPath, string targetDir)
public static void Put(string filename, string targetDir)
{
Process winscp = new Process();
winscp.StartInfo.FileName = Properties.Settings.Default.WINSCPFullPath;
@ -32,14 +33,18 @@ namespace bsmd.dakosy
winscp.StartInfo.CreateNoWindow = true;
winscp.Start();
string dotlessFilename = filename.Substring(1);
// Feed in the scripting commands
winscp.StandardInput.WriteLine("option batch abort");
winscp.StandardInput.WriteLine("option confirm off");
winscp.StandardInput.WriteLine("open " + Properties.Settings.Default.SFTPSessionName);
winscp.StandardInput.WriteLine("ls");
winscp.StandardInput.WriteLine("lcd " + Properties.Settings.Default.SFTPOutDir);
// winscp.StandardInput.WriteLine("ls");
if (targetDir != null)
winscp.StandardInput.WriteLine("cd " + targetDir);
winscp.StandardInput.WriteLine("put " + fullPath);
winscp.StandardInput.WriteLine("put " + filename);
winscp.StandardInput.WriteLine(string.Format("mv {0} {1}", filename, dotlessFilename));
winscp.StandardInput.Close();
// Collect all output (not used in this example)
@ -83,8 +88,62 @@ namespace bsmd.dakosy
}
public static void GetAll(string fullPath)
public static void GetAll(string remoteDir)
{
Process winscp = new Process();
winscp.StartInfo.FileName = Properties.Settings.Default.WINSCPFullPath;
winscp.StartInfo.Arguments = "/xmllog=\"" + Properties.Settings.Default.SFTPLog + "\"";
winscp.StartInfo.UseShellExecute = false;
winscp.StartInfo.RedirectStandardInput = true;
winscp.StartInfo.RedirectStandardOutput = true;
winscp.StartInfo.CreateNoWindow = true;
winscp.Start();
// Feed in the scripting commands
winscp.StandardInput.WriteLine("option batch abort");
winscp.StandardInput.WriteLine("option confirm off");
winscp.StandardInput.WriteLine("open " + Properties.Settings.Default.SFTPSessionName);
winscp.StandardInput.WriteLine("lcd " + Properties.Settings.Default.SFTPInDir);
// winscp.StandardInput.WriteLine("ls");
if (remoteDir != null)
winscp.StandardInput.WriteLine("cd " + remoteDir);
winscp.StandardInput.WriteLine("get *.xml");
winscp.StandardInput.Close();
// Collect all output (not used in this example)
string output = winscp.StandardOutput.ReadToEnd();
// Wait until WinSCP finishes
winscp.WaitForExit();
}
public static void RemoveProcessedFile(string remoteDir, string filename)
{
Process winscp = new Process();
winscp.StartInfo.FileName = Properties.Settings.Default.WINSCPFullPath;
winscp.StartInfo.Arguments = "/xmllog=\"" + Properties.Settings.Default.SFTPLog + "\"";
winscp.StartInfo.UseShellExecute = false;
winscp.StartInfo.RedirectStandardInput = true;
winscp.StartInfo.RedirectStandardOutput = true;
winscp.StartInfo.CreateNoWindow = true;
winscp.Start();
// Feed in the scripting commands
winscp.StandardInput.WriteLine("option batch abort");
winscp.StandardInput.WriteLine("option confirm off");
winscp.StandardInput.WriteLine("open " + Properties.Settings.Default.SFTPSessionName);
// winscp.StandardInput.WriteLine("ls");
if (remoteDir != null)
winscp.StandardInput.WriteLine("cd " + remoteDir);
winscp.StandardInput.WriteLine("rm " + filename);
winscp.StandardInput.Close();
// Collect all output (not used in this example)
string output = winscp.StandardOutput.ReadToEnd();
// Wait until WinSCP finishes
winscp.WaitForExit();
}

View File

@ -31,6 +31,14 @@ namespace bsmd.database
#region DatabaseEntity implementation
public override string Subtitle
{
get
{
return "Actual time of arrival";
}
}
public override void PrepareSave(System.Data.IDbCommand cmd)
{

View File

@ -31,6 +31,14 @@ namespace bsmd.database
#region DatabaseEntity implementation
public override string Subtitle
{
get
{
return "Actual time of departure";
}
}
public override void PrepareSave(System.Data.IDbCommand cmd)
{

View File

@ -36,6 +36,14 @@ namespace bsmd.database
#region DatabaseEntity implementation
public override string Subtitle
{
get
{
return "Bunker fuel on arrival";
}
}
public override void PrepareSave(System.Data.IDbCommand cmd)
{

View File

@ -108,6 +108,14 @@ namespace bsmd.database
#region IMessageParagraph implementation
public override string Subtitle
{
get
{
return "Border police notification";
}
}
public override List<IMessageParagraph> ChildParagraphs
{
get

View File

@ -36,6 +36,14 @@ namespace bsmd.database
#region DatabaseEntity implementation
public override string Subtitle
{
get
{
return "Bunker fuel on departure";
}
}
public override void PrepareSave(System.Data.IDbCommand cmd)
{

View File

@ -25,33 +25,57 @@ namespace bsmd.database
#region Properties
[ShowReport]
[ReportDisplayName("Last name")]
public string CrewMemberLastName { get; set; }
[ShowReport]
[ReportDisplayName("First name")]
public string CrewMemberFirstName { get; set; }
[ShowReport]
[ReportDisplayName("Place of birth")]
public string CrewMemberPlaceOfBirth { get; set; }
[ShowReport]
public DateTime? CrewMemberDateOfBirth { get; set; }
[ShowReport]
[ReportDisplayName("Date of birth")]
public string CrewMemberDateOfBirthDisplay
{
get
{
if (CrewMemberDateOfBirth.HasValue)
return this.CrewMemberDateOfBirth.Value.ToShortDateString();
return string.Empty;
}
}
public byte? CrewMemberGender { get; set; }
[ShowReport]
public string CrewMemberNationality { get; set; }
[ReportDisplayName("Gender")]
public string CrewMemberGenderDisplay { get { return Util.GetGenderDisplay(this.CrewMemberGender); } }
[ShowReport]
[ReportDisplayName("Nationality")]
public string CrewMemberNationality { get; set; }
public byte? CrewMemberIdentityDocumentType { get; set; }
[ShowReport]
[ReportDisplayName("Identity document type")]
public string CrewMemberIdentityDocumentTypeDisplay { get { return Util.GetIdentityDocumentTypeDisplay(this.CrewMemberIdentityDocumentType); } }
[ShowReport]
[ReportDisplayName("Identity document id")]
public string CrewMemberIdentityDocumentId { get; set; }
[ShowReport]
[ReportDisplayName("Visa number")]
public string CrewMemberVisaNumber { get; set; }
[ShowReport]
[ReportDisplayName("Duty")]
public string CrewMemberDuty { get; set; }
public string Identifier { get; set; }
@ -60,6 +84,14 @@ namespace bsmd.database
#region DatabaseEntity implementation
public override string Subtitle
{
get
{
return "Crew members";
}
}
public override void PrepareSave(System.Data.IDbCommand cmd)
{

View File

@ -11,6 +11,7 @@ using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Diagnostics;
using log4net;
namespace bsmd.database
@ -20,6 +21,7 @@ namespace bsmd.database
private SqlConnection _con;
private static DBManager _instance;
private static ILog _log = LogManager.GetLogger(typeof(DBManager));
private static Dictionary<Guid, ReportingParty> allReportingParties;
#region Properties
@ -74,11 +76,24 @@ namespace bsmd.database
}
public List<MessageCore> GetMessageCoresByStatus(MessageCore.BSMDStatus status)
{
MessageCore aMessageCore = new MessageCore();
SqlCommand cmd = new SqlCommand();
aMessageCore.PrepareLoadCommand(cmd, Message.LoadFilter.BSMDSTATUS, status);
SqlDataReader reader = this.PerformCommand(cmd);
List<DatabaseEntity> cores = aMessageCore.LoadList(reader);
List<MessageCore> result = new List<MessageCore>();
foreach (MessageCore core in cores)
result.Add(core);
return result;
}
public List<MessageCore> GetMessageCoresByReportStatus(MessageCore.ReportStatusEnum reportStatus)
{
MessageCore aMessageCore = new MessageCore();
SqlCommand cmd = new SqlCommand();
Message.LoadFilter filter = Message.LoadFilter.BSMDSTATUS;
aMessageCore.PrepareLoadCommand(cmd, filter, status);
aMessageCore.PrepareLoadCommand(cmd, Message.LoadFilter.REPORTSTATUS, reportStatus);
SqlDataReader reader = this.PerformCommand(cmd);
List<DatabaseEntity> cores = aMessageCore.LoadList(reader);
@ -109,35 +124,38 @@ namespace bsmd.database
}
public List<Message> GetMessagesForCore(MessageCore core)
{
{
Message aMessage = new Message();
SqlCommand cmd = new SqlCommand();
aMessage.PrepareLoadCommand(cmd, Message.LoadFilter.BY_CORE, core.Id);
IDataReader reader = this.PerformCommand(cmd);
List<DatabaseEntity> messages = aMessage.LoadList(reader);
List<Message> messageList = new List<Message>();
List<DatabaseEntity> messages = aMessage.LoadList(reader);
List<Message> messageList = new List<Message>();
foreach (Message message in messages)
{
{
message.MessageCore = core;
messageList.Add(message);
}
}
this.LoadMessageDependencies(messageList);
return messageList;
}
public Dictionary<Guid, ReportingParty> GetReportingPartyDict()
{
ReportingParty aRep = new ReportingParty();
SqlCommand cmd = new SqlCommand();
aRep.PrepareLoadCommand(cmd, Message.LoadFilter.ALL);
if (DBManager.allReportingParties == null)
{
ReportingParty aRep = new ReportingParty();
SqlCommand cmd = new SqlCommand();
aRep.PrepareLoadCommand(cmd, Message.LoadFilter.ALL);
SqlDataReader reader = this.PerformCommand(cmd);
List<DatabaseEntity> reportingParties = aRep.LoadList(reader);
Dictionary<Guid, ReportingParty> result = new Dictionary<Guid, ReportingParty>();
foreach (ReportingParty rp in reportingParties)
result.Add(rp.Id.Value, rp);
return result;
SqlDataReader reader = this.PerformCommand(cmd);
List<DatabaseEntity> reportingParties = aRep.LoadList(reader);
DBManager.allReportingParties = new Dictionary<Guid, ReportingParty>();
foreach (ReportingParty rp in reportingParties)
DBManager.allReportingParties.Add(rp.Id.Value, rp);
}
return DBManager.allReportingParties;
}
public DatabaseEntity GetMessageById(Guid id)
@ -191,6 +209,25 @@ namespace bsmd.database
return result;
}
public MessageCore GetMessageCoreByShipInfos(string imo, DateTime eta, string poc)
{
MessageCore aCore = new MessageCore();
SqlCommand cmd = new SqlCommand();
Message.LoadFilter filter = Message.LoadFilter.IMO_ETA_POC;
aCore.PrepareLoadCommand(cmd, filter, imo, eta, poc);
SqlDataReader reader = this.PerformCommand(cmd);
List<DatabaseEntity> cores = aCore.LoadList(reader);
MessageCore result = null;
if (cores.Count > 0)
{
if (cores.Count > 1)
_log.WarnFormat("Multiple ({3}) cores found for IMO {0}, ETA {1}, PoC {2}",
imo, eta, poc, cores.Count);
result = cores[0] as MessageCore;
}
return result;
}
public void Save(DatabaseEntity entity)
{
@ -200,16 +237,35 @@ namespace bsmd.database
switch(queryResult)
{
case 1:
_log.DebugFormat("Message {0} saved", entity.Id); break;
_log.DebugFormat("Entity {0} saved", entity.Id); break;
case 0:
_log.DebugFormat("Message {0} save affected no rows", entity.Id); break;
_log.DebugFormat("Entity {0} save affected no rows", entity.Id); break;
case -1:
_log.DebugFormat("Message {0} save: error occurred", entity.Id); break;
_log.DebugFormat("Entity {0} save: error occurred", entity.Id); break;
default:
_log.DebugFormat("Message {0} save affected {1} rows", entity.Id, queryResult); break;
_log.DebugFormat("Entity {0} save affected {1} rows", entity.Id, queryResult); break;
}
}
public void Delete(DatabaseEntity entity)
{
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;
}
}
public void Save(MessageCore core)
{
if (core.Customer != null)
@ -236,14 +292,14 @@ namespace bsmd.database
internal void LoadMessageDependencies(List<Message> messageList)
{
// Dictionary<Guid, MessageCore> messageCoreDict = this.GetToSendMessageCoreList();
Dictionary<Guid, ReportingParty> reportingPartyDict = this.GetReportingPartyDict();
Dictionary<Guid, ReportingParty> reportingPartyDict = this.GetReportingPartyDict();
// Zuordnung MessageCore,Zuordnung Reporting party
Message.AssignReportingParties(messageList, reportingPartyDict);
// Message.AssignMessageCores(messageList, messageCoreDict);
foreach (Message message in messageList)
{
{
this.LoadErrorList(message);
this.LoadViolationList(message);
@ -266,7 +322,7 @@ namespace bsmd.database
else
{
_log.DebugFormat("cannot create a message class for notification type {0}", message.MessageNotificationClass);
}
}
}
}
@ -582,6 +638,12 @@ namespace bsmd.database
{
System.Diagnostics.Trace.WriteLine("SQL Exception:" + ex.Message);
_log.Error("Error performing command", ex);
_log.DebugFormat("Query: {0}", cmd.CommandText);
_log.Debug("Parameters:");
for (int i = 0; i < cmd.Parameters.Count; i++)
{
_log.DebugFormat("{0}:{1}", cmd.Parameters[i].ParameterName, cmd.Parameters[i].Value);
}
return null;
}
}
@ -597,6 +659,12 @@ namespace bsmd.database
{
System.Diagnostics.Trace.WriteLine("SQL Exception:" + ex.Message);
_log.Error("Error performing command", ex);
_log.DebugFormat("Query: {0}", cmd.CommandText);
_log.Debug("Parameters:");
for (int i = 0; i < cmd.Parameters.Count; i++)
{
_log.DebugFormat("{0}:{1}", cmd.Parameters[i].ParameterName, cmd.Parameters[i].Value);
}
return -1;
}
}

View File

@ -82,6 +82,16 @@ namespace bsmd.database
}
}
public virtual string Subtitle
{
get { return string.Empty; }
}
public virtual bool ShowChildrenAsTable
{
get { return false; }
}
/// <summary>
/// must be overridden if it must make sense
/// </summary>
@ -99,7 +109,14 @@ namespace bsmd.database
{
object propValue = property.GetValue(this, null);
string value = (propValue == null) ? string.Empty : propValue.ToString();
result.Add(new KeyValuePair<string, string>(property.Name, value));
string displayName = property.Name;
if(Attribute.IsDefined(property, typeof(ReportDisplayNameAttribute))) {
ReportDisplayNameAttribute reportDisplayNameAttribute = Attribute.GetCustomAttribute(property, typeof(ReportDisplayNameAttribute))
as ReportDisplayNameAttribute;
displayName = reportDisplayNameAttribute.DisplayName;
}
result.Add(new KeyValuePair<string, string>(displayName, value));
}
return result;

View File

@ -11,7 +11,7 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text.RegularExpressions;
using log4net;
namespace bsmd.database
{
@ -20,6 +20,7 @@ namespace bsmd.database
/// </summary>
public static class Extensions
{
private static ILog _log = LogManager.GetLogger(typeof(Extensions));
public static bool IsNullOrEmpty(this String str)
{
@ -61,11 +62,33 @@ namespace bsmd.database
return source.IndexOf(toCheck, comp) >= 0;
}
public static DateTime? TryParse(string text)
public static DateTime? TryParseDateTime(string text)
{
DateTime date;
return DateTime.TryParse(text, DateTimeFormatInfo.InvariantInfo,DateTimeStyles.AssumeUniversal, out date) ? date : (DateTime?)null;
if(DateTime.TryParse(text, DateTimeFormatInfo.InvariantInfo,DateTimeStyles.AssumeUniversal, out date))
{
return date;
}
else
{
_log.WarnFormat("{0} cannot be parsed as datetime", text);
return null;
}
}
public static double? TryParseDouble(string text)
{
double d;
if (Double.TryParse(text, NumberStyles.Any, NumberFormatInfo.InvariantInfo, out d))
{
return d;
}
else
{
_log.WarnFormat("{0} cannot be parsed as double", text);
return null;
}
}
}
}

View File

@ -206,6 +206,14 @@ namespace bsmd.database
#region IMessageParagraph implementation
public override string Subtitle
{
get
{
return this.IsDeparture ? "Hazardous items on departure" : "Hazardous items on arrival";
}
}
public override List<IMessageParagraph> ChildParagraphs
{
get

View File

@ -10,9 +10,14 @@ namespace bsmd.database
/// Interface to print nsw messages to a report (get text info from messages)
/// </summary>
public interface IMessageParagraph
{
{
string Title { get; }
string Subtitle { get; }
bool ShowChildrenAsTable { get; }
List<KeyValuePair<string, string>> MessageText { get; }
List<IMessageParagraph> ChildParagraphs { get; }

View File

@ -46,6 +46,14 @@ namespace bsmd.database
#region DatabaseEntity implementation
public override string Subtitle
{
get
{
return "General information";
}
}
public override void PrepareSave(System.Data.IDbCommand cmd)
{

View File

@ -42,6 +42,14 @@ namespace bsmd.database
#region DatabaseEntity implementation
public override string Subtitle
{
get
{
return "Cargo information";
}
}
public override void PrepareSave(System.Data.IDbCommand cmd)
{

View File

@ -131,7 +131,7 @@ namespace bsmd.database
"AwareOfFurtherInfections = @P11, SanitaryMeasuresApplied = @P12, SanitaryMeasuresType = @P13, SanitaryMeasuresLocation = @P14, " +
"SanitaryMeasuresDate = @P15, StowawaysDetected = @P16, StowawaysJoiningLocation = @P17, SickAnimalOrPetOnBoard = @P18, " +
"ValidSanitaryControlExemptionOrCertificateOnBoard = @P19, PlaceofIssue = @P20, DateOfIssue = @P21, SanitaryControlReinspectionRequired = @P22, " +
"InfectedAreaVisited = @P23, InfectedAreaPort = @P24, InfectedAreaDate = @P25", this.Tablename);
"InfectedAreaVisited = @P23, InfectedAreaPort = @P24, InfectedAreaDate = @P25 WHERE Id = @ID", this.Tablename);
scmd.Parameters.AddWithValue("@ID", this.Id);
}
}
@ -218,6 +218,14 @@ namespace bsmd.database
#region IMessageParagraph implementation
public override string Subtitle
{
get
{
return "Medical declaration of health";
}
}
public override List<IMessageParagraph> ChildParagraphs
{
get

View File

@ -57,7 +57,9 @@ namespace bsmd.database
BY_CORE,
NOA_NODID,
HAZ_ID,
IMDG_ID
IMDG_ID,
REPORTSTATUS,
IMO_ETA_POC
}
/// <summary>
@ -70,9 +72,9 @@ namespace bsmd.database
TOSEND,
SENT,
SEND_FAILED,
RESPONSE_RECEIVED,
CONFIRMED,
VIOLATION,
ERROR
ERROR,
}
/// <summary>
@ -354,6 +356,17 @@ namespace bsmd.database
}
}
public override string Subtitle
{
get
{
if (this.Elements.Count > 0)
return this.Elements[0].Subtitle;
else
return string.Empty;
}
}
public override List<KeyValuePair<string, string>> MessageText
{
get
@ -381,7 +394,14 @@ namespace bsmd.database
case NotificationClass.TIEFA:
case NotificationClass.TIEFD:
case NotificationClass.WAS:
return this.Elements[0].MessageText;
if (this.Elements.Count > 0)
{
return this.Elements[0].MessageText;
}
else
{
return null;
}
default:
return null;
@ -389,6 +409,21 @@ namespace bsmd.database
}
}
public override bool ShowChildrenAsTable
{
get
{
switch (this.MessageNotificationClass)
{
case NotificationClass.CREW:
case NotificationClass.PAS:
return true;
default:
return false;
}
}
}
public override List<IMessageParagraph> ChildParagraphs
{
get
@ -416,7 +451,14 @@ namespace bsmd.database
case NotificationClass.TIEFA:
case NotificationClass.TIEFD:
case NotificationClass.WAS:
return this.Elements[0].ChildParagraphs;
if (this.Elements.Count > 0)
{
return this.Elements[0].ChildParagraphs;
}
else
{
return null;
}
default:
List<IMessageParagraph> result = new List<IMessageParagraph>();

View File

@ -36,8 +36,19 @@ namespace bsmd.database
FAILURE,
REPORTREQUESTED,
ARCHIVED,
HIS_FAILURE_DBH,
CREATE_RECEIVE_RECEIPT
HIS_FAILURE_DBH
}
/// <summary>
/// Dieses Enum dient zur Steuerung des ReportGenerator Service
/// </summary>
public enum ReportStatusEnum
{
NONE = 0, // keine Aktion
COMPLETE, // Report mit vollst. Ausgabe aller Felder
HE_REVISION, // eine neue EU-NOAD Rev. wurde empfangen (TBD)
HE_REPORTTYPE, // ein neuer EU-NOAD ReportType wurde empfangen (TBD)
RECEIPT // einfache Empfangsbestätigung (TBD)
}
#endregion
@ -76,10 +87,16 @@ namespace bsmd.database
public string HerbergEmail24HrsContact { get; set; }
public DateTime? HerbergRevDate { get; set; }
public Customer Customer { get; set; }
public Guid? CustomerId { get { return this.customerId; } set { this.customerId = value; } }
public ReportStatusEnum ReportStatus { get; set; }
public string SietasSheetVersion { get; set; }
#endregion
#region DatabaseEntity implementation
@ -119,6 +136,9 @@ namespace bsmd.database
scmd.Parameters.AddWithNullableValue("@P18", this.HerbergEmailContactReportingVessel);
scmd.Parameters.AddWithNullableValue("@P19", this.HerbergEmail24HrsContact);
scmd.Parameters.AddWithNullableValue("@P20", this.ETAKielCanal);
scmd.Parameters.AddWithNullableValue("@P21", this.HerbergRevDate);
scmd.Parameters.AddWithValue("@P22", this.ReportStatus);
scmd.Parameters.AddWithNullableValue("@P23", this.SietasSheetVersion);
if (this.IsNew)
{
@ -126,8 +146,10 @@ namespace bsmd.database
scmd.Parameters.AddWithValue("@ID", this.Id);
string query = string.Format("INSERT INTO {0} (Id, VisitId, TransitId, IMO, ENI, PoC, Portname, ETA, CustomerId, " +
"Previous, Next, IsTransit, Wetris_zz_56_datensatz_id, BSMDStatus, InitialHIS, HerbergFormGuid, " +
"HerbergFormTemplateGuid, HerbergReportType, HerbergEmailcontactReportingVessel, HerbergEmail24HrsContact, ETAKielCanal) VALUES " +
"(@ID, @P1, @P2, @P3, @P4, @P5, @P6, @P7, @P8, @P9, @P10, @P11, @P12, @P13, @P14, @P15, @P16, @P17, @P18, @P19, @P20)",
"HerbergFormTemplateGuid, HerbergReportType, HerbergEmailcontactReportingVessel, HerbergEmail24HrsContact, " +
"ETAKielCanal, HerbergRevDate, ReportStatus, SietasSheetVersion) VALUES " +
"(@ID, @P1, @P2, @P3, @P4, @P5, @P6, @P7, @P8, @P9, @P10, @P11, @P12, @P13, @P14, @P15, @P16, @P17, " +
"@P18, @P19, @P20, @P21, @P22, @P23)",
this.Tablename);
scmd.CommandText = query;
}
@ -138,7 +160,8 @@ namespace bsmd.database
"Portname = @P6, ETA = @P7, CustomerId = @P8, Previous = @P9, Next = @P10, IsTransit = @P11, " +
"Wetris_zz_56_datensatz_id = @P12, BSMDStatus = @P13, InitialHIS = @P14, HerbergFormGuid = @P15, " +
"HerbergFormTemplateGuid = @P16, HerbergReportType = @P17, HerbergEmailContactReportingVessel = @P18, " +
"HerbergEmail24HrsContact = @P19, ETAKielCanal = @P20 WHERE Id = @ID", this.Tablename);
"HerbergEmail24HrsContact = @P19, ETAKielCanal = @P20, HerbergRevDate = @P21, ReportStatus = @P22, " +
"SietasSheetVersion = @P23 WHERE Id = @ID", this.Tablename);
scmd.CommandText = query;
}
}
@ -148,7 +171,8 @@ namespace bsmd.database
string query = string.Format("SELECT Id, VisitId, TransitId, IMO, ENI, PoC, Portname, " +
"ETA, CustomerId, Previous, Next, IsTransit, Wetris_zz_56_datensatz_id, BSMDStatus, InitialHIS, " +
"HerbergFormGuid, HerbergFormTemplateGuid, HerbergReportType, HerbergEmailContactReportingVessel, " +
"HerbergEmail24HrsContact, ETAKielCanal FROM {0} ", this.Tablename);
"HerbergEmail24HrsContact, ETAKielCanal, HerbergRevDate, ReportStatus, SietasSheetVersion FROM {0} ",
this.Tablename);
switch (filter)
{
@ -170,6 +194,26 @@ namespace bsmd.database
((SqlCommand)cmd).Parameters.AddWithValue("@STATUS", criteria[0]);
break;
}
case Message.LoadFilter.REPORTSTATUS:
{
query += "WHERE ReportStatus = @REPORTSTATUS";
((SqlCommand)cmd).Parameters.AddWithValue("@REPORTSTATUS", criteria[0]);
break;
}
case Message.LoadFilter.BY_ID:
{
query += "WHERE Id = @ID";
((SqlCommand)cmd).Parameters.AddWithValue("@ID", criteria[0]);
break;
}
case Message.LoadFilter.IMO_ETA_POC:
{
query += "WHERE (IMO = @IMO AND ETA = @ETA AND Portname = @POC)";
((SqlCommand)cmd).Parameters.AddWithValue("@IMO", criteria[0]);
((SqlCommand)cmd).Parameters.AddWithValue("@ETA", criteria[1]);
((SqlCommand)cmd).Parameters.AddWithValue("@POC", criteria[2]);
break;
}
case Message.LoadFilter.ALL:
default:
break;
@ -205,6 +249,9 @@ namespace bsmd.database
if (!reader.IsDBNull(18)) core.HerbergEmailContactReportingVessel = reader.GetString(18);
if (!reader.IsDBNull(19)) core.HerbergEmail24HrsContact = reader.GetString(19);
if (!reader.IsDBNull(20)) core.ETAKielCanal = reader.GetDateTime(20);
if (!reader.IsDBNull(21)) core.HerbergRevDate = reader.GetDateTime(21);
if (!reader.IsDBNull(22)) core.ReportStatus = (ReportStatusEnum) Enum.ToObject(typeof(ReportStatusEnum), reader.GetByte(22));
if (!reader.IsDBNull(23)) core.SietasSheetVersion = reader.GetString(23);
result.Add(core);
}

View File

@ -31,6 +31,14 @@ namespace bsmd.database
#region DatabaseEntity implementation
public override string Subtitle
{
get
{
return "Name of master";
}
}
public override void PrepareSave(System.Data.IDbCommand cmd)
{

View File

@ -137,6 +137,14 @@ namespace bsmd.database
#region IMessageParagraph implementation
public override string Subtitle
{
get
{
return "Arrival and departure notification";
}
}
public override List<IMessageParagraph> ChildParagraphs
{
get

View File

@ -24,32 +24,70 @@ namespace bsmd.database
#region Properties
[ShowReport]
[ReportDisplayName("Last name")]
public string PassengerLastName { get; set; }
[ShowReport]
[ReportDisplayName("First name")]
public string PassengerFirstName { get; set; }
[ShowReport]
[ReportDisplayName("Place of birth")]
public string PassengerPlaceOfBirth { get; set; }
[ShowReport]
public DateTime? PassengerDateOfBirth { get; set; }
[ShowReport]
[ReportDisplayName("Date of birth")]
public string PassengerDateOfBirthDisplay {
get
{
if (this.PassengerDateOfBirth.HasValue)
return this.PassengerDateOfBirth.Value.ToShortDateString();
return string.Empty;
}
}
public byte? PassengerGender { get; set; }
[ShowReport]
[ReportDisplayName("Gender")]
public string PassengerGenderDisplay { get { return Util.GetGenderDisplay(this.PassengerGender); } }
[ShowReport]
[ReportDisplayName("Nationality")]
public string PassengerNationality { get; set; }
[ShowReport]
public byte? PassengerIdentityDocumentType { get; set; }
[ShowReport]
[ReportDisplayName("Identity document type")]
public string PassengerIdentityDocumentTypeDisplay { get { return Util.GetIdentityDocumentTypeDisplay(this.PassengerIdentityDocumentType); } }
[ShowReport]
[ReportDisplayName("Identity document id")]
public string PassengerIdentityDocumentId { get; set; }
[ShowReport]
[ReportDisplayName("Visa number")]
public string PassengerVisaNumber { get; set; }
[ShowReport]
[ReportDisplayName("Port of embarkation")]
public string PassengerPortOfEmbarkation { get; set; }
[ShowReport]
[ReportDisplayName("Port od disembarkation")]
public string PassengerPortOfDisembarkation { get; set; }
[ShowReport]
[ReportDisplayName("In transit")]
public bool? PassengerInTransit { get; set; }
public string Identifier { get; set; }
public override string Subtitle
{
get
{
return "Passenger information";
}
}
#endregion
#region DatabaseEntity implementation

View File

@ -34,6 +34,14 @@ namespace bsmd.database
#endregion
public override string Subtitle
{
get
{
return "Persons on board on arrival";
}
}
public override void PrepareSave(System.Data.IDbCommand cmd)
{

View File

@ -32,6 +32,14 @@ namespace bsmd.database
[ShowReport]
public int? TotalStowawaysOnBoardUponDeparture { get; set; }
public override string Subtitle
{
get
{
return "Persons on board on arrival";
}
}
#endregion
public override void PrepareSave(System.Data.IDbCommand cmd)

View File

@ -42,6 +42,14 @@ namespace bsmd.database
[ShowReport]
public double? PlannedPeriodOfStay_HUR { get; set; }
public override string Subtitle
{
get
{
return "72h appointment";
}
}
#endregion
#region DatabaseEntity implementation

View File

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

View File

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

View File

@ -197,6 +197,14 @@ namespace bsmd.database
#region IMessageParagraph implementation
public override string Subtitle
{
get
{
return "Sea security notification";
}
}
public override List<IMessageParagraph> ChildParagraphs
{
get

View File

@ -32,6 +32,14 @@ namespace bsmd.database
public string Identifier { get; set; }
public override string Subtitle
{
get
{
return "Vessel service notification";
}
}
#endregion
#region DatabaseEntity implementation

View File

@ -0,0 +1,175 @@
//
// Class: SOAPLoggerExtension
// Current CLR: 4.0.30319.34209
// System: Microsoft Visual Studio 10.0
// Author: dani
// Created: 6/4/2015 7:49:28 AM
//
// Copyright (c) 2015 Informatikbüro Daniel Schick. All rights reserved.
using System;
using System.Collections.Generic;
using System.IO;
using System.Web.Services.Protocols;
using log4net;
namespace bsmd.database
{
/// <summary>
/// Hilfsklasse um die eigentlichen SOAP-Inhalte mitzulesen
/// http://stackoverflow.com/questions/300674/getting-raw-soap-data-from-a-web-reference-client-running-in-asp-net
/// und
/// http://www.rhyous.com/2015/04/29/authenticating-to-java-web-services-with-csharp-using-soap-authentication/
/// </summary>
public class SOAPLoggerExtension : SoapExtension
{
private static readonly ILog _log = LogManager.GetLogger(typeof(SOAPLoggerExtension));
private Stream oldStream;
private Stream newStream;
public override object GetInitializer(LogicalMethodInfo methodInfo, SoapExtensionAttribute attribute)
{
return null;
}
public override object GetInitializer(Type serviceType)
{
return null;
}
public override void Initialize(object initializer)
{
}
public override System.IO.Stream ChainStream(System.IO.Stream stream)
{
oldStream = stream;
newStream = new MemoryStream();
return newStream;
}
public override void ProcessMessage(SoapMessage message)
{
switch (message.Stage)
{
case SoapMessageStage.BeforeSerialize:
_log.Debug("BeforeSerialize");
break;
case SoapMessageStage.AfterSerialize:
this.Log(message, "AfterSerialize");
CopyStream(newStream, oldStream);
newStream.Position = 0;
break;
case SoapMessageStage.BeforeDeserialize:
CopyStream(oldStream, newStream);
this.Log(message, "BeforeDeserialize");
break;
case SoapMessageStage.AfterDeserialize:
_log.Debug("AfterDeserialize");
break;
}
}
public void Log(SoapMessage message, string stage)
{
newStream.Position = 0;
string contents = (message is SoapServerMessage) ? "SoapRequest " : "SoapResponse ";
contents += stage + ";";
StreamReader reader = new StreamReader(newStream);
contents += reader.ReadToEnd();
newStream.Position = 0;
_log.Debug(contents);
}
void ReturnStream()
{
CopyAndReverse(newStream, oldStream);
}
void ReceiveStream()
{
CopyAndReverse(newStream, oldStream);
}
public void ReverseIncomingStream()
{
ReverseStream(newStream);
}
public void ReverseOutgoingStream()
{
ReverseStream(newStream);
}
public void ReverseStream(Stream stream)
{
TextReader tr = new StreamReader(stream);
string str = tr.ReadToEnd();
char[] data = str.ToCharArray();
Array.Reverse(data);
string strReversed = new string(data);
TextWriter tw = new StreamWriter(stream);
stream.Position = 0;
tw.Write(strReversed);
tw.Flush();
}
void CopyAndReverse(Stream from, Stream to)
{
TextReader tr = new StreamReader(from);
TextWriter tw = new StreamWriter(to);
string str = tr.ReadToEnd();
char[] data = str.ToCharArray();
Array.Reverse(data);
string strReversed = new string(data);
tw.Write(strReversed);
tw.Flush();
}
private void CopyStream(Stream fromStream, Stream toStream)
{
try
{
StreamReader sr = new StreamReader(fromStream);
StreamWriter sw = new StreamWriter(toStream);
sw.WriteLine(sr.ReadToEnd());
sw.Flush();
}
catch (Exception ex)
{
string message = String.Format("CopyStream failed because: {0}", ex.Message);
_log.Error(message, ex);
}
}
}
#region class SoapLoggerExtensionAttribute
[AttributeUsage(AttributeTargets.Method)]
public class SoapLoggerExtensionAttribute : SoapExtensionAttribute
{
private int priority = 1;
public override int Priority
{
get { return priority; }
set { priority = value; }
}
public override System.Type ExtensionType
{
get { return typeof(bsmd.database.SOAPLoggerExtension); }
}
}
#endregion
}

View File

@ -70,7 +70,15 @@ namespace bsmd.database
public string ISMCompanyCity { get; set; }
[ShowReport]
public string ISMCompanyCountry { get; set; }
public string ISMCompanyCountry { get; set; }
public override string Subtitle
{
get
{
return "Vessel details";
}
}
#endregion

View File

@ -12,8 +12,26 @@ using System.Collections.Generic;
namespace bsmd.database
{
[AttributeUsage(AttributeTargets.Property)]
public class ShowReportAttribute : Attribute
{
public ShowReportAttribute() { }
}
[AttributeUsage(AttributeTargets.Property)]
public class ReportDisplayNameAttribute : Attribute
{
private string displayName;
public ReportDisplayNameAttribute(string displayName)
{
this.displayName = displayName;
}
public string DisplayName
{
get { return this.displayName; }
set { this.displayName = value; }
}
}
}

View File

@ -0,0 +1,98 @@
//
// Class: SubsidiaryRisks
// Current CLR: 4.0.30319.34209
// System: Microsoft Visual Studio 10.0
// Author: dani
// Created: 5/31/2015 10:00:57 AM
//
// Copyright (c) 2015 Informatikbüro Daniel Schick. All rights reserved.
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
namespace bsmd.database
{
public class SubsidiaryRisks : DatabaseEntity, ISublistElement
{
public SubsidiaryRisks()
{
this.tablename = "[dbo].[SubsidiaryRisks]";
}
#region Properties
public IMDGPosition IMDGPosition { get; set; }
[ShowReport]
public string SubsidiaryRisk { get; set; }
public string Identifier { get; set; }
#endregion
#region DatabaseEntity implementation
public override void PrepareSave(IDbCommand cmd)
{
SqlCommand scmd = cmd as SqlCommand;
scmd.Parameters.AddWithValue("@P1", this.IMDGPosition.Id);
scmd.Parameters.AddWithNullableValue("@P2", this.SubsidiaryRisk);
scmd.Parameters.AddWithNullableValue("@P3", this.Identifier);
if (this.IsNew)
{
cmd.CommandText = string.Format("INSERT INTO {0} (IMDGPositionId, SubsidiaryRisk, Identifier) " +
"VALUES (@P1, @P2, @P3)", this.Tablename);
}
else
{
cmd.CommandText = string.Format("UPDATE {0} SET SubsidiaryRisk = @P2 WHERE Id = @ID", this.Tablename);
scmd.Parameters.AddWithValue("@ID", this.Id);
}
}
public override void PrepareLoadCommand(IDbCommand cmd, Message.LoadFilter filter, params object[] criteria)
{
string query = string.Format("SELECT Id, SubsidiaryRisk, Identifier FROM {0}",
this.Tablename);
switch (filter)
{
case Message.LoadFilter.IMDG_ID:
query += "WHERE IMDGPositionId = @IMDGID";
((SqlCommand)cmd).Parameters.AddWithValue("@IMDGID", criteria[0]);
break;
case Message.LoadFilter.ALL:
default:
break;
}
cmd.CommandText = query;
}
public override List<DatabaseEntity> LoadList(IDataReader reader)
{
List<DatabaseEntity> result = new List<DatabaseEntity>();
while (reader.Read())
{
SubsidiaryRisks sRisks = new SubsidiaryRisks();
sRisks.id = reader.GetGuid(0);
if (!reader.IsDBNull(1)) sRisks.SubsidiaryRisk = reader.GetString(1);
if (!reader.IsDBNull(2)) sRisks.Identifier = reader.GetString(2);
result.Add(sRisks);
}
reader.Close();
return result;
}
#endregion
}
}

View File

@ -26,6 +26,14 @@ namespace bsmd.database
[ShowReport]
public double? DraughtUponArrival_DMT { get; set; }
public override string Subtitle
{
get
{
return "Draught at arrival notification";
}
}
#endregion
#region DatabaseEntity implementation

View File

@ -26,6 +26,14 @@ namespace bsmd.database
[ShowReport]
public double? DraughtUponDeparture_DMT { get; set; }
public override string Subtitle
{
get
{
return "Draught at arrival notification";
}
}
#endregion
#region DatabaseEntity implementation

View File

@ -73,6 +73,14 @@ namespace bsmd.database
public string Identifier { get; set; }
public override string Subtitle
{
get
{
return "Towage at arrival";
}
}
#endregion
#region DatabaseEntity implementation

View File

@ -68,6 +68,14 @@ namespace bsmd.database
public string Identifier { get; set; }
public override string Subtitle
{
get
{
return "Towage on departure";
}
}
#endregion
#region DatabaseEntity implementation

View File

@ -26,5 +26,43 @@ namespace bsmd.database
else
return collection.AddWithValue(parameterName, value);
}
public static string GetGenderDisplay(byte? val)
{
if (val.HasValue)
{
switch (val)
{
case 0: return "Male";
case 1: return "Female";
default: return "Other";
}
}
else
{
return "Unknown";
}
}
public static string GetIdentityDocumentTypeDisplay(byte? val)
{
if(val.HasValue)
{
switch (val)
{
case 0: return "Identity card";
case 1: return "Passport";
case 2: return "Muster book";
case 3: return "Picture ID";
case 4: return "Residantal permit";
default: return "Other legal identity document";
}
}
else
{
return "Unknown";
}
}
}
}

View File

@ -133,6 +133,14 @@ namespace bsmd.database
#region IMessageParagraph implementation
public override string Subtitle
{
get
{
return "Waste/cargo residue";
}
}
public override List<IMessageParagraph> ChildParagraphs
{
get

View File

@ -25,7 +25,29 @@ namespace bsmd.database
#region Properties
public WAS WAS { get; set; }
[ShowReport]
public string WasteTypeDisplay
{
get
{
if (!WasteType.HasValue) return "";
switch (WasteType.Value)
{
case 1: return "WASTE_OILS-SLUDGE";
case 2: return "WASTE_OILS-BILGE_WATER";
case 3: return "WASTE_OILS-OTHERS";
case 4: return "GARBAGE-FOOD_WASTE";
case 5: return "GARBATE-PLASTIC";
case 6: return "GARBAGE-OTHER";
case 7: return "SEWAGE";
case 8: return "CARGO-ASSOSIATED_WASTE";
case 9: return "CARGO-RESIDUES";
default: return "";
}
}
}
public byte? WasteType { get; set; }
[ShowReport]
public string WasteDescription { get; set; }
@ -40,6 +62,7 @@ namespace bsmd.database
[ShowReport]
public double? WasteAmountGeneratedTillNextPort_MTQ { get; set; }
public string Identifier { get; set; }
#endregion

View File

@ -20,7 +20,11 @@ namespace bsmd.dbh.ResponseService
[OperationContract(Action = "http://tempuri.org/IResponseService/NSWResponse")]
[XmlSerializerFormatAttribute()]
void root(string Version, string MessageId, string VisitId, string TransitId, DateTime Timestamp,
string SenderReference, bsmd.dbh.response.RootType Type,
string SenderReference, bsmd.dbh.response.RootType Type,
List<bsmd.dbh.response.RootReportingClassesFullReportingClass> ReportingClassesFull,
List<bsmd.dbh.response.RootReportingClassesPartialReportingClass> ReportingClassesPartial,
List<bsmd.dbh.response.RootReportingClassesErrorReportingClass> RootReportingClassesError,
List<bsmd.dbh.response.RootReportingClassesResettedReportingClass> ReportingClassesResetted,
List<bsmd.dbh.response.RootMessage> Messages);
}

View File

@ -19,6 +19,10 @@ namespace bsmd.dbh.ResponseService
public void root(string Version, string MessageId, string VisitId, string TransitId, DateTime Timestamp,
string SenderReference, bsmd.dbh.response.RootType Type,
List<bsmd.dbh.response.RootReportingClassesFullReportingClass> ReportingClassesFull,
List<bsmd.dbh.response.RootReportingClassesPartialReportingClass> ReportingClassesPartial,
List<bsmd.dbh.response.RootReportingClassesErrorReportingClass> RootReportingClassesError,
List<bsmd.dbh.response.RootReportingClassesResettedReportingClass> ReportingClassesResetted,
List<bsmd.dbh.response.RootMessage> Messages)
{
@ -33,7 +37,7 @@ namespace bsmd.dbh.ResponseService
if (Timestamp != null)
_log.InfoFormat("Timestamp: {0}", Timestamp);
if (SenderReference != null)
_log.InfoFormat("Sender-Reference: {0}", SenderReference);
_log.InfoFormat("Sender-Reference: {0}", SenderReference);
_log.InfoFormat("Type: {0}", Type);
if (Messages != null)
@ -43,27 +47,19 @@ namespace bsmd.dbh.ResponseService
_log.InfoFormat("Message type {0}: {1}", rootMessage.Type, rootMessage.Text);
}
}
/*
if (!(root is bsmd.dbh.response.Root))
if (SenderReference.IsNullOrEmpty())
{
_log.Info(root);
_log.ErrorFormat("No sender reference, cannot process message");
return;
}
else
{
_log.Info("response received!");
if (root != null)
{
_log.Info("processing..");
Response.ProcessResponse((bsmd.dbh.response.Root) root, Properties.Settings.Default.DBConnectionString);
}
else
{
_log.Fatal("root element null (probable deserialization problem");
}
}
*/
_log.DebugFormat("processing {0}..", MessageId ?? "?");
Response.ProcessResponse(VisitId, TransitId, Timestamp, SenderReference, Type, Messages,
ReportingClassesFull, ReportingClassesPartial, RootReportingClassesError, ReportingClassesResetted,
Properties.Settings.Default.DBConnectionString);
}
}
}

View File

@ -664,14 +664,19 @@ namespace bsmd.dbh
rootMDH.ItemsElementName[7] = ItemsChoiceType2.AwareOfConditionsForFurtherInfections;
rootMDH.Items[7] = mdh.AwareOfFurtherInfections ?? false ? RootMDHAwareOfConditionsForFurtherInfections.Y : RootMDHAwareOfConditionsForFurtherInfections.N;
rootMDH.ItemsElementName[8] = ItemsChoiceType2.SanitaryMeasuresApplied;
rootMDH.Items[8] = mdh.SanitaryMeasuresApplied ?? false ? RootMDHSanitaryMeasuresApplied.Y : RootMDHSanitaryMeasuresApplied.N;
rootMDH.ItemsElementName[9] = ItemsChoiceType2.SanitaryMeasuresDetails;
RootMDHSanitaryMeasuresDetails smDet = new RootMDHSanitaryMeasuresDetails();
if (mdh.SanitaryMeasuresDate.HasValue)
smDet.SanitaryMeasuresDate = mdh.SanitaryMeasuresDate.Value;
smDet.SanitaryMeasuresType = mdh.SanitaryMeasuresType;
smDet.SanitaryMeasuresLocation = mdh.SanitaryMeasuresLocation;
rootMDH.Items[9] = smDet;
rootMDH.Items[8] = mdh.SanitaryMeasuresApplied ?? false ? RootMDHSanitaryMeasuresApplied.Y : RootMDHSanitaryMeasuresApplied.N;
if (mdh.SanitaryMeasuresApplied ?? false)
{
rootMDH.ItemsElementName[9] = ItemsChoiceType2.SanitaryMeasuresDetails;
RootMDHSanitaryMeasuresDetails smDet = new RootMDHSanitaryMeasuresDetails();
if (mdh.SanitaryMeasuresDate.HasValue)
smDet.SanitaryMeasuresDate = mdh.SanitaryMeasuresDate.Value;
smDet.SanitaryMeasuresType = mdh.SanitaryMeasuresType;
smDet.SanitaryMeasuresLocation = mdh.SanitaryMeasuresLocation;
rootMDH.Items[9] = smDet;
}
rootMDH.ItemsElementName[10] = ItemsChoiceType2.StowawaysDetected;
rootMDH.Items[10] = mdh.StowawaysDetected ?? false ? RootMDHStowawaysDetected.Y : RootMDHStowawaysDetected.N;
rootMDH.ItemsElementName[11] = ItemsChoiceType2.StowawaysJoiningLocation;
@ -739,55 +744,64 @@ namespace bsmd.dbh
}
else
{
rootWAS.Items = new object[5];
rootWAS.ItemsElementName = new ItemsChoiceType3[5];
rootWAS.Items = new object[14];
rootWAS.ItemsElementName = new ItemsChoiceType3[14];
rootWAS.ItemsElementName[0] = ItemsChoiceType3.LastWasteDisposalPort;
rootWAS.Items[0] = was.LastWasteDisposalPort;
rootWAS.ItemsElementName[0] = ItemsChoiceType3.ConfirmationOfCorrectness;
rootWAS.Items[0] = was.ConfirmationOfCorrectness ?? false ? RootWASConfirmationOfCorrectness.Y : RootWASConfirmationOfCorrectness.N;
rootWAS.ItemsElementName[1] = ItemsChoiceType3.LastWasteDisposalDate;
if (was.LastWasteDisposalDate.HasValue)
rootWAS.Items[1] = was.LastWasteDisposalDate.Value;
rootWAS.ItemsElementName[2] = ItemsChoiceType3.WasteDisposalServiceProviderName;
// TODO: Klären wie es nun genau hier aussieht!
/*
if(was.WasteDisposalServiceProvider.Count > 0) {
rootWAS.Items[2] = new string[was.WasteDisposalServiceProvider.Count];
for (int i = 0; i < was.WasteDisposalServiceProvider.Count; i++)
{
rootWAS.Items[2][i] = was.WasteDisposalServiceProvider[i].WasteDisposalServiceProviderName;
}
}
rootWAS.ItemsElementName[2] = ItemsChoiceType3.LastWasteDisposalPort;
rootWAS.Items[2] = was.LastWasteDisposalPort;
*/
rootWAS.ItemsElementName[2] = ItemsChoiceType3.WasteDisposalServiceProviderName;
rootWAS.ItemsElementName[3] = ItemsChoiceType3.WasteDisposalDelivery;
if (was.WasteDisposalDelivery.HasValue)
rootWAS.Items[3] = (RootWASWasteDisposalDelivery)was.WasteDisposalDelivery.Value;
rootWAS.ItemsElementName[4] = ItemsChoiceType3.Waste;
if (was.Waste.Count > 0)
rootWAS.ItemsElementName[4] = ItemsChoiceType3.WasteDisposalServiceProviderName;
if (was.WasteDisposalServiceProvider.Count > 0)
{
RootWASWaste[] rww = new RootWASWaste[was.Waste.Count];
rootWAS.Items[4] = rww;
for (int i = 0; i < was.Waste.Count; i++)
// TODO: Klären wie es nun genau hier aussieht!
string serviceProviderName = "";
for (int i = 0; i < was.WasteDisposalServiceProvider.Count; i++)
{
rww[i] = new RootWASWaste();
rww[i].WasteDescription = was.Waste[i].WasteDescription;
if(was.Waste[i].WasteType.HasValue)
rww[i].WasteType = (RootWASWasteWasteType) was.Waste[i].WasteType.Value;
if (was.Waste[i].WasteDisposalAmount_MTQ.HasValue)
rww[i].WasteDisposalAmount_MTQ = (float) was.Waste[i].WasteDisposalAmount_MTQ.Value;
rww[i].WasteDetails = new RootWASWasteWasteDetails();
if (was.Waste[i].WasteCapacity_MTQ.HasValue)
rww[i].WasteDetails.WasteCapacity_MTQ = (float) was.Waste[i].WasteCapacity_MTQ.Value;
if (was.Waste[i].WasteAmountRetained_MTQ.HasValue)
rww[i].WasteDetails.WasteAmountRetained_MTQ = (float) was.Waste[i].WasteAmountRetained_MTQ.Value;
rww[i].WasteDetails.WasteDisposalPort = was.Waste[i].WasteDisposalPort;
if (was.Waste[i].WasteAmountGeneratedTillNextPort_MTQ.HasValue)
rww[i].WasteDetails.WasteAmountGeneratedTillNextPort_MTQ = (float) was.Waste[i].WasteAmountGeneratedTillNextPort_MTQ.Value;
serviceProviderName = string.Format("{0}{1}", serviceProviderName, was.WasteDisposalServiceProvider[i].WasteDisposalServiceProviderName);
}
rootWAS.Items[4] = serviceProviderName;
}
/*
{"Wert von 'ItemsElementName' stimmt nicht mit dem Typ von 'bsmd.dbh.DBHWebReference.RootWASWaste' überein.
* Sie müssen ihn auf 'bsmd.dbh.DBHWebReference.ItemsChoiceType3.@Waste' festlegen."}
*/
for (int j = 5; j < 14; j++)
{
if (was.Waste.Count > 0)
{
rootWAS.ItemsElementName[j] = ItemsChoiceType3.Waste;
RootWASWaste rww = new RootWASWaste();
rootWAS.Items[j] = rww;
if(was.Waste.Count > (j - 5))
{
rww.WasteDescription = was.Waste[j-5].WasteDescription;
if (was.Waste[j - 5].WasteType.HasValue)
rww.WasteType = (RootWASWasteWasteType)was.Waste[j - 5].WasteType.Value;
if (was.Waste[j - 5].WasteDisposalAmount_MTQ.HasValue)
rww.WasteDisposalAmount_MTQ = (float)was.Waste[j - 5].WasteDisposalAmount_MTQ.Value;
rww.WasteDetails = new RootWASWasteWasteDetails();
if (was.Waste[j - 5].WasteCapacity_MTQ.HasValue)
rww.WasteDetails.WasteCapacity_MTQ = (float)was.Waste[j - 5].WasteCapacity_MTQ.Value;
if (was.Waste[j - 5].WasteAmountRetained_MTQ.HasValue)
rww.WasteDetails.WasteAmountRetained_MTQ = (float)was.Waste[j - 5].WasteAmountRetained_MTQ.Value;
rww.WasteDetails.WasteDisposalPort = was.Waste[j - 5].WasteDisposalPort;
if (was.Waste[j - 5].WasteAmountGeneratedTillNextPort_MTQ.HasValue)
rww.WasteDetails.WasteAmountGeneratedTillNextPort_MTQ = (float)was.Waste[j - 5].WasteAmountGeneratedTillNextPort_MTQ.Value;
}
}
}
rootWAS.ItemsElementName[5] = ItemsChoiceType3.ConfirmationOfCorrectness;
rootWAS.Items[5] = was.ConfirmationOfCorrectness ?? false ? RootWASConfirmationOfCorrectness.Y : RootWASConfirmationOfCorrectness.N;
}
item = rootWAS;

View File

@ -21,9 +21,14 @@ namespace bsmd.dbh
private static ILog _log = LogManager.GetLogger("dbh Response");
public static void ProcessResponse(response.Root aResponse, string connectionString)
{
_log.InfoFormat("processing message type {0}, version {1}", aResponse.Type, aResponse.Version);
public static void ProcessResponse(string VisitId, string TransitId, DateTime Timestamp,
string SenderReference, response.RootType Type, List<response.RootMessage> Messages,
List<bsmd.dbh.response.RootReportingClassesFullReportingClass> ReportingClassesFull,
List<bsmd.dbh.response.RootReportingClassesPartialReportingClass> ReportingClassesPartial,
List<bsmd.dbh.response.RootReportingClassesErrorReportingClass> RootReportingClassesError,
List<bsmd.dbh.response.RootReportingClassesResettedReportingClass> ReportingClassesResetted,
string connectionString)
{
/*
XmlSerializer serializer = new XmlSerializer(typeof(response.Root));
@ -34,102 +39,121 @@ namespace bsmd.dbh
}
*/
_log.Debug(aResponse.Serialize());
// _log.Debug(aResponse.Serialize());
if (DBManager.Instance.Connect(connectionString))
{
if (aResponse.Messages != null)
Guid messageId;
if (!Guid.TryParseExact(SenderReference, "N", out messageId))
{
_log.WarnFormat("SenderReference {0} is not a guid, skipping message processing!", SenderReference);
return;
}
DatabaseEntity dbEntity = DBManager.Instance.GetMessageById(messageId);
if (!(dbEntity is Message))
{
_log.WarnFormat("SenderReference DB Entity Object is no MessageHeader, aborting ({0})", dbEntity.GetType());
return;
}
Message aMessage = dbEntity as Message;
switch (Type)
{
case dbh.response.RootType.VISIT:
// neue VISIT - ID
aMessage.MessageCore.VisitId = VisitId;
aMessage.MessageCore.BSMDStatusInternal = MessageCore.BSMDStatus.PREPARE;
DBManager.Instance.Save(aMessage.MessageCore);
break;
case dbh.response.RootType.TRANSIT:
aMessage.MessageCore.TransitId = TransitId;
aMessage.MessageCore.BSMDStatusInternal = MessageCore.BSMDStatus.PREPARE;
DBManager.Instance.Save(aMessage.MessageCore);
break;
case dbh.response.RootType.CANCEL:
if ((ReportingClassesFull != null) && (ReportingClassesFull.Count > 0) &&
(int)ReportingClassesFull[0] == (int)aMessage.MessageNotificationClass)
{
aMessage.Cancel = true;
aMessage.InternalStatus = Message.BSMDStatus.CONFIRMED;
}
break;
case dbh.response.RootType.RESET:
if ((ReportingClassesResetted != null) && (ReportingClassesResetted.Count > 0) &&
(int)ReportingClassesResetted[0] == (int)aMessage.MessageNotificationClass)
{
aMessage.Reset = true;
aMessage.InternalStatus = Message.BSMDStatus.CONFIRMED;
}
break;
case dbh.response.RootType.DATA:
if((ReportingClassesFull != null) && (ReportingClassesFull.Count > 0) &&
(int)ReportingClassesFull[0] == (int)aMessage.MessageNotificationClass)
{
// this was successful, save status to MessageHeader
aMessage.InternalStatus = Message.BSMDStatus.CONFIRMED;
aMessage.Status = Message.MessageStatus.ACCEPTED;
}
break;
}
if (Messages != null)
{
// Status zu den jeweiligen Nachrichten. Bei uns sollte die Anzahl hier immer 1 sein, da wir die Dinger
// einzeln verschicken.
for (int i = 0; i < aResponse.Messages.Count; i++)
// einzeln verschicken.
for (int i = 0; i < Messages.Count; i++)
{
_log.InfoFormat("message {0} type {1}: {2}", i,
aResponse.Messages[i].Type,
aResponse.Messages[i].Text ?? "null");
switch (aResponse.Messages[i].Type)
_log.InfoFormat("message {0} type {1}: {2}", i,
Messages[i].Type,
Messages[i].Text ?? "null");
switch (Messages[i].Type)
{
case dbh.response.RootMessageType.ERROR:
MessageError error = new MessageError();
error.ErrorText = aResponse.Messages[i].Text;
_log.WarnFormat("Error received for {0}: {1}", aResponse.Messages[i].Type, error.ErrorText);
error.ErrorText = Messages[i].Text;
_log.WarnFormat("Error received for {0}: {1}", Messages[i].Type, error.ErrorText);
error.MessageHeaderId = aMessage.Id.Value;
aMessage.InternalStatus = Message.BSMDStatus.ERROR;
DBManager.Instance.Save(error);
break;
case dbh.response.RootMessageType.VIOLATION:
MessageViolation violation = new MessageViolation();
violation.ViolationText = aResponse.Messages[i].Text;
_log.WarnFormat("Violation received for {0}: {1}", aResponse.Messages[i].Type, violation.ViolationText);
violation.ViolationText = Messages[i].Text;
_log.WarnFormat("Violation received for {0}: {1}", Messages[i].Type, violation.ViolationText);
violation.MessageHeaderId = aMessage.Id.Value;
aMessage.InternalStatus = Message.BSMDStatus.VIOLATION;
DBManager.Instance.Save(violation);
break;
case dbh.response.RootMessageType.WARNING:
_log.InfoFormat("WARNING received for {0}: {1}", aResponse.Messages[i].Type, aResponse.Messages[i].Text);
_log.InfoFormat("WARNING received for {0}: {1}", Messages[i].Type, Messages[i].Text);
break;
case dbh.response.RootMessageType.INFO:
default:
_log.InfoFormat("INFO received for {0}: {1}", Messages[i].Type, Messages[i].Text);
_log.InfoFormat("INFO received for {0}: {1}", aResponse.Messages[i].Type, aResponse.Messages[i].Text);
break;
}
}
}
Guid messageId;
if (!Guid.TryParseExact(aResponse.SenderReference, "N", out messageId))
{
_log.WarnFormat("SenderReference {0} is not a guid, skipping message processing!", aResponse.SenderReference);
return;
}
DatabaseEntity dbEntity = DBManager.Instance.GetMessageById(messageId);
if ((dbEntity != null) && (dbEntity.MessageCore != null))
{
Message aMessage = null;
if (dbEntity.GetType().IsAssignableFrom(typeof(Message)))
aMessage = (Message)dbEntity;
else
aMessage = dbEntity.MessageHeader;
switch (aResponse.Type)
{
case dbh.response.RootType.VISIT:
// neue VISIT - ID
aMessage.MessageCore.VisitId = aResponse.VisitId;
aMessage.MessageCore.BSMDStatusInternal = MessageCore.BSMDStatus.PREPARE;
DBManager.Instance.Save(aMessage.MessageCore);
break;
case dbh.response.RootType.TRANSIT:
aMessage.MessageCore.TransitId = aResponse.TransitId;
aMessage.MessageCore.BSMDStatusInternal = MessageCore.BSMDStatus.PREPARE;
DBManager.Instance.Save(aMessage.MessageCore);
break;
case dbh.response.RootType.CANCEL:
break;
case dbh.response.RootType.RESET:
break;
case dbh.response.RootType.DATA:
break;
}
aMessage.ReceivedAt = DateTime.Now;
aMessage.InternalStatus = Message.BSMDStatus.RESPONSE_RECEIVED;
DBManager.Instance.Save(aMessage);
}
else
{
_log.ErrorFormat("no entry found in DB for sender reference {0}", messageId);
}
aMessage.ReceivedAt = DateTime.Now;
DBManager.Instance.Save(aMessage);
DBManager.Instance.Disconnect();
}
else
{
_log.Fatal("cannot connect to database");
}
}
}
}
}

View File

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

View File

@ -0,0 +1,118 @@
//
// Class: BSMDPopClient
// Current CLR: 4.0.30319.34209
// System: Microsoft Visual Studio 10.0
// Author: dani
// Created: 6/15/2015 8:43:41 PM
//
// Copyright (c) 2015 Informatikbüro Daniel Schick. All rights reserved.
using System;
using System.Collections.Generic;
using System.IO;
using OpenPop.Pop3;
using OpenPop.Mime;
using log4net;
namespace bsmd.email
{
public class BSMDPopClient : IDisposable
{
private Pop3Client pop3Client;
private bool _connected = false;
private ILog _log = LogManager.GetLogger(typeof(BSMDPopClient));
public BSMDPopClient()
{
try
{
this.pop3Client = new Pop3Client();
this.pop3Client.Connect(Properties.Settings.Default.POP3Server, 995, true);
this.pop3Client.Authenticate(Properties.Settings.Default.POP3User, Properties.Settings.Default.POP3Password);
this._connected = true;
}
catch (Exception ex)
{
_log.ErrorFormat("Error connecting to POP3 Server: {0}", ex.Message);
}
}
public bool IsConnected { get { return this._connected; } }
public bool ReceiveSingleMail(out string attachmentLocalFile, out string messageId, out string sender)
{
attachmentLocalFile = null;
messageId = null;
sender = null;
if (!_connected) return false;
int messageCount = this.pop3Client.GetMessageCount();
if (messageCount > 0)
{
Message mailMessage = this.pop3Client.GetMessage(1);
if ((mailMessage.Headers.Sender != null) && mailMessage.Headers.Sender.HasValidMailAddress)
sender = mailMessage.Headers.Sender.MailAddress.Address;
if ((sender == null) && (mailMessage.Headers.From != null) && mailMessage.Headers.From.HasValidMailAddress)
sender = mailMessage.Headers.From.MailAddress.Address;
messageId = mailMessage.Headers.MessageId;
foreach(MessagePart part in mailMessage.FindAllAttachments())
{
_log.DebugFormat("found attachment named {0}, ContentType {1}", part.FileName, part.ContentType);
if (part.FileName.EndsWith(".xls", StringComparison.InvariantCultureIgnoreCase))
{
attachmentLocalFile = Path.Combine(Properties.Settings.Default.ArchiveFolder, part.FileName);
part.Save(new FileInfo(attachmentLocalFile));
}
}
}
else
{
_log.Info("no new mail on server");
}
return true;
}
/// <summary>
/// deletes message referenced by messageId
/// </summary>
/// <returns>true if successful</returns>
public bool DeleteMessageByMessageId(string messageId)
{
if (!_connected) return false;
// Get the number of messages on the POP3 server
int messageCount = this.pop3Client.GetMessageCount();
// Run trough each of these messages and download the headers
for (int messageItem = messageCount; messageItem > 0; messageItem--)
{
// If the Message ID of the current message is the same as the parameter given, delete that message
if (this.pop3Client.GetMessageHeaders(messageItem).MessageId.Equals(messageId))
{
// Delete
this.pop3Client.DeleteMessage(messageItem);
return true;
}
}
// We did not find any message with the given messageId, report this back
return false;
}
public void Dispose()
{
if (this.pop3Client != null)
{
if(this.pop3Client.Connected)
this.pop3Client.Disconnect();
this.pop3Client.Dispose();
}
}
}
}

View File

@ -0,0 +1,18 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("bsmd.email")]
[assembly: AssemblyDescription("E-Mail Send/Receive helper functions")]
[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("5aaf5f68-0f76-4b0e-bd1e-21fe4ff6cf0b")]

View File

@ -0,0 +1,110 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34209
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace bsmd.email.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.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("E:\\temp\\SietasSheets")]
public string ArchiveFolder {
get {
return ((string)(this["ArchiveFolder"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("pop3.strato.de")]
public string POP3Server {
get {
return ((string)(this["POP3Server"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("excel@textbausteine.net")]
public string POP3User {
get {
return ((string)(this["POP3User"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("lKLK!.435Dsd")]
public string POP3Password {
get {
return ((string)(this["POP3Password"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("smtp.strato.de")]
public string SMTPServer {
get {
return ((string)(this["SMTPServer"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("nsw@textbausteine.net")]
public string SMTPUser {
get {
return ((string)(this["SMTPUser"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("J#4elkj!..DF")]
public string SMTPPassword {
get {
return ((string)(this["SMTPPassword"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("<?xml version=\"1.0\" encoding=\"utf-16\"?>\r\n<ArrayOfString xmlns:xsi=\"http://www.w3." +
"org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\r\n <s" +
"tring>nsw@textbausteine.net</string>\r\n <string>hollmann@bsmd.de</string>\r\n</Arr" +
"ayOfString>")]
public global::System.Collections.Specialized.StringCollection Recipient {
get {
return ((global::System.Collections.Specialized.StringCollection)(this["Recipient"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("donotreply@bsmd.de")]
public string Sender {
get {
return ((string)(this["Sender"]));
}
}
}
}

View File

@ -0,0 +1,37 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="bsmd.email.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="ArchiveFolder" Type="System.String" Scope="Application">
<Value Profile="(Default)">E:\temp\SietasSheets</Value>
</Setting>
<Setting Name="POP3Server" Type="System.String" Scope="Application">
<Value Profile="(Default)">pop3.strato.de</Value>
</Setting>
<Setting Name="POP3User" Type="System.String" Scope="Application">
<Value Profile="(Default)">excel@textbausteine.net</Value>
</Setting>
<Setting Name="POP3Password" Type="System.String" Scope="Application">
<Value Profile="(Default)">lKLK!.435Dsd</Value>
</Setting>
<Setting Name="SMTPServer" Type="System.String" Scope="Application">
<Value Profile="(Default)">smtp.strato.de</Value>
</Setting>
<Setting Name="SMTPUser" Type="System.String" Scope="Application">
<Value Profile="(Default)">nsw@textbausteine.net</Value>
</Setting>
<Setting Name="SMTPPassword" Type="System.String" Scope="Application">
<Value Profile="(Default)">J#4elkj!..DF</Value>
</Setting>
<Setting Name="Recipient" Type="System.Collections.Specialized.StringCollection" Scope="Application">
<Value Profile="(Default)">&lt;?xml version="1.0" encoding="utf-16"?&gt;
&lt;ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
&lt;string&gt;nsw@textbausteine.net&lt;/string&gt;
&lt;string&gt;hollmann@bsmd.de&lt;/string&gt;
&lt;/ArrayOfString&gt;</Value>
</Setting>
<Setting Name="Sender" Type="System.String" Scope="Application">
<Value Profile="(Default)">donotreply@bsmd.de</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="bsmd.email.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<applicationSettings>
<bsmd.email.Properties.Settings>
<setting name="ArchiveFolder" serializeAs="String">
<value>E:\temp\SietasSheets</value>
</setting>
<setting name="POP3Server" serializeAs="String">
<value>pop3.strato.de</value>
</setting>
<setting name="POP3User" serializeAs="String">
<value>excel@textbausteine.net</value>
</setting>
<setting name="POP3Password" serializeAs="String">
<value>lKLK!.435Dsd</value>
</setting>
<setting name="SMTPServer" serializeAs="String">
<value>smtp.strato.de</value>
</setting>
<setting name="SMTPUser" serializeAs="String">
<value>nsw@textbausteine.net</value>
</setting>
<setting name="SMTPPassword" serializeAs="String">
<value>J#4elkj!..DF</value>
</setting>
<setting name="Recipient" serializeAs="Xml">
<value>
<ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<string>nsw@textbausteine.net</string>
<string>hollmann@bsmd.de</string>
</ArrayOfString>
</value>
</setting>
<setting name="Sender" serializeAs="String">
<value>donotreply@bsmd.de</value>
</setting>
</bsmd.email.Properties.Settings>
</applicationSettings>
</configuration>

View File

@ -0,0 +1,89 @@
<?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>{4B48A8AD-926D-4E0C-BEB3-59E040928137}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>bsmd.email</RootNamespace>
<AssemblyName>bsmd.email</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<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' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net">
<HintPath>..\packages\log4net.2.0.3\lib\net40-full\log4net.dll</HintPath>
</Reference>
<Reference Include="OpenPop">
<HintPath>..\packages\OpenPop.NET.2.0.6.1114\lib\net40\OpenPop.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="BSMDMail.cs" />
<Compile Include="BSMDPopClient.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>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="log4net" version="2.0.3" targetFramework="net45" />
<package id="OpenPop.NET" version="2.0.6.1114" targetFramework="net45" />
</packages>

View File

@ -154,5 +154,16 @@ namespace bsmd.herberg.FormService
return null;
}
public static byte? ParseGender(string val)
{
if (val.Equals("MALE")) return 0;
if (val.Equals("M")) return 0;
if (val.Equals("FEMALE")) return 1;
if (val.Equals("F")) return 1;
if (val.Equals("OTHER")) return 2;
if (val.Equals("O")) return 2;
return null;
}
}
}

View File

@ -144,7 +144,9 @@ namespace bsmd.herberg.FormService
aMessageCore = new MessageCore();
aMessageCore.HerbergFormGuid = new Guid(formBody.formGuid);
// aMessageCore.HerbergFormTemplateGuid = formResponse.
aMessageCore.IMO = formResponse.imoNumber.ToString();
aMessageCore.IMO = formResponse.imoNumber.ToString();
aMessageCore.ReportStatus = MessageCore.ReportStatusEnum.COMPLETE;
aMessageCore.BSMDStatusInternal = MessageCore.BSMDStatus.PREPARE;
if (aMessageCore.IMO.Length > 7)
{

View File

@ -38,9 +38,19 @@ namespace bsmd.herberg.FormService
//for (int i = 0; i < formResponse.formDatasets.Length; i++)
if(formResponse.formDatasets.Length > 0) // wir verarbeiten nur das "neueste" form dataset
{
{
int i = formResponse.formDatasets.Length - 1;
// Daten werden nur aktualisiert, wenn die form ein anderes (=neueres) Rev. Date hat
if (aMessageCore.HerbergRevDate.HasValue && (formResponse.formDatasets[i].revisionDate == aMessageCore.HerbergRevDate.Value))
return;
if (aMessageCore.ReportStatus != MessageCore.ReportStatusEnum.COMPLETE)
aMessageCore.ReportStatus = MessageCore.ReportStatusEnum.HE_REVISION;
aMessageCore.HerbergRevDate = formResponse.formDatasets[i].revisionDate;
Dictionary<string, Dictionary<string, string>> groupedVals = new Dictionary<string, Dictionary<string, string>>();
Dictionary<string, Dictionary<int, Dictionary<string, string>>> groupedRowVals = new Dictionary<string, Dictionary<int, Dictionary<string, string>>>();
@ -61,6 +71,11 @@ namespace bsmd.herberg.FormService
_log.InfoFormat("REGISTRATION_TYPE: {0}", formData.value);
break;
case "REPORT_TYPE":
if ((aMessageCore.HerbergReportType != formData.value) &&
(aMessageCore.ReportStatus != MessageCore.ReportStatusEnum.COMPLETE))
aMessageCore.ReportStatus = MessageCore.ReportStatusEnum.HE_REPORTTYPE;
aMessageCore.HerbergReportType = formData.value;
if (aMessageCore.HerbergReportType.Equals("Pre-Departure Notification Update") ||
aMessageCore.HerbergReportType.Equals("Departure Notification Update"))
@ -187,7 +202,7 @@ namespace bsmd.herberg.FormService
{
try
{
if (vDict.ContainsKey("ATAPortOfCall")) ata.ATAPortOfCall = Extensions.TryParse(vDict["ATAPortOfCall"]);
if (vDict.ContainsKey("ATAPortOfCall")) ata.ATAPortOfCall = Extensions.TryParseDateTime(vDict["ATAPortOfCall"]);
}
catch (Exception ex)
{
@ -214,7 +229,7 @@ namespace bsmd.herberg.FormService
{
try
{
if (vDict.ContainsKey("ATDPortOfCall")) atd.ATDPortOfCall = Extensions.TryParse(vDict["ATDPortOfCall"]);
if (vDict.ContainsKey("ATDPortOfCall")) atd.ATDPortOfCall = Extensions.TryParseDateTime(vDict["ATDPortOfCall"]);
}
catch (Exception ex)
{
@ -269,14 +284,14 @@ namespace bsmd.herberg.FormService
try
{
// if (vDict.ContainsKey("CallPurposeCode")) noa_nod.CallPurposeCode = Int32.Parse(vDict["CallPurposeCode"]);
if (vDict.ContainsKey("ETAToNextPort")) noa_nod.ETAToNextPort = Extensions.TryParse(vDict["ETAToNextPort"]);
if (vDict.ContainsKey("ETDFromLastPort")) noa_nod.ETDFromLastPort = Extensions.TryParse(vDict["ETDFromLastPort"]);
if (vDict.ContainsKey("ETAToPortOfCall")) noa_nod.ETAToPortOfCall = Extensions.TryParse(vDict["ETAToPortOfCall"]);
if (vDict.ContainsKey("ETDFromPortOfCall")) noa_nod.ETDFromPortOfCall = Extensions.TryParse(vDict["ETDFromPortOfCall"]);
if (vDict.ContainsKey("ETAToNextPort")) noa_nod.ETAToNextPort = Extensions.TryParseDateTime(vDict["ETAToNextPort"]);
if (vDict.ContainsKey("ETDFromLastPort")) noa_nod.ETDFromLastPort = Extensions.TryParseDateTime(vDict["ETDFromLastPort"]);
if (vDict.ContainsKey("ETAToPortOfCall")) noa_nod.ETAToPortOfCall = Extensions.TryParseDateTime(vDict["ETAToPortOfCall"]);
if (vDict.ContainsKey("ETDFromPortOfCall")) noa_nod.ETDFromPortOfCall = Extensions.TryParseDateTime(vDict["ETDFromPortOfCall"]);
// if (vDict.ContainsKey("CallPurposeDescription")) noa_nod.CallPurposeDescription = vDict["CallPurposeDescription"];
// if(vDict.ContainsKey("CountryOfNextPort")) noa_nod. nicht relevant
if (vDict.ContainsKey("ETAToKielCanal")) noa_nod.ETAToKielCanal = Extensions.TryParse(vDict["ETAToKielCanal"]);
if (vDict.ContainsKey("ETDFromKielCanal")) noa_nod.ETDFromKielCanal = Extensions.TryParse(vDict["ETDFromKielCanal"]);
if (vDict.ContainsKey("ETAToKielCanal")) noa_nod.ETAToKielCanal = Extensions.TryParseDateTime(vDict["ETAToKielCanal"]);
if (vDict.ContainsKey("ETDFromKielCanal")) noa_nod.ETDFromKielCanal = Extensions.TryParseDateTime(vDict["ETDFromKielCanal"]);
if (vDict.ContainsKey("CountryCodeOfLastPort") && vDict.ContainsKey("LastPortCode"))
noa_nod.LastPort = vDict["CountryCodeOfLastPort"] + vDict["LastPortCode"];
if (vDict.ContainsKey("CountryCodeOfNextPort") && vDict.ContainsKey("NextPortCode"))
@ -330,8 +345,8 @@ namespace bsmd.herberg.FormService
if (vDict.ContainsKey("MMSINumber")) stat.MMSINumber = vDict["MMSINumber"];
if (vDict.ContainsKey("Flag")) stat.Flag = vDict["Flag"];
if (vDict.ContainsKey("ShipType")) stat.ShipType = vDict["ShipType"];
if (vDict.ContainsKey("LengthOverall_MTR")) stat.LengthOverall_MTR = Double.Parse(vDict["LengthOverall_MTR"], NumberFormatInfo.InvariantInfo);
if (vDict.ContainsKey("Beam_MTR")) stat.Beam_MTR = Double.Parse(vDict["Beam_MTR"], NumberFormatInfo.InvariantInfo);
if (vDict.ContainsKey("LengthOverall_MTR")) stat.LengthOverall_MTR = Extensions.TryParseDouble(vDict["LengthOverall_MTR"]);
if (vDict.ContainsKey("Beam_MTR")) stat.Beam_MTR = Extensions.TryParseDouble(vDict["Beam_MTR"]);
if (vDict.ContainsKey("GrossTonnage")) stat.GrossTonnage = Int32.Parse(vDict["GrossTonnage"]);
// if (vDict.ContainsKey("PortNameOfRegistry")) stat.PortOfRegistry = vDict["PortNameOfRegistry"]; // existiert nicht
if (vDict.ContainsKey("InmarsatCallNumber")) stat.InmarsatCallNumber = vDict["InmarsatCallNumber"];
@ -386,17 +401,17 @@ namespace bsmd.herberg.FormService
if (vDict.ContainsKey("SanitaryMeasuresApplied")) mdh.SanitaryMeasuresApplied = vDict["SanitaryMeasuresApplied"].Equals("Y");
if (vDict.ContainsKey("SanitaryMeasuresType")) mdh.SanitaryMeasuresType = vDict["SanitaryMeasuresType"];
if (vDict.ContainsKey("SanitaryMeasuresLocation")) mdh.SanitaryMeasuresLocation = vDict["SanitaryMeasuresLocation"];
if (vDict.ContainsKey("SanitaryMeasuresDate")) mdh.SanitaryMeasuresDate = Extensions.TryParse(vDict["SanitaryMeasuresDate"]);
if (vDict.ContainsKey("SanitaryMeasuresDate")) mdh.SanitaryMeasuresDate = Extensions.TryParseDateTime(vDict["SanitaryMeasuresDate"]);
if (vDict.ContainsKey("StowawaysDetected")) mdh.StowawaysDetected = vDict["StowawaysDetected"].Equals("Y");
if (vDict.ContainsKey("StowawaysJoiningLocation")) mdh.StowawaysJoiningLocation = vDict["StowawaysJoiningLocation"];
if (vDict.ContainsKey("SickAnimalOrPetOnBoard")) mdh.SickAnimalOrPetOnBoard = vDict["SickAnimalOrPetOnBoard"].Equals("Y");
if (vDict.ContainsKey("ValidSanitaryControlExemptionOrCertificateOnBoard")) mdh.ValidSanitaryControlExemptionOrCertificateOnBoard = vDict["ValidSanitaryControlExemptionOrCertificateOnBoard"].Equals("Y");
if (vDict.ContainsKey("SanitaryControlCertPlaceOfIssue")) mdh.PlaceOfIssue = vDict["SanitaryControlCertPlaceOfIssue"];
if (vDict.ContainsKey("SanitaryControlCertDateOfIssue")) mdh.DateOfIssue = Extensions.TryParse(vDict["SanitaryControlCertDateOfIssue"]);
if (vDict.ContainsKey("SanitaryControlCertDateOfIssue")) mdh.DateOfIssue = Extensions.TryParseDateTime(vDict["SanitaryControlCertDateOfIssue"]);
if (vDict.ContainsKey("SanitaryControlReinspectionRequired")) mdh.SanitaryControlReinspectionRequired = vDict["SanitaryControlReinspectionRequired"].Equals("Y");
if (vDict.ContainsKey("InfectedAreaVisited")) mdh.InfectedAreaVisited = vDict["InfectedAreaVisited"].Equals("Y");
if (vDict.ContainsKey("InfectedAreaPort")) mdh.InfectedAreaPort = vDict["InfectedAreaPort"];
if (vDict.ContainsKey("InfectedAreaDate")) mdh.InfectedAreaDate = Extensions.TryParse(vDict["InfectedAreaDate"]);
if (vDict.ContainsKey("InfectedAreaDate")) mdh.InfectedAreaDate = Extensions.TryParseDateTime(vDict["InfectedAreaDate"]);
// sublisten
foreach (int key in nDict.Keys)
@ -411,7 +426,7 @@ namespace bsmd.herberg.FormService
poc30.MDH = mdh;
}
if (pDict.ContainsKey("PortOfCallLast30DaysDateOfDeparture")) poc30.PortOfCallLast30DaysDateOfDeparture = Extensions.TryParse(pDict["PortOfCallLast30DaysDateOfDeparture"]);
if (pDict.ContainsKey("PortOfCallLast30DaysDateOfDeparture")) poc30.PortOfCallLast30DaysDateOfDeparture = Extensions.TryParseDateTime(pDict["PortOfCallLast30DaysDateOfDeparture"]);
if (pDict.ContainsKey("PortOfCallLast30DaysCrewMembersJoined")) poc30.PortOfCallLast30DaysCrewMembersJoined = pDict["PortOfCallLast30DaysCrewMembersJoined"].Equals("Y");
if (pDict.ContainsKey("PortOfCallLast30DaysPortCode") && pDict.ContainsKey("PortOfCallLast30DaysCountryCode"))
poc30.PortOfCallLast30DaysLocode = pDict["PortOfCallLast30DaysCountryCode"] + pDict["PortOfCallLast30DaysPortCode"];
@ -540,7 +555,7 @@ namespace bsmd.herberg.FormService
}
if (ppDict.ContainsKey("PortOfItineraryName")) poi.PortOfItineraryName = ppDict["PortOfItineraryName"];
if (ppDict.ContainsKey("PortOfItineraryETA")) poi.PortOfItineraryETA = Extensions.TryParse(ppDict["PortOfItineraryETA"]);
if (ppDict.ContainsKey("PortOfItineraryETA")) poi.PortOfItineraryETA = Extensions.TryParseDateTime(ppDict["PortOfItineraryETA"]);
saveMessages.Add(poi);
}
@ -573,7 +588,7 @@ namespace bsmd.herberg.FormService
try
{
if (bDict.ContainsKey("BunkerFuelType")) bkra.BunkerFuelType = bDict["BunkerFuelType"];
if (bDict.ContainsKey("BunkerFuelQuantity_TNE")) bkra.BunkerFuelQuantity_TNE = Double.Parse(bDict["BunkerFuelQuantity_TNE"], NumberFormatInfo.InvariantInfo);
if (bDict.ContainsKey("BunkerFuelQuantity_TNE")) bkra.BunkerFuelQuantity_TNE = Extensions.TryParseDouble(bDict["BunkerFuelQuantity_TNE"]);
}
catch (Exception ex)
{
@ -637,8 +652,8 @@ namespace bsmd.herberg.FormService
if (pDict.ContainsKey("CrewMemberLastName")) crew.CrewMemberLastName = pDict["CrewMemberLastName"];
if (pDict.ContainsKey("CrewMemberFirstName")) crew.CrewMemberFirstName = pDict["CrewMemberFirstName"];
if (pDict.ContainsKey("CrewMemberPlaceOfBirth")) crew.CrewMemberPlaceOfBirth = pDict["CrewMemberPlaceOfBirth"];
if (pDict.ContainsKey("CrewMemberDateOfBirth")) crew.CrewMemberDateOfBirth = Extensions.TryParse(pDict["CrewMemberDateOfBirth"]);
if (pDict.ContainsKey("CrewMemberGender")) crew.CrewMemberGender = (byte)Enum.Parse(typeof(Enums.PassengerGender), pDict["CrewMemberGender"], true);
if (pDict.ContainsKey("CrewMemberDateOfBirth")) crew.CrewMemberDateOfBirth = Extensions.TryParseDateTime(pDict["CrewMemberDateOfBirth"]);
if (pDict.ContainsKey("CrewMemberGender")) crew.CrewMemberGender = Enums.ParseGender(pDict["CrewMemberGender"]);
if (pDict.ContainsKey("CrewMemberNationalityCode")) crew.CrewMemberNationality = pDict["CrewMemberNationalityCode"];
if (pDict.ContainsKey("CrewMemberIdentityDocumentType")) crew.CrewMemberIdentityDocumentType = (byte)Enum.Parse(typeof(Enums.PassengerIdentityDocumentType), pDict["CrewMemberIdentityDocumentType"], true);
if (pDict.ContainsKey("CrewMemberIdentityDocumentId")) crew.CrewMemberIdentityDocumentId = pDict["CrewMemberIdentityDocumentId"];
@ -675,7 +690,7 @@ namespace bsmd.herberg.FormService
try
{
if (bDict.ContainsKey("BunkerFuelType")) bkrd.BunkerFuelType = bDict["BunkerFuelType"];
if (bDict.ContainsKey("BunkerFuelQuantity_TNE")) bkrd.BunkerFuelQuantity_TNE = Double.Parse(bDict["BunkerFuelQuantity_TNE"], NumberFormatInfo.InvariantInfo);
if (bDict.ContainsKey("BunkerFuelQuantity_TNE")) bkrd.BunkerFuelQuantity_TNE = Extensions.TryParseDouble(bDict["BunkerFuelQuantity_TNE"]);
}
catch (Exception ex)
{
@ -739,11 +754,11 @@ namespace bsmd.herberg.FormService
if (vDict.ContainsKey("TankerHullConfiguration")) pre72h.TankerHullConfiguration = (byte)Enum.Parse(typeof(Enums.TankerHullConfiguration), vDict["TankerHullConfiguration"]);
if (vDict.ContainsKey("ConditionCargoBallastTanks")) pre72h.ConditionCargoBallastTanks = (byte)Enum.Parse(typeof(Enums.ConditionCargoBallastTanks), vDict["ConditionCargoBallastTanks"]);
if (vDict.ContainsKey("NatureOfCargo")) pre72h.NatureOfCargo = vDict["NatureOfCargo"];
if (vDict.ContainsKey("VolumeOfCargo_TNE")) pre72h.VolumeOfCargo = Double.Parse(vDict["VolumeOfCargo_TNE"], NumberFormatInfo.InvariantInfo);
if (vDict.ContainsKey("VolumeOfCargo_TNE")) pre72h.VolumeOfCargo = Extensions.TryParseDouble(vDict["VolumeOfCargo_TNE"]);
if (vDict.ContainsKey("PlannedOperations")) pre72h.PlannedOperations = vDict["PlannedOperations"];
if (vDict.ContainsKey("PlannedWorks")) pre72h.PlannedWorks = vDict["PlannedWorks"];
if (vDict.ContainsKey("DateOfLastExpandedInspection")) pre72h.DateOfLastExpandedInspection = Extensions.TryParse(vDict["DateOfLastExpandedInspection"]);
if (vDict.ContainsKey("PlannedPeriodOfStay_HUR")) pre72h.PlannedPeriodOfStay_HUR = Double.Parse(vDict["PlannedPeriodOfStay_HUR"], NumberFormatInfo.InvariantInfo);
if (vDict.ContainsKey("DateOfLastExpandedInspection")) pre72h.DateOfLastExpandedInspection = Extensions.TryParseDateTime(vDict["DateOfLastExpandedInspection"]);
if (vDict.ContainsKey("PlannedPeriodOfStay_HUR")) pre72h.PlannedPeriodOfStay_HUR = Extensions.TryParseDouble(vDict["PlannedPeriodOfStay_HUR"]);
}
catch (Exception ex)
{
@ -769,7 +784,7 @@ namespace bsmd.herberg.FormService
theMessage.MessageNotificationClass = Message.NotificationClass.LADG;
theMessage.Elements.Add(ladg);
}
if (lDict.ContainsKey("CargoGrossQuantity_TNE")) ladg.CargoGrossQuantity_TNE = Double.Parse(lDict["CargoGrossQuantity_TNE"], NumberFormatInfo.InvariantInfo);
if (lDict.ContainsKey("CargoGrossQuantity_TNE")) ladg.CargoGrossQuantity_TNE = Extensions.TryParseDouble(lDict["CargoGrossQuantity_TNE"]);
if (lDict.ContainsKey("CargoNumberOfItems")) ladg.CargoNumberOfItems = Int32.Parse(lDict["CargoNumberOfItems"]);
if (lDict.ContainsKey("CargoCodeNST")) ladg.CargoCodeNST = lDict["CargoCodeNST"];
if (lDict.ContainsKey("CargoHandlingType")) ladg.CargoHandlingType = (byte) Enum.Parse(typeof(Enums.CargoHandlingType), lDict["CargoHandlingType"]);
@ -800,8 +815,8 @@ namespace bsmd.herberg.FormService
if (pDict.ContainsKey("PassengerLastName")) pas.PassengerLastName = pDict["PassengerLastName"];
if (pDict.ContainsKey("PassengerFirstName")) pas.PassengerFirstName = pDict["PassengerFirstName"];
if (pDict.ContainsKey("PassengerPlaceOfBirth")) pas.PassengerPlaceOfBirth = pDict["PassengerPlaceOfBirth"];
if (pDict.ContainsKey("PassengerDateOfBirth")) pas.PassengerDateOfBirth = Extensions.TryParse(pDict["PassengerDateOfBirth"]);
if (pDict.ContainsKey("PassengerGender")) pas.PassengerGender = (byte)Enum.Parse(typeof(Enums.PassengerGender), pDict["PassengerGender"], true);
if (pDict.ContainsKey("PassengerDateOfBirth")) pas.PassengerDateOfBirth = Extensions.TryParseDateTime(pDict["PassengerDateOfBirth"]);
if (pDict.ContainsKey("PassengerGender")) pas.PassengerGender = Enums.ParseGender(pDict["PassengerGender"]);
if (pDict.ContainsKey("PassengerNationalityCode")) pas.PassengerNationality = pDict["PassengerNationalityCode"];
if (pDict.ContainsKey("PassengerIdentityDocumentType")) pas.PassengerIdentityDocumentType = (byte)Enum.Parse(typeof(Enums.PassengerIdentityDocumentType), pDict["PassengerIdentityDocumentType"], true);
if (pDict.ContainsKey("PassengerIdentityDocumentId")) pas.PassengerIdentityDocumentId = pDict["PassengerIdentityDocumentId"];
@ -840,7 +855,7 @@ namespace bsmd.herberg.FormService
try
{
if (vDict.ContainsKey("WasteDisposalValidExemption")) was.WasteDisposalValidExemption = vDict["WasteDisposalValidExemption"].Equals("Y");
if (vDict.ContainsKey("LastWasteDisposalDate")) was.LastWasteDisposalDate = Extensions.TryParse(vDict["LastWasteDisposalDate"]);
if (vDict.ContainsKey("LastWasteDisposalDate")) was.LastWasteDisposalDate = Extensions.TryParseDateTime(vDict["LastWasteDisposalDate"]);
if (vDict.ContainsKey("LastWasteDisposalPortCode") && vDict.ContainsKey("LastWasteDisposalCountryCode"))
was.LastWasteDisposalPort = vDict["LastWasteDisposalCountryCode"] + vDict["LastWasteDisposalPortCode"];
@ -859,13 +874,13 @@ namespace bsmd.herberg.FormService
was.Waste.Add(waste);
}
if (wDict.ContainsKey("WasteAmountGeneratedTillNextPort_MTQ")) waste.WasteAmountGeneratedTillNextPort_MTQ = Double.Parse(wDict["WasteAmountGeneratedTillNextPort_MTQ"], NumberFormatInfo.InvariantInfo);
if (wDict.ContainsKey("WasteAmountRetained_MTQ")) waste.WasteAmountRetained_MTQ = Double.Parse(wDict["WasteAmountRetained_MTQ"], NumberFormatInfo.InvariantInfo);
if (wDict.ContainsKey("WasteCapacity_MTQ")) waste.WasteCapacity_MTQ = Double.Parse(wDict["WasteCapacity_MTQ"], NumberFormatInfo.InvariantInfo);
if (wDict.ContainsKey("WasteDisposalAmount_MTQ")) waste.WasteDisposalAmount_MTQ = Double.Parse(wDict["WasteDisposalAmount_MTQ"], NumberFormatInfo.InvariantInfo);
if(wDict.ContainsKey("WasteDescription")) waste.WasteDescription = wDict["WasteDescription"];
if(wDict.ContainsKey("WasteType")) waste.WasteType = Enums.ParseWasteType(wDict["WasteType"]);
if(wDict.ContainsKey("WasteDisposalPort")) waste.WasteDisposalPort = wDict["WasteDisposalPort"];
if (wDict.ContainsKey("WasteAmountGeneratedTillNextPort_MTQ")) waste.WasteAmountGeneratedTillNextPort_MTQ = Extensions.TryParseDouble(wDict["WasteAmountGeneratedTillNextPort_MTQ"]);
if (wDict.ContainsKey("WasteAmountRetained_MTQ")) waste.WasteAmountRetained_MTQ = Extensions.TryParseDouble(wDict["WasteAmountRetained_MTQ"]);
if (wDict.ContainsKey("WasteCapacity_MTQ")) waste.WasteCapacity_MTQ = Extensions.TryParseDouble(wDict["WasteCapacity_MTQ"]);
if (wDict.ContainsKey("WasteDisposalAmount_MTQ")) waste.WasteDisposalAmount_MTQ = Extensions.TryParseDouble(wDict["WasteDisposalAmount_MTQ"]);
if (wDict.ContainsKey("WasteDescription")) waste.WasteDescription = wDict["WasteDescription"];
if (wDict.ContainsKey("WasteType")) waste.WasteType = Enums.ParseWasteType(wDict["WasteType"]);
if (wDict.ContainsKey("WasteDisposalPort")) waste.WasteDisposalPort = wDict["WasteDisposalPort"];
saveMessages.Add(waste);
}
@ -925,7 +940,7 @@ namespace bsmd.herberg.FormService
if (vDict.ContainsKey("ISSCType")) sec.ISSCType = (byte)Enum.Parse(typeof(Enums.ISSCType), vDict["ISSCType"], true);
if (vDict.ContainsKey("ISSCIssuerType")) sec.ISSCIssuerType = (byte)Enum.Parse(typeof(Enums.ISSCIssuerType), vDict["ISSCIssuerType"], true);
if (vDict.ContainsKey("ISSCIssuerName")) sec.ISSCIssuerName = vDict["ISSCIssuerName"];
if (vDict.ContainsKey("ISSCDateOfExpiration")) sec.ISSCDateOfExpiration = Extensions.TryParse(vDict["ISSCDateOfExpiration"]);
if (vDict.ContainsKey("ISSCDateOfExpiration")) sec.ISSCDateOfExpiration = Extensions.TryParseDateTime(vDict["ISSCDateOfExpiration"]);
if (vDict.ContainsKey("ApprovedSecurityPlanOnBoard")) sec.ApprovedSecurityPlanOnBoard = vDict["ApprovedSecurityPlanOnBoard"].Equals("Y");
if (vDict.ContainsKey("CurrentShipSecurityLevel")) sec.CurrentShipSecurityLevel = Byte.Parse(vDict["CurrentShipSecurityLevel"]);
if (vDict.ContainsKey("CurrentShipSecurityLevel ")) sec.CurrentShipSecurityLevel = Byte.Parse(vDict["CurrentShipSecurityLevel "]);
@ -965,8 +980,8 @@ namespace bsmd.herberg.FormService
poc.PortFacilityPortLoCode = sDict["PortFacilityPortCountryCode"] + sDict["PortFacilityPortLoCode"];
changedPfC = true;
}
if (sDict.ContainsKey("PortFacilityDateOfArrival")) { poc.PortFacilityDateOfArrival = Extensions.TryParse(sDict["PortFacilityDateOfArrival"]); changedPfC = true; }
if (sDict.ContainsKey("PortFacilityDateOfDeparture")) { poc.PortFacilityDateOfDeparture = Extensions.TryParse(sDict["PortFacilityDateOfDeparture"]); changedPfC = true; }
if (sDict.ContainsKey("PortFacilityDateOfArrival")) { poc.PortFacilityDateOfArrival = Extensions.TryParseDateTime(sDict["PortFacilityDateOfArrival"]); changedPfC = true; }
if (sDict.ContainsKey("PortFacilityDateOfDeparture")) { poc.PortFacilityDateOfDeparture = Extensions.TryParseDateTime(sDict["PortFacilityDateOfDeparture"]); changedPfC = true; }
if (sDict.ContainsKey("PortFacilityShipSecurityLevel")) { poc.PortFacilityShipSecurityLevel = Byte.Parse(sDict["PortFacilityShipSecurityLevel"]); changedPfC = true; }
if (sDict.ContainsKey("PortFacilitySecurityMattersToReport")) { poc.PortFacilitySecurityMattersToReport = sDict["PortFacilitySecurityMattersToReport"]; changedPfC = true; }
if (sDict.ContainsKey("PortFacilityGISISCode"))
@ -984,8 +999,8 @@ namespace bsmd.herberg.FormService
}
if (sDict.ContainsKey("ShipToShipActivityLocationCoordinatesLatitude")) { sts.ShipToShipActivityLocationCoordinatesLatitude = Int32.Parse(sDict["ShipToShipActivityLocationCoordinatesLatitude"]); changedStS = true; }
if (sDict.ContainsKey("ShipToShipActivityLocationCoordinatesLongitude")) { sts.ShipToShipActivityLocationCoordinatesLongitude = Int32.Parse(sDict["ShipToShipActivityLocationCoordinatesLongitude"]); changedStS = true; }
if (sDict.ContainsKey("ShipToShipActivityDateFrom")) { sts.ShipToShipActivityDateFrom = Extensions.TryParse(sDict["ShipToShipActivityDateFrom"]); changedStS = true; }
if (sDict.ContainsKey("ShipToShipActivityDateTo")) { sts.ShipToShipActivityDateTo = Extensions.TryParse(sDict["ShipToShipActivityDateTo"]); changedStS = true; }
if (sDict.ContainsKey("ShipToShipActivityDateFrom")) { sts.ShipToShipActivityDateFrom = Extensions.TryParseDateTime(sDict["ShipToShipActivityDateFrom"]); changedStS = true; }
if (sDict.ContainsKey("ShipToShipActivityDateTo")) { sts.ShipToShipActivityDateTo = Extensions.TryParseDateTime(sDict["ShipToShipActivityDateTo"]); changedStS = true; }
if (sDict.ContainsKey("ShipToShipActivityType")) { sts.ShipToShipActivityType = sDict["ShipToShipActivityType"]; changedStS = true; }
if (sDict.ContainsKey("ShipToShipActivitySecurityMattersToReport")) { sts.ShipToShipActivitySecurityMattersToReport = sDict["ShipToShipActivitySecurityMattersToReport"]; changedStS = true; }
@ -1009,8 +1024,8 @@ namespace bsmd.herberg.FormService
if (vDict.ContainsKey("PortNameOfCall")) aMessageCore.Portname = vDict["PortNameOfCall"];
if (vDict.ContainsKey("PortOfCall")) aMessageCore.PoC = "DE" + vDict["PortOfCall"];
if (vDict.ContainsKey("TransitKielCanal")) aMessageCore.IsTransit = vDict["TransitKielCanal"].Equals("Y");
if (vDict.ContainsKey("ETAPortOfCall")) aMessageCore.ETA = Extensions.TryParse(vDict["ETAPortOfCall"]);
if (vDict.ContainsKey("ETAKielCanal")) aMessageCore.ETAKielCanal = Extensions.TryParse(vDict["ETAKielCanal"]);
if (vDict.ContainsKey("ETAPortOfCall")) aMessageCore.ETA = Extensions.TryParseDateTime(vDict["ETAPortOfCall"]);
if (vDict.ContainsKey("ETAKielCanal")) aMessageCore.ETAKielCanal = Extensions.TryParseDateTime(vDict["ETAKielCanal"]);
}
break;
#endregion
@ -1019,7 +1034,7 @@ namespace bsmd.herberg.FormService
case "Transit":
{
theMessage.MessageNotificationClass = Message.NotificationClass.TRANSIT;
if (vDict.ContainsKey("ETAKielCanal")) aMessageCore.ETAKielCanal = Extensions.TryParse(vDict["ETAKielCanal"]);
if (vDict.ContainsKey("ETAKielCanal")) aMessageCore.ETAKielCanal = Extensions.TryParseDateTime(vDict["ETAKielCanal"]);
}
break;
#endregion
@ -1040,9 +1055,9 @@ namespace bsmd.herberg.FormService
}
try
{
if (pDict.ContainsKey("TowageOnArrivalBeam_MTR")) towa.TowageOnArrivalBeam_MTR = Double.Parse(pDict["TowageOnArrivalBeam_MTR"], NumberFormatInfo.InvariantInfo);
if (pDict.ContainsKey("TowageOnArrivalDraught_DMT")) towa.TowageOnArrivalDraught_DMT = Double.Parse(pDict["TowageOnArrivalDraught_DMT"], NumberFormatInfo.InvariantInfo);
if (pDict.ContainsKey("TowageOnArrivalLengthOverall_MTR")) towa.TowageOnArrivalLengthOverall_MTR = Double.Parse(pDict["TowageOnArrivalLengthOverall_MTR"], NumberFormatInfo.InvariantInfo);
if (pDict.ContainsKey("TowageOnArrivalBeam_MTR")) towa.TowageOnArrivalBeam_MTR = Extensions.TryParseDouble(pDict["TowageOnArrivalBeam_MTR"]);
if (pDict.ContainsKey("TowageOnArrivalDraught_DMT")) towa.TowageOnArrivalDraught_DMT = Extensions.TryParseDouble(pDict["TowageOnArrivalDraught_DMT"]);
if (pDict.ContainsKey("TowageOnArrivalLengthOverall_MTR")) towa.TowageOnArrivalLengthOverall_MTR = Extensions.TryParseDouble(pDict["TowageOnArrivalLengthOverall_MTR"]);
if (pDict.ContainsKey("TowageOnArrivalGrossTonnage")) towa.TowageOnArrivalGrossTonnage = Int32.Parse(pDict["TowageOnArrivalGrossTonnage"]);
if (pDict.ContainsKey("TowageOnArrivalOperatorCountry")) towa.TowageOnArrivalOperatorCountry = pDict["TowageOnArrivalOperatorCountry"];
if (pDict.ContainsKey("TowageOnArrivalPurposeOfCall")) towa.TowageOnArrivalPurposeOfCall = pDict["TowageOnArrivalPurposeOfCall"];
@ -1082,9 +1097,9 @@ namespace bsmd.herberg.FormService
}
try
{
if (pDict.ContainsKey("TowageOnDepartureBeam_MTR")) towd.TowageOnDepartureBeam_MTR = Double.Parse(pDict["TowageOnDepartureBeam_MTR"], NumberFormatInfo.InvariantInfo);
if (pDict.ContainsKey("TowageOnDepartureDraught_DMT")) towd.TowageOnDepartureDraught_DMT = Double.Parse(pDict["TowageOnDepartureDraught_DMT"], NumberFormatInfo.InvariantInfo);
if (pDict.ContainsKey("TowageOnDepartureLengthOverall_MTR")) towd.TowageOnDepartureLengthOverall_MTR = Double.Parse(pDict["TowageOnDepartureLengthOverall_MTR"], NumberFormatInfo.InvariantInfo);
if (pDict.ContainsKey("TowageOnDepartureBeam_MTR")) towd.TowageOnDepartureBeam_MTR = Extensions.TryParseDouble(pDict["TowageOnDepartureBeam_MTR"]);
if (pDict.ContainsKey("TowageOnDepartureDraught_DMT")) towd.TowageOnDepartureDraught_DMT = Extensions.TryParseDouble(pDict["TowageOnDepartureDraught_DMT"]);
if (pDict.ContainsKey("TowageOnDepartureLengthOverall_MTR")) towd.TowageOnDepartureLengthOverall_MTR = Extensions.TryParseDouble(pDict["TowageOnDepartureLengthOverall_MTR"]);
if (pDict.ContainsKey("TowageOnDepartureOperatorCountry")) towd.TowageOnDepartureOperatorCountry = pDict["TowageOnDepartureOperatorCountry"];
if (pDict.ContainsKey("TowageOnDepartureName")) towd.TowageOnDepartureName = pDict["TowageOnDepartureName"];
if (pDict.ContainsKey("TowageOnDepartureFlag")) towd.TowageOnDepartureFlag = pDict["TowageOnDepartureFlag"];
@ -1122,7 +1137,7 @@ namespace bsmd.herberg.FormService
{
try
{
if (vDict.ContainsKey("DraughtUponArrival_DMT")) tiefa.DraughtUponArrival_DMT = Double.Parse(vDict["DraughtUponArrival_DMT"], NumberFormatInfo.InvariantInfo);
if (vDict.ContainsKey("DraughtUponArrival_DMT")) tiefa.DraughtUponArrival_DMT = Extensions.TryParseDouble(vDict["DraughtUponArrival_DMT"]);
}
catch (Exception ex)
{
@ -1149,7 +1164,7 @@ namespace bsmd.herberg.FormService
{
try
{
if (vDict.ContainsKey("DraughtUponDeparture_DMT")) tiefd.DraughtUponDeparture_DMT = Double.Parse(vDict["DraughtUponDeparture_DMT"], NumberFormatInfo.InvariantInfo);
if (vDict.ContainsKey("DraughtUponDeparture_DMT")) tiefd.DraughtUponDeparture_DMT = Extensions.TryParseDouble(vDict["DraughtUponDeparture_DMT"]);
}
catch (Exception ex)
{
@ -1209,15 +1224,15 @@ namespace bsmd.herberg.FormService
if (aDict.ContainsKey("IMOClass")) imdgPosition.IMOClass = aDict["IMOClass"];
if (aDict.ContainsKey("CompatibilityGroup")) imdgPosition.CompatibilityGroup = aDict["CompatibilityGroup"];
if (aDict.ContainsKey("TechnicalName")) imdgPosition.TechnicalName = aDict["TechnicalName"];
if (aDict.ContainsKey("NetExplosiveMass_KGM")) imdgPosition.NetExplosiveMass_KGM = Double.Parse(aDict["NetExplosiveMass_KGM"], NumberFormatInfo.InvariantInfo);
if (aDict.ContainsKey("NetExplosiveMass_KGM")) imdgPosition.NetExplosiveMass_KGM = Extensions.TryParseDouble(aDict["NetExplosiveMass_KGM"]);
if (aDict.ContainsKey("Flashpoint_CEL")) imdgPosition.Flashpoint_CEL = aDict["Flashpoint_CEL"];
if (aDict.ContainsKey("Class7NuclideName")) imdgPosition.Class7NuclideName = aDict["Class7NuclideName"];
if (aDict.ContainsKey("Class7MaxActivity_BQL")) imdgPosition.Class7MaxActivity_BQL = Double.Parse(aDict["Class7MaxActivity_BQL"], NumberFormatInfo.InvariantInfo);
if (aDict.ContainsKey("Class7MaxActivity_BQL")) imdgPosition.Class7MaxActivity_BQL = Extensions.TryParseDouble(aDict["Class7MaxActivity_BQL"]);
if (aDict.ContainsKey("Class7Category")) imdgPosition.Class7Category = Int32.Parse(aDict["Class7Category"], NumberFormatInfo.InvariantInfo);
if (aDict.ContainsKey("Class7TransportIndex")) imdgPosition.Class7TransportIndex = Double.Parse(aDict["Class7TransportIndex"], NumberFormatInfo.InvariantInfo);
if (aDict.ContainsKey("Class7TransportIndex")) imdgPosition.Class7TransportIndex = Extensions.TryParseDouble(aDict["Class7TransportIndex"]);
if (aDict.ContainsKey("Class7CSI")) imdgPosition.Class7CSI = Int32.Parse(aDict["Class7CSI"]);
if (aDict.ContainsKey("ControlTemperature_CEL")) imdgPosition.ControlTemperature_CEL = Double.Parse(aDict["ControlTemperature_CEL"], NumberFormatInfo.InvariantInfo);
if (aDict.ContainsKey("EmergencyTemperature_CEL")) imdgPosition.EmergencyTemperature_CEL = Double.Parse(aDict["EmergencyTemperature_CEL"], NumberFormatInfo.InvariantInfo);
if (aDict.ContainsKey("ControlTemperature_CEL")) imdgPosition.ControlTemperature_CEL = Extensions.TryParseDouble(aDict["ControlTemperature_CEL"]);
if (aDict.ContainsKey("EmergencyTemperature_CEL")) imdgPosition.EmergencyTemperature_CEL = Extensions.TryParseDouble(aDict["EmergencyTemperature_CEL"]);
if (aDict.ContainsKey("SubsidiaryRisk"))
{
if (imdgPosition.SubsidiaryRiskList.Count == 0)
@ -1235,9 +1250,9 @@ namespace bsmd.herberg.FormService
if (aDict.ContainsKey("PackageType")) imdgPosition.PackageType = aDict["PackageType"];
if (aDict.ContainsKey("LimitedQuantities")) imdgPosition.LimitedQuantities = aDict["LimitedQuantities"].Equals("Y");
if (aDict.ContainsKey("ExceptedQuantities")) imdgPosition.ExceptedQuantities = aDict["ExceptedQuantities"].Equals("Y");
if (aDict.ContainsKey("NetQuantity_KGM")) imdgPosition.NetQuantity_KGM = Double.Parse(aDict["NetQuantity_KGM"], NumberFormatInfo.InvariantInfo);
if (aDict.ContainsKey("GrossQuantity_KGM")) imdgPosition.GrossQuantity_KGM = Double.Parse(aDict["GrossQuantity_KGM"], NumberFormatInfo.InvariantInfo);
if (aDict.ContainsKey("Volume_MTQ")) imdgPosition.Volume_MTQ = Double.Parse(aDict["Volume_MTQ"], NumberFormatInfo.InvariantInfo);
if (aDict.ContainsKey("NetQuantity_KGM")) imdgPosition.NetQuantity_KGM = Extensions.TryParseDouble(aDict["NetQuantity_KGM"]);
if (aDict.ContainsKey("GrossQuantity_KGM")) imdgPosition.GrossQuantity_KGM = Extensions.TryParseDouble(aDict["GrossQuantity_KGM"]);
if (aDict.ContainsKey("Volume_MTQ")) imdgPosition.Volume_MTQ = Extensions.TryParseDouble(aDict["Volume_MTQ"]);
if (aDict.ContainsKey("GeneralCargoIBC")) imdgPosition.GeneralCargoIBC = aDict["GeneralCargoIBC"].Equals("Y");
if (aDict.ContainsKey("ContainerNumber")) imdgPosition.ContainerNumber = aDict["ContainerNumber"];
if (aDict.ContainsKey("VehicleLicenseNumber")) imdgPosition.VehicleLicenseNumber = aDict["VehicleLicenseNumber"];
@ -1275,7 +1290,7 @@ namespace bsmd.herberg.FormService
if (aDict.ContainsKey("PollutionCategory")) ibcPosition.PollutionCategory = (byte)Enum.Parse(typeof(Enums.PollutionCategory), aDict["PollutionCategory"], true);
if (aDict.ContainsKey("Hazards")) ibcPosition.Hazards = Enums.ParseHazardType(aDict["Hazards"]);
if (aDict.ContainsKey("FlashpointInformation")) ibcPosition.FlashpointInformation = Enums.ParseFlashpointInformation(aDict["FlashpointInformation"]);
if (aDict.ContainsKey("Quantity_KGM")) ibcPosition.Quantity_KGM = Double.Parse(aDict["Quantity_KGM"], NumberFormatInfo.InvariantInfo);
if (aDict.ContainsKey("Quantity_KGM")) ibcPosition.Quantity_KGM = Extensions.TryParseDouble(aDict["Quantity_KGM"]);
if (aDict.ContainsKey("StowagePosition")) ibcPosition.StowagePosition = aDict["StowagePosition"];
if (aDict.ContainsKey("PortCodeOfLoading") && aDict.ContainsKey("CountryCodeOfLoading"))
ibcPosition.PortOfLoading = aDict["CountryCodeOfLoading"] + aDict["PortCodeOfLoading"];
@ -1310,7 +1325,7 @@ namespace bsmd.herberg.FormService
if (aDict.ContainsKey("UNNumber")) igcPosition.UNNumber = aDict["UNNumber"];
if (aDict.ContainsKey("IMOClass")) igcPosition.IMOClass = aDict["IMOClass"];
if (aDict.ContainsKey("ProductName")) igcPosition.ProductName = aDict["ProductName"];
if (aDict.ContainsKey("Quantity_KGM")) igcPosition.Quantity_KGM = Double.Parse(aDict["Quantity_KGM"], NumberFormatInfo.InvariantInfo);
if (aDict.ContainsKey("Quantity_KGM")) igcPosition.Quantity_KGM = Extensions.TryParseDouble(aDict["Quantity_KGM"]);
if (aDict.ContainsKey("StowagePosition")) igcPosition.StowagePosition = aDict["StowagePosition"];
if (aDict.ContainsKey("PortCodeOfLoading") && aDict.ContainsKey("CountryCodeOfLoading"))
igcPosition.PortOfLoading = aDict["CountryCodeOfLoading"] + aDict["PortCodeOfLoading"];
@ -1347,7 +1362,7 @@ namespace bsmd.herberg.FormService
if (aDict.ContainsKey("MHB")) imsbcPosition.MHB = aDict["MHB"].Equals("Y");
if (aDict.ContainsKey("UNNumber")) imsbcPosition.UNNumber = aDict["UNNumber"];
if (aDict.ContainsKey("IMOClass")) imsbcPosition.IMOClass = aDict["IMOClass"];
if (aDict.ContainsKey("Quantity_KGM")) imsbcPosition.Quantity_KGM = Double.Parse(aDict["Quantity_KGM"], NumberFormatInfo.InvariantInfo);
if (aDict.ContainsKey("Quantity_KGM")) imsbcPosition.Quantity_KGM = Extensions.TryParseDouble(aDict["Quantity_KGM"]);
if (aDict.ContainsKey("StowagePosition")) imsbcPosition.StowagePosition = aDict["StowagePosition"];
if (aDict.ContainsKey("PortCodeOfLoading") && aDict.ContainsKey("CountryCodeOfLoading"))
imsbcPosition.PortOfLoading = aDict["CountryCodeOfLoading"] + aDict["PortCodeOfLoading"];
@ -1382,7 +1397,7 @@ namespace bsmd.herberg.FormService
if (aDict.ContainsKey("Name")) marpolPosition.Name = aDict["Name"];
if (aDict.ContainsKey("FlashpointInformation")) marpolPosition.FlashpointInformation = Enums.ParseFlashpointInformation(aDict["FlashpointInformation"]);
if (aDict.ContainsKey("Flashpoint_CEL")) marpolPosition.Flashpoint_CEL = aDict["Flashpoint_CEL"];
if (aDict.ContainsKey("Quantity_KGM")) marpolPosition.Quantity_KGM = Double.Parse(aDict["Quantity_KGM"], NumberFormatInfo.InvariantInfo);
if (aDict.ContainsKey("Quantity_KGM")) marpolPosition.Quantity_KGM = Extensions.TryParseDouble(aDict["Quantity_KGM"]);
if (aDict.ContainsKey("StowagePosition")) marpolPosition.StowagePosition = aDict["StowagePosition"];
if (aDict.ContainsKey("PortCodeOfLoading") && aDict.ContainsKey("CountryCodeOfLoading"))
marpolPosition.PortOfLoading = aDict["CountryCodeOfLoading"] + aDict["PortCodeOfLoading"];
@ -1425,12 +1440,9 @@ namespace bsmd.herberg.FormService
foreach (DatabaseEntity saveEntity in saveMessages)
DBManager.Instance.Save(saveEntity);
}
}
}
if (aMessageCore.BSMDStatusInternal == MessageCore.BSMDStatus.UNDEFINED)
aMessageCore.BSMDStatusInternal = MessageCore.BSMDStatus.CREATE_RECEIVE_RECEIPT;
DBManager.Instance.Save(aMessageCore); // warum?
DBManager.Instance.Save(aMessageCore);
}
}

View File

@ -0,0 +1,11 @@
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.hisnord")]
[assembly: AssemblyDescription("Classes to connect to DuD NSW Service (HIS-Nord)")]
[assembly: AssemblyCulture("")]

View File

@ -0,0 +1,67 @@
<?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>{E7E48971-E879-4E6A-B316-70AC0A6F4C95}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>bsmd.hisnord</RootNamespace>
<AssemblyName>bsmd.hisnord</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<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' ">
<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="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="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

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

View File

@ -5,7 +5,10 @@
<repository path="..\bsmd.database\packages.config" />
<repository path="..\bsmd.dbh.ResponseService\packages.config" />
<repository path="..\bsmd.dbh\packages.config" />
<repository path="..\bsmd.email\packages.config" />
<repository path="..\bsmd.ExcelReadService\packages.config" />
<repository path="..\bsmd.herberg.FormService\packages.config" />
<repository path="..\bsmd.hisnord\packages.config" />
<repository path="..\bsmd.ReportGenerator\packages.config" />
<repository path="..\SendNSWMessageService\packages.config" />
</repositories>

Binary file not shown.

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