Version 3.1.1 Korrekturen und
DB Erweiterung für ENI-2 (Historisierung)
This commit is contained in:
parent
a52232cff1
commit
f596558610
Binary file not shown.
8
nsw/Source/SQL/Update_3.0.1_To_3.1.sql
Normal file
8
nsw/Source/SQL/Update_3.0.1_To_3.1.sql
Normal file
@ -0,0 +1,8 @@
|
||||
PRINT N'Altering [dbo].[MessageHeader]...';
|
||||
GO
|
||||
ALTER TABLE [dbo].[MessageHeader] ADD [CreatedBy] NVARCHAR(64) NULL;
|
||||
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[MessageHeader] ADD [ChangedBy] NVARCHAR(64) NULL;
|
||||
GO
|
||||
@ -80,9 +80,10 @@ namespace SendNSWMessageService
|
||||
|
||||
foreach (MessageCore core in coresMarkedForSending)
|
||||
{
|
||||
List<Message> messages = DBManager.Instance.GetMessagesForCore(core);
|
||||
// TODO: Hier sollten jeweils die "neuesten" Nachrichten geladen werden, wenn es mehrere geben sollte!!
|
||||
List<Message> messages = DBManager.Instance.GetMessagesForCore(core, DBManager.MessageLoad.ALL);
|
||||
|
||||
// TODO: Das muss wieder entfernt werden wenn 3.0 funktional ist
|
||||
//
|
||||
// if (core.InitialHIS != Message.NSWProvider.DBH_TEST) continue; // ignore everything else
|
||||
|
||||
if (core.InitialHIS == Message.NSWProvider.DUDR)
|
||||
|
||||
@ -34,6 +34,18 @@
|
||||
<setting name="TestMode" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="ValidSender" serializeAs="Xml">
|
||||
<value>
|
||||
<ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<string>report@bsmd.de</string>
|
||||
<string>hsok@gmx.de</string>
|
||||
<string>bald@puls200.de</string>
|
||||
<string>d.schick@gmx.de</string>
|
||||
<string>hollmann@bsmd.de</string>
|
||||
</ArrayOfString>
|
||||
</value>
|
||||
</setting>
|
||||
</bsmd.ExcelReadService.Properties.Settings>
|
||||
</applicationSettings>
|
||||
</configuration>
|
||||
@ -40,7 +40,7 @@ namespace bsmd.ExcelReadService
|
||||
System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
|
||||
FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
|
||||
string version = fvi.FileVersion;
|
||||
this._log.InfoFormat("Starting NSW Excel Read Service. v.{0}", version);
|
||||
this._log.InfoFormat("Starting NSW Excel Read Service. v.{0} -------------- ", version);
|
||||
this.DoOnce();
|
||||
}
|
||||
|
||||
@ -106,23 +106,42 @@ namespace bsmd.ExcelReadService
|
||||
else
|
||||
{
|
||||
|
||||
// try to read/import attachment
|
||||
using (ExcelReader reader = new ExcelReader(attachmentLocalPath))
|
||||
// only a valid sender gets a reply
|
||||
bool isValidSender = false;
|
||||
foreach (string aValidSender in Properties.Settings.Default.ValidSender)
|
||||
{
|
||||
readResult = Util.ProcessSheet(reader, out readMessage, out messageCore);
|
||||
if (!readResult)
|
||||
_log.Error("Excel sheet could not be interpreted");
|
||||
if (mailSender.Equals(aValidSender, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
isValidSender = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Quittung / set messagecore to createreport and let reportGenerator create a reply?
|
||||
if (!isValidSender)
|
||||
{
|
||||
_log.WarnFormat("ignored e-mail from illegal sender: {0}", mailSender);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 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");
|
||||
}
|
||||
|
||||
// create a reply sheet (template + scanned highlighted content for verification
|
||||
// TODO: Quittung / set messagecore to createreport and let reportGenerator create a reply?
|
||||
|
||||
string confirmationExcelFilePath = Util.CreateConfirmationSheet(messageCore);
|
||||
List<string> sendItems = new List<string>();
|
||||
sendItems.Add(confirmationExcelFilePath);
|
||||
// send reply sheet back to sender
|
||||
BSMDMail.SendNSWReportWithAttachments(Properties.Settings.Default.SendEMailSubject, sendItems);
|
||||
// create a reply sheet (template + scanned highlighted content for verification
|
||||
|
||||
string confirmationExcelFilePath = Util.CreateConfirmationSheet(messageCore);
|
||||
List<string> sendItems = new List<string>();
|
||||
sendItems.Add(confirmationExcelFilePath);
|
||||
// send reply sheet back to sender
|
||||
BSMDMail.SendNSWReportWithAttachments(Properties.Settings.Default.SendEMailSubject, sendItems);
|
||||
|
||||
}
|
||||
|
||||
// remove e-Mail
|
||||
_log.InfoFormat("deleting mail with messageId {0}", messageId);
|
||||
|
||||
@ -94,5 +94,21 @@ namespace bsmd.ExcelReadService.Properties {
|
||||
return ((bool)(this["TestMode"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute(@"<?xml version=""1.0"" encoding=""utf-16""?>
|
||||
<ArrayOfString xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
|
||||
<string>report@bsmd.de</string>
|
||||
<string>hsok@gmx.de</string>
|
||||
<string>bald@puls200.de</string>
|
||||
<string>d.schick@gmx.de</string>
|
||||
<string>hollmann@bsmd.de</string>
|
||||
</ArrayOfString>")]
|
||||
public global::System.Collections.Specialized.StringCollection ValidSender {
|
||||
get {
|
||||
return ((global::System.Collections.Specialized.StringCollection)(this["ValidSender"]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,5 +26,15 @@
|
||||
<Setting Name="TestMode" Type="System.Boolean" Scope="Application">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="ValidSender" Type="System.Collections.Specialized.StringCollection" Scope="Application">
|
||||
<Value Profile="(Default)"><?xml version="1.0" encoding="utf-16"?>
|
||||
<ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<string>report@bsmd.de</string>
|
||||
<string>hsok@gmx.de</string>
|
||||
<string>bald@puls200.de</string>
|
||||
<string>d.schick@gmx.de</string>
|
||||
<string>hollmann@bsmd.de</string>
|
||||
</ArrayOfString></Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
@ -29,7 +29,7 @@ namespace bsmd.ExcelReadService
|
||||
if (messageCore == null) return false; // cannot work with this sheet or create one
|
||||
|
||||
// load messages if already present
|
||||
List<Message> messages = DBManager.Instance.GetMessagesForCore(messageCore);
|
||||
List<Message> messages = DBManager.Instance.GetMessagesForCore(messageCore, DBManager.MessageLoad.EXCEL);
|
||||
|
||||
// start parsing fields
|
||||
if (messageCore.IsTransit)
|
||||
@ -134,10 +134,9 @@ namespace bsmd.ExcelReadService
|
||||
|
||||
foreach(Message message in messages)
|
||||
{
|
||||
message.CreatedBy = "EXCEL";
|
||||
DBManager.Instance.Save(message);
|
||||
|
||||
message.SaveElements();
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@ -11,6 +11,8 @@
|
||||
<AssemblyName>bsmd.ExcelReadService</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
@ -46,8 +48,9 @@
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration.Install" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data.SQLite">
|
||||
<HintPath>..\packages\System.Data.SQLite.Core.1.0.99.0\lib\net45\System.Data.SQLite.dll</HintPath>
|
||||
<Reference Include="System.Data.SQLite, Version=1.0.101.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Data.SQLite.Core.1.0.101.0\lib\net45\System.Data.SQLite.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Management" />
|
||||
@ -125,7 +128,13 @@
|
||||
<WCFMetadata Include="Service References\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\packages\System.Data.SQLite.Core.1.0.99.0\build\net45\System.Data.SQLite.Core.targets" Condition="Exists('..\packages\System.Data.SQLite.Core.1.0.99.0\build\net45\System.Data.SQLite.Core.targets')" />
|
||||
<Import Project="..\packages\System.Data.SQLite.Core.1.0.101.0\build\net45\System.Data.SQLite.Core.targets" Condition="Exists('..\packages\System.Data.SQLite.Core.1.0.101.0\build\net45\System.Data.SQLite.Core.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\System.Data.SQLite.Core.1.0.101.0\build\net45\System.Data.SQLite.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\System.Data.SQLite.Core.1.0.101.0\build\net45\System.Data.SQLite.Core.targets'))" />
|
||||
</Target>
|
||||
<!-- 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">
|
||||
|
||||
@ -2,5 +2,5 @@
|
||||
<packages>
|
||||
<package id="log4net" version="2.0.5" targetFramework="net45" />
|
||||
<package id="OpenPop.NET" version="2.0.6.1120" targetFramework="net45" />
|
||||
<package id="System.Data.SQLite.Core" version="1.0.99.0" targetFramework="net45" />
|
||||
<package id="System.Data.SQLite.Core" version="1.0.101.0" targetFramework="net45" />
|
||||
</packages>
|
||||
@ -25,7 +25,7 @@ namespace bsmd.Tool
|
||||
if (core != null)
|
||||
{
|
||||
// get messges
|
||||
List<Message> messages = DBManager.Instance.GetMessagesForCore(core);
|
||||
List<Message> messages = DBManager.Instance.GetMessagesForCore(core, DBManager.MessageLoad.ALL);
|
||||
RuleEngine ruleEngine = new RuleEngine();
|
||||
|
||||
foreach(Message message in messages) {
|
||||
|
||||
@ -41,8 +41,9 @@
|
||||
<Reference Include="CommandLine">
|
||||
<HintPath>..\packages\CommandLineParser.1.9.71\lib\net45\CommandLine.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="log4net">
|
||||
<HintPath>..\packages\log4net.2.0.3\lib\net40-full\log4net.dll</HintPath>
|
||||
<Reference Include="log4net, Version=1.2.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.5\lib\net45-full\log4net.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="CommandLineParser" version="1.9.71" targetFramework="net45" />
|
||||
<package id="log4net" version="2.0.3" targetFramework="net45" />
|
||||
<package id="log4net" version="2.0.5" targetFramework="net45" />
|
||||
</packages>
|
||||
@ -772,13 +772,25 @@ namespace bsmd.dakosy
|
||||
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(filePath)) {
|
||||
serializer.Serialize(tw, edm);
|
||||
}
|
||||
bool serializationFailed = false;
|
||||
|
||||
// call sftp client to send
|
||||
sftp.Put(fileName,
|
||||
useTestSystem ? Properties.Settings.Default.RemoteTestIncomingDir : Properties.Settings.Default.RemoteProdIncomingDir);
|
||||
using(TextWriter tw = new StreamWriter(filePath)) {
|
||||
try
|
||||
{
|
||||
serializer.Serialize(tw, edm);
|
||||
} catch (Exception serEx)
|
||||
{
|
||||
_log.ErrorFormat("serialization problem: {0}", serEx.ToString());
|
||||
serializationFailed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!serializationFailed)
|
||||
{
|
||||
// call sftp client to send
|
||||
sftp.Put(fileName,
|
||||
useTestSystem ? Properties.Settings.Default.RemoteTestIncomingDir : Properties.Settings.Default.RemoteProdIncomingDir);
|
||||
}
|
||||
|
||||
// remove sent file if not test mode
|
||||
if (!useTestSystem)
|
||||
@ -887,15 +899,15 @@ namespace bsmd.dakosy
|
||||
reqList.RequestId[0].MessageHeader.MessageSender.ParticipantCode.AgencyID = "DAK";
|
||||
reqList.RequestId[0].MessageHeader.MessageSender.ParticipantCode.Value = "BSM"; // TODO -> Absprache!
|
||||
reqList.RequestId[0].ReportingParty = new ReportingParty();
|
||||
reqList.RequestId[0].ReportingParty.City = aMessage.ReportingParty.City;
|
||||
reqList.RequestId[0].ReportingParty.Country = aMessage.ReportingParty.Country;
|
||||
reqList.RequestId[0].ReportingParty.EMail = aMessage.ReportingParty.EMail;
|
||||
reqList.RequestId[0].ReportingParty.Fax = aMessage.ReportingParty.Fax;
|
||||
reqList.RequestId[0].ReportingParty.FirstName = aMessage.ReportingParty.FirstName;
|
||||
reqList.RequestId[0].ReportingParty.LastName = aMessage.ReportingParty.LastName;
|
||||
reqList.RequestId[0].ReportingParty.Name = aMessage.ReportingParty.Name;
|
||||
reqList.RequestId[0].ReportingParty.Phone = aMessage.ReportingParty.Phone;
|
||||
reqList.RequestId[0].ReportingParty.PostalCode = aMessage.ReportingParty.PostalCode;
|
||||
reqList.RequestId[0].ReportingParty.City = aMessage.ReportingParty.City ?? "";
|
||||
reqList.RequestId[0].ReportingParty.Country = aMessage.ReportingParty.Country ?? "";
|
||||
reqList.RequestId[0].ReportingParty.EMail = aMessage.ReportingParty.EMail ?? "";
|
||||
reqList.RequestId[0].ReportingParty.Fax = aMessage.ReportingParty.Fax ?? "";
|
||||
reqList.RequestId[0].ReportingParty.FirstName = aMessage.ReportingParty.FirstName ?? "";
|
||||
reqList.RequestId[0].ReportingParty.LastName = aMessage.ReportingParty.LastName ?? "";
|
||||
reqList.RequestId[0].ReportingParty.Name = aMessage.ReportingParty.Name ?? "";
|
||||
reqList.RequestId[0].ReportingParty.Phone = aMessage.ReportingParty.Phone ?? "";
|
||||
reqList.RequestId[0].ReportingParty.PostalCode = aMessage.ReportingParty.PostalCode ?? "";
|
||||
if (!aMessage.ReportingParty.StreetAndNumber.IsNullOrEmpty())
|
||||
{
|
||||
int lastBlank = aMessage.ReportingParty.StreetAndNumber.LastIndexOf(' ');
|
||||
@ -911,17 +923,17 @@ namespace bsmd.dakosy
|
||||
if (aMessage.MessageNotificationClass == Message.NotificationClass.TRANSIT)
|
||||
{
|
||||
reqList.RequestId[0].REG_TRANSIT = new REG_TRANSIT();
|
||||
reqList.RequestId[0].REG_TRANSIT.EniNumber = aMessage.MessageCore.ENI;
|
||||
reqList.RequestId[0].REG_TRANSIT.EtaKielCanal = aMessage.MessageCore.ETA.Value;
|
||||
reqList.RequestId[0].REG_TRANSIT.ImoNumber = aMessage.MessageCore.IMO;
|
||||
reqList.RequestId[0].REG_TRANSIT.EniNumber = aMessage.MessageCore.ENI ?? "";
|
||||
reqList.RequestId[0].REG_TRANSIT.EtaKielCanal = aMessage.MessageCore.ETA ?? DateTime.Now; // DEBUG: der Fallback sollte nie passieren
|
||||
reqList.RequestId[0].REG_TRANSIT.ImoNumber = aMessage.MessageCore.IMO ?? "";
|
||||
}
|
||||
else
|
||||
{
|
||||
reqList.RequestId[0].REG_VISIT = new REG_VISIT();
|
||||
reqList.RequestId[0].REG_VISIT.EniNumber = aMessage.MessageCore.ENI;
|
||||
reqList.RequestId[0].REG_VISIT.EtaPortOfCall = aMessage.MessageCore.ETA.Value;
|
||||
reqList.RequestId[0].REG_VISIT.ImoNumber = aMessage.MessageCore.IMO;
|
||||
reqList.RequestId[0].REG_VISIT.PortOfCall = aMessage.MessageCore.PoC;
|
||||
reqList.RequestId[0].REG_VISIT.EniNumber = aMessage.MessageCore.ENI ?? "";
|
||||
reqList.RequestId[0].REG_VISIT.EtaPortOfCall = aMessage.MessageCore.ETA ?? DateTime.Now; // DEBUG: der Fallback sollte nie passieren
|
||||
reqList.RequestId[0].REG_VISIT.ImoNumber = aMessage.MessageCore.IMO ?? "";
|
||||
reqList.RequestId[0].REG_VISIT.PortOfCall = aMessage.MessageCore.PoC ?? "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -28,6 +28,18 @@ namespace bsmd.database
|
||||
|
||||
#endregion
|
||||
|
||||
#region Enums
|
||||
|
||||
public enum MessageLoad
|
||||
{
|
||||
ALL,
|
||||
EXCEL,
|
||||
HE,
|
||||
ENI
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public static DBManager Instance
|
||||
@ -141,11 +153,21 @@ namespace bsmd.database
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<Message> GetMessagesForCore(MessageCore core)
|
||||
public List<Message> GetMessagesForCore(MessageCore core, MessageLoad loadType)
|
||||
{
|
||||
Message aMessage = new Message();
|
||||
SqlCommand cmd = new SqlCommand();
|
||||
aMessage.PrepareLoadCommand(cmd, Message.LoadFilter.BY_CORE, core.Id);
|
||||
|
||||
Message.LoadFilter loadFilter = Message.LoadFilter.BY_CORE;
|
||||
switch(loadType)
|
||||
{
|
||||
case MessageLoad.ENI: loadFilter = Message.LoadFilter.BY_CORE_ENI; break;
|
||||
case MessageLoad.EXCEL: loadFilter = Message.LoadFilter.BY_CORE_EXCEL; break;
|
||||
case MessageLoad.HE: loadFilter = Message.LoadFilter.BY_CORE_HE; break;
|
||||
|
||||
}
|
||||
|
||||
aMessage.PrepareLoadCommand(cmd, loadFilter, core.Id);
|
||||
IDataReader reader = this.PerformCommand(cmd);
|
||||
List<DatabaseEntity> messages = aMessage.LoadList(reader);
|
||||
|
||||
|
||||
@ -127,7 +127,10 @@ namespace bsmd.database
|
||||
REPORTSTATUS,
|
||||
IMO_ETA_POC,
|
||||
BY_VISITID,
|
||||
BY_TRANSITID
|
||||
BY_TRANSITID,
|
||||
BY_CORE_ENI,
|
||||
BY_CORE_EXCEL,
|
||||
BY_CORE_HE
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -250,6 +253,16 @@ namespace bsmd.database
|
||||
/// </summary>
|
||||
public Guid? ReportingPartyId { get { return this.reportingPartyId; } set { this.reportingPartyId = value; } }
|
||||
|
||||
/// <summary>
|
||||
/// Urheber der Nachricht (Excel oder HE)
|
||||
/// </summary>
|
||||
public string CreatedBy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Bearbeiter für Änderungshistorie (=Name des angemeldeten Melders), wird vom ENI-2 Speicherprozess befüllt
|
||||
/// </summary>
|
||||
public string ChangedBy { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDatabaseEntity implementation
|
||||
@ -289,14 +302,16 @@ namespace bsmd.database
|
||||
|
||||
cmd.Parameters.AddWithNullableValue("@REPORTINGPARTYID", this.reportingPartyId);
|
||||
cmd.Parameters.AddWithValue("@BSMDSTATUS", this.InternalStatus);
|
||||
cmd.Parameters.AddWithValue("@HIS", this.HIS);
|
||||
cmd.Parameters.AddWithValue("@HIS", this.HIS);
|
||||
cmd.Parameters.AddWithNullableValue("@CREATEDBY", this.CreatedBy);
|
||||
cmd.Parameters.AddWithNullableValue("@CHANGEDBY", this.ChangedBy);
|
||||
|
||||
if (this.IsNew)
|
||||
{
|
||||
this.CreateId();
|
||||
cmd.Parameters.AddWithValue("@ID", this.Id);
|
||||
string query = string.Format("INSERT INTO {0} (Id, ClientRequestId, MessageCoreId, MessageId, SentAt, ReceivedAt, RequestedAt, NotificationClass, Reset, Cancel, Status, ReportingPartyId, BSMDStatus, HIS) " +
|
||||
"VALUES (@ID, @CLIENTREQUESTID, @MESSAGECOREID, @MESSAGEID, @SENTAT, @RECEIVEDAT, @REQUESTEDAT, @NOTIFICATIONCLASS, @RESET, @CANCEL, @STATUS, @REPORTINGPARTYID, @BSMDSTATUS, @HIS)",
|
||||
string query = string.Format("INSERT INTO {0} (Id, ClientRequestId, MessageCoreId, MessageId, SentAt, ReceivedAt, RequestedAt, NotificationClass, Reset, Cancel, Status, ReportingPartyId, BSMDStatus, HIS, CreatedBy, ChangedBy) " +
|
||||
"VALUES (@ID, @CLIENTREQUESTID, @MESSAGECOREID, @MESSAGEID, @SENTAT, @RECEIVEDAT, @REQUESTEDAT, @NOTIFICATIONCLASS, @RESET, @CANCEL, @STATUS, @REPORTINGPARTYID, @BSMDSTATUS, @HIS, @CREATEDBY, @CHANGEDBY)",
|
||||
this.Tablename);
|
||||
cmd.CommandText = query;
|
||||
}
|
||||
@ -304,8 +319,8 @@ namespace bsmd.database
|
||||
{
|
||||
cmd.Parameters.AddWithValue("@ID", this.Id);
|
||||
cmd.CommandText = string.Format("UPDATE {0} SET ClientRequestId = @CLIENTREQUESTID, MessageId = @MESSAGEID, SentAt = @SENTAT, ReceivedAt = @RECEIVEDAT, RequestedAt = @REQUESTEDAT, " +
|
||||
"NotificationClass = @NOTIFICATIONCLASS, Reset = @RESET, Cancel = @CANCEL, Status = @STATUS, ReportingPartyId = @REPORTINGPARTYID, BSMDStatus = @BSMDSTATUS, HIS = @HIS " +
|
||||
"WHERE Id = @ID", this.Tablename);
|
||||
"NotificationClass = @NOTIFICATIONCLASS, Reset = @RESET, Cancel = @CANCEL, Status = @STATUS, ReportingPartyId = @REPORTINGPARTYID, BSMDStatus = @BSMDSTATUS, HIS = @HIS, " +
|
||||
"CreatedBy = @CREATEDBY, ChangedBy = @CHANGEDBY WHERE Id = @ID", this.Tablename);
|
||||
}
|
||||
}
|
||||
|
||||
@ -313,7 +328,7 @@ namespace bsmd.database
|
||||
public override void PrepareLoadCommand(IDbCommand cmd, LoadFilter filter, params object[] criteria )
|
||||
{
|
||||
string query = string.Format("SELECT Id, ClientRequestId, MessageCoreId, MessageId, SentAt, ReceivedAt, RequestedAt, NotificationClass, " +
|
||||
"Reset, Cancel, Status, ReportingPartyId, BSMDStatus, HIS, Created FROM {0} ", this.Tablename);
|
||||
"Reset, Cancel, Status, ReportingPartyId, BSMDStatus, HIS, Created, CreatedBy, ChangedBy FROM {0} ", this.Tablename);
|
||||
|
||||
switch (filter)
|
||||
{
|
||||
@ -335,12 +350,30 @@ namespace bsmd.database
|
||||
((SqlCommand)cmd).Parameters.AddWithValue("@ID", criteria[0]);
|
||||
break;
|
||||
}
|
||||
case LoadFilter.BY_CORE:
|
||||
case LoadFilter.BY_CORE:
|
||||
{
|
||||
query += "WHERE MessageCoreId = @COREID";
|
||||
((SqlCommand)cmd).Parameters.AddWithValue("@COREID", criteria[0]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
case LoadFilter.BY_CORE_ENI:
|
||||
{
|
||||
query += "WHERE MessageCoreId = @COREID AND ChangedBy IS NOT NULL";
|
||||
((SqlCommand)cmd).Parameters.AddWithValue("@COREID", criteria[0]);
|
||||
break;
|
||||
}
|
||||
case LoadFilter.BY_CORE_EXCEL:
|
||||
{
|
||||
query += "WHERE MessageCoreId = @COREID AND CreatedBy = 'EXCEL'";
|
||||
((SqlCommand)cmd).Parameters.AddWithValue("@COREID", criteria[0]);
|
||||
break;
|
||||
}
|
||||
case LoadFilter.BY_CORE_HE:
|
||||
{
|
||||
query += "WHERE MessageCoreId = @COREID AND (CreatedBy = 'HE' OR CreatedBy IS NULL)"; // TODO: letzte Bedingung nach Übergangsphase entfernen
|
||||
((SqlCommand)cmd).Parameters.AddWithValue("@COREID", criteria[0]);
|
||||
break;
|
||||
}
|
||||
case LoadFilter.ALL:
|
||||
default:
|
||||
break;
|
||||
@ -370,6 +403,8 @@ namespace bsmd.database
|
||||
if (!reader.IsDBNull(12)) msg.InternalStatus = (BSMDStatus)Enum.ToObject(typeof(BSMDStatus), reader.GetByte(12));
|
||||
if (!reader.IsDBNull(13)) msg.HIS = (NSWProvider)Enum.ToObject(typeof(NSWProvider), reader.GetByte(13));
|
||||
if (!reader.IsDBNull(14)) msg.created = reader.GetDateTime(14);
|
||||
if (!reader.IsDBNull(15)) msg.CreatedBy = reader.GetString(15);
|
||||
if (!reader.IsDBNull(16)) msg.ChangedBy = reader.GetString(16);
|
||||
result.Add(msg);
|
||||
}
|
||||
reader.Close();
|
||||
|
||||
@ -2,6 +2,6 @@
|
||||
|
||||
[assembly: AssemblyCompany("Informatikbüro Daniel Schick")]
|
||||
[assembly: AssemblyProduct("BSMD NSW interface")]
|
||||
[assembly: AssemblyInformationalVersion("3.0.15")]
|
||||
[assembly: AssemblyInformationalVersion("3.1.1")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2014-2016 Informatikbüro Daniel Schick. All rights reserved.")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
@ -1,4 +1,4 @@
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: AssemblyVersion("3.0.15.*")]
|
||||
[assembly: AssemblyVersion("3.1.1.*")]
|
||||
|
||||
|
||||
@ -19,73 +19,53 @@ using System.Net.Security;
|
||||
|
||||
namespace bsmd.email
|
||||
{
|
||||
public class BSMDMail
|
||||
public class BSMDMail : IDisposable
|
||||
{
|
||||
public static void SendNSWReportWithAttachments(string subject, List<string> filenameList)
|
||||
private SmtpClient client;
|
||||
ILog log = LogManager.GetLogger(typeof(BSMDMail));
|
||||
|
||||
internal BSMDMail()
|
||||
{
|
||||
ILog log = LogManager.GetLogger(typeof(BSMDMail));
|
||||
SmtpClient smtpClient = new SmtpClient();
|
||||
this.client = new SmtpClient();
|
||||
NetworkCredential basicCredential = new NetworkCredential(Properties.Settings.Default.SMTPUser,
|
||||
Properties.Settings.Default.SMTPPassword);
|
||||
|
||||
foreach (string recipient in Properties.Settings.Default.Recipient)
|
||||
// setup up the host, increase the timeout to 5 minutes
|
||||
this.client.Host = Properties.Settings.Default.SMTPServer;
|
||||
this.client.UseDefaultCredentials = false;
|
||||
this.client.Credentials = basicCredential;
|
||||
this.client.Timeout = (60 * 5 * 1000);
|
||||
this.client.EnableSsl = true;
|
||||
|
||||
// evil workaround for invalid BSMD E-Mail certificate!
|
||||
ServicePointManager.ServerCertificateValidationCallback = delegate (object s, X509Certificate certificate, X509Chain chain,
|
||||
SslPolicyErrors sslPolicyErrors)
|
||||
{ return true; };
|
||||
|
||||
}
|
||||
|
||||
internal void Send(MailMessage message)
|
||||
{
|
||||
// doch nicht asynchron, da nur eine Nachricht gleichzeitig geschickt werden kann und ich so den sync code spare
|
||||
try
|
||||
{
|
||||
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;
|
||||
|
||||
// evil workaround for invalid BSMD E-Mail certificate!
|
||||
ServicePointManager.ServerCertificateValidationCallback = delegate (object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
|
||||
{ return true; };
|
||||
|
||||
message.From = fromAddress;
|
||||
message.Subject = string.Format(subject);
|
||||
message.IsBodyHtml = false;
|
||||
message.Body = "see attachment";
|
||||
message.To.Add(recipient);
|
||||
|
||||
foreach(string filename in filenameList)
|
||||
{
|
||||
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();
|
||||
|
||||
this.client.Send(message);
|
||||
log.InfoFormat("Email sending to {0} successful.", message.To.ToString());
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
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!)
|
||||
|
||||
// in meinem Fall nicht so recht wirksam, da eine Mail meist an mehrere Empfänger geschickt wird
|
||||
|
||||
/*
|
||||
smtpClient.SendCompleted += (s, e) =>
|
||||
{
|
||||
@ -95,6 +75,70 @@ namespace bsmd.email
|
||||
|
||||
smtpClient.SendAsync(message, null);
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void SendNSWReportWithAttachments(string subject, List<string> filenameList)
|
||||
{
|
||||
|
||||
using (BSMDMail mailer = new BSMDMail())
|
||||
{
|
||||
foreach (string recipient in Properties.Settings.Default.Recipient)
|
||||
{
|
||||
MailMessage message = new MailMessage();
|
||||
MailAddress fromAddress = new MailAddress(Properties.Settings.Default.Sender);
|
||||
|
||||
message.From = fromAddress;
|
||||
message.Subject = string.Format(subject);
|
||||
message.IsBodyHtml = false;
|
||||
message.Body = "see attachment";
|
||||
message.To.Add(recipient);
|
||||
|
||||
foreach (string filename in filenameList)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
mailer.Send(message);
|
||||
|
||||
message.Dispose();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void SendSystemInfo(string subject, string body, string recipient)
|
||||
{
|
||||
using (BSMDMail mailer = new BSMDMail())
|
||||
{
|
||||
MailMessage message = new MailMessage();
|
||||
MailAddress fromAddress = new MailAddress(Properties.Settings.Default.Sender);
|
||||
message.From = fromAddress;
|
||||
message.Subject = subject;
|
||||
message.IsBodyHtml = false;
|
||||
message.Body = body;
|
||||
|
||||
message.To.Add(recipient);
|
||||
MailAddress adminAddress = new MailAddress(Properties.Settings.Default.AdminEmail);
|
||||
message.CC.Add(adminAddress);
|
||||
|
||||
mailer.Send(message);
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
this.client.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.34209
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
@ -12,7 +12,7 @@ namespace bsmd.email.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
@ -106,5 +106,14 @@ namespace bsmd.email.Properties {
|
||||
return ((string)(this["Sender"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("nsw@textbausteine.net")]
|
||||
public string AdminEmail {
|
||||
get {
|
||||
return ((string)(this["AdminEmail"]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,5 +33,8 @@
|
||||
<Setting Name="Sender" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">donotreply@bsmd.de</Value>
|
||||
</Setting>
|
||||
<Setting Name="AdminEmail" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">nsw@textbausteine.net</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
@ -40,6 +40,9 @@
|
||||
<setting name="Sender" serializeAs="String">
|
||||
<value>donotreply@bsmd.de</value>
|
||||
</setting>
|
||||
<setting name="AdminEmail" serializeAs="String">
|
||||
<value>nsw@textbausteine.net</value>
|
||||
</setting>
|
||||
</bsmd.email.Properties.Settings>
|
||||
</applicationSettings>
|
||||
</configuration>
|
||||
@ -43,8 +43,8 @@
|
||||
<HintPath>..\packages\log4net.2.0.5\lib\net45-full\log4net.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="OpenPop, Version=2.0.6.1119, Culture=neutral, PublicKeyToken=6bdb97f144b7efc8, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OpenPop.NET.2.0.6.1119\lib\net40\OpenPop.dll</HintPath>
|
||||
<Reference Include="OpenPop, Version=2.0.6.1120, Culture=neutral, PublicKeyToken=6bdb97f144b7efc8, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OpenPop.NET.2.0.6.1120\lib\net40\OpenPop.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="log4net" version="2.0.5" targetFramework="net45" />
|
||||
<package id="OpenPop.NET" version="2.0.6.1119" targetFramework="net45" />
|
||||
<package id="OpenPop.NET" version="2.0.6.1120" targetFramework="net45" />
|
||||
</packages>
|
||||
@ -824,6 +824,8 @@ namespace bsmd.herberg.FormService
|
||||
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 ((crew.CrewMemberNationality != null) && (crew.CrewMemberNationality.Length > 2))
|
||||
crew.CrewMemberNationality = crew.CrewMemberNationality.Substring(0, 2);
|
||||
if (pDict.ContainsKey("CrewMemberIdentityDocumentType")) crew.CrewMemberIdentityDocumentType = (byte)Enum.Parse(typeof(Enums.PassengerIdentityDocumentType), pDict["CrewMemberIdentityDocumentType"], true);
|
||||
if (pDict.ContainsKey("CrewMemberIdentityDocumentId")) crew.CrewMemberIdentityDocumentId = pDict["CrewMemberIdentityDocumentId"];
|
||||
if (pDict.ContainsKey("CrewMemberVisaNumber")) crew.CrewMemberVisaNumber = pDict["CrewMemberVisaNumber"];
|
||||
@ -914,11 +916,13 @@ namespace bsmd.herberg.FormService
|
||||
if (vDict.ContainsKey("ShippingArea")) info.ShippingArea = (byte) Enum.Parse(typeof(Enums.ShippingArea), vDict["ShippingArea"]);
|
||||
if (vDict.ContainsKey("RequestedPositionInPortOfCall")) info.RequestedPositionInPortOfCall = vDict["RequestedPositionInPortOfCall"];
|
||||
if (vDict.ContainsKey("SpecialRequirementsOfShipAtBerth")) info.SpecialRequirementsOfShipAtBerth = vDict["SpecialRequirementsOfShipAtBerth"];
|
||||
if (info.SpecialRequirementsOfShipAtBerth.IsNullOrEmpty())
|
||||
if (info.SpecialRequirementsOfShipAtBerth.IsNullOrEmpty() && (aMessageCore.Customer != null))
|
||||
{
|
||||
info.SpecialRequirementsOfShipAtBerth = aMessageCore.Customer.Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
if((aMessageCore.Customer != null) && (aMessageCore.Customer.Name != null) && !info.SpecialRequirementsOfShipAtBerth.Contains("- Agent: "))
|
||||
if ((aMessageCore.Customer != null) && (aMessageCore.Customer.Name != null) && !info.SpecialRequirementsOfShipAtBerth.Contains("- Agent: "))
|
||||
info.SpecialRequirementsOfShipAtBerth = string.Format("{0} - Agent: {1}", info.SpecialRequirementsOfShipAtBerth, aMessageCore.Customer.Name);
|
||||
}
|
||||
if (vDict.ContainsKey("ConstructionCharacteristicsOfShip")) info.ConstructionCharacteristicsOfShip = vDict["ConstructionCharacteristicsOfShip"];
|
||||
@ -1850,6 +1854,9 @@ namespace bsmd.herberg.FormService
|
||||
{
|
||||
DBManager.Instance.DeleteMessageErrors(theMessage);
|
||||
DBManager.Instance.DeleteMessageViolations(theMessage);
|
||||
} else
|
||||
{
|
||||
theMessage.CreatedBy = "HE";
|
||||
}
|
||||
|
||||
DBManager.Instance.Save(theMessage);
|
||||
@ -1875,7 +1882,7 @@ namespace bsmd.herberg.FormService
|
||||
/// </summary>
|
||||
private static Dictionary<string, Message> PrepareMessageDict(MessageCore aMessageCore)
|
||||
{
|
||||
List<Message> messages = DBManager.Instance.GetMessagesForCore(aMessageCore);
|
||||
List<Message> messages = DBManager.Instance.GetMessagesForCore(aMessageCore, DBManager.MessageLoad.HE);
|
||||
Dictionary<string, Message> result = new Dictionary<string, Message>();
|
||||
_log.DebugFormat("Core has {0} messages", messages.Count);
|
||||
foreach (Message message in messages)
|
||||
|
||||
@ -713,35 +713,38 @@ namespace bsmd.hisnord
|
||||
// }
|
||||
if (mdh.SanitaryControlReinspectionRequired.HasValue)
|
||||
_mdh.SanitaryControlReinspectionRequired = mdh.SanitaryControlReinspectionRequired.Value ? yorntype.Y : yorntype.N;
|
||||
if (mdh.SanitaryMeasuresApplied.HasValue)
|
||||
_mdh.SanitaryMeasuresApplied = mdh.SanitaryMeasuresApplied.Value ? yorntype.Y : yorntype.N;
|
||||
|
||||
// if (mdh.SanitaryMeasuresDetails.Count > 0)
|
||||
// {
|
||||
_mdh.SanitaryMeasuresDetails = new sanitarydetail[mdh.SanitaryMeasuresDetails.Count];
|
||||
for (int i = 0; i < mdh.SanitaryMeasuresDetails.Count; i++)
|
||||
{
|
||||
_mdh.SanitaryMeasuresDetails[i] = new sanitarydetail();
|
||||
if (mdh.SanitaryMeasuresDetails[i].SanitaryMeasuresDate.HasValue)
|
||||
_mdh.SanitaryMeasuresDetails[i].SanitaryMeasuresDate = mdh.SanitaryMeasuresDetails[i].SanitaryMeasuresDate.Value;
|
||||
_mdh.SanitaryMeasuresDetails[i].SanitaryMeasuresLocation = mdh.SanitaryMeasuresDetails[i].SanitaryMeasuresLocation;
|
||||
_mdh.SanitaryMeasuresDetails[i].SanitaryMeasuresType = mdh.SanitaryMeasuresDetails[i].SanitaryMeasuresType;
|
||||
}
|
||||
// }
|
||||
|
||||
// 26.05.2016 09:44:13 XML Document has Error:truecvc - assertion.3.13.4.1: Asserti
|
||||
// on evaluation('if (SanitaryMeasuresApplied eq 'Y') then SanitaryMeasuresDetails
|
||||
// else empty(SanitaryMeasuresDetails)') for element 'MDH' with type 'mdh' did not
|
||||
// succeed.
|
||||
|
||||
_mdh.SanitaryMeasuresApplied = (mdh.SanitaryMeasuresApplied ?? false) ? yorntype.Y : yorntype.N;
|
||||
|
||||
_mdh.SanitaryMeasuresDetails = new sanitarydetail[mdh.SanitaryMeasuresDetails.Count];
|
||||
for (int i = 0; i < mdh.SanitaryMeasuresDetails.Count; i++)
|
||||
{
|
||||
_mdh.SanitaryMeasuresDetails[i] = new sanitarydetail();
|
||||
if (mdh.SanitaryMeasuresDetails[i].SanitaryMeasuresDate.HasValue)
|
||||
_mdh.SanitaryMeasuresDetails[i].SanitaryMeasuresDate = mdh.SanitaryMeasuresDetails[i].SanitaryMeasuresDate.Value;
|
||||
_mdh.SanitaryMeasuresDetails[i].SanitaryMeasuresLocation = mdh.SanitaryMeasuresDetails[i].SanitaryMeasuresLocation;
|
||||
_mdh.SanitaryMeasuresDetails[i].SanitaryMeasuresType = mdh.SanitaryMeasuresDetails[i].SanitaryMeasuresType;
|
||||
}
|
||||
|
||||
if (mdh.SickAnimalOrPetOnBoard.HasValue)
|
||||
_mdh.SickAnimalOrPetOnBoard = mdh.SickAnimalOrPetOnBoard.Value ? yorntype.Y : yorntype.N;
|
||||
if (mdh.SickPersonsOnBoard.HasValue)
|
||||
_mdh.SickPersonOnBoard = mdh.SickPersonsOnBoard.Value ? yorntype.Y : yorntype.N;
|
||||
|
||||
_mdh.StowawaysDetected = (mdh.StowawaysDetected ?? false) ? yorntype.Y : yorntype.N;
|
||||
// if ((_mdh.StowawaysDetected == yorntype.Y) && (mdh.StowawaysJoiningLocations.Count > 0))
|
||||
// {
|
||||
if (_mdh.StowawaysDetected == yorntype.Y)
|
||||
{
|
||||
_mdh.StowawayJoiningLocations = new string[mdh.StowawaysJoiningLocations.Count];
|
||||
for (int i = 0; i < mdh.StowawaysJoiningLocations.Count; i++)
|
||||
{
|
||||
_mdh.StowawayJoiningLocations[i] = mdh.StowawaysJoiningLocations[i].StowawayJoiningLocation;
|
||||
}
|
||||
// }
|
||||
}
|
||||
if (mdh.SuspisionInfectiousNature.HasValue)
|
||||
_mdh.SuspisionInfectiousNature = mdh.SuspisionInfectiousNature.Value ? yorntype.Y : yorntype.N;
|
||||
|
||||
|
||||
@ -40,14 +40,14 @@ namespace bsmd.hisnord
|
||||
int timeout = Properties.Settings.Default.BatchTimeoutMins * 1000 * 60; // convert to ms
|
||||
process.WaitForExit((timeout == 0) ? int.MaxValue : timeout);
|
||||
|
||||
_log.Error(process.StandardError.ReadToEnd());
|
||||
_log.ErrorFormat("HIS-Nord transmitter error: {0}", process.StandardError.ReadToEnd());
|
||||
process.WaitForExit();
|
||||
|
||||
_log.Info(process.StandardOutput.ReadToEnd());
|
||||
_log.InfoFormat("HIS-Nord transmitter: {0}", process.StandardOutput.ReadToEnd());
|
||||
process.WaitForExit();
|
||||
|
||||
// now we should read the response message...
|
||||
string resultFilename = string.Format("{0}.result.xml", Path.GetFileName(filenameFullPath));
|
||||
string resultFilename = string.Format("{0}.result", Path.GetFileName(filenameFullPath)); // hier war früher noch ein .xml dran am Ende
|
||||
|
||||
string resultFullPath = Path.Combine(Properties.Settings.Default.ResultDir, resultFilename);
|
||||
return result.ReadResult(resultFullPath);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user