This commit is contained in:
2020-02-14 13:50:06 +01:00
parent 73bfb00299
commit f636abc2fc
12 changed files with 2234 additions and 2440 deletions

View File

@@ -238,7 +238,7 @@ Public Class frmAdministration
End Sub
Private Sub TBPM_PROFILEBindingSource_PositionChanged(sender As System.Object, e As System.EventArgs) Handles TBPM_PROFILEBindingSource.PositionChanged
tstrlblSave.Visible = False
tsbStaticInfo.Caption = ""
Indexe_eintragen()
If tabctrl_Profilkonfig.SelectedIndex = 1 And TBPM_PROFILEBindingSource.Position <> -1 Then
Refresh_Final_indexe()
@@ -249,7 +249,7 @@ Public Class frmAdministration
Private Sub btnmovetoFolderDialog_Click(sender As System.Object, e As System.EventArgs) Handles btnmovetoFolderDialog.Click
Private Sub btnmovetoFolderDialog_Click(sender As System.Object, e As System.EventArgs)
' wenn im Formular der OK-Button geklickt wurde
If Me.FolderBrowserDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
' den Speicherort der windream-Suche in die TextBox eintragen
@@ -393,6 +393,7 @@ Public Class frmAdministration
Private Sub frmProfileDesigner_Shown(sender As Object, e As System.EventArgs) Handles Me.Shown
TabControl1.SelectedIndex = 0
formloaded = True
RibbonPageGroup2.Enabled = False
End Sub
@@ -410,21 +411,23 @@ Public Class frmAdministration
End Sub
Private Sub TabControl2_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles tabctrl_Profilkonfig.SelectedIndexChanged
If tabctrl_Profilkonfig.SelectedIndex = 1 Then
CURRENT_OBJECTTYPE = cmbObjekttypen.Text
Refresh_Final_indexe()
CancelFinalIndexInsert()
End If
Select Case tabctrl_Profilkonfig.SelectedIndex
Case 0
RibbonPageGroup2.Enabled = False
Case 1
CURRENT_OBJECTTYPE = cmbObjekttypen.Text
Refresh_Final_indexe()
CancelFinalIndexInsert()
End Select
End Sub
Private Sub TabControl1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles TabControl1.SelectedIndexChanged
Select Case TabControl1.SelectedIndex
Case 0
RibbonPageGroup1.Enabled = True
RibbonPageGroup2.Enabled = False
Case 1
RibbonPageGroup2.Enabled = True
RibbonPageGroup1.Enabled = False
If PROFILGUIDTextBox.Text = String.Empty Then
@@ -612,8 +615,9 @@ Public Class frmAdministration
Private Sub CancelFinalIndexInsert()
INSERT_ACTIVE = False
tsBtnCancel.Visible = False
BindingNavigatorAddNewItem.Visible = True
BarButtonItem19.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
BarButtonItem16.Visibility = DevExpress.XtraBars.BarItemVisibility.Always
TBPM_PROFILE_FINAL_INDEXINGBindingSource.CancelEdit()
@@ -816,15 +820,17 @@ Public Class frmAdministration
' End Try
'End Sub
Private Sub tsBtnCancel_Click(sender As Object, e As EventArgs) Handles tsBtnCancel.Click
CancelFinalIndexInsert()
End Sub
Private Sub frmProfileDesigner_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing
CancelFinalIndexInsert()
End Sub
Private Sub TabControl2_SelectedIndexChanged_1(sender As Object, e As EventArgs) Handles TabControl2.SelectedIndexChanged
Select Case TabControl2.SelectedIndex
Case 0
RibbonPageGroup2.Enabled = True
Case Else
RibbonPageGroup2.Enabled = False
End Select
CancelFinalIndexInsert()
End Sub
@@ -869,6 +875,8 @@ Public Class frmAdministration
End If
If IDB_ACTIVE Then
obj.Indicies = MyIndicies.Except(IDBData.IDBSystemIndices).ToList
Else
obj.Indicies = MyIndicies
End If
@@ -893,87 +901,6 @@ Public Class frmAdministration
End Try
End Sub
Private Sub BindingNavigatorAddNewItem_Click(sender As Object, e As EventArgs) Handles BindingNavigatorAddNewItem.Click
INSERT_ACTIVE = True
tsBtnCancel.Visible = True
BindingNavigatorAddNewItem.Visible = False
End Sub
Private Sub ToolStripButton4_Click_1(sender As Object, e As EventArgs) Handles tsBtnSave.Click
Try
Dim obj As FinalIndexProperties = PropertyGrid1.SelectedObject
If Not IsNothing(obj) Then
Dim value
If obj.SQLCommand.Value <> String.Empty Then
value = "SQL-Command"
Else
value = FINALINDICES.GetValue(obj, obj.IndexName, MyIndicies, MyIndicies_Types, obj.VectorIndex)
End If
value = NotNull(value, String.Empty)
Dim guid = obj.GUID
Dim profileId As Integer = PROFILGUIDTextBox.Text
Dim connectionId As Integer = obj.ConnectionId
Dim sqlCommand As String = NotNull(obj.SQLCommand.Value, String.Empty).Replace("'", "''")
Dim indexName As String = NotNull(obj.IndexName, String.Empty)
Dim isVectorIndex As Boolean = obj.VectorIndex
Dim addedWho As String = USER_USERNAME
Dim description As String = obj.Description
Dim active As Integer = IIf(obj.Active, 1, 0)
Dim preventDuplicates As Integer = IIf(obj.PreventDuplicates, 1, 0)
Dim AllowAddNewValues As Integer = IIf(obj.AllowAddNewValues, 1, 0)
Dim IF_VEKTOR_BEHAVIOUR As String = NotNull(obj.VectorBehaviour, String.Empty)
If indexName = String.Empty Then
MsgBox("Das Feld IndexName muss ausgefüllt sein!", MsgBoxStyle.Exclamation)
Exit Sub
End If
If sqlCommand = String.Empty And value = String.Empty Then
MsgBox("Entweder SQLCommand oder StaticValue müssen ausgefüllt sein!", MsgBoxStyle.Exclamation)
Exit Sub
End If
' Add the vector prefix to the value if index is a vector index
' and value is NOT an SQL-Command
If obj.VectorIndex And value <> "SQL-Command" Then
value = $"{FINALINDICES.PREFIX_VECTOR}{value}"
End If
If INSERT_ACTIVE = True Then
Dim sql As String = $"INSERT INTO TBPM_PROFILE_FINAL_INDEXING (PROFIL_ID, CONNECTION_ID, SQL_COMMAND, INDEXNAME, VALUE, ACTIVE, PREVENT_DUPLICATES, ALLOW_NEW_VALUES, ADDED_WHO,IF_VEKTOR_BEHAVIOUR)
VALUES ({profileId}, {connectionId}, '{sqlCommand}', '{indexName}', '{value}', {active}, {preventDuplicates}, {AllowAddNewValues}, '{addedWho}','{IF_VEKTOR_BEHAVIOUR}')"
If ClassDatabase.Execute_non_Query(sql, True) Then
INSERT_ACTIVE = False
End If
Else
Dim sql As String = $"UPDATE TBPM_PROFILE_FINAL_INDEXING
SET CONNECTION_ID = {connectionId}, SQL_COMMAND = '{sqlCommand}', INDEXNAME = '{indexName}', CHANGED_WHO = '{addedWho}',
VALUE = '{value}', ACTIVE = {active}, ALLOW_NEW_VALUES = {AllowAddNewValues}, PREVENT_DUPLICATES = {preventDuplicates},IF_VEKTOR_BEHAVIOUR = '{IF_VEKTOR_BEHAVIOUR}'
WHERE GUID = {guid}"
If ClassDatabase.Execute_non_Query(sql, True) Then
End If
End If
Refresh_Final_indexe()
End If
Catch ex As Exception
LOGGER.Error(ex)
MsgBox("Error while Saving Final Index: " & ex.Message, MsgBoxStyle.Critical)
LOGGER.Info("Error while Saving Final Index: " & ex.Message)
Finally
tsBtnCancel.Visible = False
BindingNavigatorAddNewItem.Visible = True
INSERT_ACTIVE = False
End Try
End Sub
Private Sub PropertyGrid1_PropertyValueChanged(s As Object, e As PropertyValueChangedEventArgs) Handles PropertyGrid1.PropertyValueChanged
Dim propertyGrid As PropertyGrid = s
@@ -996,25 +923,8 @@ Public Class frmAdministration
End If
End Sub
Private Sub BindingNavigatorDeleteItem_Click(sender As Object, e As EventArgs) Handles BindingNavigatorDeleteItem.Click
Dim selectedRowHandle = viewFinalIndex.GetSelectedRows().First()
Dim row As DataRow = viewFinalIndex.GetDataRow(selectedRowHandle)
If Not IsNothing(row) Then
If MsgBox("Wollen Sie den Index wirklich löschen?", MsgBoxStyle.YesNo Or MsgBoxStyle.Question) = MsgBoxResult.Yes Then
TBPM_PROFILE_FINAL_INDEXINGTableAdapter.DeleteFinalIndex(row.Item("GUID"))
Refresh_Final_indexe()
MsgBox("Index erfolgreich gelöscht!", MsgBoxStyle.Information, "Hinweis:")
End If
End If
End Sub
Private Sub ToolStripButton5_Click(sender As Object, e As EventArgs) Handles ToolStripButton5.Click
Refresh_Final_indexe()
End Sub
Private Sub tsBtnCancel_Click_1(sender As Object, e As EventArgs) Handles tsBtnCancel.Click
Private Sub tsBtnCancel_Click_1(sender As Object, e As EventArgs)
CancelFinalIndexInsert()
End Sub
@@ -1125,9 +1035,10 @@ Public Class frmAdministration
Me.TBPM_PROFILEBindingSource.EndEdit()
If DD_DMSLiteDataSet.TBPM_PROFILE.GetChanges Is Nothing = False Then
Me.TBPM_PROFILETableAdapter.Update(DD_DMSLiteDataSet.TBPM_PROFILE)
tstrlblSave.Visible = True
tsbStaticInfo.Caption = $"ProfileData saved - {Now.ToLongTimeString}"
Else
tstrlblSave.Visible = False
tsbStaticInfo.Caption = ""
End If
Catch ex As Exception
LOGGER.Error(ex)
@@ -1180,4 +1091,113 @@ Public Class frmAdministration
LOGGER.Error(ex)
End Try
End Sub
Private Sub BarButtonItem15_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem15.ItemClick
Refresh_Final_indexe()
End Sub
Private Sub BarButtonItem16_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem16.ItemClick
INSERT_ACTIVE = True
BarButtonItem19.Visibility = DevExpress.XtraBars.BarItemVisibility.Always
BarButtonItem16.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
TBPM_PROFILE_FINAL_INDEXINGBindingSource.AddNew()
End Sub
Private Sub BarButtonItem17_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem17.ItemClick
Dim selectedRowHandle = viewFinalIndex.GetSelectedRows().First()
Dim row As DataRow = viewFinalIndex.GetDataRow(selectedRowHandle)
If Not IsNothing(row) Then
If MsgBox("Wollen Sie den Index wirklich löschen?", MsgBoxStyle.YesNo Or MsgBoxStyle.Question) = MsgBoxResult.Yes Then
TBPM_PROFILE_FINAL_INDEXINGTableAdapter.DeleteFinalIndex(row.Item("GUID"))
Refresh_Final_indexe()
MsgBox("Index erfolgreich gelöscht!", MsgBoxStyle.Information, "Hinweis:")
End If
End If
End Sub
Private Sub BarButtonItem18_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem18.ItemClick
Try
Dim obj As FinalIndexProperties = PropertyGrid1.SelectedObject
If Not IsNothing(obj) Then
Dim value
If obj.SQLCommand.Value <> String.Empty Then
value = "SQL-Command"
Else
value = FINALINDICES.GetValue(obj, obj.IndexName, MyIndicies, MyIndicies_Types, obj.VectorIndex)
End If
value = NotNull(value, String.Empty)
Dim guid = obj.GUID
Dim profileId As Integer = PROFILGUIDTextBox.Text
Dim connectionId As Integer = obj.ConnectionId
Dim sqlCommand As String = NotNull(obj.SQLCommand.Value, String.Empty).Replace("'", "''")
Dim indexName As String = NotNull(obj.IndexName, String.Empty)
Dim isVectorIndex As Boolean = obj.VectorIndex
Dim addedWho As String = USER_USERNAME
Dim description As String = obj.Description
Dim active As Integer = IIf(obj.Active, 1, 0)
Dim preventDuplicates As Integer = IIf(obj.PreventDuplicates, 1, 0)
Dim AllowAddNewValues As Integer = IIf(obj.AllowAddNewValues, 1, 0)
Dim IF_VEKTOR_BEHAVIOUR As String = NotNull(obj.VectorBehaviour, String.Empty)
If indexName = String.Empty Then
MsgBox("We need an index!", MsgBoxStyle.Exclamation)
Exit Sub
End If
If sqlCommand = String.Empty And value = String.Empty Then
MsgBox("SQLCommand or StaticValue need to be filled!", MsgBoxStyle.Exclamation)
Exit Sub
End If
' Add the vector prefix to the value if index is a vector index
' and value is NOT an SQL-Command
If obj.VectorIndex And value <> "SQL-Command" Then
value = $"{FINALINDICES.PREFIX_VECTOR}{value}"
End If
If INSERT_ACTIVE = True Then
Dim sql As String = $"INSERT INTO TBPM_PROFILE_FINAL_INDEXING (PROFIL_ID, CONNECTION_ID, SQL_COMMAND, INDEXNAME, VALUE, ACTIVE, PREVENT_DUPLICATES, ALLOW_NEW_VALUES, ADDED_WHO,IF_VEKTOR_BEHAVIOUR)
VALUES ({profileId}, {connectionId}, '{sqlCommand}', '{indexName}', '{value}', {active}, {preventDuplicates}, {AllowAddNewValues}, '{addedWho}','{IF_VEKTOR_BEHAVIOUR}')"
If ClassDatabase.Execute_non_Query(sql, True) Then
tsbStaticInfo.Caption = $"Final index added - {Now.ToLongTimeString}"
INSERT_ACTIVE = False
End If
Else
Dim sql As String = $"UPDATE TBPM_PROFILE_FINAL_INDEXING
SET CONNECTION_ID = {connectionId}, SQL_COMMAND = '{sqlCommand}', INDEXNAME = '{indexName}', CHANGED_WHO = '{addedWho}',
VALUE = '{value}', ACTIVE = {active}, ALLOW_NEW_VALUES = {AllowAddNewValues}, PREVENT_DUPLICATES = {preventDuplicates},IF_VEKTOR_BEHAVIOUR = '{IF_VEKTOR_BEHAVIOUR}'
WHERE GUID = {guid}"
If ClassDatabase.Execute_non_Query(sql, True) Then
tsbStaticInfo.Caption = $"Final index saved - {Now.ToLongTimeString}"
End If
End If
Refresh_Final_indexe()
End If
Catch ex As Exception
LOGGER.Error(ex)
MsgBox("Error while Saving Final Index: " & ex.Message, MsgBoxStyle.Critical)
LOGGER.Info("Error while Saving Final Index: " & ex.Message)
Finally
BarButtonItem19.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
BarButtonItem16.Visibility = DevExpress.XtraBars.BarItemVisibility.Always
INSERT_ACTIVE = False
End Try
End Sub
Private Sub BarButtonItem19_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem19.ItemClick
CancelFinalIndexInsert()
End Sub
Private Sub gridFinalIndex_MouseHover(sender As Object, e As EventArgs) Handles gridFinalIndex.MouseHover
RibbonPageGroup2.Enabled = True
End Sub
End Class