IDB Conform Step1

This commit is contained in:
2019-11-14 09:59:31 +01:00
parent d8e7f94480
commit 9e20642257
34 changed files with 2836 additions and 4570 deletions

View File

@@ -7,15 +7,13 @@ Imports DevExpress.XtraGrid.Views.Grid
Public Class frmAdministration
'Private _windreamPM As ClassPMWindream
Private email As New ClassEmail
Public profile_guid As Integer = 0
Dim formloaded As Boolean
Private INSERT_ACTIVE As Boolean = False
Dim Windream_Indicies As List(Of String)
Dim Windream_Indicies_Types As List(Of Integer)
Dim MyIndicies As List(Of String)
Dim MyIndicies_Types As List(Of Integer)
Private Sub frmFormDesigner_Load(sender As Object, e As System.EventArgs) Handles Me.Load
formloaded = False
Try
@@ -41,6 +39,7 @@ Public Class frmAdministration
dragDropManager.AddGridView(viewAvailableGroups)
dragDropManager.AddGridView(viewAssignedGroups)
'If clsModules.IsModuleInstalled("User Manager") Then
' btnUserManager.Enabled = True
'Else
@@ -58,76 +57,92 @@ Public Class frmAdministration
LOGGER.Error(ex)
MsgBox("Fehler bei Laden der Wertehilfen und Konfig-Daten: " & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Achtung:")
End Try
Try
' Windream instanziieren
'_windreamPM = New ClassPMWindream()
'Windream initialisieren (Connection, Session, ... aufbauen)
'_windreamPM.Create_Session()
Catch ex As Exception
LOGGER.Error(ex)
MsgBox("Fehler bei Initialisieren von windream: " & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Achtung:")
End Try
If IDB_ACTIVE = True Then
IDBData.Init()
End If
ObjekttypenEintragen()
Indexe_eintragen()
Try
If cmbObjekttypen.Text <> String.Empty Then
Windream_Indicies = WINDREAM.GetIndicesByObjecttype(cmbObjekttypen.Text).ToList()
Windream_Indicies_Types = New List(Of Integer)
For Each i In Windream_Indicies
Dim type = WINDREAM.GetTypeOfIndex(i)
Windream_Indicies_Types.Add(type)
Next
End If
Catch ex As Exception
LOGGER.Error(ex)
MsgBox("Fehler bei Indexe_eintragen: " & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Achtung:")
End Try
End Sub
Sub Indexe_eintragen()
If cmbObjekttypen.Text <> "" Then
Try
Me.PM_VEKTOR_INDEXComboBox.Items.Clear()
Me.cmbLOGIndex.Items.Clear()
Dim indexe = WINDREAM.GetIndicesByObjecttype(cmbObjekttypen.Text)
Me.PM_VEKTOR_INDEXComboBox.Items.Add("")
Me.cmbLOGIndex.Items.Add("")
If indexe IsNot Nothing Then
For Each index As String In indexe
Dim _vektorString As Boolean = False
Select Case WINDREAM.GetTypeOfIndex(index)
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
Me.PM_VEKTOR_INDEXComboBox.Items.Clear()
Me.cmbLOGIndex.Items.Clear()
Me.PM_VEKTOR_INDEXComboBox.Items.Add("")
Me.cmbLOGIndex.Items.Add("")
If IDB_ACTIVE = False Then
PM_VEKTOR_INDEXComboBox.Enabled = True
Label4.Enabled = True
Try
Dim indexe = WINDREAM.GetIndicesByObjecttype(cmbObjekttypen.Text)
If indexe IsNot Nothing Then
For Each index As String In indexe
Dim _vektorString As Boolean = False
Select Case WINDREAM.GetTypeOfIndex(index)
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 = WINDREAM.GetIndicesByObjecttype(cmbObjekttypen.Text).ToList()
For Each i In MyIndicies
Dim type = WINDREAM.GetTypeOfIndex(i)
MyIndicies_Types.Add(type)
Next
End If
If Me.PM_VEKTOR_INDEXComboBox.Text <> "" Then
PM_VEKTOR_INDEXComboBox.SelectedIndex = PM_VEKTOR_INDEXComboBox.FindStringExact(Me.PM_VEKTOR_INDEXComboBox.Text)
Else
Catch ex As Exception
LOGGER.Error(ex)
MsgBox("Error in GetIndices windream: " & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Achtung:")
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
Catch ex As Exception
LOGGER.Error(ex)
MsgBox("Fehler bei Indexe_eintragen: " & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Achtung:")
End Try
Else
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
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 Try
End If
End If
@@ -156,16 +171,25 @@ Public Class frmAdministration
End Sub
Private Sub ObjekttypenEintragen()
Me.cmbObjekttypen.Items.Clear()
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)
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 = ClassDatabase.Return_Datatable_ConStr(oSQL, CONNECTION_STRING_IDB)
For Each oROW As DataRow In oDT.Rows
Me.cmbObjekttypen.Items.Add(oROW.Item(1))
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
End If
End Sub
@@ -212,7 +236,7 @@ Public Class frmAdministration
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 = Environment.UserName
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
@@ -281,7 +305,7 @@ Public Class frmAdministration
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 = Environment.UserName
DD_DMSLiteDataSet.TBDD_USER.ADDED_WHOColumn.DefaultValue = USER_USERNAME
End Sub
Private Function GetCurrentProfileId() As Integer
@@ -315,7 +339,7 @@ Public Class frmAdministration
Dim userId As Integer = data.Split("|")(0)
Dim profileId = GetCurrentProfileId()
TBPROFILE_USERTableAdapter.CMDInsert(profileId, userId, Environment.UserName)
TBPROFILE_USERTableAdapter.CMDInsert(profileId, userId, USER_USERNAME)
FillProfile_User(profileId)
Catch ex As Exception
LOGGER.Error(ex)
@@ -344,8 +368,8 @@ Public Class frmAdministration
Dim profileId = GetCurrentProfileId()
TBPROFILE_GROUPTableAdapter.CmdInsert(profileId, groupId, Environment.UserName)
' TBPROFILE_USERTableAdapter.CMDInsert(profileId, userId, Environment.UserName)
TBPROFILE_GROUPTableAdapter.CmdInsert(profileId, groupId, USER_USERNAME)
' TBPROFILE_USERTableAdapter.CMDInsert(profileId, userId, USER_USERNAME)
FillProfile_User(profileId)
Catch ex As Exception
LOGGER.Error(ex)
@@ -386,7 +410,7 @@ Public Class frmAdministration
Sub Save_Konfiguration()
TBPM_KONFIGURATIONBindingSource.EndEdit()
If DD_DMSLiteDataSet.TBPM_KONFIGURATION.GetChanges Is Nothing = False Then
GEAENDERTWERTextBox.Text = Environment.UserName
GEAENDERTWERTextBox.Text = USER_USERNAME
TBPM_KONFIGURATIONBindingSource.EndEdit()
TBPM_KONFIGURATIONTableAdapter.Update(DD_DMSLiteDataSet.TBPM_KONFIGURATION)
tstrpinfo.Text = "Konfiguration wurde erfolgreich gespeichert"
@@ -543,7 +567,7 @@ Public Class frmAdministration
' End If
' Try
' TBPM_PROFILE_FINAL_INDEXINGTableAdapter.CmdInsert(PROFILGUIDTextBox.Text, cmbIndexe.Text, indexwert, Environment.UserName, 0, "")
' TBPM_PROFILE_FINAL_INDEXINGTableAdapter.CmdInsert(PROFILGUIDTextBox.Text, cmbIndexe.Text, indexwert, USER_USERNAME, 0, "")
' Me.lblSaveFinalIndex.Text = "Der Index wurde erfolgreich angelegt - " & Now
' Me.lblSaveFinalIndex.Visible = True
@@ -566,7 +590,7 @@ Public Class frmAdministration
' End If
' Try
' TBPM_PROFILE_FINAL_INDEXINGTableAdapter.CmdInsert(PROFILGUIDTextBox.Text, "[%VKT" & txtBezeichner.Text, indexwert, Environment.UserName, 0, "")
' TBPM_PROFILE_FINAL_INDEXINGTableAdapter.CmdInsert(PROFILGUIDTextBox.Text, "[%VKT" & txtBezeichner.Text, indexwert, USER_USERNAME, 0, "")
' Me.lblSaveFinalIndex.Text = "Der Index wurde erfolgreich angelegt - " & Now
' Me.lblSaveFinalIndex.Visible = True
' Catch ex As Exception
@@ -599,7 +623,7 @@ Public Class frmAdministration
copySuffix = copySuffix & "_COPY"
End While
TBPM_PROFILETableAdapter.cmdInsert_Copy(copySuffix, Environment.UserName, PROFILGUIDTextBox.Text)
TBPM_PROFILETableAdapter.cmdInsert_Copy(copySuffix, USER_USERNAME, PROFILGUIDTextBox.Text)
Dim NewGUID As Integer = TBPM_PROFILETableAdapter.cmdMaxGuid
If NewGUID > 0 Then
Dim _sql = "INSERT INTO TBPM_PROFILE_CONTROLS " &
@@ -610,11 +634,11 @@ Public Class frmAdministration
"FROM TBPM_PROFILE_CONTROLS AS TBPM_PROFILE_CONTROLS_1 " &
"WHERE (PROFIL_ID = @Copy_profilId) "
_sql = _sql.Replace("@NEW_PROFIL_ID", NewGUID)
_sql = _sql.Replace("@User", Environment.UserName)
_sql = _sql.Replace("@User", USER_USERNAME)
_sql = _sql.Replace("@Copy_profilId", PROFILGUIDTextBox.Text)
TBPM_PROFILE_FINAL_INDEXINGTableAdapter.CopyFinalIndex(NewGUID, Environment.UserName, PROFILGUIDTextBox.Text)
'TBPM_PROFILE_CONTROLSTableAdapter.cmdInsertCopy(NewGUID, Environment.UserName, PROFILGUIDTextBox.Text)
TBPM_PROFILE_FINAL_INDEXINGTableAdapter.CopyFinalIndex(NewGUID, USER_USERNAME, PROFILGUIDTextBox.Text)
'TBPM_PROFILE_CONTROLSTableAdapter.cmdInsertCopy(NewGUID, USER_USERNAME, PROFILGUIDTextBox.Text)
Execute_SQL(_sql)
MsgBox("Das Profil " & NAMETextBox.Text & " wurde erfolgreich kopiert!", MsgBoxStyle.Information, "Erfolgsmeldung")
Refresh_Profildaten()
@@ -775,14 +799,14 @@ Public Class frmAdministration
' MsgBox("Bitte wählen Sie eine Connection und definieren einen SQL-Befehl!", MsgBoxStyle.Exclamation)
' Exit Sub
' End If
' TBPM_PROFILE_FINAL_INDEXINGTableAdapter.CmdInsert(PROFILGUIDTextBox.Text, cmbIndexe2.Text, "SQL-Command", Environment.UserName, cmbConnection.SelectedValue, SQL_COMMANDTextBox.Text)
' TBPM_PROFILE_FINAL_INDEXINGTableAdapter.CmdInsert(PROFILGUIDTextBox.Text, cmbIndexe2.Text, "SQL-Command", USER_USERNAME, cmbConnection.SelectedValue, SQL_COMMANDTextBox.Text)
' INSERT_ACTIVE = False
' Else
' 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.cmdUpdateSQL(cmbConnection.SelectedValue, SQL_COMMANDTextBox.Text, Environment.UserName, ID)
' TBPM_PROFILE_FINAL_INDEXINGTableAdapter.cmdUpdateSQL(cmbConnection.SelectedValue, SQL_COMMANDTextBox.Text, USER_USERNAME, ID)
' End If
' End If
@@ -801,7 +825,7 @@ Public Class frmAdministration
' Exit Sub
' End If
' TBPM_PROFILE_FINAL_INDEXINGTableAdapter.CmdInsert(PROFILGUIDTextBox.Text, cmbIndexe2.Text, "SQL-Command", Environment.UserName, CONID, SQL_COMMANDTextBox.Text)
' TBPM_PROFILE_FINAL_INDEXINGTableAdapter.CmdInsert(PROFILGUIDTextBox.Text, cmbIndexe2.Text, "SQL-Command", USER_USERNAME, CONID, SQL_COMMANDTextBox.Text)
' End If
' Dim i, ID As Integer
@@ -915,8 +939,8 @@ Public Class frmAdministration
End Sub
Private Sub GridView2_FocusedRowChanged(sender As Object, e As Views.Base.FocusedRowChangedEventArgs) Handles viewFinalIndex.FocusedRowChanged
Try
Dim view As GridView = sender
'Try
Dim view As GridView = sender
Dim focusedRow As DataRow = view.GetFocusedDataRow()
If IsNothing(focusedRow) Then
@@ -951,37 +975,11 @@ Public Class frmAdministration
' 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)
obj = FINALINDICES.SetValue(value, obj, index, MyIndicies, MyIndicies_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.Indicies = MyIndicies
obj.IndiciesType = MyIndicies_Types
obj.IndexName = index
obj.VectorBehaviourType = New List(Of String) From {
"Add",
@@ -989,17 +987,17 @@ Public Class frmAdministration
}
If Not index Is Nothing Then
Dim indexType As Integer = ClassFinalIndex.GetIndexType(index, Windream_Indicies, Windream_Indicies_Types)
obj.VectorIndex = ClassFinalIndex.IsVectorIndex(indexType)
Dim indexType As Integer = FINALINDICES.GetIndexType(index, MyIndicies, MyIndicies_Types)
obj.VectorIndex = FINALINDICES.IsVectorIndex(indexType)
End If
PropertyGrid1.SelectedObject = obj
PropertyGrid1.Refresh()
Catch ex As Exception
LOGGER.Error(ex)
MsgBox($"Error while loading Final Index properties: {ex.Message}")
LOGGER.Info($"Error while loading Final Index properties: {ex.Message}")
End Try
'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 BindingNavigatorAddNewItem_Click(sender As Object, e As EventArgs) Handles BindingNavigatorAddNewItem.Click
@@ -1020,7 +1018,7 @@ Public Class frmAdministration
If obj.SQLCommand.Value <> String.Empty Then
value = "SQL-Command"
Else
value = ClassFinalIndex.GetValue(obj, obj.IndexName, Windream_Indicies, Windream_Indicies_Types, obj.VectorIndex)
value = FINALINDICES.GetValue(obj, obj.IndexName, MyIndicies, MyIndicies_Types, obj.VectorIndex)
End If
value = NotNull(value, String.Empty)
@@ -1030,7 +1028,7 @@ Public Class frmAdministration
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 = Environment.UserName
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)
@@ -1050,7 +1048,7 @@ Public Class frmAdministration
' 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 = $"{ClassFinalIndex.PREFIX_VECTOR}{value}"
value = $"{FINALINDICES.PREFIX_VECTOR}{value}"
End If
If INSERT_ACTIVE = True Then
@@ -1098,8 +1096,8 @@ 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)
Dim type As Integer = FINALINDICES.GetIndexType(e.ChangedItem.Value, MyIndicies, MyIndicies_Types)
obj.VectorIndex = FINALINDICES.IsVectorIndex(type)
propertyGrid.Refresh()
End If