Customize Msgbox title, handle minDate when file not found, show filename in msgbox

This commit is contained in:
Jonathan Jenne
2021-05-04 14:06:08 +02:00
parent 580597569d
commit e029c20ae9
3 changed files with 35 additions and 81 deletions

View File

@@ -1,5 +1,7 @@
Public Class ClassIndexFunctions
Public Shared Function FileExistsinDropTable(Filename As String) As DateTime
Imports System.IO
Public Class ClassIndexFunctions
Public Shared Function FileExistsinDropTable(Filename As String) As Date
Dim oSQL As String
Dim oHash As String
@@ -45,4 +47,31 @@
Return Nothing
End Try
End Function
Public Shared Function CheckDuplicateFiles(Filepath As String, ModuleTitle As String)
Dim oFileInfo As New FileInfo(Filepath)
Dim oFilename As String = oFileInfo.Name
Dim oFileExists As Date = FileExistsinDropTable(Filepath)
If oFileExists.Equals(Date.MinValue) Then
Return True
Else
Dim oResult As DialogResult
Dim oDate As String = oFileExists.ToString("d")
Dim oBoxTitle = $"GLOBIX - {ModuleTitle}"
Dim oBoxOptions = MsgBoxStyle.Question Or MsgBoxStyle.YesNo
If USER_LANGUAGE = "de-DE" Then
oResult = MsgBox($"Die Datei [{oFilename}] wurde bereits am [{oDate}] verarbeitet. Wollen Sie die gleiche Datei noch einmal verarbeiten?", oBoxOptions, oBoxTitle)
Else
oResult = MsgBox($"The file [{oFilename}] has already been processed at [{oDate}]. Do you want to process the same file again?", oBoxOptions, oBoxTitle)
End If
If oResult = DialogResult.Yes Then
Return True
End If
End If
Return False
End Function
End Class