MS_27042016

This commit is contained in:
SchreiberM
2016-04-28 11:43:09 +02:00
parent a573219f6f
commit c173fe57e8
5 changed files with 379 additions and 52 deletions

View File

@@ -10,9 +10,33 @@ Imports System.Text
Imports System.IO
Imports DevExpress.XtraGrid
Imports WINDREAMLib
Imports System.Runtime.InteropServices
Public Class frmConstructor_Main
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
#Region "Laufzeitvariablen & Konstanten"
Private CONSTRUCTORID As Integer
Private CONSTRUCTOR_DETAIL_ID As Integer
@@ -107,6 +131,8 @@ Public Class frmConstructor_Main
Private _ENTITYSQL As String
Private _ENTITYSTRING As String
Private RESULT_DOC_PATH
Public Enum EditState
None
Insert
@@ -210,9 +236,11 @@ Public Class frmConstructor_Main
Dim XMLPath = System.IO.Path.Combine(Application.UserAppDataPath(), Filename)
If File.Exists(XMLPath) Then
grvwGridPos.RestoreLayoutFromXml(XMLPath)
grvwGridPos.GuessAutoFilterRowValuesFromFilter()
'grvwGrid.ClearGrouping()
' grvwGridPos.ClearSelection()
grvwGridPos.OptionsView.ShowPreview = False
' grvwGridPos.OptionsView.ShowPreview = False
End If
Catch ex As Exception
MsgBox("Error in Load_POSGrid_Layout:" & vbNewLine & ex.Message)
@@ -241,7 +269,7 @@ Public Class frmConstructor_Main
'grvwGrid.ClearGrouping()
' grvwGrid.ClearSelection()
'grvwGrid.OptionsView.ShowPreview = False
grvwGridPos.GuessAutoFilterRowValuesFromFilter()
'Update_Status_Label(True, "Grid Layout Loaded")
End If
Catch ex As Exception
@@ -689,6 +717,7 @@ Public Class frmConstructor_Main
Show_Selected_Record_Data(Grid_RecordID, False)
RIGHT_ONLY_READ = False
tsmi_RecordDelete.Enabled = True
RecordKopierenToolStripMenuItem.Enabled = True
tslblLocked.Visible = False
TabFollowUp.PageEnabled = True
@@ -1747,8 +1776,11 @@ Public Class frmConstructor_Main
If windream_Docshow = True Then
If TCDetails.SelectedTabPageIndex = 1 Then
Clear_Windream_ResultList()
Me.GridControlDocSearch.DataSource = Nothing
If WD_ShowEnitityDocs = True Then
Clear_Windream_ResultList()
GridControlDocSearch.Visible = True
RUN_WD_SEARCH("", "ENTITY")
End If
End If
@@ -2428,7 +2460,8 @@ Public Class frmConstructor_Main
If RECORD_ID = 0 Then
RUN_WD_SEARCH(WD_Suche, "ENTITY")
Else
RUN_WD_SEARCH(WD_Suche, "RECORD")
RUN_WDSEARCH_GRID()
' RUN_WD_SEARCH(WD_Suche, "RECORD")
End If
Case 2
tsButtonEdit.Enabled = False
@@ -3160,7 +3193,7 @@ Public Class frmConstructor_Main
End If
Dim fileContents As String
If LogErrorsOnly = False Then ClassLogger.Add(" >> ReadAlltext: " & windream_temp_search, False)
fileContents = My.Computer.FileSystem.ReadAllText(BaseSearch, EncodingFormat) ', System.Text.Encoding.Unicode
fileContents = My.Computer.FileSystem.ReadAllText(Basesearch, EncodingFormat) ', System.Text.Encoding.Unicode
If LogErrorsOnly = False Then ClassLogger.Add(" >> fileContents geladen", False)
fileContents = fileContents.Replace("Í", "Ö")
Dim _sp1 = SP1
@@ -3278,6 +3311,7 @@ Public Class frmConstructor_Main
Exit Sub
End If
Cursor = Cursors.WaitCursor
GridControlDocSearch.DataSource = Nothing
Dim DTWD As DataTable
Dim sql = "SELECT WINDREAM_SEARCH,SEARCH_PATTERN1,SEARCH_PATTERN2,SEARCH_PATTERN3,SEARCH_PATTERN4,SEARCH_PATTERN5 FROM TBPMO_FORM_VIEW WHERE WINDREAM_SEARCH <> '' AND FORM_ID = " & ENTITY_ID
DTWD = ClassDatabase.Return_Datatable(sql)
@@ -3429,6 +3463,12 @@ Public Class frmConstructor_Main
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)
If Not DT Is Nothing And DT.Rows.Count = 1 Then
Dim ColCount As Integer = 1
@@ -3490,20 +3530,24 @@ Public Class frmConstructor_Main
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 Else
NewRow.Item(0) = My.Resources._blank
End Select
'Den Filepath mitgeben
NewRow.Item(1) = fullpath
Dim i = 1 'Fängt bei 1 an, um die ICON Column zu überspringen
Dim i = 2 'Fängt bei 2 an, um die ICON Column zu überspringen
For Each Column As String In ColArray
Dim Indexname = DT.Rows(0).Item(Column)
Dim idxvalue
@@ -3517,12 +3561,16 @@ Public Class frmConstructor_Main
If LogErrorsOnly = False Then ClassLogger.Add(" >> idxvalue from windream: '" & idxvalue.ToString & "'", False)
Catch ex As Exception
ClassLogger.Add("Unexpected Error in GetVariableValue for Index '" & Indexname & "- Error: " & ex.Message)
idxvalue = "Error getting indexvalue"
If Indexname.ToString.StartsWith("Doct") Or Indexname.ToString.StartsWith("Dokum") Then
idxvalue = ""
Else
idxvalue = "Error getting indexvalue"
End If
End Try
NewRow.Item(i) = idxvalue.ToString
i += 1
Next
DTGrid.Rows.Add(NewRow)
Catch ex As Exception
ClassLogger.Add("Unexpected Error in CreateRow for doc '" & filename & "- Error: " & ex.Message)
@@ -3534,7 +3582,7 @@ Public Class frmConstructor_Main
GridControlDocSearch.DataSource = DTGrid
GridViewDoc_Search.Columns.Item(0).MaxWidth = 24
GridViewDoc_Search.Columns.Item(0).MinWidth = 24
grvwGrid.Columns.Item(1).Visible = False
End If
Else
Dim msg = "Windream-Dokumente für Record: " & RECORD_ID & " - Keine Dateien gefunden"
@@ -3542,7 +3590,7 @@ Public Class frmConstructor_Main
msg = "windream-files for record: " & RECORD_ID & " - no files found"
End If
tslblWindreamView.Text = "Windream-Dokumente für Record: " & RECORD_ID & " - Keine Dateien gefunden"
Clear_Windream_ResultList()
'Clear_Windream_ResultList()
End If
Cursor = Cursors.Default
@@ -3713,7 +3761,7 @@ Public Class frmConstructor_Main
If RECORD_ID = 0 Then
RUN_WD_SEARCH(WD_Suche, "ENTITY")
Else
RUN_WD_SEARCH(WD_Suche, "RECORD")
' RUN_WD_SEARCH(WD_Suche, "RECORD")
RUN_WDSEARCH_GRID()
End If
End If
@@ -3793,8 +3841,8 @@ Public Class frmConstructor_Main
CURRENT_RECORD_ID = RECORD_ID
CURRENT_FORMVIEW_ID = FORMVIEW_ID
frmWD_Index_Dokart.ShowDialog()
RUN_WD_SEARCH(WD_Suche, "RECORD")
RUN_WDSEARCH_GRID()
'RUN_WD_SEARCH(WD_Suche, "RECORD")
End If
ElseIf (e.Data.GetDataPresent("FileGroupDescriptor")) AndAlso (e.Data.GetDataPresent("FileContents")) Then
CURRENT_RECORD_ID = RECORD_ID
@@ -3862,7 +3910,8 @@ Public Class frmConstructor_Main
If LogErrorsOnly = False Then ClassLogger.Add(" >> File was deleted or worked meanwhile!")
End If
Next
RUN_WD_SEARCH(WD_Suche, "RECORD")
RUN_WDSEARCH_GRID()
' RUN_WD_SEARCH(WD_Suche, "RECORD")
End If
End If
Else
@@ -4124,7 +4173,8 @@ Public Class frmConstructor_Main
Private Sub WindreamsucheNeuLadenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles WindreamsucheNeuLadenToolStripMenuItem.Click
RUN_WD_SEARCH(WD_Suche, "RECORD")
RUN_WDSEARCH_GRID()
' RUN_WD_SEARCH(WD_Suche, "RECORD")
End Sub
Private Sub WorkflowTasksNeuErstellenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles WorkflowTasksNeuErstellenToolStripMenuItem.Click
@@ -4296,7 +4346,8 @@ Public Class frmConstructor_Main
If CInt(SOLLENTITY_ID) = REC_ENTITY_ID Then
Cursor = Cursors.WaitCursor
If ClassOfficeTemplate.Open_Word_Template(TemplateID, RECORD_ID) = True Then
RUN_WD_SEARCH(WD_Suche, "RECORD")
RUN_WDSEARCH_GRID()
' RUN_WD_SEARCH(WD_Suche, "RECORD")
Update_Status_Label(True, "Template file imported to windream", EditState.Insert)
End If
Cursor = Cursors.Default
@@ -4663,4 +4714,102 @@ Public Class frmConstructor_Main
Private Sub tsmi_RecordDelete_Click(sender As Object, e As EventArgs) Handles tsmi_RecordDelete.Click
Delete_Record()
End Sub
Private Sub KopierenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles KopierenToolStripMenuItem.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 GridViewDoc_Search_FocusedRowChanged(sender As Object, e As 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 LöschenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles LöschenToolStripMenuItem.Click
If RESULT_DOC_PATH <> Nothing Then
Dim msg = "Sind Sie sicher, dass Sie diese Dateien 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 EigenschaftenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles EigenschaftenToolStripMenuItem.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 DateiÖffnenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles DateiÖffnenToolStripMenuItem.Click
File_open()
End Sub
Sub File_open()
If RESULT_DOC_PATH <> Nothing Then
Try
Dim Proc As New System.Diagnostics.Process
Dim psi As New ProcessStartInfo(RESULT_DOC_PATH)
Proc.EnableRaisingEvents = True
Proc.StartInfo = psi
Proc.Start()
Catch ex As Exception
MsgBox("Unexpected Error in Open file:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
ClassLogger.Add("Fehler bei Datei öffnen: " & ex.Message, True)
End Try
End If
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
File_open()
End Sub
End Class