jj: add confirmation when removing final index, set (readonly) vector prop when selecting index

This commit is contained in:
Jonathan Jenne 2018-07-12 11:04:52 +02:00
parent 23795dd3da
commit 80099c5a01
5 changed files with 115 additions and 131 deletions

View File

@ -28,11 +28,13 @@
value = IIf(props.BoolValue, "1", "0")
End If
If isVector Then
Return $"{PREFIX_VECTOR}{value}"
Else
Return value
End If
Return value
'If isVector Then
' Return $"{PREFIX_VECTOR}{value}"
'Else
' Return value
'End If
Catch ex As Exception
MsgBox($"Error in GetValue: {ex.Message}", MsgBoxStyle.Critical)
End Try
@ -50,6 +52,12 @@
Dim type As Integer = types.Item(i)
Dim isVector = value.StartsWith(PREFIX_VECTOR)
If isVector Then
value = value.Replace(PREFIX_VECTOR, String.Empty)
End If
props.VectorIndex = isVector
If type = INDEX_TYPE_STRING Or type = INDEX_TYPE_VECTOR_STRING Then
value = NotNull(value, "")
@ -93,4 +101,12 @@
Return False
End If
End Function
Public Shared Function GetIndexType(indexName As String, indicies As List(Of String), types As List(Of Integer))
Dim position As Integer = indicies.IndexOf(indexName)
Dim type As Integer = types.Item(position)
Return type
End Function
End Class

View File

@ -53,7 +53,9 @@ Module ModuleFinalIndexProperties
<Category("Index")>
<TypeConverter(GetType(IndexListConverter))>
Public Property IndexName As String
<Category("Index")>
<[ReadOnly](True)>
Public Property VectorIndex As Boolean
' Eigenschaften für die Liste der Indicies

View File

@ -166,7 +166,6 @@ Partial Class frmAdministration
Me.colCHANGED_WHO = New DevExpress.XtraGrid.Columns.GridColumn()
Me.colCHANGED_WHEN = New DevExpress.XtraGrid.Columns.GridColumn()
Me.colGUID = New DevExpress.XtraGrid.Columns.GridColumn()
Me.colCONNECTION_ID = New DevExpress.XtraGrid.Columns.GridColumn()
Me.colSQL_COMMAND = New DevExpress.XtraGrid.Columns.GridColumn()
Me.PropertyGrid1 = New System.Windows.Forms.PropertyGrid()
Me.BindingNavigator1 = New System.Windows.Forms.BindingNavigator(Me.components)
@ -185,7 +184,6 @@ Partial Class frmAdministration
Me.tsBtnSave = New System.Windows.Forms.ToolStripButton()
Me.ToolStripButton5 = New System.Windows.Forms.ToolStripButton()
Me.Label13 = New System.Windows.Forms.Label()
Me.TBDD_CONNECTIONBindingSource = New System.Windows.Forms.BindingSource(Me.components)
Me.Label5 = New System.Windows.Forms.Label()
Me.Label6 = New System.Windows.Forms.Label()
Me.TabPage12 = New System.Windows.Forms.TabPage()
@ -247,6 +245,7 @@ Partial Class frmAdministration
Me.BindingNavigatorMoveNextItem3 = New System.Windows.Forms.ToolStripButton()
Me.BindingNavigatorMoveLastItem3 = New System.Windows.Forms.ToolStripButton()
Me.BindingNavigatorSeparator11 = New System.Windows.Forms.ToolStripSeparator()
Me.TBDD_CONNECTIONBindingSource = New System.Windows.Forms.BindingSource(Me.components)
Me.TBPM_PROFILE_CONTROLSBindingSource = New System.Windows.Forms.BindingSource(Me.components)
Me.StatusStrip1 = New System.Windows.Forms.StatusStrip()
Me.tstrpinfo = New System.Windows.Forms.ToolStripStatusLabel()
@ -336,7 +335,6 @@ Partial Class frmAdministration
CType(Me.viewFinalIndex, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.BindingNavigator1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.BindingNavigator1.SuspendLayout()
CType(Me.TBDD_CONNECTIONBindingSource, System.ComponentModel.ISupportInitialize).BeginInit()
Me.TabPage12.SuspendLayout()
Me.TabPage2.SuspendLayout()
CType(Me.SplitContainerProfilzuordnung, System.ComponentModel.ISupportInitialize).BeginInit()
@ -358,6 +356,7 @@ Partial Class frmAdministration
CType(Me.TBPM_ERROR_LOGBindingSource, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.TBPM_ERROR_LOGBindingNavigator, System.ComponentModel.ISupportInitialize).BeginInit()
Me.TBPM_ERROR_LOGBindingNavigator.SuspendLayout()
CType(Me.TBDD_CONNECTIONBindingSource, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.TBPM_PROFILE_CONTROLSBindingSource, System.ComponentModel.ISupportInitialize).BeginInit()
Me.StatusStrip1.SuspendLayout()
Me.pnlMain.SuspendLayout()
@ -1279,7 +1278,7 @@ Partial Class frmAdministration
'
'viewFinalIndex
'
Me.viewFinalIndex.Columns.AddRange(New DevExpress.XtraGrid.Columns.GridColumn() {Me.colINDEXNAME, Me.colVALUE, Me.colADDED_WHO, Me.colADDED_WHEN, Me.colCHANGED_WHO, Me.colCHANGED_WHEN, Me.colGUID, Me.colCONNECTION_ID, Me.colSQL_COMMAND})
Me.viewFinalIndex.Columns.AddRange(New DevExpress.XtraGrid.Columns.GridColumn() {Me.colGUID, Me.colINDEXNAME, Me.colVALUE, Me.colSQL_COMMAND, Me.colADDED_WHO, Me.colADDED_WHEN, Me.colCHANGED_WHO, Me.colCHANGED_WHEN})
Me.viewFinalIndex.GridControl = Me.gridFinalIndex
Me.viewFinalIndex.Name = "viewFinalIndex"
Me.viewFinalIndex.OptionsBehavior.Editable = False
@ -1288,15 +1287,15 @@ Partial Class frmAdministration
'
'colINDEXNAME
'
resources.ApplyResources(Me.colINDEXNAME, "colINDEXNAME")
Me.colINDEXNAME.FieldName = "INDEXNAME"
Me.colINDEXNAME.Name = "colINDEXNAME"
resources.ApplyResources(Me.colINDEXNAME, "colINDEXNAME")
'
'colVALUE
'
resources.ApplyResources(Me.colVALUE, "colVALUE")
Me.colVALUE.FieldName = "VALUE"
Me.colVALUE.Name = "colVALUE"
resources.ApplyResources(Me.colVALUE, "colVALUE")
'
'colADDED_WHO
'
@ -1324,21 +1323,15 @@ Partial Class frmAdministration
'
'colGUID
'
resources.ApplyResources(Me.colGUID, "colGUID")
Me.colGUID.FieldName = "GUID"
Me.colGUID.Name = "colGUID"
resources.ApplyResources(Me.colGUID, "colGUID")
'
'colCONNECTION_ID
'
Me.colCONNECTION_ID.FieldName = "CONNECTION_ID"
Me.colCONNECTION_ID.Name = "colCONNECTION_ID"
resources.ApplyResources(Me.colCONNECTION_ID, "colCONNECTION_ID")
'
'colSQL_COMMAND
'
resources.ApplyResources(Me.colSQL_COMMAND, "colSQL_COMMAND")
Me.colSQL_COMMAND.FieldName = "SQL_COMMAND"
Me.colSQL_COMMAND.Name = "colSQL_COMMAND"
resources.ApplyResources(Me.colSQL_COMMAND, "colSQL_COMMAND")
'
'PropertyGrid1
'
@ -1444,11 +1437,6 @@ Partial Class frmAdministration
resources.ApplyResources(Me.Label13, "Label13")
Me.Label13.Name = "Label13"
'
'TBDD_CONNECTIONBindingSource
'
Me.TBDD_CONNECTIONBindingSource.DataMember = "TBDD_CONNECTION"
Me.TBDD_CONNECTIONBindingSource.DataSource = Me.DD_DMSLiteDataSet
'
'Label5
'
resources.ApplyResources(Me.Label5, "Label5")
@ -1901,6 +1889,11 @@ Partial Class frmAdministration
Me.BindingNavigatorSeparator11.Name = "BindingNavigatorSeparator11"
resources.ApplyResources(Me.BindingNavigatorSeparator11, "BindingNavigatorSeparator11")
'
'TBDD_CONNECTIONBindingSource
'
Me.TBDD_CONNECTIONBindingSource.DataMember = "TBDD_CONNECTION"
Me.TBDD_CONNECTIONBindingSource.DataSource = Me.DD_DMSLiteDataSet
'
'TBPM_PROFILE_CONTROLSBindingSource
'
Me.TBPM_PROFILE_CONTROLSBindingSource.DataMember = "TBPM_PROFILE_CONTROLS"
@ -2036,7 +2029,6 @@ Partial Class frmAdministration
CType(Me.BindingNavigator1, System.ComponentModel.ISupportInitialize).EndInit()
Me.BindingNavigator1.ResumeLayout(False)
Me.BindingNavigator1.PerformLayout()
CType(Me.TBDD_CONNECTIONBindingSource, System.ComponentModel.ISupportInitialize).EndInit()
Me.TabPage12.ResumeLayout(False)
Me.TabPage12.PerformLayout()
Me.TabPage2.ResumeLayout(False)
@ -2064,6 +2056,7 @@ Partial Class frmAdministration
CType(Me.TBPM_ERROR_LOGBindingNavigator, System.ComponentModel.ISupportInitialize).EndInit()
Me.TBPM_ERROR_LOGBindingNavigator.ResumeLayout(False)
Me.TBPM_ERROR_LOGBindingNavigator.PerformLayout()
CType(Me.TBDD_CONNECTIONBindingSource, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.TBPM_PROFILE_CONTROLSBindingSource, System.ComponentModel.ISupportInitialize).EndInit()
Me.StatusStrip1.ResumeLayout(False)
Me.StatusStrip1.PerformLayout()
@ -2283,7 +2276,6 @@ Partial Class frmAdministration
Friend WithEvents colCHANGED_WHO As DevExpress.XtraGrid.Columns.GridColumn
Friend WithEvents colCHANGED_WHEN As DevExpress.XtraGrid.Columns.GridColumn
Friend WithEvents colGUID As DevExpress.XtraGrid.Columns.GridColumn
Friend WithEvents colCONNECTION_ID As DevExpress.XtraGrid.Columns.GridColumn
Friend WithEvents colSQL_COMMAND As DevExpress.XtraGrid.Columns.GridColumn
Friend WithEvents ToolStripButton5 As ToolStripButton
Friend WithEvents tsBtnCancel As ToolStripButton

View File

@ -2565,18 +2565,42 @@ der Wertänderungen nutzen wollen:</value>
<data name="gridFinalIndex.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 0</value>
</data>
<data name="colGUID.Caption" xml:space="preserve">
<value>Id</value>
</data>
<data name="colGUID.Visible" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="colGUID.VisibleIndex" type="System.Int32, mscorlib">
<value>6</value>
</data>
<data name="colINDEXNAME.Caption" xml:space="preserve">
<value>Windream Index</value>
</data>
<data name="colINDEXNAME.Visible" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="colINDEXNAME.VisibleIndex" type="System.Int32, mscorlib">
<value>0</value>
</data>
<data name="colVALUE.Caption" xml:space="preserve">
<value>Fester Wert</value>
</data>
<data name="colVALUE.Visible" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="colVALUE.VisibleIndex" type="System.Int32, mscorlib">
<value>1</value>
</data>
<data name="colSQL_COMMAND.Caption" xml:space="preserve">
<value>SQL Befehl</value>
</data>
<data name="colSQL_COMMAND.Visible" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="colSQL_COMMAND.VisibleIndex" type="System.Int32, mscorlib">
<value>7</value>
</data>
<data name="colADDED_WHO.Visible" type="System.Boolean, mscorlib">
<value>True</value>
</data>
@ -2601,24 +2625,6 @@ der Wertänderungen nutzen wollen:</value>
<data name="colCHANGED_WHEN.VisibleIndex" type="System.Int32, mscorlib">
<value>5</value>
</data>
<data name="colGUID.Visible" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="colGUID.VisibleIndex" type="System.Int32, mscorlib">
<value>6</value>
</data>
<data name="colCONNECTION_ID.Visible" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="colCONNECTION_ID.VisibleIndex" type="System.Int32, mscorlib">
<value>7</value>
</data>
<data name="colSQL_COMMAND.Visible" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="colSQL_COMMAND.VisibleIndex" type="System.Int32, mscorlib">
<value>8</value>
</data>
<data name="gridFinalIndex.Size" type="System.Drawing.Size, System.Drawing">
<value>906, 269</value>
</data>
@ -4900,12 +4906,6 @@ der Wertänderungen nutzen wollen:</value>
<data name="&gt;&gt;colGUID.Type" xml:space="preserve">
<value>DevExpress.XtraGrid.Columns.GridColumn, DevExpress.XtraGrid.v15.2, Version=15.2.16.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;colCONNECTION_ID.Name" xml:space="preserve">
<value>colCONNECTION_ID</value>
</data>
<data name="&gt;&gt;colCONNECTION_ID.Type" xml:space="preserve">
<value>DevExpress.XtraGrid.Columns.GridColumn, DevExpress.XtraGrid.v15.2, Version=15.2.16.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;colSQL_COMMAND.Name" xml:space="preserve">
<value>colSQL_COMMAND</value>
</data>
@ -4996,12 +4996,6 @@ der Wertänderungen nutzen wollen:</value>
<data name="&gt;&gt;ToolStripButton5.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;TBDD_CONNECTIONBindingSource.Name" xml:space="preserve">
<value>TBDD_CONNECTIONBindingSource</value>
</data>
<data name="&gt;&gt;TBDD_CONNECTIONBindingSource.Type" xml:space="preserve">
<value>System.Windows.Forms.BindingSource, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;viewAvailableProfiles.Name" xml:space="preserve">
<value>viewAvailableProfiles</value>
</data>
@ -5122,6 +5116,12 @@ der Wertänderungen nutzen wollen:</value>
<data name="&gt;&gt;BindingNavigatorSeparator11.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;TBDD_CONNECTIONBindingSource.Name" xml:space="preserve">
<value>TBDD_CONNECTIONBindingSource</value>
</data>
<data name="&gt;&gt;TBDD_CONNECTIONBindingSource.Type" xml:space="preserve">
<value>System.Windows.Forms.BindingSource, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;TBPM_PROFILE_CONTROLSBindingSource.Name" xml:space="preserve">
<value>TBPM_PROFILE_CONTROLSBindingSource</value>
</data>

View File

@ -684,91 +684,23 @@ Public Class frmAdministration
End If
End Sub
'Private Sub Button2_Click(sender As Object, e As EventArgs)
' Me.txtindexwert_final.Text = "vUserName"
'End Sub
'Private Sub Button3_Click(sender As Object, e As EventArgs)
' Me.txtindexwert_final.Text = "vDate"
'End Sub
'Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs)
' If CheckBoxPMVEKTOR.Checked Then
' Me.txtBezeichner.Visible = True
' Me.cmbIndexe.Visible = False
' txtBezeichner.Text = ""
' Me.lblIndexPMVektor.Text = "Bezeichner für VektorIndex eingeben:"
' Me.lblIndex.Visible = True
' Me.lblIndex.Text = "Bitte den festen Wert als String eingeben:"
' Me.txtindexwert_final.Visible = True
' Me.grbxSystemStamps.Visible = True
' Me.txtindexwert_final.Text = ""
' Me.chkbxfinalIndex.Visible = False
' Else
' Me.txtBezeichner.Visible = False
' Me.cmbIndexe.Visible = True
' Me.lblIndexPMVektor.Text = "Index wählen:"
' Me.lblIndex.Visible = False
' Me.txtindexwert_final.Visible = False
' Me.grbxSystemStamps.Visible = False
' Me.txtindexwert_final.Text = ""
' Me.chkbxfinalIndex.Visible = False
' End If
'End Sub
Private Sub btnopen_SQLAdmin_Click(sender As Object, e As EventArgs) Handles btnopen_SQLAdmin.Click
frmSQL_Admin.ShowDialog()
End Sub
Private Sub btnRefreshProfiles_Click(sender As Object, e As EventArgs) Handles btnRefreshProfiles.Click
Refresh_Profildaten()
End Sub
'Private Sub ToolStripButton2_Click(sender As Object, e As EventArgs)
' TabControlFinalIndices.Enabled = True
' tsBtnCancel_old.Visible = True
' tsBtnCancel.Visible = True
' cmbIndexe.Items.Clear()
' cmbIndexe2.Items.Clear()
' Dim indexe = _windreamPM.GetIndicesByObjecttype(cmbObjekttypen.Text)
' If indexe IsNot Nothing Then
' For Each index As String In indexe
' Me.cmbIndexe.Items.Add(index)
' Me.cmbIndexe2.Items.Add(index)
' Next
' Me.cmbIndexe.SelectedIndex = -1
' End If
' INSERT_ACTIVE = True
'End Sub
Private Sub CancelFinalIndexInsert()
'TabControlFinalIndices.Enabled = False
INSERT_ACTIVE = False
'tsBtnCancel_old.Visible = False
tsBtnCancel.Visible = False
BindingNavigatorAddNewItem.Visible = True
TBPM_PROFILE_FINAL_INDEXINGBindingSource.CancelEdit()
'txtBezeichner.Text = String.Empty
'txtindexwert_final.Text = String.Empty
'cmbIndexe.SelectedIndex = -1
'cmbIndexe2.SelectedIndex = -1
'cmbConnection.SelectedIndex = -1
'SQL_COMMANDTextBox.Text = String.Empty
'CheckBoxPMVEKTOR.Checked = False
End Sub
'Private Sub ToolStripButton3_Click(sender As Object, e As EventArgs)
' Dim i, ID As Integer
' i = TBPM_PROFILE_FINAL_INDEXINGDataGridView.CurrentRow.Index
' ID = TBPM_PROFILE_FINAL_INDEXINGDataGridView.Item(0, i).Value
' If ID > 0 Then
' TBPM_PROFILE_FINAL_INDEXINGTableAdapter.CmdDelete(ID)
' End If
' Refresh_Final_indexe()
' MsgBox("Index erfolgreich gelöscht!", MsgBoxStyle.Information, "Hinweis:")
' ' DD_DMSLiteDataSet.TBPM_PROFILE_FINAL_INDEXING.Clear()
'End Sub
Private Sub ACTIVECheckBox_CheckedChanged(sender As Object, e As EventArgs) Handles ACTIVECheckBox.CheckedChanged
If ACTIVECheckBox.Checked Then
ACTIVECheckBox.BackColor = Color.Lime
@ -1021,15 +953,48 @@ Public Class frmAdministration
obj.Description = description
obj.Active = active
obj.Indicies = Windream_Indicies
obj.IndiciesType = Windream_Indicies_Types
obj.IndexName = index
' Wenn eine neue Zeile hinzugefügt wird, auf StringValue setzen
If e.FocusedRowHandle <> GridControl.NewItemRowHandle Then
obj = ClassFinalIndex.SetValue(value, obj, index, Windream_Indicies, Windream_Indicies_Types)
End If
'Dim type As Integer = ClassFinalIndex.GetIndexType(index, Windream_Indicies, Windream_Indicies_Types)
'Dim isCurrentIndexVectorIndex = ClassFinalIndex.IsVectorIndex(type)
'Dim indicies As List(Of String) = Windream_Indicies.AsEnumerable _
' .Where(Function(currentIndex As String)
' Dim currentType As Integer = ClassFinalIndex.GetIndexType(currentIndex, Windream_Indicies, Windream_Indicies_Types)
' If isCurrentIndexVectorIndex Then
' Return ClassFinalIndex.IsVectorIndex(currentType)
' Else
' Return Not ClassFinalIndex.IsVectorIndex(currentType)
' End If
' End Function).ToList()
'Dim indexTypes As List(Of Integer) = Windream_Indicies_Types.AsEnumerable _
' .Where(Function(currentType)
' If isCurrentIndexVectorIndex Then
' Return ClassFinalIndex.IsVectorIndex(currentType)
' Else
' Return Not ClassFinalIndex.IsVectorIndex(currentType)
' End If
' End Function).ToList()
'obj.Indicies = indicies
'obj.IndiciesType = indexTypes
obj.Indicies = Windream_Indicies
obj.IndiciesType = Windream_Indicies_Types
obj.IndexName = index
If Not index Is Nothing Then
Dim indexType As Integer = ClassFinalIndex.GetIndexType(index, Windream_Indicies, Windream_Indicies_Types)
obj.VectorIndex = ClassFinalIndex.IsVectorIndex(indexType)
End If
PropertyGrid1.SelectedObject = obj
PropertyGrid1.Refresh()
Catch ex As Exception
@ -1072,6 +1037,10 @@ Public Class frmAdministration
Exit Sub
End If
If obj.VectorIndex Then
value = $"{ClassFinalIndex.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, ADDED_WHO)
VALUES ({profileId}, {connectionId}, '{sqlCommand}', '{indexName}', '{value}', {active}, '{addedWho}')"
@ -1116,6 +1085,9 @@ Public Class frmAdministration
propertyGrid.Refresh()
ElseIf e.ChangedItem.Label = "IndexName" Then
Dim type As Integer = ClassFinalIndex.GetIndexType(e.ChangedItem.Value, Windream_Indicies, Windream_Indicies_Types)
obj.VectorIndex = ClassFinalIndex.IsVectorIndex(type)
propertyGrid.Refresh()
End If
End Sub
@ -1125,10 +1097,12 @@ Public Class frmAdministration
Dim row As DataRow = viewFinalIndex.GetDataRow(selectedRowHandle)
If Not IsNothing(row) Then
TBPM_PROFILE_FINAL_INDEXINGTableAdapter.CmdDelete(row.Item("GUID"))
Refresh_Final_indexe()
If MsgBox("Wollen Sie den Index wirklich löschen?", MsgBoxStyle.YesNo Or MsgBoxStyle.Question) = MsgBoxResult.Yes Then
TBPM_PROFILE_FINAL_INDEXINGTableAdapter.CmdDelete(row.Item("GUID"))
Refresh_Final_indexe()
MsgBox("Index erfolgreich gelöscht!", MsgBoxStyle.Information, "Hinweis:")
MsgBox("Index erfolgreich gelöscht!", MsgBoxStyle.Information, "Hinweis:")
End If
End If
End Sub