Duplicate files message box with top most, only hash filename for msg files directly from outlook

This commit is contained in:
Jonathan Jenne 2021-07-07 10:59:23 +02:00
parent 47a66e1220
commit 82be34b28e
6 changed files with 35 additions and 30 deletions

View File

@ -91,8 +91,7 @@ Public Class ClassFileDrop
LOGGER.Info("Attachment File from Outlook could not be created") LOGGER.Info("Attachment File from Outlook could not be created")
End If End If
End If End If
End If ElseIf e.Data.GetDataPresent("FileGroupDescriptor") Then
If e.Data.GetDataPresent("FileGroupDescriptor") Then
Dim oApp As Outlook.Application Dim oApp As Outlook.Application
Try Try
oApp = New Outlook.Application() oApp = New Outlook.Application()
@ -141,6 +140,8 @@ Public Class ClassFileDrop
Next Next
Return True Return True
'Drop eines Outlook Attachments 'Drop eines Outlook Attachments
Else
Return False
End If End If
Catch ex As Exception Catch ex As Exception
MsgBox("Error in Drop-File" & vbNewLine & ex.Message, MsgBoxStyle.Critical) MsgBox("Error in Drop-File" & vbNewLine & ex.Message, MsgBoxStyle.Critical)

View File

@ -1,7 +1,7 @@
Imports System.IO Imports System.IO
Public Class ClassIndexFunctions Public Class ClassIndexFunctions
Public Shared Function FileExistsinDropTable(pFilename As String) As Date Public Shared Function FileExistsinDropTable(pFilename As String, pHandleType As String) As Date
Dim oSQL As String Dim oSQL As String
Dim oHash As String Dim oHash As String
@ -10,7 +10,7 @@ Public Class ClassIndexFunctions
pFilename = pFilename.Replace("'", "''") pFilename = pFilename.Replace("'", "''")
End If End If
If pFilename.ToUpper.EndsWith(".MSG") Then If pFilename.ToUpper.EndsWith(".MSG") And pHandleType = "|OUTLOOK_MESSAGE|" Then
' MSG Files cannot be hashed based on filecontents, so we use the filename instead ' MSG Files cannot be hashed based on filecontents, so we use the filename instead
oHash = FILESYSTEM.GetChecksumFromString(pFilename) oHash = FILESYSTEM.GetChecksumFromString(pFilename)
Else Else
@ -55,25 +55,27 @@ Public Class ClassIndexFunctions
End Try End Try
End Function End Function
Public Shared Function CheckDuplicateFiles(Filepath As String, ModuleTitle As String) Public Shared Function CheckDuplicateFiles(pFilepath As String, pModuleTitle As String, Optional pHandleType As String = "")
Dim oFileInfo As New FileInfo(Filepath) Dim oFileInfo As New FileInfo(pFilepath)
Dim oFilename As String = oFileInfo.Name Dim oFilename As String = oFileInfo.Name
Dim oFileExists As Date = FileExistsinDropTable(Filepath) Dim oFileExists As Date = FileExistsinDropTable(pFilepath, pHandleType)
If oFileExists.Equals(Date.MinValue) Then If oFileExists.Equals(Date.MinValue) Then
Return True Return True
Else Else
Dim oResult As DialogResult Dim oResult As DialogResult
Dim oDate As String = oFileExists.ToString("d") Dim oDate As String = oFileExists.ToString("d")
Dim oBoxTitle = $"GLOBIX - {ModuleTitle}" Dim oBoxTitle = $"GLOBIX - {pModuleTitle}"
Dim oBoxOptions = MsgBoxStyle.Question Or MsgBoxStyle.YesNo Dim oMessage As String
If USER_LANGUAGE = "de-DE" Then 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) oMessage = $"Die Datei [{oFilename}] wurde bereits am [{oDate}] verarbeitet. Wollen Sie die gleiche Datei noch einmal verarbeiten?"
Else Else
oResult = MsgBox($"The file [{oFilename}] has already been processed at [{oDate}]. Do you want to process the same file again?", oBoxOptions, oBoxTitle) oMessage = $"The file [{oFilename}] has already been processed at [{oDate}]. Do you want to process the same file again?"
End If End If
oResult = MessageBox.Show(oMessage, oBoxTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly)
If oResult = DialogResult.Yes Then If oResult = DialogResult.Yes Then
Return True Return True
End If End If

View File

@ -107,9 +107,9 @@ Partial Class frmIndex
Me.ComboboxDoctype.Name = "ComboboxDoctype" Me.ComboboxDoctype.Name = "ComboboxDoctype"
SerializableAppearanceObject1.BackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(214, Byte), Integer), CType(CType(49, Byte), Integer)) SerializableAppearanceObject1.BackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(214, Byte), Integer), CType(CType(49, Byte), Integer))
SerializableAppearanceObject1.Options.UseBackColor = True SerializableAppearanceObject1.Options.UseBackColor = True
Me.ComboboxDoctype.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons"), DevExpress.XtraEditors.Controls.ButtonPredefines), resources.GetString("ComboBoxEdit1.Properties.Buttons1"), CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons2"), Integer), CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons3"), Boolean), CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons4"), Boolean), CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons5"), Boolean), EditorButtonImageOptions1, New DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), SerializableAppearanceObject1, SerializableAppearanceObject2, SerializableAppearanceObject3, SerializableAppearanceObject4, resources.GetString("ComboBoxEdit1.Properties.Buttons6"), CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons7"), Object), CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons8"), DevExpress.Utils.SuperToolTip), CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons9"), DevExpress.Utils.ToolTipAnchor))}) Me.ComboboxDoctype.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(CType(resources.GetObject("ComboboxDoctype.Properties.Buttons"), DevExpress.XtraEditors.Controls.ButtonPredefines), resources.GetString("ComboboxDoctype.Properties.Buttons1"), CType(resources.GetObject("ComboboxDoctype.Properties.Buttons2"), Integer), CType(resources.GetObject("ComboboxDoctype.Properties.Buttons3"), Boolean), CType(resources.GetObject("ComboboxDoctype.Properties.Buttons4"), Boolean), CType(resources.GetObject("ComboboxDoctype.Properties.Buttons5"), Boolean), EditorButtonImageOptions1, New DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), SerializableAppearanceObject1, SerializableAppearanceObject2, SerializableAppearanceObject3, SerializableAppearanceObject4, resources.GetString("ComboboxDoctype.Properties.Buttons6"), CType(resources.GetObject("ComboboxDoctype.Properties.Buttons7"), Object), CType(resources.GetObject("ComboboxDoctype.Properties.Buttons8"), DevExpress.Utils.SuperToolTip), CType(resources.GetObject("ComboboxDoctype.Properties.Buttons9"), DevExpress.Utils.ToolTipAnchor))})
Me.ComboboxDoctype.Properties.ButtonsStyle = DevExpress.XtraEditors.Controls.BorderStyles.UltraFlat Me.ComboboxDoctype.Properties.ButtonsStyle = DevExpress.XtraEditors.Controls.BorderStyles.UltraFlat
Me.ComboboxDoctype.Properties.NullText = resources.GetString("ComboBoxEdit1.Properties.NullText") Me.ComboboxDoctype.Properties.NullText = resources.GetString("ComboboxDoctype.Properties.NullText")
Me.ComboboxDoctype.Properties.Padding = New System.Windows.Forms.Padding(5) Me.ComboboxDoctype.Properties.Padding = New System.Windows.Forms.Padding(5)
' '
'RibbonControl1 'RibbonControl1

View File

@ -433,37 +433,37 @@
<value>2</value> <value>2</value>
</data> </data>
<assembly alias="DevExpress.Utils.v19.2" name="DevExpress.Utils.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" /> <assembly alias="DevExpress.Utils.v19.2" name="DevExpress.Utils.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<data name="ComboBoxEdit1.Properties.Buttons" type="DevExpress.XtraEditors.Controls.ButtonPredefines, DevExpress.Utils.v19.2"> <data name="ComboboxDoctype.Properties.Buttons" type="DevExpress.XtraEditors.Controls.ButtonPredefines, DevExpress.Utils.v19.2">
<value>Combo</value> <value>Combo</value>
</data> </data>
<data name="ComboBoxEdit1.Properties.Buttons1" xml:space="preserve"> <data name="ComboboxDoctype.Properties.Buttons1" xml:space="preserve">
<value /> <value />
</data> </data>
<data name="ComboBoxEdit1.Properties.Buttons2" type="System.Int32, mscorlib"> <data name="ComboboxDoctype.Properties.Buttons2" type="System.Int32, mscorlib">
<value>20</value> <value>20</value>
</data> </data>
<data name="ComboBoxEdit1.Properties.Buttons3" type="System.Boolean, mscorlib"> <data name="ComboboxDoctype.Properties.Buttons3" type="System.Boolean, mscorlib">
<value>True</value> <value>True</value>
</data> </data>
<data name="ComboBoxEdit1.Properties.Buttons4" type="System.Boolean, mscorlib"> <data name="ComboboxDoctype.Properties.Buttons4" type="System.Boolean, mscorlib">
<value>True</value> <value>True</value>
</data> </data>
<data name="ComboBoxEdit1.Properties.Buttons5" type="System.Boolean, mscorlib"> <data name="ComboboxDoctype.Properties.Buttons5" type="System.Boolean, mscorlib">
<value>False</value> <value>False</value>
</data> </data>
<data name="ComboBoxEdit1.Properties.Buttons6" xml:space="preserve"> <data name="ComboboxDoctype.Properties.Buttons6" xml:space="preserve">
<value /> <value />
</data> </data>
<data name="ComboBoxEdit1.Properties.Buttons7" type="System.Resources.ResXNullRef, System.Windows.Forms"> <data name="ComboboxDoctype.Properties.Buttons7" type="System.Resources.ResXNullRef, System.Windows.Forms">
<value /> <value />
</data> </data>
<data name="ComboBoxEdit1.Properties.Buttons8" type="System.Resources.ResXNullRef, System.Windows.Forms"> <data name="ComboboxDoctype.Properties.Buttons8" type="System.Resources.ResXNullRef, System.Windows.Forms">
<value /> <value />
</data> </data>
<data name="ComboBoxEdit1.Properties.Buttons9" type="DevExpress.Utils.ToolTipAnchor, DevExpress.Utils.v19.2"> <data name="ComboboxDoctype.Properties.Buttons9" type="DevExpress.Utils.ToolTipAnchor, DevExpress.Utils.v19.2">
<value>Default</value> <value>Default</value>
</data> </data>
<data name="ComboBoxEdit1.Properties.NullText" xml:space="preserve"> <data name="ComboboxDoctype.Properties.NullText" xml:space="preserve">
<value>Bitte wählen Sie ein Profil</value> <value>Bitte wählen Sie ein Profil</value>
</data> </data>
<data name="ComboboxDoctype.Size" type="System.Drawing.Size, System.Drawing"> <data name="ComboboxDoctype.Size" type="System.Drawing.Size, System.Drawing">
@ -619,7 +619,7 @@
<value>DocumentViewer1</value> <value>DocumentViewer1</value>
</data> </data>
<data name="&gt;&gt;DocumentViewer1.Type" xml:space="preserve"> <data name="&gt;&gt;DocumentViewer1.Type" xml:space="preserve">
<value>DigitalData.Controls.DocumentViewer.DocumentViewer, DigitalData.Controls.DocumentViewer, Version=1.4.4.0, Culture=neutral, PublicKeyToken=null</value> <value>DigitalData.Controls.DocumentViewer.DocumentViewer, DigitalData.Controls.DocumentViewer, Version=1.6.3.0, Culture=neutral, PublicKeyToken=null</value>
</data> </data>
<data name="&gt;&gt;DocumentViewer1.Parent" xml:space="preserve"> <data name="&gt;&gt;DocumentViewer1.Parent" xml:space="preserve">
<value>SplitContainer1.Panel2</value> <value>SplitContainer1.Panel2</value>

View File

@ -1658,12 +1658,12 @@ Public Class frmIndex
If Directory.Exists(oDestination) = False Then If Directory.Exists(oDestination) = False Then
MsgBox($"Profile Path [{oNewDestination}] is not available. Please select another profile.", MsgBoxStyle.Exclamation, Text) MsgBox($"Profile Path [{oNewDestination}] is not available. Please select another profile.", MsgBoxStyle.Exclamation, Text)
ComboboxDoctype.SelectedIndex = -1 ComboboxDoctype.SelectedIndex = -1
End If Else
WDDirect = oDocType.Item("WINDREAM_DIRECT") WDDirect = oDocType.Item("WINDREAM_DIRECT")
CURRENT_DOKART_DUPLICATE_HANDLING = oDocType.Item("DUPLICATE_HANDLING") CURRENT_DOKART_DUPLICATE_HANDLING = oDocType.Item("DUPLICATE_HANDLING")
Refresh_IndexeMan(oSelectedItem.Guid) Refresh_IndexeMan(oSelectedItem.Guid)
End If End If
End If
End Sub End Sub
'Private Sub cmbDokumentart_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) 'Private Sub cmbDokumentart_SelectedIndexChanged(sender As System.Object, e As System.EventArgs)
@ -2747,5 +2747,7 @@ Public Class frmIndex
CONFIG.Save() CONFIG.Save()
End Sub End Sub
Private Sub RibbonControl1_Click(sender As Object, e As EventArgs) Handles RibbonControl1.Click
End Sub
End Class End Class

View File

@ -168,7 +168,7 @@ Public Class frmStart
Dim oHandleType As String = oFiledropString.Substring(0, oLastPipe + 1) Dim oHandleType As String = oFiledropString.Substring(0, oLastPipe + 1)
Dim oFilename As String = oFiledropString.Substring(oLastPipe + 1) Dim oFilename As String = oFiledropString.Substring(oLastPipe + 1)
If ClassIndexFunctions.CheckDuplicateFiles(oFilename, "Manuelle Ablage") Then If ClassIndexFunctions.CheckDuplicateFiles(oFilename, "Manuelle Ablage", oHandleType) Then
ClassFilehandle.Decide_FileHandle(oFilename, oHandleType) ClassFilehandle.Decide_FileHandle(oFilename, oHandleType)
End If End If
End If End If