MS Common Verzeichnisstruktur
This commit is contained in:
parent
a3c66ecd19
commit
5abc1d9779
@ -1,5 +1,6 @@
|
|||||||
Public Class DbConfig
|
Public Class DbConfig
|
||||||
Public Property ExternalProgramName As String = "Sign Flow"
|
Public Property ExternalProgramName As String = "Sign Flow"
|
||||||
|
Public Property DocumentPathOrigin As String = ""
|
||||||
Public Property DocumentPath As String = ""
|
Public Property DocumentPath As String = ""
|
||||||
Public Property ExportPath As String = ""
|
Public Property ExportPath As String = ""
|
||||||
Public Property DocumentPath_DMZ As String = ""
|
Public Property DocumentPath_DMZ As String = ""
|
||||||
|
|||||||
@ -12,6 +12,7 @@ Imports EnvelopeGenerator.Common.Constants
|
|||||||
Imports DevExpress.XtraBars.Docking
|
Imports DevExpress.XtraBars.Docking
|
||||||
Imports System.ServiceModel
|
Imports System.ServiceModel
|
||||||
Imports DevExpress.XtraRichEdit.Export
|
Imports DevExpress.XtraRichEdit.Export
|
||||||
|
Imports DevExpress.Pdf.Native.BouncyCastle.Asn1.Cms
|
||||||
|
|
||||||
Namespace Jobs
|
Namespace Jobs
|
||||||
Public Class FinalizeDocumentJob
|
Public Class FinalizeDocumentJob
|
||||||
@ -35,7 +36,7 @@ Namespace Jobs
|
|||||||
Private PDFMerger As PDFMerger
|
Private PDFMerger As PDFMerger
|
||||||
Private ReportCreator As ReportCreator
|
Private ReportCreator As ReportCreator
|
||||||
|
|
||||||
Private ReadOnly CompleteWaitTimeInMinutes As Integer = 5
|
Private ReadOnly CompleteWaitTime As Integer = 5
|
||||||
|
|
||||||
Private Class EnvelopeData
|
Private Class EnvelopeData
|
||||||
Public EnvelopeId As Integer
|
Public EnvelopeId As Integer
|
||||||
@ -78,7 +79,8 @@ Namespace Jobs
|
|||||||
|
|
||||||
Logger.Debug("Loading ReportCreator..")
|
Logger.Debug("Loading ReportCreator..")
|
||||||
ReportCreator = New ReportCreator(LogConfig, oState)
|
ReportCreator = New ReportCreator(LogConfig, oState)
|
||||||
|
Logger.Debug("My.Settings.RuninDMZ: [{0}]", My.Settings.RuninDMZ.ToString)
|
||||||
|
Logger.Debug("My.Settings.NetUse_Usr: [{0}]", My.Settings.NetUse_Usr)
|
||||||
|
|
||||||
If My.Settings.RuninDMZ = True Then
|
If My.Settings.RuninDMZ = True Then
|
||||||
If Config.DocumentPath_DMZ <> String.Empty Then
|
If Config.DocumentPath_DMZ <> String.Empty Then
|
||||||
@ -90,14 +92,16 @@ Namespace Jobs
|
|||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
If Config.DOCUMENT_PATH_MOVE_AFTSEND <> String.Empty Then
|
If Config.DOCUMENT_PATH_MOVE_AFTSEND <> String.Empty Then
|
||||||
Logger.Debug("Using DMZRemotePath: [{0}] - Overwrite Document-Path", Config.DOCUMENT_PATH_MOVE_AFTSEND)
|
Logger.Debug("Using DMZRemotePath: [{0}] - Overwrite Document-Path...", Config.DOCUMENT_PATH_MOVE_AFTSEND)
|
||||||
Config.DocumentPath = Config.DOCUMENT_PATH_MOVE_AFTSEND
|
Config.DocumentPath = Config.DOCUMENT_PATH_MOVE_AFTSEND
|
||||||
Config.NetUse_necessary = True
|
Config.NetUse_Finish = True
|
||||||
|
|
||||||
Else
|
Else
|
||||||
Config.DocumentPath = Config.DocumentPath
|
Config.DocumentPath = Config.DocumentPath
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
Logger.Debug("DocumentPath: [{0}]", Config.DocumentPath)
|
Logger.Debug("DocumentPath: [{0}]", Config.DocumentPath)
|
||||||
|
|
||||||
If My.Settings.RuninDMZ = True Then
|
If My.Settings.RuninDMZ = True Then
|
||||||
If Config.FINISHED_PATH_EX_DMZ <> String.Empty Then
|
If Config.FINISHED_PATH_EX_DMZ <> String.Empty Then
|
||||||
Logger.Debug("RuninDMZ - FINISHED_PATH_EX_DMZ configured: [{0}]", Config.FINISHED_PATH_EX_DMZ)
|
Logger.Debug("RuninDMZ - FINISHED_PATH_EX_DMZ configured: [{0}]", Config.FINISHED_PATH_EX_DMZ)
|
||||||
@ -109,20 +113,21 @@ Namespace Jobs
|
|||||||
Else
|
Else
|
||||||
Config.ExportPath = Config.ExportPath
|
Config.ExportPath = Config.ExportPath
|
||||||
End If
|
End If
|
||||||
|
|
||||||
ElseIf Config.DOCUMENT_PATH_MOVE_AFTSEND <> String.Empty Then
|
|
||||||
Logger.Debug("DOCUMENT_PATH_MOVE_AFTSEND configured: [{0}] - Overwrite ExportPath", Config.DOCUMENT_PATH_MOVE_AFTSEND)
|
|
||||||
Config.ExportPath = Config.DOCUMENT_PATH_MOVE_AFTSEND
|
|
||||||
Config.NetUse_Finish = True
|
|
||||||
Else
|
Else
|
||||||
Config.ExportPath = Config.ExportPath
|
Config.ExportPath = Config.ExportPath
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
Logger.Debug("ExportPath: [{0}]", Config.ExportPath)
|
Logger.Debug("ExportPath: [{0}]", Config.ExportPath)
|
||||||
|
|
||||||
|
If Config.NetUse_Finish = True Then
|
||||||
|
Logger.Debug("NetUse_Finish = true, Now executing NetUse....")
|
||||||
|
If NetUse_Command(Config.DocumentPath, My.Settings.NetUse_Usr, My.Settings.NetUse_PW) = True Then
|
||||||
|
Logger.Debug("NetUse_Finish = successful!")
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
Dim oCompleteStatus As Integer = Constants.EnvelopeStatus.EnvelopeCompletelySigned
|
Dim oCompleteStatus As Integer = Constants.EnvelopeStatus.EnvelopeCompletelySigned
|
||||||
Dim oSql = $"SELECT * FROM TBSIG_ENVELOPE WHERE STATUS = {oCompleteStatus} AND DATEDIFF(minute, CHANGED_WHEN, GETDATE()) >= {CompleteWaitTimeInMinutes}"
|
Dim oSql = $"SELECT * FROM TBSIG_ENVELOPE WHERE STATUS = {oCompleteStatus} AND DATEDIFF(minute, CHANGED_WHEN, GETDATE()) >= {CompleteWaitTime}"
|
||||||
Dim oTable = Database.GetDatatable(oSql)
|
Dim oTable = Database.GetDatatable(oSql)
|
||||||
|
|
||||||
Dim oEnvelopeIds As List(Of Integer) = oTable.Rows.Cast(Of DataRow).
|
Dim oEnvelopeIds As List(Of Integer) = oTable.Rows.Cast(Of DataRow).
|
||||||
@ -149,6 +154,11 @@ Namespace Jobs
|
|||||||
Logger.Debug("Loading Envelope Data..")
|
Logger.Debug("Loading Envelope Data..")
|
||||||
Dim oEnvelopeData = GetEnvelopeData(oId)
|
Dim oEnvelopeData = GetEnvelopeData(oId)
|
||||||
|
|
||||||
|
If Config.DOCUMENT_PATH_MOVE_AFTSEND <> String.Empty Then
|
||||||
|
oEnvelopeData.DocumentPath.Replace(Config.DocumentPathOrigin, Config.DOCUMENT_PATH_MOVE_AFTSEND)
|
||||||
|
Logger.Debug("Replaced Path in oEnvelopeData.DocumentPath!")
|
||||||
|
End If
|
||||||
|
|
||||||
If oEnvelopeData Is Nothing Then
|
If oEnvelopeData Is Nothing Then
|
||||||
Logger.Warn("EnvelopeData could not be loaded for Id [{0}]!", oId)
|
Logger.Warn("EnvelopeData could not be loaded for Id [{0}]!", oId)
|
||||||
Throw New ArgumentNullException("EnvelopeData")
|
Throw New ArgumentNullException("EnvelopeData")
|
||||||
@ -187,7 +197,7 @@ Namespace Jobs
|
|||||||
Throw New ExportDocumentException("Could not export final document to disk!", ex)
|
Throw New ExportDocumentException("Could not export final document to disk!", ex)
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
Logger.Info("Sending final Emails..")
|
Logger.Info("Sending finalized report-mails..")
|
||||||
|
|
||||||
If Config.NetUse_Finish = True Then
|
If Config.NetUse_Finish = True Then
|
||||||
If Config.FINISHED_PATH_EX_DMZ <> String.Empty Then
|
If Config.FINISHED_PATH_EX_DMZ <> String.Empty Then
|
||||||
@ -196,7 +206,10 @@ Namespace Jobs
|
|||||||
If oReturnPath <> String.Empty Then
|
If oReturnPath <> String.Empty Then
|
||||||
oOutputFilePath = oReturnPath
|
oOutputFilePath = oReturnPath
|
||||||
If Config.EML_PATH_EX_DMZ <> String.Empty Then
|
If Config.EML_PATH_EX_DMZ <> String.Empty Then
|
||||||
|
Logger.Debug($"Now replacing [{Config.FINISHED_PATH_EX_DMZ}] with ")
|
||||||
|
Logger.Debug($"............. [{Config.EML_PATH_EX_DMZ}] ")
|
||||||
oOutputFilePath = oOutputFilePath.Replace(Config.FINISHED_PATH_EX_DMZ, Config.EML_PATH_EX_DMZ)
|
oOutputFilePath = oOutputFilePath.Replace(Config.FINISHED_PATH_EX_DMZ, Config.EML_PATH_EX_DMZ)
|
||||||
|
Logger.Debug($"oOutputFilePath [{oOutputFilePath}] ")
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
@ -238,11 +251,8 @@ Namespace Jobs
|
|||||||
|
|
||||||
Return Task.FromResult(True)
|
Return Task.FromResult(True)
|
||||||
End Function
|
End Function
|
||||||
|
Private Function NetUse_Command(pDestinationPath As String, pUsername As String, pPassword As String)
|
||||||
Private Function MoveFileWithNetUse(pSourcePath As String, pDestinationPath As String, pUsername As String, pPassword As String) As String
|
|
||||||
Dim oDectryptedPW = Helpers.Decrypt(My.Settings.NetUse_PW)
|
Dim oDectryptedPW = Helpers.Decrypt(My.Settings.NetUse_PW)
|
||||||
Dim oFilename = System.IO.Path.GetFileName(pSourcePath)
|
|
||||||
|
|
||||||
Dim netUseCommand As String = $"net use {pDestinationPath} /user:{pUsername} {oDectryptedPW}"
|
Dim netUseCommand As String = $"net use {pDestinationPath} /user:{pUsername} {oDectryptedPW}"
|
||||||
|
|
||||||
Dim processInfo As New ProcessStartInfo("cmd.exe", $"/C {netUseCommand}")
|
Dim processInfo As New ProcessStartInfo("cmd.exe", $"/C {netUseCommand}")
|
||||||
@ -255,10 +265,32 @@ Namespace Jobs
|
|||||||
|
|
||||||
' Prüfe den Rückgabewert des net use Befehls
|
' Prüfe den Rückgabewert des net use Befehls
|
||||||
If process.ExitCode = 0 Then
|
If process.ExitCode = 0 Then
|
||||||
|
Return True
|
||||||
|
Else
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
End Using
|
||||||
|
End Function
|
||||||
|
Private Function MoveFileWithNetUse(pSourcePath As String, pDestinationPath As String, pUsername As String, pPassword As String) As String
|
||||||
|
Dim oDectryptedPW = Helpers.Decrypt(My.Settings.NetUse_PW)
|
||||||
|
Dim oFilename = System.IO.Path.GetFileName(pSourcePath)
|
||||||
|
|
||||||
|
Dim netUseCommand As String = $"net use {pDestinationPath} /user:{pUsername} {oDectryptedPW}"
|
||||||
|
|
||||||
|
Dim processInfo As New ProcessStartInfo("cmd.exe", $"/C {netUseCommand}")
|
||||||
|
processInfo.RedirectStandardOutput = True
|
||||||
|
processInfo.UseShellExecute = False
|
||||||
|
processInfo.CreateNoWindow = True
|
||||||
|
|
||||||
|
Using oProcess As Process = Process.Start(processInfo)
|
||||||
|
oProcess.WaitForExit()
|
||||||
|
|
||||||
|
' Prüfe den Rückgabewert des net use Befehls
|
||||||
|
If oProcess.ExitCode = 0 Then
|
||||||
' Verschiebe die Datei
|
' Verschiebe die Datei
|
||||||
Try
|
Try
|
||||||
Dim oFilePath As String = pSourcePath
|
Dim oFilePath As String = pSourcePath
|
||||||
|
Dim oDirectory As String = Path.GetDirectoryName(oFilePath)
|
||||||
Dim split As String() = oFilePath.Split("\")
|
Dim split As String() = oFilePath.Split("\")
|
||||||
Dim parentFolder As String = split(split.Length - 2)
|
Dim parentFolder As String = split(split.Length - 2)
|
||||||
pDestinationPath &= "\" + parentFolder
|
pDestinationPath &= "\" + parentFolder
|
||||||
@ -271,6 +303,7 @@ Namespace Jobs
|
|||||||
End If
|
End If
|
||||||
Logger.Info($"MoveFileWithNetUse To {pDestinationPath} ...")
|
Logger.Info($"MoveFileWithNetUse To {pDestinationPath} ...")
|
||||||
System.IO.File.Move(pSourcePath, pDestinationPath)
|
System.IO.File.Move(pSourcePath, pDestinationPath)
|
||||||
|
Directory.Delete(oDirectory)
|
||||||
Return pDestinationPath
|
Return pDestinationPath
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
Logger.Error(ex)
|
Logger.Error(ex)
|
||||||
@ -352,7 +385,15 @@ Namespace Jobs
|
|||||||
|
|
||||||
Logger.Info("Burning [{0}] signatures", pData.AnnotationData.Count)
|
Logger.Info("Burning [{0}] signatures", pData.AnnotationData.Count)
|
||||||
Dim oAnnotations = pData.AnnotationData
|
Dim oAnnotations = pData.AnnotationData
|
||||||
Dim oInputPath = pData.DocumentPath
|
Dim oInputPath = ""
|
||||||
|
|
||||||
|
If My.Settings.RuninDMZ Then
|
||||||
|
oInputPath = pData.DocumentPath.Replace(Config.DocumentPathOrigin, Config.DocumentPath)
|
||||||
|
Logger.Debug("Replaced Path in pData.DocumentPath!")
|
||||||
|
ElseIf Config.DOCUMENT_PATH_MOVE_AFTSEND <> String.Empty Then
|
||||||
|
oInputPath = pData.DocumentPath.Replace(Config.DocumentPathOrigin, Config.DOCUMENT_PATH_MOVE_AFTSEND)
|
||||||
|
Logger.Debug("Replaced Path in pData.DocumentPath!")
|
||||||
|
End If
|
||||||
|
|
||||||
Logger.Info("Input path: [{0}]", oInputPath)
|
Logger.Info("Input path: [{0}]", oInputPath)
|
||||||
Dim oInputDocumentBuffer As Byte()
|
Dim oInputDocumentBuffer As Byte()
|
||||||
|
|||||||
@ -17,6 +17,7 @@ Public Class ConfigModel
|
|||||||
|
|
||||||
Return New DbConfig() With {
|
Return New DbConfig() With {
|
||||||
.DocumentPath = oRow.ItemEx("DOCUMENT_PATH", ""),
|
.DocumentPath = oRow.ItemEx("DOCUMENT_PATH", ""),
|
||||||
|
.DocumentPathOrigin = oRow.ItemEx("DOCUMENT_PATH", ""),
|
||||||
.DocumentPath_DMZ = oRow.ItemEx("DOCUMENT_PATH_DMZ", ""),
|
.DocumentPath_DMZ = oRow.ItemEx("DOCUMENT_PATH_DMZ", ""),
|
||||||
.ExportPath = oRow.ItemEx("EXPORT_PATH", ""),
|
.ExportPath = oRow.ItemEx("EXPORT_PATH", ""),
|
||||||
.ExportPath_DMZ = oRow.ItemEx("EXPORT_PATH_DMZ", ""),
|
.ExportPath_DMZ = oRow.ItemEx("EXPORT_PATH_DMZ", ""),
|
||||||
|
|||||||
@ -72,16 +72,13 @@ Namespace My
|
|||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
<Global.System.Configuration.UserScopedSettingAttribute(), _
|
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
||||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||||
Global.System.Configuration.DefaultSettingValueAttribute("sY4vnATDXwosbTJGip6SqA==")> _
|
Global.System.Configuration.DefaultSettingValueAttribute("sY4vnATDXwosbTJGip6SqA==")> _
|
||||||
Public Property NetUse_PW() As String
|
Public ReadOnly Property NetUse_PW() As String
|
||||||
Get
|
Get
|
||||||
Return CType(Me("NetUse_PW"),String)
|
Return CType(Me("NetUse_PW"),String)
|
||||||
End Get
|
End Get
|
||||||
Set
|
|
||||||
Me("NetUse_PW") = value
|
|
||||||
End Set
|
|
||||||
End Property
|
End Property
|
||||||
End Class
|
End Class
|
||||||
End Namespace
|
End Namespace
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
<Setting Name="NetUse_Usr" Type="System.String" Scope="Application">
|
<Setting Name="NetUse_Usr" Type="System.String" Scope="Application">
|
||||||
<Value Profile="(Default)">dd-gan\Administrator</Value>
|
<Value Profile="(Default)">dd-gan\Administrator</Value>
|
||||||
</Setting>
|
</Setting>
|
||||||
<Setting Name="NetUse_PW" Type="System.String" Scope="User">
|
<Setting Name="NetUse_PW" Type="System.String" Scope="Application">
|
||||||
<Value Profile="(Default)">sY4vnATDXwosbTJGip6SqA==</Value>
|
<Value Profile="(Default)">sY4vnATDXwosbTJGip6SqA==</Value>
|
||||||
</Setting>
|
</Setting>
|
||||||
</Settings>
|
</Settings>
|
||||||
|
|||||||
@ -5,9 +5,6 @@
|
|||||||
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
|
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
|
||||||
<section name="EnvelopeGenerator.Common.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
|
<section name="EnvelopeGenerator.Common.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
|
||||||
</sectionGroup>
|
</sectionGroup>
|
||||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
|
|
||||||
<section name="EnvelopeGenerator.Common.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
|
||||||
</sectionGroup>
|
|
||||||
</configSections>
|
</configSections>
|
||||||
<system.diagnostics>
|
<system.diagnostics>
|
||||||
<sources>
|
<sources>
|
||||||
@ -40,13 +37,9 @@
|
|||||||
<setting name="NetUse_Usr" serializeAs="String">
|
<setting name="NetUse_Usr" serializeAs="String">
|
||||||
<value>dd-gan\Administrator</value>
|
<value>dd-gan\Administrator</value>
|
||||||
</setting>
|
</setting>
|
||||||
</EnvelopeGenerator.Common.My.MySettings>
|
|
||||||
</applicationSettings>
|
|
||||||
<userSettings>
|
|
||||||
<EnvelopeGenerator.Common.My.MySettings>
|
|
||||||
<setting name="NetUse_PW" serializeAs="String">
|
<setting name="NetUse_PW" serializeAs="String">
|
||||||
<value>sY4vnATDXwosbTJGip6SqA==</value>
|
<value>sY4vnATDXwosbTJGip6SqA==</value>
|
||||||
</setting>
|
</setting>
|
||||||
</EnvelopeGenerator.Common.My.MySettings>
|
</EnvelopeGenerator.Common.My.MySettings>
|
||||||
</userSettings>
|
</applicationSettings>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|||||||
@ -364,7 +364,7 @@ Partial Public Class frmEnvelopeEditor
|
|||||||
' Verschiebe die Datei
|
' Verschiebe die Datei
|
||||||
Try
|
Try
|
||||||
Dim oFilePath As String = pSourcePath
|
Dim oFilePath As String = pSourcePath
|
||||||
|
Dim oDirectory As String = Path.GetDirectoryName(oFilePath)
|
||||||
Dim split As String() = oFilePath.Split("\")
|
Dim split As String() = oFilePath.Split("\")
|
||||||
Dim parentFolder As String = split(split.Length - 2)
|
Dim parentFolder As String = split(split.Length - 2)
|
||||||
pDestinationPath &= "\" + parentFolder
|
pDestinationPath &= "\" + parentFolder
|
||||||
@ -376,6 +376,7 @@ Partial Public Class frmEnvelopeEditor
|
|||||||
File.Delete(pDestinationPath)
|
File.Delete(pDestinationPath)
|
||||||
End If
|
End If
|
||||||
System.IO.File.Move(pSourcePath, pDestinationPath)
|
System.IO.File.Move(pSourcePath, pDestinationPath)
|
||||||
|
System.IO.Directory.Delete(oDirectory)
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
MsgBox(ex.Message, MsgBoxStyle.Critical, "Unexpected error in MoveFileWithNetUse")
|
MsgBox(ex.Message, MsgBoxStyle.Critical, "Unexpected error in MoveFileWithNetUse")
|
||||||
End Try
|
End Try
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user