jj: fix abort of indexing

This commit is contained in:
Jonathan Jenne 2018-10-30 11:39:41 +01:00
parent 159c8a6924
commit cfda6ba3af
3 changed files with 71 additions and 89 deletions

View File

@ -46,8 +46,6 @@
Public CURRENT_HTML_DOC As String
Public CURRENT_ABBRUCH As Integer = 0
Public MULTIINDEXING_ACTIVE As Boolean = False
Public ABORT_INDEXING As Boolean = False

View File

@ -26,6 +26,8 @@ Public Class frmIndex
Dim sql_history_Index_Values As String
Dim NewFileString As String
Private CancelAttempts As Integer = 0
Private Property viewer_string As String
'Dim DocView
@ -3013,13 +3015,70 @@ Public Class frmIndex
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Select Case CURRENT_ABBRUCH
Case 0
CURRENT_ABBRUCH = 1
Case 1
CURRENT_ABBRUCH = 2
End Select
Me.Close()
If File.Exists(CURRENT_FILENAME) Then
Select Case CancelAttempts
Case 0
If USER_LANGUAGE = "de-DE" Then
MsgBox("Bitte indexieren Sie die Datei vollständig!" & vbNewLine & "(Abbruch 1 des Indexierungsvorgangs)", MsgBoxStyle.Information)
Else
MsgBox("Please Index file completely" & vbNewLine & "(Abort 1 of Indexdialog)", MsgBoxStyle.Information)
End If
CancelAttempts = CancelAttempts + 1
Case 1
Dim result As MsgBoxResult
If USER_LANGUAGE = "de-DE" Then
result = MessageBox.Show("Sie brechen nun zum zweiten Mal den Indexierungsvorgang ab!" & vbNewLine & "Wollen Sie die Indexierung aller Dateien abbrechen?", "Bestätigung erforderlich:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
Else
result = MessageBox.Show("You abort the indexdialog for the 2nd time!" & vbNewLine & "Do You want to abort indexing?", "Confirmation needed:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
End If
If result = MsgBoxResult.Yes Then
Dim containsfw_file As Boolean = False
Try
ABORT_INDEXING = True
Dim sql As String = "SELECT * FROM TBGI_FILES_USER WHERE WORKED = 0 AND UPPER(USER@WORK) = UPPER('" & Environment.UserName & "')"
Dim DT As DataTable = ClassDatabase.Return_Datatable(sql, True)
Dim anz = DT.Rows.Count
For Each Filerow As DataRow In DT.Rows
Dim filestring As String = Filerow.Item("FILENAME2WORK")
Dim handletype As String = Filerow.Item("HANDLE_TYPE")
If handletype = "|MSGONLY|" Or handletype = "|ATTMNTEXTRACTED|" Then
Try
System.IO.File.Delete(filestring)
Catch ex As Exception
End Try
ElseIf handletype.StartsWith("|FW") Then
containsfw_file = True
End If
Next
'Zuerst die Daten des Ablaufs löschen
If ClassDatabase.Execute_non_Query("DELETE FROM TBGI_FILES_USER WHERE UPPER(USER@WORK) = UPPER('" & Environment.UserName & "')", True) = True Then
If containsfw_file = True Then
If USER_LANGUAGE = "de-DE" Then
MsgBox("Der Indexierungsprozess beinhaltete (auch) Dateien per Folderwatch!" & vbNewLine & "Diese Dateien wurden nicht gelöscht und verbleiben im Folderwatch-Verzeichnis!" & vbNewLine & "Bitte verschieben Sie die Dateien ggfls.", MsgBoxStyle.Information, "Achtung - Hinweis:")
Else
MsgBox("The Indexingprocess contained (also) files from folderwatch!" & vbNewLine & "These files weren't deleted and will stay in the folderwatch-folder!" & vbNewLine & "Please move these files manually.", MsgBoxStyle.Information, "Achtung - Hinweis:")
End If
End If
End If
Catch ex As Exception
MsgBox("Unexpected Error in Abort Indexing: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
Close()
End If
End Select
End If
End Sub
Private Sub chkMultiIndexer_CheckedChanged(sender As Object, e As EventArgs) Handles chkMultiIndexer.CheckedChanged

View File

@ -240,7 +240,6 @@ Public Class frmStart
Try
Me.TopMost = False
ClassDatabase.Execute_non_Query("DELETE FROM TBGI_FILES_USER WHERE WORKED = 1 AND UPPER(USER@WORK) = UPPER('" & Environment.UserName & "')")
CURRENT_ABBRUCH = 0
Dim i As Integer
For Each Str As Object In ClassDragDrop.files_dropped
If Not Str Is Nothing Then
@ -287,85 +286,11 @@ Public Class frmStart
End Sub
Sub Open_IndexDialog()
Try
Me.Hide()
frmIndex.ShowDialog()
Me.Visible = True
Me.TopMost = True
Me.BringToFront()
If File.Exists(CURRENT_FILENAME) Then
Select Case CURRENT_ABBRUCH
Case 1
If USER_LANGUAGE = "de-DE" Then
MsgBox("Bitte indexieren Sie die Datei vollständig!" & vbNewLine & "(Abbruch 1 des Indexierungsvorgangs)", MsgBoxStyle.Information)
Else
MsgBox("Please Index file completely" & vbNewLine & "(Abort 1 of Indexdialog)", MsgBoxStyle.Information)
End If
Open_IndexDialog()
Case 2
Dim result As MsgBoxResult
If USER_LANGUAGE = "de-DE" Then
result = MessageBox.Show("Sie brechen nun zum zweiten Mal den Indexierungsvorgang ab!" & vbNewLine & "Wollen Sie die Indexierung aller Dateien abbrechen?", "Bestätigung erforderlich:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
Else
result = MessageBox.Show("You abort the indexdialog for the 2nd time!" & vbNewLine & "Do You want to abort all file-
?", "Confirmation needed:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
End If
If result = MsgBoxResult.Yes Then
Dim containsfw_file As Boolean = False
Try
ABORT_INDEXING = True
Dim sql As String = "SELECT * FROM TBGI_FILES_USER WHERE WORKED = 0 AND UPPER(USER@WORK) = UPPER('" & Environment.UserName & "')"
Dim DT As DataTable = ClassDatabase.Return_Datatable(sql, True)
Dim anz = DT.Rows.Count
For Each Filerow As DataRow In DT.Rows
Dim filestring As String = Filerow.Item("FILENAME2WORK")
Dim handletype As String = Filerow.Item("HANDLE_TYPE")
If handletype = "|MSGONLY|" Or handletype = "|ATTMNTEXTRACTED|" Then
Try
System.IO.File.Delete(filestring)
Catch ex As Exception
End Try
ElseIf handletype.StartsWith("|FW") Then
containsfw_file = True
End If
Next
'Zuerst die Daten des Ablaufs löschen
If ClassDatabase.Execute_non_Query("DELETE FROM TBGI_FILES_USER WHERE UPPER(USER@WORK) = UPPER('" & Environment.UserName & "')", True) = True Then
If containsfw_file = True Then
If USER_LANGUAGE = "de-DE" Then
MsgBox("Der Indexierungsprozess beinhaltete (auch) Dateien per Folderwatch!" & vbNewLine & "Diese Dateien wurden nicht gelöscht und verbleiben im Folderwatch-Verzeichnis!" & vbNewLine & "Bitte verschieben Sie die Dateien ggfls.", MsgBoxStyle.Information, "Achtung - Hinweis:")
Else
MsgBox("The Indexingprocess contained (also) files from folderwatch!" & vbNewLine & "These files weren't deleted and will stay in the folderwatch-folder!" & vbNewLine & "Please move these files manually.", MsgBoxStyle.Information, "Achtung - Hinweis:")
End If
End If
End If
Catch ex As Exception
MsgBox("Unexpected Error in Abort Indexing: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
CURRENT_ABBRUCH = 0
Exit Sub
Else
CURRENT_ABBRUCH = 0
End If
End Select
End If
Catch ex As Exception
MsgBox("Unexpected Error in Call Indexdialog: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
Me.Visible = True
End Try
Me.Hide()
frmIndex.ShowDialog()
Me.Visible = True
Me.TopMost = True
Me.BringToFront()
End Sub
Private Sub frmStart_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing