91 lines
3.8 KiB
VB.net
91 lines
3.8 KiB
VB.net
Imports System.ComponentModel
|
|
Imports DevExpress.XtraEditors.Controls
|
|
|
|
Public Class frmIndexFileList
|
|
|
|
Private Sub frmIndexFileList_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
|
Try
|
|
Me.TBGI_FILES_USERTableAdapter.Connection.ConnectionString = MyConnectionString
|
|
Me.TBGI_FILES_USERTableAdapter.Fill(Me.MyDataset1.TBGI_FILES_USER, Environment.UserName)
|
|
|
|
If MyDataset1.TBGI_FILES_USER.Rows.Count > 0 Then
|
|
CheckedListBoxControl1.DataSource = MyDataset1.TBGI_FILES_USER
|
|
CheckedListBoxControl1.DisplayMember = MyDataset1.TBGI_FILES_USER.Columns("FILENAME_ONLY").ColumnName
|
|
CheckedListBoxControl1.ValueMember = MyDataset1.TBGI_FILES_USER.Columns(0).ColumnName
|
|
End If
|
|
|
|
CheckedListBoxControl1.CheckAll()
|
|
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
MsgBox("Error in Load Form: " & ex.Message, MsgBoxStyle.Critical)
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub btnstartIndex_Click(sender As Object, e As EventArgs) Handles btnstartIndex.Click
|
|
Try
|
|
LOGGER.Debug("Starting indexing of {0} files", CheckedListBoxControl1.Items.Count - CheckedListBoxControl1.CheckedItems.Count)
|
|
|
|
For index = 0 To CheckedListBoxControl1.ItemCount - 1
|
|
Dim oRow = MyDataset1.TBGI_FILES_USER.Item(index)
|
|
Dim oChecked = CheckedListBoxControl1.GetItemChecked(index)
|
|
|
|
Dim oFilePath = oRow.Item("FILENAME2WORK")
|
|
Dim oHandletype As String = oRow.Item("HANDLE_TYPE")
|
|
Dim oGuid = oRow.Item("GUID")
|
|
|
|
If oChecked = False Then
|
|
If oHandletype = "|MSGONLY|" Or oHandletype = "|ATTMNTEXTRACTED|" Then
|
|
Try
|
|
IO.File.Delete(oFilePath)
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
End Try
|
|
End If
|
|
|
|
LOGGER.Debug("Removing file from user files: [{0}]", oFilePath)
|
|
ClassDatabase.Execute_non_Query("DELETE FROM TBGI_FILES_USER WHERE GUID = " & oGuid, True)
|
|
End If
|
|
Next
|
|
|
|
DialogResult = DialogResult.OK
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
MsgBox("Unexpected Error in Clear Multiple Documents: " & ex.Message, MsgBoxStyle.Critical)
|
|
End Try
|
|
|
|
Me.Close()
|
|
End Sub
|
|
|
|
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
|
CheckedListBoxControl1.CheckAll()
|
|
End Sub
|
|
|
|
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
|
|
CheckedListBoxControl1.UnCheckAll()
|
|
End Sub
|
|
|
|
Private Sub frmIndexFileList_Shown(sender As Object, e As EventArgs) Handles Me.Shown
|
|
Me.BringToFront()
|
|
CheckedListBoxControl1.Focus()
|
|
End Sub
|
|
|
|
Private Sub CheckedListBoxControl1_DrawItem(sender As Object, e As DevExpress.XtraEditors.ListBoxDrawItemEventArgs) Handles CheckedListBoxControl1.DrawItem
|
|
If e.State = (DrawItemState.Selected Or DrawItemState.Checked) Or e.State = DrawItemState.Checked Then
|
|
e.Appearance.BackColor = Color.LightGreen
|
|
Else
|
|
e.Appearance.BackColor = Color.Transparent
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub frmIndexFileList_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing
|
|
If DialogResult = DialogResult.Cancel Then
|
|
Try
|
|
ClassDatabase.Execute_non_Query("DELETE FROM TBGI_FILES_USER WHERE UPPER(USER@WORK) = UPPER('" & Environment.UserName & "')", True)
|
|
Catch ex As Exception
|
|
MsgBox("Error while deleting User Files: " & ex.Message, MsgBoxStyle.Critical, Text)
|
|
LOGGER.Error(ex)
|
|
End Try
|
|
End If
|
|
End Sub
|
|
End Class |