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")
End If
End If
End If
If e.Data.GetDataPresent("FileGroupDescriptor") Then
ElseIf e.Data.GetDataPresent("FileGroupDescriptor") Then
Dim oApp As Outlook.Application
Try
oApp = New Outlook.Application()
@ -141,6 +140,8 @@ Public Class ClassFileDrop
Next
Return True
'Drop eines Outlook Attachments
Else
Return False
End If
Catch ex As Exception
MsgBox("Error in Drop-File" & vbNewLine & ex.Message, MsgBoxStyle.Critical)

View File

@ -1,7 +1,7 @@
Imports System.IO
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 oHash As String
@ -10,7 +10,7 @@ Public Class ClassIndexFunctions
pFilename = pFilename.Replace("'", "''")
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
oHash = FILESYSTEM.GetChecksumFromString(pFilename)
Else
@ -55,25 +55,27 @@ Public Class ClassIndexFunctions
End Try
End Function
Public Shared Function CheckDuplicateFiles(Filepath As String, ModuleTitle As String)
Dim oFileInfo As New FileInfo(Filepath)
Public Shared Function CheckDuplicateFiles(pFilepath As String, pModuleTitle As String, Optional pHandleType As String = "")
Dim oFileInfo As New FileInfo(pFilepath)
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
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
Dim oBoxTitle = $"GLOBIX - {pModuleTitle}"
Dim oMessage As String
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
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
oResult = MessageBox.Show(oMessage, oBoxTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly)
If oResult = DialogResult.Yes Then
Return True
End If

View File

@ -107,9 +107,9 @@ Partial Class frmIndex
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.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.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)
'
'RibbonControl1

View File

@ -433,37 +433,37 @@
<value>2</value>
</data>
<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>
</data>
<data name="ComboBoxEdit1.Properties.Buttons1" xml:space="preserve">
<data name="ComboboxDoctype.Properties.Buttons1" xml:space="preserve">
<value />
</data>
<data name="ComboBoxEdit1.Properties.Buttons2" type="System.Int32, mscorlib">
<data name="ComboboxDoctype.Properties.Buttons2" type="System.Int32, mscorlib">
<value>20</value>
</data>
<data name="ComboBoxEdit1.Properties.Buttons3" type="System.Boolean, mscorlib">
<data name="ComboboxDoctype.Properties.Buttons3" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="ComboBoxEdit1.Properties.Buttons4" type="System.Boolean, mscorlib">
<data name="ComboboxDoctype.Properties.Buttons4" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="ComboBoxEdit1.Properties.Buttons5" type="System.Boolean, mscorlib">
<data name="ComboboxDoctype.Properties.Buttons5" type="System.Boolean, mscorlib">
<value>False</value>
</data>
<data name="ComboBoxEdit1.Properties.Buttons6" xml:space="preserve">
<data name="ComboboxDoctype.Properties.Buttons6" xml:space="preserve">
<value />
</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 />
</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 />
</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>
</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>
</data>
<data name="ComboboxDoctype.Size" type="System.Drawing.Size, System.Drawing">
@ -619,7 +619,7 @@
<value>DocumentViewer1</value>
</data>
<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 name="&gt;&gt;DocumentViewer1.Parent" xml:space="preserve">
<value>SplitContainer1.Panel2</value>

View File

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

View File

@ -168,7 +168,7 @@ Public Class frmStart
Dim oHandleType As String = oFiledropString.Substring(0, 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)
End If
End If