Modules.Jobs: Dateien löschen, falls Prüfung fehlschlägt
This commit is contained in:
@@ -868,6 +868,7 @@ Public Class ImportZUGFeRDFiles
|
|||||||
_logger.Error("Could not save File to Disk!")
|
_logger.Error("Could not save File to Disk!")
|
||||||
Dim oReasonString = "Could not save file " + newAttachmentFilename + " to disk."
|
Dim oReasonString = "Could not save file " + newAttachmentFilename + " to disk."
|
||||||
AddRejectedState(pMessageId, oReasonString, "EMBEDDED FILE CONSISTENCY NOT OK", "Info GUI", pConnections.SQLServerTransaction)
|
AddRejectedState(pMessageId, oReasonString, "EMBEDDED FILE CONSISTENCY NOT OK", "Info GUI", pConnections.SQLServerTransaction)
|
||||||
|
nextAttachmentIndex += 1
|
||||||
Continue For
|
Continue For
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@@ -875,6 +876,11 @@ Public Class ImportZUGFeRDFiles
|
|||||||
_logger.Error("Could not save File to Disk!")
|
_logger.Error("Could not save File to Disk!")
|
||||||
Dim oReasonString = "Validation of file " + newAttachmentFilename + " on disk was NOT succesfully."
|
Dim oReasonString = "Validation of file " + newAttachmentFilename + " on disk was NOT succesfully."
|
||||||
AddRejectedState(pMessageId, oReasonString, "EMBEDDED FILE CONSISTENCY NOT OK", "Info GUI", pConnections.SQLServerTransaction)
|
AddRejectedState(pMessageId, oReasonString, "EMBEDDED FILE CONSISTENCY NOT OK", "Info GUI", pConnections.SQLServerTransaction)
|
||||||
|
|
||||||
|
' Datei ist Murks und muss gelöscht werden, wenn möglich
|
||||||
|
DeleteFileFromDisk(embeddedFilePath)
|
||||||
|
|
||||||
|
nextAttachmentIndex += 1
|
||||||
Continue For
|
Continue For
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@@ -920,6 +926,20 @@ Public Class ImportZUGFeRDFiles
|
|||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Private Function DeleteFileFromDisk(pEmbeddedFilePath As String) As Boolean
|
||||||
|
|
||||||
|
Try
|
||||||
|
Dim oFile As FileInfo = New FileInfo(pEmbeddedFilePath)
|
||||||
|
If oFile IsNot Nothing Then
|
||||||
|
oFile.Delete()
|
||||||
|
End If
|
||||||
|
Return True
|
||||||
|
Catch ex As Exception
|
||||||
|
_logger.Warn("Coul not delete file {0}.", pEmbeddedFilePath)
|
||||||
|
Return False
|
||||||
|
End Try
|
||||||
|
End Function
|
||||||
|
|
||||||
Private Function GetEmbeddedFileExtension(pMimeTypeValue As String) As String
|
Private Function GetEmbeddedFileExtension(pMimeTypeValue As String) As String
|
||||||
|
|
||||||
If pMimeTypeValue.IsNullOrEmpty() Then
|
If pMimeTypeValue.IsNullOrEmpty() Then
|
||||||
|
|||||||
Reference in New Issue
Block a user