Imports System.ComponentModel Imports System.Data.SqlClient Imports System.IO Imports DD_LIB_Standards Imports DevExpress.XtraGrid Imports DevExpress.XtraGrid.Views.Base Imports DevExpress.XtraGrid.Views.Grid Imports DigitalData.GUIs.Common Imports DigitalData.Modules.Language.Utils Imports DigitalData.Modules.Logging Public Class frmAdministration Private UNSAVED_CHANGES_PROFILE As Boolean = False Private UNSAVED_CHANGES_FI As Boolean = False Private FORM_LOADED As Boolean = False Private INSERT_ACTIVE As Boolean = False Private BINDINGSOURCE_CHANGING As Boolean = False Private ReadOnly email As New ClassEmail Private FormDesigner As frmFormDesigner Private FormHelper As FormHelper Private ReadOnly _Logger As Logger = LOGCONFIG.GetLogger() Private Property profile_guid As Integer = 0 Private Property DT_CHART_CONFIG As DataTable Private Property PROF_ORIGIN As DataTable Private Sub frmAdministration_Load(sender As Object, e As System.EventArgs) Handles Me.Load _Logger.Debug("Loading Administration") FORM_LOADED = False UNSAVED_CHANGES_PROFILE = False Try FormDesigner = New frmFormDesigner() FormHelper = New FormHelper(LOGCONFIG, Me) TBPM_KONFIGURATIONTableAdapter.Connection.ConnectionString = CONNECTION_STRING_ECM TBPM_PROFILETableAdapter.Connection.ConnectionString = CONNECTION_STRING_ECM PROF_ORIGIN = DD_DMSLiteDataSet.TBPM_PROFILE TBPM_TYPETableAdapter.Connection.ConnectionString = CONNECTION_STRING_ECM TBDD_USERTableAdapter.Connection.ConnectionString = CONNECTION_STRING_ECM FNPM_GET_FREE_USER_FOR_PROFILETableAdapter.Connection.ConnectionString = CONNECTION_STRING_ECM TBDD_GROUPSTableAdapter.Connection.ConnectionString = CONNECTION_STRING_ECM TBPROFILE_USERTableAdapter.Connection.ConnectionString = CONNECTION_STRING_ECM TBPROFILE_GROUPTableAdapter.Connection.ConnectionString = CONNECTION_STRING_ECM TBPM_PROFILE_FINAL_INDEXINGTableAdapter.Connection.ConnectionString = CONNECTION_STRING_ECM TBPM_PROFILE_CONTROLSTableAdapter.Connection.ConnectionString = CONNECTION_STRING_ECM TBPM_PROFILE_FILESTableAdapter.Connection.ConnectionString = CONNECTION_STRING_ECM TBDD_CONNECTIONTableAdapter.Connection.ConnectionString = CONNECTION_STRING_ECM TBDD_CONNECTIONTableAdapter.Fill(DD_DMSLiteDataSet.TBDD_CONNECTION) Refresh_Profildaten() Dim dragDropManager = New ClassDragDrop() dragDropManager.AddGridView(viewAssignedUsers) dragDropManager.AddGridView(viewAvailableUsers) dragDropManager.AddGridView(viewAvailableGroups) dragDropManager.AddGridView(viewAssignedGroups) tabctrl_Profilkonfig.SelectedIndex = 0 Catch ex As Exception _Logger.Error(ex) MsgBox("Fehler bei Laden der Wertehilfen und Konfig-Daten: " & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Achtung:") End Try If IDB_ACTIVE = True Then IDBData.Init() lblSearch.Text = "Datei-Suche (SQL):" btnWMopenSuche.Visible = False SORT_BY_LATESTCheckBox.Visible = False PRIORITYNumericUpDown.Visible = False lblPriority.Visible = False Else lblSearch.Text = "windream-Suche:" btnWMopenSuche.Visible = True SORT_BY_LATESTCheckBox.Visible = True PRIORITYNumericUpDown.Visible = True lblPriority.Visible = True End If ObjekttypenEintragen() Indexe_eintragen() ' RibbonPageGroupProfile.Enabled = False _Logger.Debug("Administration loaded!") End Sub Sub Indexe_eintragen() If cmbObjekttypen.Text <> "" Then Me.PM_VEKTOR_INDEXComboBox.Items.Clear() Me.cmbLOGIndex.Items.Clear() Me.PM_VEKTOR_INDEXComboBox.Items.Add("") Me.cmbLOGIndex.Items.Add("") cmbLOGIndex.Enabled = True Label9.Enabled = True If IDB_ACTIVE = False Then If cmbObjekttypen.Text = "DEFAULT" And IDB_ACTIVE = False Then MsgBox("The Objecttype is invalid!", MsgBoxStyle.Exclamation) Exit Sub End If PM_VEKTOR_INDEXComboBox.Enabled = True Label4.Enabled = True Try MyIndicies_Types = New List(Of Integer) MyIndicies = New List(Of String) MyIndicies = WINDREAM.GetIndicesByObjecttype(cmbObjekttypen.Text).ToList() If MyIndicies IsNot Nothing Then Dim i As Integer = 0 For Each index As String In MyIndicies Dim _vektorString = False Dim oIndexType = WINDREAM.GetTypeOfIndex(index) i += 1 MyIndicies_Types.Add(oIndexType) Select Case oIndexType Case 4097 _vektorString = True Case 36865 _vektorString = True Case Else _vektorString = False End Select If _vektorString = True Then Me.PM_VEKTOR_INDEXComboBox.Items.Add(index) Me.cmbLOGIndex.Items.Add(index) End If Next End If 'MyIndicies_Types = New List(Of Integer) 'MyIndicies = WINDREAM.GetIndicesByObjecttype(cmbObjekttypen.Text).ToList() 'For Each i In MyIndicies ' Dim type = WINDREAM.GetTypeOfIndex(i) ' MyIndicies_Types.Add(type) 'Next Catch ex As Exception _LOGGER.Error(ex) MsgBox("Error in GetIndices windream: " & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Achtung:") PM_VEKTOR_INDEXComboBox.SelectedIndex = -1 cmbLOGIndex.SelectedIndex = -1 End Try If Me.PM_VEKTOR_INDEXComboBox.Text <> "" Then PM_VEKTOR_INDEXComboBox.SelectedIndex = PM_VEKTOR_INDEXComboBox.FindStringExact(Me.PM_VEKTOR_INDEXComboBox.Text) Else PM_VEKTOR_INDEXComboBox.SelectedIndex = -1 End If If Me.cmbLOGIndex.Text <> "" Then cmbLOGIndex.SelectedIndex = cmbLOGIndex.FindStringExact(Me.cmbLOGIndex.Text) Else cmbLOGIndex.SelectedIndex = -1 End If Else '############## IDB ACTIVE ################# PM_VEKTOR_INDEXComboBox.Enabled = False Label4.Enabled = False Try For Each oRow As DataRow In IDBData.DTVWIDB_BE_ATTRIBUTE.Rows Select Case CInt(oRow.Item("TYP_ID")) Case 8 Me.PM_VEKTOR_INDEXComboBox.Items.Add(oRow.Item("ATTR_TITLE")) Me.cmbLOGIndex.Items.Add(oRow.Item("ATTR_TITLE")) End Select Next MyIndicies_Types = New List(Of Integer) MyIndicies = IDBData.GetIndicesByBE(cmbObjekttypen.Text).ToList() For Each oIndex In MyIndicies Dim type = IDBData.GetTypeOfIndex(oIndex) MyIndicies_Types.Add(type) Next Catch ex As Exception _LOGGER.Error(ex) MsgBox("Error in GetIndices IDB: " & vbNewLine & ex.Message, MsgBoxStyle.Critical) End Try End If DD_DMSLiteDataSet.AcceptChanges() End If End Sub Sub Refresh_Profildaten() _Logger.Debug("Loading Profile Data") Try BINDINGSOURCE_CHANGING = True CHANGES_FORM_DESIGN = True UNSAVED_CHANGES_PROFILE = False ' CURR_TEXT_CONTROL_CONTENT = String.Empty TBPM_PROFILETableAdapter.Fill(DD_DMSLiteDataSet.TBPM_PROFILE) TBPM_TYPETableAdapter.Fill(DD_DMSLiteDataSet.TBPM_TYPE) TBPM_KONFIGURATIONTableAdapter.Fill(DD_DMSLiteDataSet.TBPM_KONFIGURATION) If tabctrl_Profilkonfig.SelectedIndex = 1 Then CURRENT_OBJECTTYPE = cmbObjekttypen.Text If TabControl2.SelectedIndex = 1 Then Refresh_Final_indexe() End If End If Catch ex As Exception _Logger.Error(ex) MsgBox("Fehler bei Refresh_Profildaten: " & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Achtung:") Finally BINDINGSOURCE_CHANGING = False _Logger.Debug("Loading Profile Data done!") End Try End Sub Private Sub ObjekttypenEintragen() Me.cmbObjekttypen.Items.Clear() If IDB_ACTIVE = False Then Try Dim oDokumentTypen As WINDREAMLib.WMObjects = WINDREAM.GetObjecttypesAsObjects() If oDokumentTypen Is Nothing Then Exit Sub For Each aType In oDokumentTypen Me.cmbObjekttypen.Items.Add(aType.aName) Next Catch ex As Exception _LOGGER.Error(ex) MsgBox("Es konnte keine Verbindung zum windream-Server hergestellt werden.", MsgBoxStyle.Critical, "Fehler beim Zugriff auf windream-Server") End Try Else Dim oSQL = "SELECT GUID, TITLE FROM TBIDB_BUSINESS_ENTITY" Dim oDT As DataTable = DatabaseFallback.GetDatatableIDB(oSQL) For Each oROW As DataRow In oDT.Rows Me.cmbObjekttypen.Items.Add(oROW.Item(1)) Next End If End Sub Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles btnWMSuche.Click If IDB_ACTIVE = True Then CURRENT_DESIGN_TYPE = "IDB_SEARCH" Dim oForm As New frmSQLEditor(LOGCONFIG, DatabaseECM) With { .SQLCommand = Me.WD_SEARCHTextBox.Text, .SQLConnection = 1, .AllowSQLConnectionSelection = False } oForm.ShowDialog() If oForm.DialogResult = DialogResult.OK Then Me.WD_SEARCHTextBox.Text = oForm.SQLCommand End If Else If Not Me.WD_SEARCHTextBox.Text = "" Then Me.dlgWindreamsuche.FileName = Me.WD_SEARCHTextBox.Text End If If Me.dlgWindreamsuche.ShowDialog = Windows.Forms.DialogResult.OK Then Me.WD_SEARCHTextBox.Text = Me.dlgWindreamsuche.FileName End If End If End Sub Private Sub btnopenSuche_Click(sender As System.Object, e As System.EventArgs) Handles btnWMopenSuche.Click Try If Not Me.WD_SEARCHTextBox.Text = "" Then Dim p As New Process() p.StartInfo.FileName = Me.WD_SEARCHTextBox.Text p.StartInfo.WindowStyle = ProcessWindowStyle.Normal p.Start() p.WaitForExit() p.Close() End If Catch ex As Exception _LOGGER.Error(ex) MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler bei öffnen der windream-Suche:") End Try End Sub Private Sub TBPM_PROFILEBindingSource_AddingNew(sender As Object, e As System.ComponentModel.AddingNewEventArgs) Handles TBPM_PROFILEBindingSource.AddingNew DD_DMSLiteDataSet.TBPM_PROFILE.ADDED_WHOColumn.DefaultValue = USER_USERNAME DD_DMSLiteDataSet.TBPM_PROFILE.ADDED_WHENColumn.DefaultValue = Date.Now DD_DMSLiteDataSet.TBPM_PROFILE.TYPEColumn.DefaultValue = 1 End Sub 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 Me.MOVE2FOLDERTextBox.Text = Me.FolderBrowserDialog1.SelectedPath End If End Sub Private Sub ADDED_WHOLabel_Click(sender As System.Object, e As System.EventArgs) End Sub Sub FillProfile_Zuordnung(profileId As Integer) Try If IsNothing(profileId) Or IsDBNull(profileId) Then MsgBox("Something went wrong in choosing a profile. Please select a profile!") TabControl1.SelectedIndex = 0 Exit Sub End If TBPROFILE_USERTableAdapter.Fill(DD_DMSLiteDataSet.TBPROFILE_USER, profileId) TBPROFILE_GROUPTableAdapter.Fill(DD_DMSLiteDataSet.TBPROFILE_GROUP, profileId) FNPM_GET_FREE_USER_FOR_PROFILETableAdapter.Fill(DD_DMSLiteDataSet.FNPM_GET_FREE_USER_FOR_PROFILE, profileId) TBDD_GROUPSTableAdapter.FillByProfileId_NotAssigned(DD_DMSLiteDataSet.TBDD_GROUPS, profileId) Catch ex As Exception 'Profilzuordnung' _LOGGER.Error(ex) End Try End Sub Private Sub TBPM_USERBindingSource_AddingNew(sender As System.Object, e As System.ComponentModel.AddingNewEventArgs) Handles TBDD_USERBindingSource.AddingNew DD_DMSLiteDataSet.TBDD_USER.ADDED_WHOColumn.DefaultValue = USER_USERNAME End Sub Private Function GetCurrentProfileId() As Integer Dim rowView As DataRowView = GridViewProfile.GetFocusedRow() If IsNothing(rowView) = False Then Dim profileId As Integer = rowView.Item("GUID") Return profileId Else : Return Nothing End If End Function Private Sub gridAssignedUsers_DragDrop(sender As Object, e As DragEventArgs) Handles gridAssignedUsers.DragDrop Try Dim data As String = e.Data.GetData(DataFormats.Text) Dim userId As Integer = data.Split("|")(0) Dim profileId = GetCurrentProfileId() TBPROFILE_USERTableAdapter.CMDInsert(profileId, userId, USER_USERNAME) FillProfile_Zuordnung(profileId) Catch ex As Exception _LOGGER.Error(ex) MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler beim Hinzufügen eines Users:") End Try End Sub Private Sub gridAvailableUsers_DragDrop(sender As Object, e As DragEventArgs) Handles gridAvailableUsers.DragDrop Try Dim data As String = e.Data.GetData(DataFormats.Text) Dim userId As Integer = data.Split("|")(0) Dim profileId = GetCurrentProfileId() TBPROFILE_USERTableAdapter.CmdDelete(profileId, userId) FillProfile_Zuordnung(profileId) Catch ex As Exception _LOGGER.Error(ex) MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler beim Entfernen eines Users:") End Try End Sub Private Sub gridAssignedGroups_DragDrop(sender As Object, e As DragEventArgs) Handles gridAssignedGroups.DragDrop Try Dim data As String = e.Data.GetData(DataFormats.Text) Dim groupId As Integer = data.Split("|")(0) Dim profileId = GetCurrentProfileId() TBPROFILE_GROUPTableAdapter.CmdInsert(profileId, groupId, USER_USERNAME) ' TBPROFILE_USERTableAdapter.CMDInsert(profileId, userId, USER_USERNAME) FillProfile_Zuordnung(profileId) Catch ex As Exception _LOGGER.Error(ex) MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler beim Hinzufügen einer Gruppe:") End Try End Sub Private Sub gridAvailableGroups_DragDrop(sender As Object, e As DragEventArgs) Handles gridAvailableGroups.DragDrop Try Dim data As String = e.Data.GetData(DataFormats.Text) Dim groupId As Integer = data.Split("|")(0) Dim profileId = GetCurrentProfileId() TBPROFILE_GROUPTableAdapter.CmdDelete(profileId, groupId) 'TBPROFILE_USERTableAdapter.cmdDelete(userId) FillProfile_Zuordnung(profileId) Catch ex As Exception _LOGGER.Error(ex) MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler beim Entfernen einer Gruppe:") End Try End Sub Private Sub frmProfileDesigner_Shown(sender As Object, e As System.EventArgs) Handles Me.Shown TabControl1.SelectedIndex = 0 FORM_LOADED = True RibbonPageGroup2.Enabled = False RibbonPageGroup4.Enabled = False EditMode_Profile("Unlock") End Sub Private Sub Refresh_Final_indexe() _Logger.Debug("Loading Final Index Data") Try 'Me.lblSaveFinalIndex.Visible = False If FORM_LOADED = False Then Exit Sub If NAMETextBox.Text <> String.Empty Then TBPM_PROFILE_FINAL_INDEXINGTableAdapter.Fill(FinalIndexDataSet.TBPM_PROFILE_FINAL_INDEXING, NAMETextBox.Text) End If If FinalIndexDataSet.TBPM_PROFILE_FINAL_INDEXING.Count = 0 Then pgFinalIndexes.SelectedObject = Nothing End If Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler bei Refresh_Final_indexe:") Finally _Logger.Debug("Loading Final Index Data done!") End Try End Sub Private Sub TabControl2_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles tabctrl_Profilkonfig.SelectedIndexChanged Select Case tabctrl_Profilkonfig.SelectedIndex Case 0 RibbonPageGroup2.Enabled = False RibbonPageGroup4.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 GridControlNavigation.Enabled = True RibbonPageGroupProfile.Enabled = True Case 1 GridControlNavigation.Enabled = True RibbonPageGroupProfile.Enabled = False RibbonPageGroup2.Enabled = False RibbonPageGroup4.Enabled = False If PROFILGUIDTextBox.Text = String.Empty Then MsgBox("Kein Profil angelegt oder ausgeählt", MsgBoxStyle.Critical) Else FillProfile_Zuordnung(PROFILGUIDTextBox.Text) End If Case 2 RibbonPageGroupProfile.Enabled = False RibbonPageGroup2.Enabled = False RibbonPageGroup4.Enabled = True GridControlNavigation.Enabled = False Load_Chart_Konfig() End Select End Sub Sub Load_Chart_Konfig() Try Series1GUID.Text = "" Series1Type.SelectedIndex = -1 Series1SQL.Tag = "" Series1Argument.Text = "" Series1Column.Text = "" Series1Title.Text = "" Series1Sequence.Value = 1 Series2GUID.Text = "" Series2Type.SelectedIndex = -1 Series2SQL.Tag = Nothing Series2Argument.Text = "" Series2Column.Text = "" Series2Title.Text = "" Series2Sequence.Value = 1 Series3GUID.Text = "" Series3Type.SelectedIndex = -1 Series3SQL.Tag = Nothing Series3Argument.Text = "" Series3Column.Text = "" Series3Title.Text = "" Series3Sequence.Value = 1 Series4GUID.Text = "" Series4Type.SelectedIndex = -1 Series4SQL.Tag = Nothing Series4Argument.Text = "" Series4Column.Text = "" Series4Title.Text = "" Series4Sequence.Value = 1 Dim oSQLChart As String = "SELECT * FROM TBPM_CHART ORDER BY GROUP_ID" DT_CHART_CONFIG = DatabaseFallback.GetDatatableECM(oSQLChart) ', "Adm_Chart") For Each oROW As DataRow In DT_CHART_CONFIG.Rows If oROW.Item("GROUP_ID") = 1 Then Series1GUID.Text = oROW.Item("GUID") Series1Type.SelectedIndex = Series1Type.FindStringExact(oROW.Item("TYPE_CHART")) Series1SQL.Tag = oROW.Item("SQL_COMMAND") Series1Argument.Text = oROW.Item("ARGUMENT") Series1Column.Text = oROW.Item("VALUE") Series1Title.Text = oROW.Item("TITLE") Series1Sequence.Value = oROW.Item("GROUP_ID") ElseIf oROW.Item("GROUP_ID") = 2 Then Series2GUID.Text = oROW.Item("GUID") Series2Type.SelectedIndex = Series1Type.FindStringExact(oROW.Item("TYPE_CHART")) Series2SQL.Tag = oROW.Item("SQL_COMMAND") Series2Argument.Text = oROW.Item("ARGUMENT") Series2Column.Text = oROW.Item("VALUE") Series2Title.Text = oROW.Item("TITLE") Series2Sequence.Value = oROW.Item("GROUP_ID") ElseIf oROW.Item("GROUP_ID") = 3 Then Series3GUID.Text = oROW.Item("GUID") Series3Type.SelectedIndex = Series1Type.FindStringExact(oROW.Item("TYPE_CHART")) Series3SQL.Tag = oROW.Item("SQL_COMMAND") Series3Argument.Text = oROW.Item("ARGUMENT") Series3Column.Text = oROW.Item("VALUE") Series3Title.Text = oROW.Item("TITLE") Series3Sequence.Value = oROW.Item("GROUP_ID") ElseIf oROW.Item("GROUP_ID") = 4 Then Series4GUID.Text = oROW.Item("GUID") Series4Type.SelectedIndex = Series1Type.FindStringExact(oROW.Item("TYPE_CHART")) Series4SQL.Tag = oROW.Item("SQL_COMMAND") Series4Argument.Text = oROW.Item("ARGUMENT") Series4Column.Text = oROW.Item("VALUE") Series4Title.Text = oROW.Item("TITLE") Series4Sequence.Value = oROW.Item("GROUP_ID") End If Next Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, "Error in Load Chart Konfig:") End Try End Sub Private Sub tsbtnProfilkopieren_Click(sender As System.Object, e As System.EventArgs) End Sub Private Function Execute_SQL(SQL As String) Try Dim SQLconnection As New SqlClient.SqlConnection(CONNECTION_STRING_ECM) Dim SQLcommand As New SqlCommand(SQL, SQLconnection) SQLconnection.Open() SQLcommand.ExecuteNonQuery() SQLcommand.Dispose() SQLconnection.Close() Return True Catch ex As Exception _LOGGER.Error(ex) MsgBox("Fehler in Execute_SQL: " & vbNewLine & ex.Message & vbNewLine & vbNewLine & " SQL: " & SQL) Return False End Try End Function Private Sub CancelFinalIndexInsert() INSERT_ACTIVE = False BarButtonItem19.Visibility = DevExpress.XtraBars.BarItemVisibility.Never BarButtonItem16.Visibility = DevExpress.XtraBars.BarItemVisibility.Always TBPM_PROFILE_FINAL_INDEXINGBindingSource.CancelEdit() End Sub Private Sub ACTIVECheckBox_CheckedChanged(sender As Object, e As EventArgs) Handles ACTIVECheckBox.CheckedChanged If ACTIVECheckBox.Checked Then ACTIVECheckBox.BackColor = Color.LightSteelBlue Else ACTIVECheckBox.BackColor = Color.Transparent End If End Sub Private Sub ToolStripButton4_Click(sender As Object, e As EventArgs) Cursor = Cursors.WaitCursor frmUserKonfig_AddUsers.ShowDialog() Load_User() Cursor = Cursors.Default End Sub Private Sub ToolStripButton12_Click(sender As Object, e As EventArgs) Load_User() End Sub Sub Load_User() Try Me.TBDD_USERTableAdapter.Fill(Me.DD_DMSLiteDataSet.TBDD_USER) Catch ex As Exception _LOGGER.Error(ex) MsgBox("Fehler bei LoadUsers: " & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Fehler:") End Try End Sub Private Sub cmbObjekttypen_SelectedIndexChanged(sender As Object, e As EventArgs) If FORM_LOADED = False Then Exit Sub End If If cmbObjekttypen.SelectedIndex <> -1 Then Indexe_eintragen() End If End Sub Private Sub frmProfileDesigner_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing If UNSAVED_CHANGES_PROFILE Or UNSAVED_CHANGES_FI Then Dim oQuestion As String If USER_LANGUAGE <> "de-DE" Then oQuestion = "You have unsaved changes! Do You want to save them now?" Else oQuestion = "Achtung es gibt noch ungespeicherte Änderungen! Wollen Sie diese nun speichern?" End If Dim oResult = FormHelper.ShowQuestionMessage(oQuestion, ADDITIONAL_TITLE) 'Dim result As MsgBoxResult = MsgBox(oQuestion, MsgBoxStyle.YesNo, ADDITIONAL_TITLE) 'wenn Speichern ja If oResult = DialogResult.Yes Then If UNSAVED_CHANGES_PROFILE Then Save_Profile() End If If UNSAVED_CHANGES_FI Then Save_FI() End If e.Cancel = True Else End If End If 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 Private Sub GridView2_FocusedRowChanged(sender As Object, e As Views.Base.FocusedRowChangedEventArgs) Handles viewFinalIndex.FocusedRowChanged Try Dim view As GridView = sender Dim focusedRow As DataRow = view.GetFocusedDataRow() If IsNothing(focusedRow) Then Exit Sub End If Dim oShouldRefreshGrid = False If UNSAVED_CHANGES_FI = True Then oShouldRefreshGrid = CHECK_QUESTION_CHANGES() End If Dim guid As Integer = focusedRow.Item("GUID") Dim index As String = NotNull(focusedRow.Item("INDEXNAME"), Nothing) Dim sqlCommand As String = NotNull(focusedRow.Item("SQL_COMMAND"), "") Dim connectionId As Integer = NotNull(focusedRow.Item("CONNECTION_ID"), 0) Dim value As String = NotNull(focusedRow.Item("VALUE"), "") Dim active As Boolean = NotNull(focusedRow.Item("ACTIVE"), True) Dim description As String = NotNull(focusedRow.Item("DESCRIPTION"), "") Dim preventDuplicates As Boolean = NotNull(focusedRow.Item("PREVENT_DUPLICATES"), False) Dim allowNewValues As Boolean = NotNull(focusedRow.Item("ALLOW_NEW_VALUES"), False) Dim VectorBehaviour As String = NotNull(focusedRow.Item("IF_VEKTOR_BEHAVIOUR"), "Add") Dim oSequence As Int16 = NotNull(focusedRow.Item("SEQUENCE"), 0) Dim oIndetermined As Boolean = NotNull(focusedRow.Item("CONTINUE_INDETERMINED"), False) CURRENT_INDEX_ID = guid Dim obj As New FinalIndexProperties With { .GUID = guid, .IndexName = index, .SQLCommand = New SQLValue(sqlCommand, connectionId), .ConnectionId = connectionId, .Description = description, .Active = active, .AllowAddNewValues = allowNewValues, .PreventDuplicates = preventDuplicates, .VectorBehaviour = VectorBehaviour, .Sequence = oSequence, .ContinueOnIndifferentState = oIndetermined } ' Wenn eine neue Zeile hinzugefügt wird, auf StringValue setzen If e.FocusedRowHandle <> GridControl.NewItemRowHandle Then obj = FINALINDICES.SetValue(value, obj, index, MyIndicies, MyIndicies_Types) End If If IDB_ACTIVE Then obj.Indicies = MyIndicies.Except(IDBData.IDBSystemIndices).ToList Else obj.Indicies = MyIndicies End If obj.IndiciesType = MyIndicies_Types obj.IndexName = index obj.VectorBehaviourType = New List(Of String) From { "Add", "Overwrite" } If index IsNot Nothing Then Dim indexType As Integer = FINALINDICES.GetIndexType(index, MyIndicies, MyIndicies_Types) obj.VectorIndex = FINALINDICES.IsVectorIndex(indexType) End If 'PropertyGrid1.SelectedObject = obj 'PropertyGrid1.Refresh() pgFinalIndexes.SelectedObject = obj pgFinalIndexes.Refresh() If oShouldRefreshGrid Then Refresh_Final_indexe() End If Catch ex As Exception _LOGGER.Error(ex) MsgBox($"Error while loading Final Index properties: {ex.Message}", MsgBoxStyle.Critical) _LOGGER.Info($"Error while loading Final Index properties: {ex.Message}") End Try End Sub Private Sub pgFinalIndexes_RowChanged(sender As Object, e As DevExpress.XtraVerticalGrid.Events.RowChangedEventArgs) Handles pgFinalIndexes.RowChanged If FORM_LOADED = False Then Exit Sub End If ' Only changes of values are interesting here If e.ChangeType <> DevExpress.XtraVerticalGrid.RowChangeTypeEnum.Value Then Exit Sub End If Try Dim propertyGrid As DevExpress.XtraVerticalGrid.PropertyGridControl = sender Dim obj As FinalIndexProperties = propertyGrid.SelectedObject Dim oValue = e.Properties.Value Dim oName = e.Properties.FieldName If TypeOf (oValue) Is SQLValue Then Dim value As SQLValue = oValue If value.Value <> String.Empty Then 'obj.ConnectionId = CURRENT_CONN_ID_FINAL_INDEX obj.StringValue = "SQL-Command" obj.ConnectionId = value.ConnectionId 'obj.FloatValue = 0 ' obj.IntegerValue = 0 End If pgFinalIndexes.Refresh() Else Dim lbl = oName If oName = "Description" Then obj.Description = oValue ElseIf oName = "IndexName" Then Dim type As Integer = FINALINDICES.GetIndexType(oValue, MyIndicies, MyIndicies_Types) obj.VectorIndex = FINALINDICES.IsVectorIndex(type) ElseIf oName = "Sequence" Then obj.Sequence = oValue ElseIf oName = "ContinueOnIndifferentState" Then obj.ContinueOnIndifferentState = oValue End If pgFinalIndexes.Refresh() End If Catch ex As Exception _Logger.Error(ex) Finally UNSAVED_CHANGES_FI = True End Try End Sub Private Sub PropertyGrid1_PropertyValueChanged(s As Object, e As PropertyValueChangedEventArgs) If FORM_LOADED = False Then Exit Sub End If Try Dim propertyGrid As PropertyGrid = s Dim obj As FinalIndexProperties = propertyGrid.SelectedObject If TypeOf (e.ChangedItem.Value) Is SQLValue Then Dim value As SQLValue = e.ChangedItem.Value If value.Value <> String.Empty Then 'obj.ConnectionId = CURRENT_CONN_ID_FINAL_INDEX obj.StringValue = "SQL-Command" obj.ConnectionId = value.ConnectionId 'obj.FloatValue = 0 ' obj.IntegerValue = 0 End If propertyGrid.Refresh() Else Dim lbl = e.ChangedItem.Label If e.ChangedItem.Label = "Description" Then obj.Description = e.ChangedItem.Value ElseIf e.ChangedItem.Label = "IndexName" Then Dim type As Integer = FINALINDICES.GetIndexType(e.ChangedItem.Value, MyIndicies, MyIndicies_Types) obj.VectorIndex = FINALINDICES.IsVectorIndex(type) ElseIf e.ChangedItem.Label = "Sequence" Then obj.Sequence = e.ChangedItem.Value ElseIf e.ChangedItem.Label = "ContinueOnIndifferentState" Then obj.ContinueOnIndifferentState = e.ChangedItem.Value End If propertyGrid.Refresh() End If Catch ex As Exception _Logger.Error(ex) Finally UNSAVED_CHANGES_FI = True End Try End Sub Private Sub tsBtnCancel_Click_1(sender As Object, e As EventArgs) CancelFinalIndexInsert() End Sub Private Sub PM_VEKTOR_INDEXComboBox_MouseHover(sender As Object, e As EventArgs) Handles PM_VEKTOR_INDEXComboBox.MouseHover ToolTip1.Show("Bitte wählen Sie hier den Vektor-Index den Sie für die Kennzeichnung der PM-Indizes verwenden wollen:", PM_VEKTOR_INDEXComboBox) End Sub Private Sub cmbLOGIndex_MouseHover(sender As Object, e As EventArgs) Handles cmbLOGIndex.MouseHover ToolTip1.Show("Bitte wählen Sie hier den Vektor-Index den Sie für das Loggen der Wertänderungen nutzen wollen:", cmbLOGIndex) End Sub Private Sub BarButtonItem2_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem2.ItemClick If CInt(PROFILGUIDTextBox.Text) > 0 Then profile_guid = PROFILGUIDTextBox.Text CURRENT_ProfilGUID = PROFILGUIDTextBox.Text My.Settings.Save() CURRENT_OBJECTTYPE = cmbObjekttypen.Text CURRENT_ProfilName = NAMETextBox.Text FormDesigner.ProfileId = CURRENT_ProfilGUID FormDesigner.ProfileName = CURRENT_ProfilName FormDesigner.ProfileObjectType = cmbObjekttypen.Text FormDesigner.ShowDialog() Else MsgBox("Eindeutiges Profil konnte nicht an den FormDesigner weitergegeben werden:", MsgBoxStyle.Exclamation) End If End Sub Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItemRefreshProfileData.ItemClick If BarButtonItem26.Tag = "Lock" Then EditMode_Profile("") End If Refresh_Profildaten() End Sub Private Sub BarButtonItem3_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem3.ItemClick Dim result As MsgBoxResult = MsgBox("Wollen Sie das gesamte Profil kopieren?" & vbNewLine & "Alle Einstellungen werden übernommen, das Profil wird angelegt und inaktiv gesetzt!", MsgBoxStyle.YesNo, "Bestätigung erforderlich:") 'wenn Speichern ja If result = MsgBoxResult.Yes Then Try Dim oEXECSQL As String = $"EXEC PRPM_COPY_PROFILE {PROFILGUIDTextBox.Text},'{USER_USERNAME}'" If DatabaseFallback.ExecuteNonQueryECM(oEXECSQL) = True Then MsgBox("Das Profil " & NAMETextBox.Text & " wurde erfolgreich kopiert!", MsgBoxStyle.Information, "Erfolgsmeldung") Refresh_Profildaten() Else MsgBox("Error creating a profileCopy - Please check Your log!", MsgBoxStyle.Exclamation) End If Catch ex As Exception _LOGGER.Error(ex) MsgBox("Fehler bei Anlage Profilkopie:" & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Fehler:") End Try End If End Sub Private Sub BarButtonItem5_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem5.ItemClick Dim result As MsgBoxResult = MsgBox("Sind Sie sicher, dass Sie das Profil " & NAMETextBox.Text & " löschen wollen?", MsgBoxStyle.YesNo, "Bestätigung erforderlich:") ' wenn Speichern ja If result = MsgBoxResult.Yes Then Try Dim profileID = PROFILGUIDTextBox.Text Dim del As String = $"EXEC PRPM_DELETE_PROFILE {profileID}" If DatabaseFallback.ExecuteNonQueryECM(del) = True Then MsgBox("Das Profil " & NAMETextBox.Text & " wurde erfolgreich gelöscht!", MsgBoxStyle.Information, "Erfolgsmeldung") Refresh_Profildaten() End If Catch ex As Exception _LOGGER.Error(ex) MsgBox("Fehler bei Löschen des Profils:" & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Fehler:") End Try End If End Sub Private Sub BarButtonItem6_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem6.ItemClick Dim result As MsgBoxResult = MsgBox("Wollen Sie die Dateien für dieses Profil wirklich entfernen?" & vbNewLine & "Wenn ja müssen Sie auf die Aktualisierung des Jobs warten bis wieder Dateien zur Bearbeitung frei sind.", MsgBoxStyle.YesNo, "Bestätigung erforderlich:") 'wenn Speichern ja If result = MsgBoxResult.Yes Then If DatabaseFallback.ExecuteNonQueryECM("DELETE FROM TBPM_PROFILE_FILES WHERE PROFIL_ID = " & PROFILGUIDTextBox.Text) = True Then MsgBox("Die Dateien zum Profil wurden erfolgreich gelöscht!", MsgBoxStyle.Information) End If End If End Sub Private Sub BarButtonItem7_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem7.ItemClick Save_Profile() End Sub Sub Save_Profile() Try If UNSAVED_CHANGES_PROFILE = False Then Me.TBPM_PROFILEBindingSource.EndEdit() End If If DD_DMSLiteDataSet.TBPM_PROFILE.GetChanges Is Nothing = False Or UNSAVED_CHANGES_PROFILE Then CHANGED_WHOTextBox.Text = USER_USERNAME Me.TBPM_PROFILEBindingSource.EndEdit() Me.TBPM_PROFILETableAdapter.Update(DD_DMSLiteDataSet.TBPM_PROFILE) 'Refresh_Profildaten() 'Dim pos As Integer = TBPM_PROFILEBindingSource.Find("GUID", CURRENT_ProfilGUID) 'TBPM_PROFILEBindingSource.Position = pos tsbStaticInfo.Caption = $"ProfileData saved - {Now.ToLongTimeString}" UNSAVED_CHANGES_PROFILE = False Else tsbStaticInfo.Caption = "" End If Catch ex As Exception _LOGGER.Error(ex) If ex.Message.Contains("DataTable-Index") = False Then MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler bei Speichern des Profils:") End If End Try End Sub Private Sub BarButtonItem8_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem8.ItemClick If DD_DMSLiteDataSet.TBPM_PROFILE.Count + 1 > LICENSE_PROFILES Then MsgBox("Sie haben die maximale Anzahl (" & LICENSE_PROFILES & ") von lizensierten Profilen erreicht!" & vbNewLine & "Bitte löschen Sie Profile oder setzen sich mit Digital Data in Verbindung!", MsgBoxStyle.Exclamation, "Achtung Lizenzhinweis:") Else Try TBPM_PROFILEBindingSource.AddNew() Catch ex As Exception _LOGGER.Error(ex) End Try End If End Sub Private Sub BarButtonItem9_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem9.ItemClick frmLicense.ShowDialog() End Sub Private Sub BarButtonItem10_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem10.ItemClick Dim result As MsgBoxResult = MsgBox("Do You really want to delete all workflow-Jobs?" & vbNewLine & "If yes You have to wait for the next Sync-Job for the jobs.", MsgBoxStyle.YesNo, "Bestätigung erforderlich:") 'wenn Speichern ja If result = MsgBoxResult.Yes Then If DatabaseFallback.ExecuteNonQueryECM("DELETE FROM TBPM_PROFILE_FILES") = True Then MsgBox("All workflow-jobs have been erased!", MsgBoxStyle.Information) End If End If End Sub Private Sub BarButtonItem11_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem11.ItemClick frmConnection.ShowDialog() End Sub Private Sub BarButtonItem14_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem14.ItemClick frmSQL_Admin.ShowDialog() End Sub Private Sub BarButtonItem13_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem13.ItemClick Try Dim oSQL = BASEDATA_DT_CONFIG.Rows(0).Item("SQL_PROFILE_MAIN_VIEW") Dim oForm As New frmSQLEditor(LOGCONFIG, DatabaseECM) With { .SQLCommand = oSQL, .SQLConnection = 1 } oForm.ShowDialog() If oForm.DialogResult = DialogResult.OK Then DatabaseFallback.ExecuteNonQueryECM(String.Format("UPDATE TBPM_KONFIGURATION SET SQL_PROFILE_MAIN_VIEW = '{0}' WHERE GUID = 1", oForm.SQLCommand.Replace("'", "''"))) BASEDATA_DT_CONFIG.Rows(0).Item("SQL_PROFILE_MAIN_VIEW") = oForm.SQLCommand End If Catch ex As Exception MsgBox("Fehler beim Speichern: " & vbNewLine & vbNewLine & ex.Message) _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 Save_FI() Refresh_Final_indexe() End Sub Private Sub Save_FI() Try 'Dim obj As FinalIndexProperties = PropertyGrid1.SelectedObject Dim obj As FinalIndexProperties = pgFinalIndexes.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 oProfileId As Integer = PROFILGUIDTextBox.Text 'Dim connectionId As Integer = obj.ConnectionId Dim connectionId As Integer = NotNull(obj.SQLCommand.ConnectionId, 1) 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) Dim oDescription As String = NotNull(obj.Description, String.Empty) Dim oSequence As Integer = obj.Sequence Dim oContinueOIdS As Integer = obj.ContinueOnIndifferentState 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 pSequence As String If oSequence = 0 Then pSequence = $"(SELECT COALESCE(MAX(SEQUENCE),0) + 1 FROM TBPM_PROFILE_FINAL_INDEXING WHERE PROFIL_ID = {oProfileId})" Else pSequence = oSequence End If 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,DESCRIPTION,SEQUENCE,CONTINUE_INDETERMINED) VALUES ({oProfileId}, {connectionId}, '{sqlCommand}', '{indexName}', '{value}', {active}, {preventDuplicates}, {AllowAddNewValues}, '{addedWho}','{IF_VEKTOR_BEHAVIOUR}','{oDescription}',{pSequence},{oContinueOIdS})" If DatabaseFallback.ExecuteNonQueryECM(sql) 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}', DESCRIPTION = '{oDescription}', VALUE = '{value}', ACTIVE = {active}, ALLOW_NEW_VALUES = {AllowAddNewValues}, PREVENT_DUPLICATES = {preventDuplicates},IF_VEKTOR_BEHAVIOUR = '{IF_VEKTOR_BEHAVIOUR}', [SEQUENCE] = {oSequence}, CONTINUE_INDETERMINED = {oContinueOIdS} WHERE GUID = {guid}" If DatabaseFallback.ExecuteNonQueryECM(sql) Then tsbStaticInfo.Caption = $"Final index saved - {Now.ToLongTimeString} - RESTART NECESSARY" End If End If ' This has been moved out to the code that calls Save_FI ' 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 UNSAVED_CHANGES_FI = 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 Private Sub CHANGED_WHENLabel_Click(sender As Object, e As EventArgs) End Sub Private Sub BarButtonItem20_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem20.ItemClick Try Dim oSQL = BASEDATA_DT_CONFIG.Rows(0).Item("SQL_PROFILE_MAIN_VIEW") CURRENT_DESIGN_TYPE = "SQL_OVERVIEW" Dim oForm As New frmSQLEditor(LOGCONFIG, DatabaseECM) With {.SQLCommand = oSQL, .SQLConnection = 1} oForm.ShowDialog() If oForm.DialogResult = DialogResult.OK Then DatabaseFallback.ExecuteNonQueryECM(String.Format("UPDATE TBPM_KONFIGURATION SET SQL_PROFILE_MAIN_VIEW = '{0}' WHERE GUID = 1", oForm.SQLCommand.Replace("'", "''"))) BASEDATA_DT_CONFIG.Rows(0).Item("SQL_PROFILE_MAIN_VIEW") = oForm.SQLCommand End If Catch ex As Exception MsgBox("Error in Saving SQL Overview: " & vbNewLine & vbNewLine & ex.Message) _LOGGER.Error(ex) End Try End Sub Private Sub BarButtonItem21_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem21.ItemClick Try profile_guid = PROFILGUIDTextBox.Text CURRENT_ProfilGUID = PROFILGUIDTextBox.Text CURRENT_DESIGN_TYPE = "SQL_PROFILE" Dim oSQL = $"SELECT [SQL_VIEW] FROM TBPM_PROFILE WHERE GUID = {CURRENT_ProfilGUID}" Dim oldSQL = DatabaseFallback.GetScalarValueECM(oSQL) Dim oForm As New frmSQLEditor(LOGCONFIG, DatabaseECM) With { .SQLCommand = oldSQL, .SQLConnection = 1, .PlaceholdersManualPrefix = "CTRL", .PlaceholdersManualTitle = "Controls", .PlaceholdersManual = CURRENT_CONTROL_NAME_LIST.ToDictionary(Function(name) name, Function(name) name) } oForm.ShowDialog() If oForm.DialogResult = DialogResult.OK Then If oldSQL <> oForm.SQLCommand Then Dim oUpdate As String = $"Update TBPM_PROFILE SET CHANGED_WHO = '{USER_USERNAME}', SQL_VIEW = '{oForm.SQLCommand.Replace("'", "''")}' WHERE GUID = {CURRENT_ProfilGUID}" If DatabaseFallback.ExecuteNonQueryECM(oUpdate) = True Then tsbStaticInfo.Caption = $"Profile SQL saved - {Now.ToLongTimeString}" CHANGES_FORM_DESIGN = True End If End If End If Catch ex As Exception MsgBox("Error in Saving Profile SQL: " & vbNewLine & vbNewLine & ex.Message) _LOGGER.Error(ex) End Try End Sub Private Sub bbtnItemFinishSQL_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles bbtnItemFinishSQL.ItemClick Try profile_guid = PROFILGUIDTextBox.Text CURRENT_ProfilGUID = PROFILGUIDTextBox.Text CURRENT_DESIGN_TYPE = "SQL_BTNFINISH" Dim oSQL = $"SELECT SQL_BTN_FINISH FROM TBPM_PROFILE WHERE GUID = {CURRENT_ProfilGUID}" Dim oldSQL = DatabaseFallback.GetScalarValueECM(oSQL) ', CONNECTION_STRING_ECM, "bbtnItemFinishSQL_ItemClick-get SQL_BTN_FINISH") Dim oForm As New frmSQLEditor(LOGCONFIG, DatabaseECM) With { .SQLCommand = oldSQL, .SQLConnection = 1, .PlaceholdersManualPrefix = "CTRL", .PlaceholdersManualTitle = "Controls", .PlaceholdersManual = CURRENT_CONTROL_NAME_LIST.ToDictionary(Function(name) name, Function(name) name) } oForm.ShowDialog() If oForm.DialogResult = DialogResult.OK Then If oldSQL <> oForm.SQLCommand Then Dim oUpdate As String = $"Update TBPM_PROFILE SET CHANGED_WHO = '{USER_USERNAME}', SQL_BTN_FINISH = '{oForm.SQLCommand.Replace("'", "''")}' WHERE GUID = {CURRENT_ProfilGUID}" If DatabaseFallback.ExecuteNonQueryECM(oUpdate) = True Then tsbStaticInfo.Caption = $"Profile SQLFinish saved - {Now.ToLongTimeString}" CHANGES_FORM_DESIGN = True End If End If End If Catch ex As Exception MsgBox("Error in Saving Profile SQLFinish: " & vbNewLine & vbNewLine & ex.Message) _LOGGER.Error(ex) End Try End Sub Function CHECK_QUESTION_CHANGES() As Boolean If FORM_LOADED = False Then Return False End If If UNSAVED_CHANGES_PROFILE Or UNSAVED_CHANGES_FI Then Dim oQuestion As String If USER_LANGUAGE <> "de-DE" Then oQuestion = "You have unsaved changes! Do You want to save them now?" Else oQuestion = "Achtung es gibt noch ungespeicherte Änderungen! Wollen Sie diese nun speichern?" End If Dim result As MsgBoxResult = MsgBox(oQuestion, MsgBoxStyle.YesNo, ADDITIONAL_TITLE) 'wenn Speichern ja If result = MsgBoxResult.Yes Then If UNSAVED_CHANGES_PROFILE Then Save_Profile() End If If UNSAVED_CHANGES_FI Then Save_FI() End If Return True Else DD_DMSLiteDataSet.RejectChanges() UNSAVED_CHANGES_PROFILE = False UNSAVED_CHANGES_FI = False End If End If Return False End Function Private Sub GridView1_FocusedRowChanged(sender As Object, e As Views.Base.FocusedRowChangedEventArgs) Handles GridViewProfile.FocusedRowChanged If FORM_LOADED = False Or UNSAVED_CHANGES_PROFILE = True Or UNSAVED_CHANGES_FI = True Or BINDINGSOURCE_CHANGING = True Then Exit Sub End If BINDINGSOURCE_CHANGING = True If TabControl1.SelectedIndex = 1 And FORM_LOADED Then Try Dim profileId As Integer = GetCurrentProfileId() _Logger.Debug("Loading Profile [{0}]", profileId) If Not IsNothing(profileId) Then FillProfile_Zuordnung(profileId) End If Catch ex As Exception _LOGGER.Error(ex) MsgBox($"Error while calling FillProfile_User", MsgBoxStyle.Critical) End Try End If BINDINGSOURCE_CHANGING = False End Sub Private Sub TBPM_PROFILEBindingSource_PositionChanged(sender As System.Object, e As System.EventArgs) Handles TBPM_PROFILEBindingSource.PositionChanged If FORM_LOADED = False Then Exit Sub End If 'If UNSAVED_CHANGES_PROFILE Then ' CHECK_QUESTION_CHANGES() 'End If 'change_BindingSource = False tsbStaticInfo.Caption = "" Indexe_eintragen() If tabctrl_Profilkonfig.SelectedIndex = 1 And TBPM_PROFILEBindingSource.Position <> -1 Then Refresh_Final_indexe() End If End Sub Private Sub GroupBox2_Enter(sender As Object, e As EventArgs) Handles GroupBox2.Enter End Sub Private Function Update_ChartRow(pGUID As Integer, pTitle As String, pArgument As String, pColumn As String, pType As String, pSQL As String, pSequence As String) pSQL = pSQL.Replace("'", "''") Dim oUpdate = $"Update [dbo].[TBPM_CHART] SET [SQL_COMMAND] = '{pSQL}',[TYPE_CHART] = '{pType}' ,[ARGUMENT] = '{pArgument}' ,[VALUE] = '{pColumn}' ,[TITLE] = '{pTitle}' ,[CHANGED_WHO] = '{USER_USERNAME}' ,[GROUP_ID] = '{pSequence}' WHERE GUID = {pGUID}" Return DatabaseFallback.ExecuteNonQueryECM(oUpdate) End Function Private Function Insert_ChartRow(pTitle As String, pArgument As String, pColumn As String, pType As String, pSQL As String, pSequence As String) pSQL = pSQL.Replace("'", "''") Dim oInsert = $"INSERT INTO [dbo].[TBPM_CHART] ([SQL_COMMAND] ,[TYPE_CHART] ,[ARGUMENT] ,[VALUE] ,[TITLE] ,[ADDED_WHO] ,[GROUP_ID]) VALUES ('{pSQL}' ,'{pType}' ,'{pArgument}' ,'{pColumn}' ,'{pTitle}' ,'{USER_USERNAME}' ,'{pSequence}')" Return DatabaseFallback.ExecuteNonQueryECM(oInsert) End Function Private Sub BarButtonItem22_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem22.ItemClick Dim oUpdate As String Dim oCtrlSeriesSQL As Button Dim oCtrlSeriesType As ComboBox Dim oCtrlSeriesArgument As TextBox Dim oCtrlSeriesColumn As TextBox Dim oCtrlSeriesTitle As TextBox Dim oCtrlSeriesSequence As NumericUpDown Dim oCtrlSeriesGUID As TextBox Dim oTypeSQL As String = "Update" If Series1GUID.Text <> String.Empty Or Series1Title.Text <> String.Empty Then oCtrlSeriesType = Series1Type oCtrlSeriesSQL = Series1SQL oCtrlSeriesArgument = Series1Argument oCtrlSeriesColumn = Series1Column oCtrlSeriesTitle = Series1Title oCtrlSeriesSequence = Series1Sequence oCtrlSeriesGUID = Series1GUID If Series1GUID.Text = String.Empty Then oTypeSQL = "Insert" End If End If If Not IsNothing(oCtrlSeriesGUID) Then If oTypeSQL = "Update" Then Update_ChartRow(oCtrlSeriesGUID.Text, oCtrlSeriesTitle.Text, oCtrlSeriesArgument.Text, oCtrlSeriesColumn.Text, oCtrlSeriesType.Text, oCtrlSeriesSQL.Tag, oCtrlSeriesSequence.Value) Else Insert_ChartRow(oCtrlSeriesTitle.Text, oCtrlSeriesArgument.Text, oCtrlSeriesColumn.Text, oCtrlSeriesType.Text, oCtrlSeriesSQL.Tag, oCtrlSeriesSequence.Value) End If End If oCtrlSeriesGUID = Nothing oTypeSQL = "Update" If Series2GUID.Text <> String.Empty Or Series2Title.Text <> String.Empty Then oCtrlSeriesType = Series2Type oCtrlSeriesSQL = Series2SQL oCtrlSeriesArgument = Series2Argument oCtrlSeriesColumn = Series2Column oCtrlSeriesTitle = Series2Title oCtrlSeriesSequence = Series2Sequence oCtrlSeriesGUID = Series2GUID If Series2GUID.Text = String.Empty Then oTypeSQL = "Insert" End If If Not IsNothing(oCtrlSeriesGUID) Then If oTypeSQL = "Update" Then Update_ChartRow(oCtrlSeriesGUID.Text, oCtrlSeriesTitle.Text, oCtrlSeriesArgument.Text, oCtrlSeriesColumn.Text, oCtrlSeriesType.Text, oCtrlSeriesSQL.Tag, oCtrlSeriesSequence.Value) Else Insert_ChartRow(oCtrlSeriesTitle.Text, oCtrlSeriesArgument.Text, oCtrlSeriesColumn.Text, oCtrlSeriesType.Text, oCtrlSeriesSQL.Tag, oCtrlSeriesSequence.Value) End If End If End If oCtrlSeriesGUID = Nothing oTypeSQL = "Update" If Series3GUID.Text <> String.Empty Or Series3Title.Text <> String.Empty Then oCtrlSeriesType = Series3Type oCtrlSeriesSQL = Series3SQL oCtrlSeriesArgument = Series3Argument oCtrlSeriesColumn = Series3Column oCtrlSeriesTitle = Series3Title oCtrlSeriesSequence = Series3Sequence oCtrlSeriesGUID = Series3GUID If Series3GUID.Text = String.Empty Then oTypeSQL = "Insert" End If If Not IsNothing(oCtrlSeriesGUID) Then If oTypeSQL = "Update" Then Update_ChartRow(oCtrlSeriesGUID.Text, oCtrlSeriesTitle.Text, oCtrlSeriesArgument.Text, oCtrlSeriesColumn.Text, oCtrlSeriesType.Text, oCtrlSeriesSQL.Tag, oCtrlSeriesSequence.Value) Else Insert_ChartRow(oCtrlSeriesTitle.Text, oCtrlSeriesArgument.Text, oCtrlSeriesColumn.Text, oCtrlSeriesType.Text, oCtrlSeriesSQL.Tag, oCtrlSeriesSequence.Value) End If End If End If oCtrlSeriesGUID = Nothing oTypeSQL = "Update" If Series4GUID.Text <> String.Empty Or Series4Title.Text <> String.Empty Then oCtrlSeriesType = Series4Type oCtrlSeriesSQL = Series4SQL oCtrlSeriesArgument = Series4Argument oCtrlSeriesColumn = Series4Column oCtrlSeriesTitle = Series4Title oCtrlSeriesSequence = Series4Sequence oCtrlSeriesGUID = Series4GUID If Series4GUID.Text = String.Empty Then oTypeSQL = "Insert" End If If Not IsNothing(oCtrlSeriesGUID) Then If oTypeSQL = "Update" Then Update_ChartRow(oCtrlSeriesGUID.Text, oCtrlSeriesTitle.Text, oCtrlSeriesArgument.Text, oCtrlSeriesColumn.Text, oCtrlSeriesType.Text, oCtrlSeriesSQL.Tag, oCtrlSeriesSequence.Value) Else Insert_ChartRow(oCtrlSeriesTitle.Text, oCtrlSeriesArgument.Text, oCtrlSeriesColumn.Text, oCtrlSeriesType.Text, oCtrlSeriesSQL.Tag, oCtrlSeriesSequence.Value) End If End If End If Load_Chart_Konfig() End Sub Private Sub Series2SQL_Click(sender As Object, e As EventArgs) Handles Series1SQL.Click, Series2SQL.Click, Series3SQL.Click, Series4SQL.Click Dim obutton As Button = sender Dim oForm As New frmSQLEditor(LOGCONFIG, DatabaseECM) With { .SQLCommand = obutton.Tag, .SQLConnection = 1 } oForm.ShowDialog() If oForm.DialogResult = DialogResult.OK Then If oForm.SQLCommand <> obutton.Tag Then obutton.Tag = oForm.SQLCommand.Replace(" '", "''") End If End If End Sub Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click If DELETE_ChartRow(Series1GUID.Text) = True Then Load_Chart_Konfig() End If End Sub Private Function DELETE_ChartRow(pGUID As String) Dim oDelete = $"DELETE FROM [dbo].[TBPM_CHART] WHERE GUID = {pGUID}" Return DatabaseFallback.ExecuteNonQueryECM(oDelete) End Function Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click If DELETE_ChartRow(Series2GUID.Text) = True Then Load_Chart_Konfig() End If End Sub Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click If DELETE_ChartRow(Series3GUID.Text) = True Then Load_Chart_Konfig() End If End Sub Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click If DELETE_ChartRow(Series4GUID.Text) = True Then Load_Chart_Konfig() End If End Sub Private Sub PROFILGUIDTextBox_TextChanged(sender As Object, e As EventArgs) Handles PROFILGUIDTextBox.TextChanged If IsNumeric(PROFILGUIDTextBox.Text) Then CURRENT_ProfilGUID = PROFILGUIDTextBox.Text 'UNSAVED_CHANGES_PROFILE = False 'change_BindingSource = False 'TBPM_PROFILE_CONTROLSTableAdapter.FillByProfil(DD_DMSLiteDataSet.TBPM_PROFILE_CONTROLS, USER_LANGUAGE, CURRENT_ProfilGUID) 'CURRENT_CONTROL_NAME_LIST = DD_DMSLiteDataSet.TBPM_PROFILE_CONTROLS.AsEnumerable(). ' Select(Function(row) row.NAME). ' ToList() FormDesigner.Reload_ControlNameList() End If End Sub Private Sub BarButtonItem26_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem26.ItemClick EditMode_Profile("") End Sub Sub EditMode_Profile(pMode As String) If BarButtonItem26.Tag = "Lock" Then Me.TBPM_PROFILEBindingSource.EndEdit() If DD_DMSLiteDataSet.TBPM_PROFILE.GetChanges Is Nothing = False Or UNSAVED_CHANGES_FI Then UNSAVED_CHANGES_PROFILE = True CHECK_QUESTION_CHANGES() End If With BarButtonItem26 .Tag = "Unlock" .ImageOptions.SvgImage = My.Resources.Security_Lock .ItemAppearance.Normal.BackColor = Nothing End With 'GridControlNavigation.Enabled = True ' RibbonPageGroupProfile.Enabled = False 'pnlEdit.Enabled = False End If If pMode = "Unlock" Or BarButtonItem26.Tag = "Unlock" Then Dim ocolor As New Color ocolor = Color.FromArgb(0, 192, 0) With BarButtonItem26 .Tag = "Lock" .ImageOptions.SvgImage = My.Resources.Security_Unlock .ItemAppearance.Normal.BackColor = ocolor End With ' GridControlNavigation.Enabled = False ' RibbonPageGroupProfile.Enabled = True ' pnlEdit.Enabled = True End If End Sub Private Sub GridViewProfile_BeforeLeaveRow(sender As Object, e As RowAllowEventArgs) Handles GridViewProfile.BeforeLeaveRow EditMode_Profile("Unlock") End Sub End Class