MS_04072016

This commit is contained in:
SchreiberM
2016-07-04 16:37:52 +02:00
parent d47d0a9f95
commit 96bf81b88c
29 changed files with 4526 additions and 978 deletions

View File

@@ -10,6 +10,7 @@ Public Class frmRecordView
Private Const SEE_MASK_FLAG_NO_UI = &H400
Public Const SW_SHOW As Short = 5
Private DT_RESULTLIST_OPTIONS As DataTable
Private DT_WINDREAM_RESULTLIST As DataTable
<DllImport("Shell32", CharSet:=CharSet.Auto, SetLastError:=True)> _
Public Shared Function ShellExecuteEx(ByRef lpExecInfo As SHELLEXECUTEINFO) As Boolean
@@ -43,183 +44,43 @@ Public Class frmRecordView
recordView.LoadRecord(JUMP_RECORD_ID)
'Titel updaten
Me.Text &= " " + recordView.RecordId.ToString()
Me.Text &= " " + JUMP_RECORD_ID.ToString()
Dim sql = "SELECT FORM_ID FROM TBPMO_RECORD WHERE GUID = " & JUMP_RECORD_ID
ENTITY_ID = ClassDatabase.Execute_Scalar(sql)
sql = String.Format("select * from TBPMO_DOCSEARCH_VARIABLE_CONTROLS WHERE ENTITY_ID = {0}", ENTITY_ID) 'TBPMO_WINDREAM_RESULTLIST_CONFIG"
DT_RESULTLIST_OPTIONS = ClassDatabase.Return_Datatable(sql, "GETVARIABLE CONTROLS")
Dim sql_ResultList = String.Format("select * from TBPMO_DOCSEARCH_RESULTLIST_CONFIG WHERE ENTITY_ID = {0} AND LANGUAGE = '{1}'", ENTITY_ID, USER_LANGUAGE) 'TBPMO_WINDREAM_RESULTLIST_CONFIG"
DT_WINDREAM_RESULTLIST = ClassDatabase.Return_Datatable(sql_ResultList, "GETRESULTLIST KONFIG")
Catch ex As Exception
MsgBox("Unexpected error in loading form: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
RUN_WDSEARCH_GRID()
Load_Tasks()
End Sub
Private Sub RUN_WDSEARCH_GRID()
Me.Cursor = Cursors.WaitCursor
Dim gridGUID = 2
Dim sql_ResultList = String.Format("select * from TBPMO_DOCSEARCH_RESULTLIST_CONFIG WHERE ENTITY_ID = {0} AND LANGUAGE = '{1}'", ENTITY_ID, USER_LANGUAGE) 'TBPMO_WINDREAM_RESULTLIST_CONFIG"
Dim DT_WINDREAM_RESULTLIST As DataTable = ClassDatabase.Return_Datatable(sql_ResultList, "GETRESULTLIST KONFIG")
Try
Dim sw As New Stopwatch
sw.Start()
Dim elapsed As Double
Dim OPTION1 = DT_RESULTLIST_OPTIONS.Rows(0).Item("OPTION1_CTRL")
Dim OPTION2 = DT_RESULTLIST_OPTIONS.Rows(0).Item("OPTION2_CTRL")
Dim OPTION3 = DT_RESULTLIST_OPTIONS.Rows(0).Item("OPTION3_CTRL")
Dim OPTION4 = DT_RESULTLIST_OPTIONS.Rows(0).Item("OPTION4_CTRL")
Dim OPTION5 = DT_RESULTLIST_OPTIONS.Rows(0).Item("OPTION5_CTRL")
If DT_RESULTLIST_OPTIONS.Rows.Count = 0 Then
OPTION1 = 0
OPTION2 = 0
OPTION3 = 0
OPTION4 = 0
OPTION5 = 0
End If
Dim SQL_DOC_SEARCH = String.Format("SELECT * ," & _
"(CASE (SELECT FORM_ID FROM TBPMO_RECORD WHERE GUID = {0}) " & _
"WHEN {1} THEN " & _
" (SELECT VALUE FROM TBPMO_CONTROL_VALUE WHERE CONTROL_ID = {2} AND RECORD_ID = {0}) " & _
"ELSE '' END) AS OPTION1," & _
"CASE (SELECT FORM_ID FROM TBPMO_RECORD WHERE GUID = 3305) " & _
"WHEN {1} THEN " & _
" (SELECT VALUE FROM TBPMO_CONTROL_VALUE WHERE CONTROL_ID = {3} AND RECORD_ID = {0}) " & _
"ELSE '' END AS OPTION2," & _
"CASE (SELECT FORM_ID FROM TBPMO_RECORD WHERE GUID = 3305) " & _
"WHEN {1} THEN " & _
" (SELECT VALUE FROM TBPMO_CONTROL_VALUE WHERE CONTROL_ID = {4} AND RECORD_ID = {0}) " & _
"ELSE '' END AS OPTION3," & _
"CASE (SELECT FORM_ID FROM TBPMO_RECORD WHERE GUID = 3305) " & _
"WHEN {1} THEN " & _
" (SELECT VALUE FROM TBPMO_CONTROL_VALUE WHERE CONTROL_ID = {5} AND RECORD_ID = {0}) " & _
"ELSE '' END AS OPTION4 " & _
"FROM VWPMO_WD_DOC_SEARCH WHERE RECORD_ID LIKE '%#{0}%'", JUMP_RECORD_ID, ENTITY_ID, OPTION1, OPTION2, OPTION3, OPTION4)
Dim DT_FILE_RESULT As DataTable = ClassDatabase.Return_Datatable_Connection(SQL_DOC_SEARCH, 1)
If IsNothing(DT_FILE_RESULT) Then
Dim DT_RESULT As DataTable = Class_DOC_SEARCH.Get_DOC_RESULTTABLE(DT_RESULTLIST_OPTIONS, DT_WINDREAM_RESULTLIST, ENTITY_ID, JUMP_RECORD_ID, "RECORD")
If IsNothing(DT_RESULT) Then
Dim msg = "wrong DocSearch-Configuration - Check logfile and contact Digital Data"
tslblWindreamView.Text = msg
Me.Cursor = Cursors.Default
Exit Sub
End If
If DT_FILE_RESULT.Rows.Count > 0 Then 'Es gibt Suchergebnisse
If DT_RESULT.Rows.Count > 0 Then 'Es gibt Suchergebnisse
Dim msg = "Windream-Dokumente für Record: " & JUMP_RECORD_ID
If USER_LANGUAGE <> "de-DE" Then
msg = "windream-files for record: " & JUMP_RECORD_ID
End If
tslblWindreamView.Text = msg
Dim DTGrid As New DataTable
Dim ColArrayDEFINITION As New List(Of String)
Try
'Die Icon Colum erstellen und konfigurieren
Dim colIcon As New System.Data.DataColumn()
colIcon.DataType = GetType(Image)
colIcon.ColumnName = "ICON"
colIcon.Caption = ""
DTGrid.Columns.Add(colIcon)
'
Dim colPath As New System.Data.DataColumn()
colPath.DataType = GetType(String)
colPath.ColumnName = "FULLPATH"
colPath.Caption = "Fullpath"
DTGrid.Columns.Add(colPath)
Dim colOtype As New System.Data.DataColumn()
colOtype.DataType = GetType(String)
colOtype.ColumnName = "OBJECTTYPE"
colOtype.Caption = "Objecttype"
DTGrid.Columns.Add(colOtype)
If Not DT_WINDREAM_RESULTLIST Is Nothing And DT_WINDREAM_RESULTLIST.Rows.Count >= 1 Then
Dim ColCount As Integer = 1
For Each rw As DataRow In DT_WINDREAM_RESULTLIST.Rows
Dim ColumnName = rw.Item("HEADER_CAPTION")
Dim Width = rw.Item("WIDTH")
If IsNothing(Width) Or IsDBNull(Width) Then
Width = 200
End If
'Die Spalte definieren
DTGrid.Columns.Add(ColumnName)
ColCount += 1
Next
'Jetzt das Array zusammenbauen um die Spaltenwerte zu erhalten
For Each rw As DataRow In DT_WINDREAM_RESULTLIST.Rows
ColArrayDEFINITION.Add(rw.Item("COLUMN_VIEW"))
Next
End If
Catch ex As Exception
MsgBox("Unexpected Error in Construct Datatable for GridResult: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
For Each FILE_ROW As DataRow In DT_FILE_RESULT.Rows
Dim fullpath = FILE_ROW.Item("FULL_FILENAME")
Dim objecttype = FILE_ROW.Item("OBJECTTYPE")
'Dim Folderpath = Path.GetDirectoryName(fullpath)
Dim filename = Path.GetFileName(fullpath)
Dim extension = Path.GetExtension(fullpath)
' Try
Dim NewRow As DataRow
NewRow = DTGrid.NewRow()
'Icon zuweisen
Select Case extension
Case ".csv"
NewRow.Item(0) = My.Resources.doc_excel_csv
Case ".txt"
NewRow.Item(0) = My.Resources.text
Case ".pdf"
NewRow.Item(0) = My.Resources.pdf
Case ".doc"
NewRow.Item(0) = My.Resources.doc
Case ".docx"
NewRow.Item(0) = My.Resources.doc
Case ".xls"
NewRow.Item(0) = My.Resources.xls
Case ".xlsx"
NewRow.Item(0) = My.Resources.xls
Case ".ppt"
NewRow.Item(0) = My.Resources.ppt
Case ".pptx"
NewRow.Item(0) = My.Resources.ppt
Case ".dwg"
NewRow.Item(0) = My.Resources.dwg
Case Else
NewRow.Item(0) = My.Resources._blank
End Select
'Den Filepath mitgeben
NewRow.Item(1) = fullpath
NewRow.Item(2) = objecttype
Dim i = 3 'Fängt bei 2 an, um die ICON Column zu überspringen
For Each Colname As String In ColArrayDEFINITION
Dim rowvalue
Try
If LogErrorsOnly = False Then ClassLogger.Add(" >> now rowvalue for Colname '" & Colname & "'", False)
rowvalue = FILE_ROW.Item(Colname)
If LogErrorsOnly = False Then ClassLogger.Add(" >> rowvalue : '" & rowvalue.ToString & "'", False)
Catch ex As Exception
ClassLogger.Add("Unexpected Error in GetVariableValue for Column '" & Colname & "- Error: " & ex.Message)
If Colname.ToString.StartsWith("doct") Or Colname.ToString.StartsWith("Dokum") Then
rowvalue = ""
Else
rowvalue = "Error getting rowvalue"
End If
End Try
NewRow.Item(i) = rowvalue.ToString
i += 1
Next
DTGrid.Rows.Add(NewRow)
' Catch ex As Exception
' ClassLogger.Add("Unexpected Error in CreateRow for doc '" & filename & "- Error: " & ex.Message)
' End Try
Next
If DTGrid.Rows.Count > 0 Then
GridControlDocSearch.DataSource = DTGrid
If DT_RESULT.Rows.Count > 0 Then
GridControlDocSearch.DataSource = DT_RESULT
' Größe der Icon Column anpassen
GridViewDoc_Search.Columns.Item("ICON").MaxWidth = 24
GridViewDoc_Search.Columns.Item("ICON").MinWidth = 24
@@ -241,6 +102,7 @@ Public Class frmRecordView
msg = "No windream-files found for record: " & JUMP_RECORD_ID
End If
tslblWindreamView.Text = msg
GridControlDocSearch.DataSource = Nothing
'Clear_Windream_ResultList()
@@ -259,7 +121,7 @@ Public Class frmRecordView
Me.TBPMO_WORKFLOW_TASK_STATETableAdapter.Connection.ConnectionString = MyConnectionString
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 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