viele Bugfixes nach Test der DBH Schnittstelle
This commit is contained in:
parent
133c2e6bcc
commit
7bfa85e96d
@ -84,7 +84,7 @@
|
||||
</PropertyGroup>
|
||||
<PropertyGroup />
|
||||
<PropertyGroup>
|
||||
<ManifestCertificateThumbprint>94D98790E3B6C4CC9F4B57C8FD305E3225894DF8</ManifestCertificateThumbprint>
|
||||
<ManifestCertificateThumbprint>F2C2D0164244EC89955EF50201EE24C2A300FF0B</ManifestCertificateThumbprint>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignManifests>true</SignManifests>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<UseIISExpress>true</UseIISExpress>
|
||||
<LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>
|
||||
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
|
||||
<Use64BitIISExpress />
|
||||
<IISExpressSSLPort />
|
||||
<IISExpressAnonymousAuthentication />
|
||||
|
||||
@ -31,7 +31,7 @@ namespace bsmd.dakosy
|
||||
string localDir = Properties.Settings.Default.SFTPInDir;
|
||||
string remoteDir = Properties.Settings.Default.RemoteOutgoingDir;
|
||||
|
||||
SFtp.TransmitAll(remoteDir, localDir, SFtp.Direction.INCOMING);
|
||||
SFtp.TransmitAll(remoteDir, localDir, SFtp.Direction.INCOMING, Properties.Settings.Default.SFTPSessionName);
|
||||
|
||||
// lokale Dateien verarbeiten
|
||||
foreach (string inputFile in Directory.GetFiles(localDir))
|
||||
|
||||
@ -101,7 +101,7 @@ namespace bsmd.dakosy
|
||||
|
||||
}
|
||||
|
||||
public static void TransmitAll(string remoteDir, string localDir, Direction direction)
|
||||
public static void TransmitAll(string remoteDir, string localDir, Direction direction, string sessionName)
|
||||
{
|
||||
Process winscp = new Process();
|
||||
winscp.StartInfo.FileName = Properties.Settings.Default.WINSCPFullPath;
|
||||
@ -109,13 +109,14 @@ namespace bsmd.dakosy
|
||||
winscp.StartInfo.UseShellExecute = false;
|
||||
winscp.StartInfo.RedirectStandardInput = true;
|
||||
winscp.StartInfo.RedirectStandardOutput = true;
|
||||
winscp.StartInfo.RedirectStandardError = 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("open " + sessionName);
|
||||
winscp.StandardInput.WriteLine("lcd " + localDir);
|
||||
// winscp.StandardInput.WriteLine("ls");
|
||||
if (remoteDir != null)
|
||||
@ -124,6 +125,9 @@ namespace bsmd.dakosy
|
||||
winscp.StandardInput.WriteLine("get *.xml");
|
||||
if(direction == Direction.OUTGOING)
|
||||
winscp.StandardInput.WriteLine("put *.xml");
|
||||
// move back up since winscp session remembers the last folder
|
||||
winscp.StandardInput.WriteLine("cd ..");
|
||||
winscp.StandardInput.WriteLine("cd ..");
|
||||
winscp.StandardInput.Close();
|
||||
|
||||
// Collect all output
|
||||
|
||||
@ -1620,7 +1620,11 @@ namespace bsmd.database
|
||||
{
|
||||
this.CheckConnection();
|
||||
cmd.Connection = this._con;
|
||||
result = (int?)cmd.ExecuteScalar();
|
||||
object r = cmd.ExecuteScalar();
|
||||
if (r == null) { result = null; }
|
||||
else if (r == DBNull.Value) { result = null; }
|
||||
else { result = (int)r; }
|
||||
|
||||
}
|
||||
catch (SqlException ex)
|
||||
{
|
||||
|
||||
@ -48,8 +48,10 @@ namespace bsmd.dbh
|
||||
|
||||
if (messageFile != null)
|
||||
{
|
||||
string onlyFileName = Path.GetFileName(messageFile);
|
||||
string moveTarget = Path.Combine(Properties.Settings.Default.OutgoingFolder, onlyFileName);
|
||||
// move file to output directory
|
||||
File.Move(messageFile, Properties.Settings.Default.OutgoingFolder);
|
||||
File.Move(messageFile, moveTarget);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -74,17 +76,19 @@ namespace bsmd.dbh
|
||||
public static void SendAndReceive()
|
||||
{
|
||||
// sent unsent messages in output folder
|
||||
bsmd.dakosy.SFtp.TransmitAll(Properties.Settings.Default.RemoteIncomingFolder, Properties.Settings.Default.OutgoingFolder, dakosy.SFtp.Direction.OUTGOING);
|
||||
bsmd.dakosy.SFtp.TransmitAll(Properties.Settings.Default.RemoteIncomingFolder, Properties.Settings.Default.OutgoingFolder, dakosy.SFtp.Direction.OUTGOING, Properties.Settings.Default.SFTPSessionName);
|
||||
// move files from output folder to archive folder
|
||||
foreach(string sentFile in Directory.GetFiles(Properties.Settings.Default.OutgoingFolder))
|
||||
{
|
||||
_log.InfoFormat("sent {0}", sentFile);
|
||||
File.Move(sentFile, Properties.Settings.Default.OutgoingArchiveFolder);
|
||||
string onlyFileName = Path.GetFileName(sentFile);
|
||||
string moveTarget = Path.Combine(Properties.Settings.Default.OutgoingArchiveFolder, onlyFileName);
|
||||
File.Move(sentFile, moveTarget);
|
||||
}
|
||||
|
||||
// receive files from remote host
|
||||
// SFTP verbindung öffnen und alle Dateien herunterladen
|
||||
bsmd.dakosy.SFtp.TransmitAll(Properties.Settings.Default.RemoteOutgoingFolder, Properties.Settings.Default.IncomingFolder, dakosy.SFtp.Direction.INCOMING);
|
||||
bsmd.dakosy.SFtp.TransmitAll(Properties.Settings.Default.RemoteOutgoingFolder, Properties.Settings.Default.IncomingFolder, dakosy.SFtp.Direction.INCOMING, Properties.Settings.Default.SFTPSessionName);
|
||||
|
||||
foreach (string inputFile in Directory.GetFiles(Properties.Settings.Default.IncomingFolder))
|
||||
{
|
||||
|
||||
8
bsmd.dbh/Properties/Settings.Designer.cs
generated
8
bsmd.dbh/Properties/Settings.Designer.cs
generated
@ -34,7 +34,7 @@ namespace bsmd.dbh.Properties {
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("e:\\temp\\dbh\\out")]
|
||||
public string OutgoingFolder {
|
||||
get {
|
||||
return ((string)(this["OutgoingFolder"]));
|
||||
@ -43,7 +43,7 @@ namespace bsmd.dbh.Properties {
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("e:\\temp\\dbh\\out_archive")]
|
||||
public string OutgoingArchiveFolder {
|
||||
get {
|
||||
return ((string)(this["OutgoingArchiveFolder"]));
|
||||
@ -52,7 +52,7 @@ namespace bsmd.dbh.Properties {
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("e:\\temp\\dbh\\in")]
|
||||
public string IncomingFolder {
|
||||
get {
|
||||
return ((string)(this["IncomingFolder"]));
|
||||
@ -61,7 +61,7 @@ namespace bsmd.dbh.Properties {
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("e:\\temp\\dbh\\in_archive")]
|
||||
public string IncomingArchiveFolder {
|
||||
get {
|
||||
return ((string)(this["IncomingArchiveFolder"]));
|
||||
|
||||
@ -6,16 +6,16 @@
|
||||
<Value Profile="(Default)">00003050</Value>
|
||||
</Setting>
|
||||
<Setting Name="OutgoingFolder" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)" />
|
||||
<Value Profile="(Default)">e:\temp\dbh\out</Value>
|
||||
</Setting>
|
||||
<Setting Name="OutgoingArchiveFolder" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)" />
|
||||
<Value Profile="(Default)">e:\temp\dbh\out_archive</Value>
|
||||
</Setting>
|
||||
<Setting Name="IncomingFolder" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)" />
|
||||
<Value Profile="(Default)">e:\temp\dbh\in</Value>
|
||||
</Setting>
|
||||
<Setting Name="IncomingArchiveFolder" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)" />
|
||||
<Value Profile="(Default)">e:\temp\dbh\in_archive</Value>
|
||||
</Setting>
|
||||
<Setting Name="RemoteIncomingFolder" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">test/bsmd_2_dbh</Value>
|
||||
|
||||
@ -1649,7 +1649,7 @@ namespace bsmd.dbh
|
||||
serializer.Serialize(tw, root);
|
||||
}
|
||||
|
||||
return filename;
|
||||
return filePath;
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
|
||||
@ -11,16 +11,16 @@
|
||||
<value>00003050</value>
|
||||
</setting>
|
||||
<setting name="OutgoingFolder" serializeAs="String">
|
||||
<value />
|
||||
<value>e:\temp\dbh\out</value>
|
||||
</setting>
|
||||
<setting name="OutgoingArchiveFolder" serializeAs="String">
|
||||
<value />
|
||||
<value>e:\temp\dbh\out_archive</value>
|
||||
</setting>
|
||||
<setting name="IncomingFolder" serializeAs="String">
|
||||
<value />
|
||||
<value>e:\temp\dbh\in</value>
|
||||
</setting>
|
||||
<setting name="IncomingArchiveFolder" serializeAs="String">
|
||||
<value />
|
||||
<value>e:\temp\dbh\in_archive</value>
|
||||
</setting>
|
||||
<setting name="RemoteIncomingFolder" serializeAs="String">
|
||||
<value>test/bsmd_2_dbh</value>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user