MS_22062016

This commit is contained in:
SchreiberM
2016-06-22 13:12:45 +02:00
parent fd8e85146a
commit 41e7886a6b
11 changed files with 521 additions and 186 deletions

View File

@@ -1,8 +1,35 @@
Imports System.IO
Imports System.Runtime.InteropServices
Public Class frmRecordView
Private recordView As ClassRecordView
Private ENTITY_ID, FORMVIEW_ID, PARENT_ENTITY_ID As Integer
Private RESULT_DOC_PATH As String
Private Const SEE_MASK_INVOKEIDLIST = &HC
Private Const SEE_MASK_NOCLOSEPROCESS = &H40
Private Const SEE_MASK_FLAG_NO_UI = &H400
Public Const SW_SHOW As Short = 5
<DllImport("Shell32", CharSet:=CharSet.Auto, SetLastError:=True)> _
Public Shared Function ShellExecuteEx(ByRef lpExecInfo As SHELLEXECUTEINFO) As Boolean
End Function
Public Structure SHELLEXECUTEINFO
Public cbSize As Integer
Public fMask As Integer
Public hwnd As IntPtr
<MarshalAs(UnmanagedType.LPTStr)> Public lpVerb As String
<MarshalAs(UnmanagedType.LPTStr)> Public lpFile As String
<MarshalAs(UnmanagedType.LPTStr)> Public lpParameters As String
<MarshalAs(UnmanagedType.LPTStr)> Public lpDirectory As String
Dim nShow As Integer
Dim hInstApp As IntPtr
Dim lpIDList As IntPtr
<MarshalAs(UnmanagedType.LPTStr)> Public lpClass As String
Public hkeyClass As IntPtr
Public dwHotKey As Integer
Public hIcon As IntPtr
Public hProcess As IntPtr
End Structure
Private Sub frmRecordView_Load(sender As Object, e As EventArgs) Handles MyBase.Load
If USER_LANGUAGE <> "de-DE" Then
Me.Text = "Detailview Record"
@@ -228,17 +255,22 @@ Public Class frmRecordView
Private Sub Load_Tasks()
Try
Me.TBPMO_WORKFLOW_TASK_STATETableAdapter.Connection.ConnectionString = MyConnectionString
Me.TBPMO_WORKFLOW_TASK_STATETableAdapter.Fill(Me.DD_DMSDataSet.TBPMO_WORKFLOW_TASK_STATE, USER_LANGUAGE)
Me.VWPMO_WF_ACTIVETableAdapter.Connection.ConnectionString = MyConnectionString
Me.VWPMO_WF_ACTIVETableAdapter.FillByRecord(Me.DD_DMSDataSet.VWPMO_WF_ACTIVE, USER_LANGUAGE, Environment.UserName, JUMP_RECORD_ID)
Dim sql = "SELECT FORM_ID FROM TBPMO_RECORD WHERE GUID = " & JUMP_RECORD_ID
ENTITY_ID = ClassDatabase.Execute_Scalar(sql)
sql = "SELECT GUID FROM TBPMO_FORM_VIEW WHERE SCREEN_ID = 1 AND FORM_ID = " & ENTITY_ID
FORMVIEW_ID = ClassDatabase.Execute_Scalar(sql)
sql = "SELECT PARENT_ID FROM TBPMO_FORM WHERE GUID = " & ENTITY_ID
PARENT_ENTITY_ID = ClassDatabase.Execute_Scalar(sql)
Catch ex As Exception
MsgBox("Error in Load_Tasks:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Private Sub TabControl1_SelectedPageChanged(sender As Object, e As DevExpress.XtraTab.TabPageChangedEventArgs) Handles TabControl1.SelectedPageChanged
If DD_DMSDataSet.VWPMO_WF_ACTIVE.Rows.Count = 0 Then
If TabControl1.SelectedTabPageIndex = 1 Then
If TabControl1.SelectedTabPageIndex = 1 Then
If DD_DMSDataSet.VWPMO_WF_ACTIVE.Rows.Count = 0 Then
COMMENTTextBox.Enabled = False
DUE_DATEDateTimePicker.Enabled = False
DateTimePickerTASK_DATE.Enabled = False
@@ -246,6 +278,13 @@ Public Class frmRecordView
lblnoTasks.Visible = True
btnSaveWorkflow.Enabled = False
Else
Try
If WF_IDTextBox.Text <> "" Then
Me.TBPMO_WORKFLOW_TASK_STATETableAdapter.FillBy(Me.DD_DMSDataSet.TBPMO_WORKFLOW_TASK_STATE, USER_LANGUAGE, WF_IDTextBox.Text, ENTITY_ID)
End If
Catch ex As Exception
MsgBox("Error in load States:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
COMMENTTextBox.Enabled = True
DUE_DATEDateTimePicker.Enabled = True
DateTimePickerTASK_DATE.Enabled = True
@@ -254,6 +293,7 @@ Public Class frmRecordView
btnSaveWorkflow.Enabled = True
End If
End If
End Sub
Private Sub btnSaveWorkflow_Click(sender As Object, e As EventArgs) Handles btnSaveWorkflow.Click
@@ -267,7 +307,204 @@ Public Class frmRecordView
End If
' Me.TBPMO_WORKFLOW_TASKTableAdapter.cmdUpdate(COMMENTTextBox.Text, DUE_DATEDateTimePicker.Value, STATE_IDComboBox.SelectedValue, 1, Environment.UserName, DateTimePicker1.Value, Me.GUIDTextBox.Text)
Catch ex As Exception
MsgBox("Error in Exit:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
MsgBox("Error in save Workflow:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Private Sub frmRecordView_Shown(sender As Object, e As EventArgs) Handles Me.Shown
End Sub
Private Sub GridViewDoc_Search_FocusedRowChanged(sender As Object, e As DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs) Handles GridViewDoc_Search.FocusedRowChanged
Try
RESULT_DOC_PATH = GridViewDoc_Search.GetFocusedRowCellValue(GridViewDoc_Search.Columns("FULLPATH"))
Catch ex As Exception
RESULT_DOC_PATH = Nothing
End Try
End Sub
Private Sub GridControlDocSearch_DoubleClick(sender As Object, e As EventArgs) Handles GridControlDocSearch.DoubleClick
Try
RESULT_DOC_PATH = GridViewDoc_Search.GetFocusedRowCellValue(GridViewDoc_Search.Columns("FULLPATH"))
Catch ex As Exception
RESULT_DOC_PATH = Nothing
End Try
ClassHelper.File_open(RESULT_DOC_PATH)
End Sub
Private Sub DateiÖffnenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles DateiÖffnenToolStripMenuItem.Click
ClassHelper.File_open(RESULT_DOC_PATH)
End Sub
Private Sub CopyToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles CopyToolStripMenuItem.Click
If RESULT_DOC_PATH <> Nothing Then
Try
Dim selectedfile(0) As String
selectedfile(0) = RESULT_DOC_PATH
Dim dataobj As New DataObject
dataobj.SetData(DataFormats.FileDrop, True, selectedfile)
Clipboard.Clear()
Clipboard.SetDataObject(dataobj, True)
Catch ex As Exception
MsgBox("Unexpected Error in Copy file:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
Cursor = Cursors.Default
End If
End Sub
Private Sub DeleteToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles DeleteToolStripMenuItem.Click
If RESULT_DOC_PATH <> Nothing Then
Dim msg = "Sind Sie sicher, dass Sie diese Datei löschen wollen?"
If USER_LANGUAGE <> "de-DE" Then
msg = "Are You sure You want to delete this file?"
End If
Dim result As MsgBoxResult
result = MessageBox.Show(msg, "Confirmation:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If result = MsgBoxResult.Yes Then
Try
Dim FileToDelete As String
FileToDelete = RESULT_DOC_PATH
If System.IO.File.Exists(FileToDelete) = True Then
System.IO.File.Delete(FileToDelete)
RUN_WDSEARCH_GRID()
End If
Catch ex As Exception
MsgBox("Unexpected Error in Delete file:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End If
End If
End Sub
Private Sub PropertiesToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles PropertiesToolStripMenuItem.Click
If RESULT_DOC_PATH <> Nothing Then
Cursor = Cursors.WaitCursor
Dim sei As New SHELLEXECUTEINFO
sei.cbSize = Marshal.SizeOf(sei)
sei.lpVerb = "properties"
sei.lpFile = RESULT_DOC_PATH
sei.nShow = SW_SHOW
sei.fMask = SEE_MASK_INVOKEIDLIST
If Not ShellExecuteEx(sei) Then
Dim ex As New System.ComponentModel.Win32Exception(System.Runtime.InteropServices.Marshal.GetLastWin32Error())
MsgBox("Unexpected Error in Open file propertys:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End If
End If
Cursor = Cursors.Default
End Sub
Private Sub pnlDetails_DragDrop(sender As Object, e As DragEventArgs) Handles pnlDetails.DragDrop
Drag_Drop(e)
End Sub
Private Sub GridControlDocSearch_DragDrop(sender As Object, e As DragEventArgs) Handles GridControlDocSearch.DragDrop
Drag_Drop(e)
End Sub
Private Sub pnlDetails_DragEnter(sender As Object, e As DragEventArgs) Handles pnlDetails.DragEnter
Drag_Enter(e)
End Sub
Private Sub GridControlDocSearch_DragEnter(sender As Object, e As DragEventArgs) Handles GridControlDocSearch.DragEnter
Drag_Enter(e)
End Sub
Sub Drag_Enter(e As DragEventArgs)
If FORMVIEW_ID <> 0 Then
ClassDragDrop.Drag_enter(e)
End If
End Sub
Sub Drag_Drop(e As DragEventArgs)
If FORMVIEW_ID <> 0 Then
Dim sql = "select count(*) from VWPMO_DOKUMENTTYPES where FORMVIEW_ID = " & FORMVIEW_ID
If ClassDatabase.Execute_Scalar(sql, True) = 0 Then
MsgBox("No documenttypes for this entity configured! Indexing is not possible!" & vbNewLine & "Please check the configuration!", MsgBoxStyle.Exclamation)
Exit Sub
End If
CURRENT_FORMVIEW_ID = FORMVIEW_ID
CURRENT_CONTROL_DOCTYPE_MATCH = 0
If e.Data.GetDataPresent(DataFormats.StringFormat) Then
Dim Wert As String = CType(e.Data.GetData(DataFormats.StringFormat), Object)
Console.WriteLine("DragDrop-Wert: " & Wert)
If Wert.Contains("SCAN") Then
Exit Sub
'Dim split() = Wert.Split(";")
'If IsNumeric(split(1)) Then
' CURRENT_FILEID = split(1)
' CURRENT_PARENT_ENTITY_ID = ClassDatabase.Execute_Scalar("SELECT PARENT_ID FROM TBPMO_FORM WHERE GUID = " & ENTITY_ID)
' CURRENT_RECORD_ID = JUMP_RECORD_ID
' CURRENT_FORMVIEW_ID = FORMVIEW_ID
' frmWD_Index_Dokart.ShowDialog()
' RUN_WDSEARCH_GRID()
'End If
ElseIf (e.Data.GetDataPresent("FileGroupDescriptor")) AndAlso (e.Data.GetDataPresent("FileContents")) Then
CURRENT_RECORD_ID = JUMP_RECORD_ID
If ClassDragDrop.Drop_File(e) = True Then
Check_Dropped_Files()
End If
ElseIf e.Data.GetDataPresent("FileGroupDescriptor") Then
CURRENT_RECORD_ID = JUMP_RECORD_ID
If ClassDragDrop.Drop_File(e) = True Then
Check_Dropped_Files()
End If
End If
Else
CURRENT_RECORD_ID = JUMP_RECORD_ID
If ClassDragDrop.Drop_File(e) = True Then
Check_Dropped_Files()
End If
End If
End If
End Sub
Sub Check_Dropped_Files()
Try
For Each Str As Object In ClassDragDrop.files_dropped
If Not IsNothing(Str) Then
Dim DropType = Str.Substring(0, Str.LastIndexOf("@") + 1)
If DropType.ToString.Contains("SCAN") = False Then
ClassLogger.Add(">> Check_Dropped_Files:" & Str.ToString, False)
Dim CURRENT_WORKFILE = Str.Substring(Str.LastIndexOf("@") + 1)
Dim insert = String.Format("INSERT INTO TBPMO_FILES_USER(FILENAME2WORK, USER_WORK, HANDLE_TYPE) VALUES('{0}','{1}','{2}')", CURRENT_WORKFILE, Environment.UserName, DropType)
If ClassDatabase.Execute_non_Query(insert) = False Then
Exit Sub
End If
End If
End If
Next
Dim sql = "select count(*) from VWPMO_DOKUMENTTYPES where FORMVIEW_ID = " & FORMVIEW_ID
If ClassDatabase.Execute_Scalar(sql, True) >= 1 Then
Dim sql1 = String.Format("SELECT GUID, FILENAME2WORK, USER_WORK, HANDLE_TYPE, WORKED, ADDED_WHEN FROM TBPMO_FILES_USER WHERE (UPPER(USER_WORK) = UPPER('{0}')) AND WORKED = 0", Environment.UserName)
Dim DT As DataTable = ClassDatabase.Return_Datatable(sql1)
If Not IsNothing(DT) Then
If DT.Rows.Count > 0 Then
For Each Filerow As DataRow In DT.Rows
'Dim datei = Str.ToString.Replace("@DROPFROMFSYSTEM@", "")
CURRENT_FILEID = Filerow.Item(0)
CURRENT_PARENT_ENTITY_ID = PARENT_ENTITY_ID
CURRENT_RECORD_ID = JUMP_RECORD_ID
CURRENT_FORM_ID = ENTITY_ID
CURRENT_FORMVIEW_ID = FORMVIEW_ID
If ClassDatabase.Execute_Scalar("SELECT COUNT(*) FROM TBPMO_FILES_USER WHERE GUID = " & CURRENT_FILEID & " AND WORKED = 0") = 1 Then
frmWD_Index_Dokart.ShowDialog()
Else
If LogErrorsOnly = False Then ClassLogger.Add(" >> File was deleted or worked meanwhile!")
End If
Next
RUN_WDSEARCH_GRID()
End If
End If
Else
MsgBox("No documenttypes for this entity configured! Indexing is not possible!" & vbNewLine & "Please check the configuration!", MsgBoxStyle.Exclamation)
Exit Sub
End If
Catch ex As Exception
MsgBox("Check_Dropped_Files: " & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
End Class