Pusch_27042016
This commit is contained in:
@@ -211,7 +211,7 @@ Public Class frmConstructor_Main
|
||||
If File.Exists(XMLPath) Then
|
||||
grvwGridPos.RestoreLayoutFromXml(XMLPath)
|
||||
'grvwGrid.ClearGrouping()
|
||||
grvwGridPos.ClearSelection()
|
||||
' grvwGridPos.ClearSelection()
|
||||
grvwGridPos.OptionsView.ShowPreview = False
|
||||
End If
|
||||
Catch ex As Exception
|
||||
@@ -728,6 +728,7 @@ Public Class frmConstructor_Main
|
||||
tsButtonEdit.Enabled = False
|
||||
tsButtonSave.Enabled = False
|
||||
tsButtonDelete.Enabled = False
|
||||
tsmi_RecordDelete.Enabled = False
|
||||
tslblLocked.Visible = True
|
||||
RecordKopierenToolStripMenuItem.Enabled = False
|
||||
TabFollowUp.PageEnabled = False
|
||||
@@ -1153,6 +1154,9 @@ Public Class frmConstructor_Main
|
||||
Me.Cursor = Cursors.WaitCursor
|
||||
Try
|
||||
If TCDetails.SelectedTabPage.Text.StartsWith("Pos") = False Then
|
||||
SELECTED_RECORD_ID = 0
|
||||
CURRENT_RECORD_ID = 0
|
||||
RECORD_ID = 0
|
||||
Lock_RecordControls(False)
|
||||
tsButtonShowWorkflowTasks.Enabled = True
|
||||
CURRENT_PARENT_ID = PARENT_ID
|
||||
@@ -1164,6 +1168,8 @@ Public Class frmConstructor_Main
|
||||
EDIT_STATE = EditState.Insert
|
||||
RECORD_CHANGED = True
|
||||
tsslblRecord.Text = "Adding record ......"
|
||||
RIGHT_ONLY_READ = False
|
||||
tslblLocked.Visible = False
|
||||
End If
|
||||
Catch ex As Exception
|
||||
MsgBox("Unexpected Error in Insert: " & ex.Message)
|
||||
@@ -1317,8 +1323,7 @@ Public Class frmConstructor_Main
|
||||
Me.Cursor = Cursors.Default
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Sub tsButtonDelete_Click(sender As Object, e As EventArgs) Handles tsButtonDelete.Click
|
||||
Sub Delete_Record()
|
||||
Dim msg = "Sind Sie sicher, dass Sie diesen Record/Datensatz löschen wollen?"
|
||||
If USER_LANGUAGE <> "de-DE" Then
|
||||
msg = "Are You sure You want to delete the selected record?"
|
||||
@@ -1360,7 +1365,9 @@ Public Class frmConstructor_Main
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
End Sub
|
||||
Private Sub tsButtonDelete_Click(sender As Object, e As EventArgs) Handles tsButtonDelete.Click
|
||||
Delete_Record()
|
||||
End Sub
|
||||
|
||||
Private Sub tsButtonEditMode_Click(sender As Object, e As EventArgs) Handles tsButtonEdit.Click
|
||||
@@ -1382,10 +1389,11 @@ Public Class frmConstructor_Main
|
||||
Dim EditingUser = ClassRecordState.IsRecordLocked(SELECTED_RECORD_ID)
|
||||
' Überprüfen, ob der Record gerade bearbeitet wird
|
||||
If Not IsNothing(EditingUser) Then
|
||||
tslblLocked.Visible = True
|
||||
If USER_LANGUAGE = "de-DE" Then
|
||||
MsgBox(String.Format("Dieser Datensatz wird gerade vom Benutzer {0} bearbeitet und kann nur lesend abgerufen werden.", EditingUser), MsgBoxStyle.Exclamation)
|
||||
MsgBox(String.Format("Dieser Datensatz wird gerade vom Benutzer '{0}' bearbeitet und kann nur lesend abgerufen werden.", EditingUser), MsgBoxStyle.Exclamation)
|
||||
Else
|
||||
MsgBox(String.Format("This Record is currently being edited by User {0} and only available in Read-Only mode.", EditingUser), MsgBoxStyle.Exclamation)
|
||||
MsgBox(String.Format("This Record is currently being edited by User '{0}' and only available in Read-Only mode.", EditingUser), MsgBoxStyle.Exclamation)
|
||||
End If
|
||||
' Wenn Record bearbeitet wird, EnableEditMode abbrechen!
|
||||
Exit Sub
|
||||
@@ -1397,7 +1405,7 @@ Public Class frmConstructor_Main
|
||||
|
||||
|
||||
Lock_RecordControls(False)
|
||||
Me.tsButtonDelete.Enabled = True
|
||||
tsmi_RecordDelete.Enabled = True
|
||||
Me.tsButtonAdd.Enabled = True
|
||||
Me.tsButtonSave.Enabled = True
|
||||
Dim stg As String
|
||||
@@ -1532,6 +1540,7 @@ Public Class frmConstructor_Main
|
||||
tsButtonAdd.Visible = True
|
||||
tsButtonEdit.Visible = True
|
||||
tsButtonDelete.Visible = True
|
||||
tsmi_RecordDelete.Enabled = True
|
||||
|
||||
If RIGHT_ADD_R = False Then
|
||||
tsButtonAdd.Visible = False
|
||||
@@ -1544,6 +1553,7 @@ Public Class frmConstructor_Main
|
||||
End If
|
||||
If RIGHT_DELETE_R = False Then
|
||||
tsButtonDelete.Visible = False
|
||||
tsmi_RecordDelete.Enabled = False
|
||||
End If
|
||||
Catch ex As Exception
|
||||
MsgBox("Error in GetSet_Rights:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
||||
@@ -3238,7 +3248,7 @@ Public Class frmConstructor_Main
|
||||
MsgBox(msg, MsgBoxStyle.Information)
|
||||
Next
|
||||
Else
|
||||
Dim msg = "Es wurden keine Dateien für diesen Datensatz gefunden!"
|
||||
Dim msg = "Es wurden keine Dateien für diesen Datensatz gefunden!"
|
||||
If USER_LANGUAGE <> "de-DE" Then
|
||||
msg = "No files found for record!"
|
||||
End If
|
||||
@@ -3257,6 +3267,257 @@ Public Class frmConstructor_Main
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> Run WD Delete Docs took " & Format(elapsed, "0.000000000") & " seconds", False)
|
||||
Cursor = Cursors.Default
|
||||
End Sub
|
||||
Private Sub RUN_WDSEARCH_GRID()
|
||||
Dim sw As New Stopwatch
|
||||
sw.Start()
|
||||
Dim elapsed As Double
|
||||
Dim Basesearch As String
|
||||
Try
|
||||
Dim windream_temp_search
|
||||
If Not windream_Docshow = True Or Sett_LoadWD_Docs = False Then
|
||||
Exit Sub
|
||||
End If
|
||||
Cursor = Cursors.WaitCursor
|
||||
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)
|
||||
If DTWD.Rows.Count = 1 Then
|
||||
If IsDBNull(DTWD.Rows(0).Item(0)) Then
|
||||
Cursor = Cursors.Default
|
||||
Exit Sub
|
||||
End If
|
||||
Else
|
||||
Cursor = Cursors.Default
|
||||
Exit Sub
|
||||
End If
|
||||
'Die SearchPatterns durchlaufen und zwischenspeichern
|
||||
If IsDBNull(DTWD.Rows(0).Item(0)) Then
|
||||
Cursor = Cursors.Default
|
||||
Exit Sub
|
||||
End If
|
||||
Basesearch = DTWD.Rows(0).Item(0)
|
||||
SP1 = DTWD.Rows(0).Item(1)
|
||||
If IsDBNull(DTWD.Rows(0).Item(2)) Then
|
||||
SP2 = ""
|
||||
Else
|
||||
SP2 = DTWD.Rows(0).Item(2)
|
||||
End If
|
||||
If IsDBNull(DTWD.Rows(0).Item(3)) Then
|
||||
SP3 = ""
|
||||
Else
|
||||
SP3 = DTWD.Rows(0).Item(3)
|
||||
End If
|
||||
If IsDBNull(DTWD.Rows(0).Item(4)) Then
|
||||
SP4 = ""
|
||||
Else
|
||||
SP4 = DTWD.Rows(0).Item(4)
|
||||
End If
|
||||
If IsDBNull(DTWD.Rows(0).Item(5)) Then
|
||||
SP5 = ""
|
||||
Else
|
||||
SP5 = DTWD.Rows(0).Item(5)
|
||||
End If
|
||||
|
||||
'Eine tempfile generieren
|
||||
Dim tempFilename1 = My.Computer.FileSystem.GetTempFileName()
|
||||
'Nur den Filenamen ohne Erweiterung
|
||||
Dim tempName = Path.GetFileNameWithoutExtension(tempFilename1)
|
||||
'tempfile lsöchen
|
||||
If My.Computer.FileSystem.FileExists(tempFilename1) Then
|
||||
My.Computer.FileSystem.DeleteFile(tempFilename1)
|
||||
End If
|
||||
|
||||
Dim temppath = Path.GetTempPath
|
||||
|
||||
Dim EncodingFormat As Encoding
|
||||
Dim WDUnicode = ClassDatabase.Execute_Scalar("SELECT WD_UNICODE FROM TBPMO_KONFIGURATION WHERE GUID = 1")
|
||||
If WDUnicode = True Then
|
||||
EncodingFormat = Encoding.GetEncoding(1252) '1252
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> Unicode is used (Encoding.GetEncoding(1252))", False)
|
||||
Else
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> UTF8 (Encoding.GetEncoding(65001))", False)
|
||||
EncodingFormat = Encoding.GetEncoding(65001)
|
||||
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
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> fileContents geladen", False)
|
||||
fileContents = fileContents.Replace("Í", "Ö")
|
||||
Dim _sp1 = SP1
|
||||
Dim _sp2 = SP2
|
||||
Dim _sp3 = SP3
|
||||
Dim _sp4 = SP4
|
||||
Dim _sp5 = SP5
|
||||
|
||||
If _sp1.ToString <> String.Empty Then
|
||||
_sp1 = Return_SearchPattern(_sp1.ToString)
|
||||
fileContents = fileContents.Replace("%pattern1%", _sp1)
|
||||
fileContents = fileContents.Replace("471101", _sp1)
|
||||
End If
|
||||
If _sp2.ToString <> String.Empty Then
|
||||
_sp2 = Return_SearchPattern(_sp2.ToString)
|
||||
If _sp2 = 0 Then
|
||||
_sp2 = ""
|
||||
End If
|
||||
fileContents = fileContents.Replace("%pattern2%", _sp2)
|
||||
fileContents = fileContents.Replace("471102", _sp2)
|
||||
End If
|
||||
If _sp3.ToString <> String.Empty Then
|
||||
_sp3 = Return_SearchPattern(_sp3.ToString)
|
||||
If _sp3 = 0 Then
|
||||
_sp3 = ""
|
||||
End If
|
||||
fileContents = fileContents.Replace("%pattern3%", _sp3)
|
||||
fileContents = fileContents.Replace("471103", _sp3)
|
||||
End If
|
||||
If _sp4.ToString <> String.Empty Then
|
||||
_sp4 = Return_SearchPattern(_sp4.ToString)
|
||||
If _sp4 = 0 Then
|
||||
_sp4 = ""
|
||||
End If
|
||||
fileContents = fileContents.Replace("%pattern4%", _sp4)
|
||||
fileContents = fileContents.Replace("471104", _sp4)
|
||||
End If
|
||||
If _sp5.ToString <> String.Empty Then
|
||||
_sp5 = Return_SearchPattern(_sp5.ToString)
|
||||
If _sp5 = 0 Then
|
||||
_sp5 = ""
|
||||
End If
|
||||
fileContents = fileContents.Replace("%pattern5%", _sp5)
|
||||
fileContents = fileContents.Replace("471105", _sp5)
|
||||
End If
|
||||
'Die windream File zusammensetzen
|
||||
windream_temp_search = temppath & tempName & ".wdf"
|
||||
TEMP_FILES.Add(windream_temp_search)
|
||||
'Die File schreiben
|
||||
My.Computer.FileSystem.WriteAllText(windream_temp_search, fileContents, False, EncodingFormat)
|
||||
My.Computer.FileSystem.WriteAllText(temppath & "SEARCH_COPY.wdf", fileContents, False, EncodingFormat)
|
||||
' XML-Datei öffnen und laden
|
||||
Dim Stream As New IO.StreamReader(CStr(windream_temp_search), EncodingFormat)
|
||||
Dim Reader As New System.Xml.XmlTextReader(Stream)
|
||||
' XML-Datei initialisieren
|
||||
Dim xml As New System.Xml.XmlDocument()
|
||||
' XML-Datei öffnen und laden
|
||||
xml.Load(Reader)
|
||||
Reader.Close()
|
||||
xml.Save(windream_temp_search)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> Xml Generiert: " & windream_temp_search, False)
|
||||
Dim windreamSucheErgebnisse As WINDREAMLib.WMObjects
|
||||
Try
|
||||
windreamSucheErgebnisse = ClassWindream.GetSearchDocuments(windream_temp_search)
|
||||
Catch ex As Exception
|
||||
MsgBox("Error in windreamSucheErgebnisse:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
||||
End Try
|
||||
elapsed = sw.Elapsed.TotalSeconds
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> GetSearchDocuments took " & Format(elapsed, "0.000000000") & " seconds", False)
|
||||
Dim DTGrid As New DataTable
|
||||
If windreamSucheErgebnisse.Count > 0 Then 'Es gibt Suchergebnisse
|
||||
Dim stg As String
|
||||
If USER_LANGUAGE = "de-DE" Then
|
||||
stg = "windream-Dateien"
|
||||
Else
|
||||
stg = "windream-files"
|
||||
End If
|
||||
TabWindream.Text = stg & " (" & windreamSucheErgebnisse.Count & ")"
|
||||
Dim sql_ResultList = "select * from TBPMO_WINDREAM_RESULTLIST_CONFIG where guid = 2"
|
||||
Dim DT As DataTable = ClassDatabase.Return_Datatable(sql_ResultList, "GET RESULTLIST KONFIG")
|
||||
Dim ColArray As New List(Of String)
|
||||
Try
|
||||
|
||||
If Not DT Is Nothing And DT.Rows.Count = 1 Then
|
||||
Dim ColCount As Integer = 1
|
||||
For Each Column As DataColumn In DT.Columns
|
||||
If Column.ColumnName.StartsWith("COLUMN") And Column.ColumnName.EndsWith("WIDTH") = False Then
|
||||
Dim sql1 = String.Format("select {0} from TBPMO_WINDREAM_RESULTLIST_CONFIG Where GUID = 2", Column.ColumnName)
|
||||
Dim ColumnName = ClassDatabase.Execute_Scalar(sql1, True)
|
||||
If Not IsDBNull(ColumnName) Then
|
||||
If Not IsDBNull(ColumnName) Or IsNothing(ColumnName) Or ColumnName <> "" Or ColumnName <> "{}" Then
|
||||
'Jetzt die Spalten aus Array hinzufügen und Breite konfigurieren
|
||||
sql1 = String.Format("select COLUMN{0}_WIDTH from TBPMO_WINDREAM_RESULTLIST_CONFIG Where GUID = 2", ColCount)
|
||||
Dim Width = ClassDatabase.Execute_Scalar(sql1, True)
|
||||
If IsNothing(Width) Or IsDBNull(Width) Then
|
||||
Width = 200
|
||||
End If
|
||||
'Die Spalte definieren
|
||||
DTGrid.Columns.Add(ColumnName)
|
||||
ColCount += 1
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
'Jetzt das Array zusammenbauen um die Spaltenwerte zu erhalten
|
||||
ColCount = 1
|
||||
For Each Column As DataColumn In DT.Columns
|
||||
If Column.ColumnName = String.Format("COLUMN{0}", ColCount) Then
|
||||
Dim sql1 = String.Format("select {0} from TBPMO_WINDREAM_RESULTLIST_CONFIG Where GUID = 2", Column.ColumnName)
|
||||
Dim ColumnName = ClassDatabase.Execute_Scalar(sql1, True)
|
||||
If Not IsDBNull(ColumnName) Then
|
||||
If Not IsDBNull(ColumnName) Or IsNothing(ColumnName) Or ColumnName <> "" Or ColumnName <> "{}" Then
|
||||
'Jetzt die Spalten aus Array hinzufügen und Breite konfigurieren
|
||||
ColArray.Add(Column.ColumnName)
|
||||
End If
|
||||
End If
|
||||
ColCount += 1
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
Catch ex As Exception
|
||||
MsgBox("Unexpected Error in Construct Datatable for GridResult: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
||||
End Try
|
||||
If DTGrid.Columns.Count > 0 Then
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> Datatable Grid created!", False)
|
||||
For Each dok As WMObject In windreamSucheErgebnisse
|
||||
Dim fullpath = "W:" & dok.aPath
|
||||
Dim Folderpath = Path.GetDirectoryName(fullpath)
|
||||
Dim filename = Path.GetFileName(fullpath)
|
||||
Try
|
||||
Dim NewRow As DataRow
|
||||
NewRow = DTGrid.NewRow()
|
||||
Dim i = 0
|
||||
For Each Column As String In ColArray
|
||||
Dim Indexname = DT.Rows(0).Item(Column)
|
||||
Dim idxvalue
|
||||
Try
|
||||
idxvalue = dok.GetVariableValue(Indexname)
|
||||
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"
|
||||
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)
|
||||
End Try
|
||||
|
||||
Next
|
||||
End If
|
||||
If DTGrid.Rows.Count > 0 Then
|
||||
GridControlDocSearch.DataSource = DTGrid
|
||||
End If
|
||||
Else
|
||||
Dim msg = "Windream-Dokumente für Record: " & RECORD_ID & " - Keine Dateien gefunden"
|
||||
If USER_LANGUAGE <> "de-DE" Then
|
||||
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()
|
||||
End If
|
||||
|
||||
Cursor = Cursors.Default
|
||||
Catch ex As Exception
|
||||
MsgBox("Error in RUN_WDSEARCH_GRID:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
||||
ClassLogger.Add("Unexpected Error in RUN_WDSEARCH_GRID: " & ex.Message)
|
||||
End Try
|
||||
elapsed = sw.Elapsed.TotalSeconds
|
||||
sw.Stop()
|
||||
sw.Reset()
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> Run RUN_WDSEARCH_GRID took " & Format(elapsed, "0.000000000") & " seconds", False)
|
||||
Cursor = Cursors.Default
|
||||
End Sub
|
||||
Private Function Return_SearchPattern(ByVal content As String)
|
||||
Select Case content.ToUpper
|
||||
Case "@Record-ID".ToUpper
|
||||
@@ -3415,6 +3676,7 @@ Public Class frmConstructor_Main
|
||||
RUN_WD_SEARCH(WD_Suche, "ENTITY")
|
||||
Else
|
||||
RUN_WD_SEARCH(WD_Suche, "RECORD")
|
||||
RUN_WDSEARCH_GRID()
|
||||
End If
|
||||
End If
|
||||
If TCDetails.SelectedTabPage.Text.ToLower.StartsWith("wieder") Or TCDetails.SelectedTabPage.Text.ToLower.StartsWith("follo") Then
|
||||
@@ -4349,4 +4611,18 @@ Public Class frmConstructor_Main
|
||||
Private Sub AxObjectListControl_Validated(sender As Object, e As EventArgs) Handles AxObjectListControl.Validated
|
||||
Console.WriteLine("Validated")
|
||||
End Sub
|
||||
|
||||
Private Sub tslblLocked_VisibleChanged(sender As Object, e As EventArgs) Handles tslblLocked.VisibleChanged
|
||||
If tslblLocked.Visible = True Then
|
||||
Dim msg = "Nur lesenden Zugriff"
|
||||
If USER_LANGUAGE <> "de-DE" Then
|
||||
msg = "Record is read only"
|
||||
End If
|
||||
tslblLocked.Text = msg
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub tsmi_RecordDelete_Click(sender As Object, e As EventArgs) Handles tsmi_RecordDelete.Click
|
||||
Delete_Record()
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user