diff --git a/EnvelopeGenerator.Common/Entities/Envelope.vb b/EnvelopeGenerator.Common/Entities/Envelope.vb
index 5f6af46c..768563cf 100644
--- a/EnvelopeGenerator.Common/Entities/Envelope.vb
+++ b/EnvelopeGenerator.Common/Entities/Envelope.vb
@@ -32,8 +32,6 @@
Public Property History As New List(Of EnvelopeHistoryEntry)
Public Property EnvelopeType As EnvelopeType
Public Property DOC_RESULT As Byte()
- Public Property Doc1 As Byte()
-
Public ReadOnly Property EnvelopeTypeTitle As String
Get
Return EnvelopeType?.Title
diff --git a/EnvelopeGenerator.Common/EnvelopeGenerator.Common.vbproj b/EnvelopeGenerator.Common/EnvelopeGenerator.Common.vbproj
index d0d1b92e..9d57e5fa 100644
--- a/EnvelopeGenerator.Common/EnvelopeGenerator.Common.vbproj
+++ b/EnvelopeGenerator.Common/EnvelopeGenerator.Common.vbproj
@@ -220,6 +220,7 @@
True
Model.resx
+
diff --git a/EnvelopeGenerator.Common/Jobs/FinalizeDocument/FinalizeDocumentJob.vb b/EnvelopeGenerator.Common/Jobs/FinalizeDocument/FinalizeDocumentJob.vb
index b600c75c..d35f149b 100644
--- a/EnvelopeGenerator.Common/Jobs/FinalizeDocument/FinalizeDocumentJob.vb
+++ b/EnvelopeGenerator.Common/Jobs/FinalizeDocument/FinalizeDocumentJob.vb
@@ -43,6 +43,7 @@ Namespace Jobs
Private ReadOnly CompleteWaitTime As Integer = 5
Private ParentFolderUID As String = ""
+ Private myTempFiles As TempFiles
Private Class EnvelopeData
Public EnvelopeId As Integer
@@ -56,7 +57,8 @@ Namespace Jobs
Dim oGdPictureKey As String = pContext.MergedJobDataMap.Item(Constants.GDPICTURE)
LogConfig = pContext.MergedJobDataMap.Item(Constants.LOGCONFIG)
Logger = LogConfig.GetLogger()
-
+ myTempFiles = New TempFiles(LogConfig)
+ myTempFiles.Create()
Dim JobId = pContext.JobDetail.Key
Logger.Info("Starting job {0}", JobId)
@@ -410,14 +412,18 @@ Namespace Jobs
Else
Logger.Info($"we got bytes..")
oInputPath = Config.DocumentPathOrigin
- Dim oTempFolder = TempFiles.TempPath
+ Logger.Info($"oInputPath: {Config.DocumentPathOrigin}")
End If
+ If IsNothing(pEnvelopeData.DocAsByte) Then
+ Dim oDirectorySource As String = Path.GetDirectoryName(oInputPath)
+ Dim split As String() = oDirectorySource.Split("\")
+ ParentFolderUID = split(split.Length - 1)
+ Else
+ ParentFolderUID = pEnvelopeData.EnvelopeId
+ End If
- Dim oDirectorySource As String = Path.GetDirectoryName(oInputPath)
- Dim split As String() = oDirectorySource.Split("\")
- ParentFolderUID = split(split.Length - 1)
Logger.Info("ParentFolderUID: [{0}]", ParentFolderUID)
Dim oInputDocumentBuffer As Byte()
diff --git a/EnvelopeGenerator.Common/Jobs/FinalizeDocument/PDFBurner.vb b/EnvelopeGenerator.Common/Jobs/FinalizeDocument/PDFBurner.vb
index e91dad40..f85a8155 100644
--- a/EnvelopeGenerator.Common/Jobs/FinalizeDocument/PDFBurner.vb
+++ b/EnvelopeGenerator.Common/Jobs/FinalizeDocument/PDFBurner.vb
@@ -41,8 +41,6 @@ Namespace Jobs.FinalizeDocument
Throw New BurnAnnotationException($"Adding Annotation failed")
End If
Next
-
-
oResult = Manager.BurnAnnotationsToPage(RemoveInitialAnnots:=True, VectorMode:=True)
If oResult <> GdPictureStatus.OK Then
Throw New BurnAnnotationException($"Could not burn annotations to file: [{oResult}]")
@@ -71,6 +69,7 @@ Namespace Jobs.FinalizeDocument
Dim oAnnotationData = JsonConvert.DeserializeObject(Of AnnotationData)(pInstantJSON)
For Each oAnnotation In oAnnotationData.annotations
+ Logger.Debug("Adding AnnotationID: " + oAnnotation.id)
Select Case oAnnotation.type
Case ANNOTATION_TYPE_IMAGE
AddImageAnnotation(oAnnotation, oAnnotationData.attachments)
diff --git a/EnvelopeGenerator.Common/Models/EmailModel.vb b/EnvelopeGenerator.Common/Models/EmailModel.vb
index 0f1bb589..b04a45b2 100644
--- a/EnvelopeGenerator.Common/Models/EmailModel.vb
+++ b/EnvelopeGenerator.Common/Models/EmailModel.vb
@@ -26,7 +26,7 @@ Public Class EmailModel
'oCommand.Parameters.Add("EMAIL_ATTMT1", SqlDbType.NVarChar).Value = pEmail.EmailAttachment
oCommand.Parameters.Add("WF_ID", SqlDbType.Int).Value = pEmail.EmailType ' Wegen DB-Trigger MUSS dieser Wert gesetzt werden
oCommand.Parameters.Add("ATT1_RELATED_ID", SqlDbType.Int).Value = pEmail.ATT1_RELATED_ID
- oCommand.Parameters.Add("ATT1_REL_TYP", SqlDbType.NVarChar).Value = pEmail.ATT1_REL_TYPE
+ oCommand.Parameters.Add("ATT1_REL_TYPE", SqlDbType.NVarChar).Value = pEmail.ATT1_REL_TYPE
If Database.ExecuteNonQuery(oCommand) Then
Return True
diff --git a/EnvelopeGenerator.Common/Models/EnvelopeModel.vb b/EnvelopeGenerator.Common/Models/EnvelopeModel.vb
index e4d6f327..96bd1648 100644
--- a/EnvelopeGenerator.Common/Models/EnvelopeModel.vb
+++ b/EnvelopeGenerator.Common/Models/EnvelopeModel.vb
@@ -193,6 +193,9 @@ Public Class EnvelopeModel
oCommand.Parameters.Add("TITLE", SqlDbType.NVarChar).Value = pEnvelope.Title
oCommand.Parameters.Add("ENVELOPE_TYPE", SqlDbType.Int).Value = pEnvelope.EnvelopeTypeId
oCommand.Parameters.Add("CONTRACT_TYPE", SqlDbType.Int).Value = pEnvelope.ContractType
+ If IsNothing(pEnvelope.Language) Then
+ pEnvelope.Language = "de-DE"
+ End If
oCommand.Parameters.Add("LANGUAGE", SqlDbType.NVarChar).Value = pEnvelope.Language
oCommand.Parameters.Add("CERTIFICATION_TYPE", SqlDbType.Int).Value = pEnvelope.CertificationType
oCommand.Parameters.Add("EXPIRES_WHEN_DAYS", SqlDbType.Int).Value = pEnvelope.ExpiresWhenDays
diff --git a/EnvelopeGenerator.Common/My Project/AssemblyInfo.vb b/EnvelopeGenerator.Common/My Project/AssemblyInfo.vb
index 4dccea27..c850157e 100644
--- a/EnvelopeGenerator.Common/My Project/AssemblyInfo.vb
+++ b/EnvelopeGenerator.Common/My Project/AssemblyInfo.vb
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' indem Sie "*" wie unten gezeigt eingeben:
'
-
-
+
+
diff --git a/EnvelopeGenerator.Common/TempFiles.vb b/EnvelopeGenerator.Common/TempFiles.vb
new file mode 100644
index 00000000..3ae0eff7
--- /dev/null
+++ b/EnvelopeGenerator.Common/TempFiles.vb
@@ -0,0 +1,60 @@
+Imports System.IO
+Imports DigitalData.Modules.Base
+Imports DigitalData.Modules.Logging
+
+Public Class TempFiles
+ Inherits BaseClass
+
+ Public Property TempPath As String
+
+ Public Sub New(pLogConfig As LogConfig)
+ MyBase.New(pLogConfig)
+
+ Dim oTempDirectoryPath = Path.GetTempPath()
+ TempPath = Path.Combine(oTempDirectoryPath, "EnvelopeGenerator")
+ End Sub
+
+ Public Function Create() As Boolean
+ Try
+ If Directory.Exists(TempPath) = False Then
+ Directory.CreateDirectory(TempPath)
+ Else
+ CleanUpFiles()
+ End If
+ Return True
+
+ Catch ex As Exception
+ Logger.Error(ex)
+ Return False
+ End Try
+
+ End Function
+
+ Private Function CleanUpFiles() As Boolean
+ Try
+ For Each fileItem As String In Directory.GetFiles(TempPath)
+ Logger.Debug("Deleting tempPath-file: {0} ...", fileItem)
+ File.Delete(fileItem)
+ Next
+
+ Return True
+
+ Catch ex As Exception
+ Logger.Error(ex)
+ Return False
+ End Try
+ End Function
+
+ Public Function CleanUp() As Boolean
+ Try
+ Logger.Debug("Deleting tempPath-Data: {0} ...", TempPath)
+ Directory.Delete(TempPath, True)
+ Return True
+
+ Catch ex As Exception
+ Logger.Error(ex)
+ Return False
+ End Try
+ End Function
+
+End Class
diff --git a/EnvelopeGenerator.Form/frmEnvelopeEditor.vb b/EnvelopeGenerator.Form/frmEnvelopeEditor.vb
index 2e8ac836..00426aa7 100644
--- a/EnvelopeGenerator.Form/frmEnvelopeEditor.vb
+++ b/EnvelopeGenerator.Form/frmEnvelopeEditor.vb
@@ -37,113 +37,36 @@ Partial Public Class frmEnvelopeEditor
Private Async Sub btnNewFile_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnNewFile.ItemClick
Dim oHandle = SplashScreenManager.ShowOverlayForm(Me)
- If IsNothing(Envelope) Then
- SaveEnvelopeWithValidation()
- If IsNothing(Envelope) Then
- Exit Sub
- End If
- End If
+ 'SaveEnvelopeWithValidation()
+ ' If Not IsNothing(Envelope) Then
Try
- ' prüfen ob es schon eine Datei gibt
- If Documents.Count > 0 Then
- MsgBox(Resources.Envelope.Only_one_file_is_allowed, MsgBoxStyle.Information, Text)
- Return
- End If
-
- If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
- Dim oDocument = Await Controller.CreateDocument(OpenFileDialog1.FileName)
-
- If oDocument IsNot Nothing Then
- Documents.Add(oDocument)
- ' Update_File_DB(OpenFileDialog1.FileName)
- Else
- MsgBox(Resources.Envelope.Document_Could_Not_Be_Saved, MsgBoxStyle.Critical, Text)
+ ' prüfen ob es schon eine Datei gibt
+ If Documents.Count > 0 Then
+ MsgBox(Resources.Envelope.Only_one_file_is_allowed, MsgBoxStyle.Information, Text)
+ Return
End If
- End If
- Catch ex As Exception
- Logger.Error(ex)
- Finally
- SplashScreenManager.CloseOverlayForm(oHandle)
+ If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
+ Dim oDocument = Await Controller.CreateDocument(OpenFileDialog1.FileName)
- RibbonPageGroupAddSignature_Enabled()
- End Try
- End Sub
- Sub Update_File_DB(pFilePath As String)
- Dim SqlCom As SqlCommand
- Dim imageData As Byte()
- Dim sFileName As String
- Dim qry As String
+ If oDocument IsNot Nothing Then
+ Documents.Add(oDocument)
+ ' Update_File_DB(OpenFileDialog1.FileName)
+ Else
+ MsgBox(Resources.Envelope.Document_Could_Not_Be_Saved, MsgBoxStyle.Critical, Text)
+ End If
+ End If
- Try
- 'Read Image Bytes into a byte array
- 'Initialize SQL Server Connection
+ Catch ex As Exception
+ Logger.Error(ex)
+ Finally
+ SplashScreenManager.CloseOverlayForm(oHandle)
- 'Convert File to bytes Array
- imageData = ReadFile(pFilePath)
- sFileName = System.IO.Path.GetFileName(pFilePath)
- 'Set insert query
- qry = $"UPDATE TBSIG_ENVELOPE SET DOC1 = @ImageData WHERE GUID = {Envelope.Id}"
- 'Initialize SqlCommand object for insert.
- SqlCom = New SqlCommand(qry, DB_DD_ECM.GetConnection)
- 'We are passing File Name and Image byte data as sql parameters.
- SqlCom.Parameters.Add(New SqlParameter("@ImageData", DirectCast(imageData, Object)))
- 'Execute the Query
- SqlCom.ExecuteNonQuery()
- Catch ex As Exception
- Logger.Error(ex)
- MessageBox.Show(ex.ToString())
-
- End Try
- End Sub
- 'Open file in to a filestream and read data in a byte array.
- Private Function ReadFile(ByVal sPath As String) As Byte()
- 'Initialize byte array with a null value initially.
- Dim data As Byte() = Nothing
- 'Use FileInfo object to get file size.
- Dim fInfo As New FileInfo(sPath)
- Dim numBytes As Long = fInfo.Length
- 'Open FileStream to read file
- Dim fStream As New FileStream(sPath, FileMode.Open, FileAccess.Read)
- 'Use BinaryReader to read file stream into byte array.
- Dim br As New BinaryReader(fStream)
- 'When you use BinaryReader, you need to supply number of bytes to read from file.
- 'In this case we want to read entire file. So supplying total number of bytes.
- data = br.ReadBytes(CInt(numBytes))
- Return data
- End Function
- Private Sub downLoadFile(ByVal sFileName As String)
-
- Dim strSql As String
-
- 'For Document
- Try
- 'Get image data from gridview column.
- strSql = "Select [DOC1] from [TBSIG_ENVELOPE] WHERE GUID =" & Envelope.Id
-
-
- 'Get image data from DB
- Dim fileData As Byte() = DirectCast(DB_DD_ECM.GetScalarValue(strSql), Byte())
- Dim sTempFileName As String = Application.StartupPath & "\" & sFileName
- If Not fileData Is Nothing Then
-
- 'Read image data into a file stream
- Using fs As New FileStream(sFileName, FileMode.OpenOrCreate, FileAccess.Write)
- fs.Write(fileData, 0, fileData.Length)
- 'Set image variable value using memory stream.
- fs.Flush()
- fs.Close()
- End Using
-
- 'Open File
-
- Process.Start(sFileName)
-
- End If
-
- Catch ex As Exception
- MsgBox(ex.Message)
- End Try
+ RibbonPageGroupAddSignature_Enabled()
+ End Try
+ ' Else
+ ' SplashScreenManager.CloseOverlayForm(oHandle)
+ ' End If
End Sub
Private Sub frmEditor_Load(sender As Object, e As EventArgs) Handles Me.Load
diff --git a/EnvelopeGenerator.Form/frmMain.vb b/EnvelopeGenerator.Form/frmMain.vb
index 4b3dac16..48badb18 100644
--- a/EnvelopeGenerator.Form/frmMain.vb
+++ b/EnvelopeGenerator.Form/frmMain.vb
@@ -374,27 +374,6 @@ Public Class frmMain
End Try
Me.Cursor = Cursors.Default
End Sub
- 'Private Sub GetFileStreamByte(ByVal pEnvID As Long)
-
- ' Dim strSql As String
- ' 'For Document
- ' Try
- ' 'Get image data from gridview column.
- ' strSql = "Select [DOC1] from [TBSIG_ENVELOPE] WHERE GUID =" & pEnvID
- ' 'Get image data from DB
- ' Dim fileData As Byte() = DirectCast(DB_DD_ECM.GetScalarValue(strSql), Byte())
- ' If Not fileData Is Nothing Then
- ' myFileData = fileData
- ' Else
- ' myFileData = Nothing
- ' End If
-
- ' Catch ex As Exception
- ' MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Error in GetFileStreamByte")
- ' myFileData = Nothing
- ' End Try
-
- 'End Sub
Private Sub GetResRepFileStreamByte(ByVal pEnvID As Long)
Dim strSql As String
@@ -504,6 +483,7 @@ Public Class frmMain
Else
BarCheckItem1.Checked = False
End If
+ bbtnitmEB.Enabled = False
RefreshTimer.Start()
End Sub