MS Globix DLL ControlCreator

This commit is contained in:
SchreiberM 2021-03-19 14:05:46 +01:00
parent e62bed993e
commit 12348d6894
13 changed files with 296 additions and 94 deletions

View File

@ -12,7 +12,7 @@ Public Class ControlCreator
Private Logger As Logger
Private Const DEFAULT_HEIGHT = 27
Private Const DEFAULT_WIDTH = 100
Private Const DEFAULT_WIDTH = 450
Private Const DEFAULT_POSITION_X = 11
Private Const TYPE_BOOLEAN = "BOOLEAN"
@ -34,7 +34,11 @@ Public Class ControlCreator
''' </summary>
''' <returns>The Datatable which contains the Control's Data</returns>
Public Property OnLookupData As Func(Of Control, String, Integer, DataTable)
Public Class ControlMeta
Public Property IndexName As String
Public Property IndexType As String
Public Property MultipleValues As Boolean = False
End Class
Public Sub New(LogConfig As LogConfig, Panel As Panel, Form As Form)
Me.Form = Form
Me.Panel = Panel

View File

@ -79,8 +79,7 @@ Public Class ClassDataASorDB
End Function
Public Sub Refresh_Connections()
Try
Dim oSql = String.Format("SELECT * FROM TBDD_CONNECTION")
Dim oResult As DataTable
Dim oSql = String.Format("SELECT * FROM TBDD_CONNECTION WHERE AKTIV = 1")
DT_CONNECTIONS = GetDatatable("DD_ECM", oSql, "TBDD_CONNECTION", "", "", "")
Catch ex As Exception
_Logger.Error(ex)

View File

@ -156,6 +156,8 @@ Public Class ClassInit
End Select
Next
oSql = "SELECT * FROM TBDD_CONNECTION"
Catch ex As Exception
_Logger.Error(ex)
Throw New InitException("Error in InitBasicData", ex)

View File

@ -56,7 +56,7 @@ Public Class ClassEmailHeaderExtractor
End Function
Public Shared Function extractFromHeader(messageHeaders As String, Regex As String) As String
Try
Dim result As String
Dim result As String = ""
Dim i As Integer = 0
If IsNothing(messageHeaders) Then
Return Nothing

View File

@ -12,7 +12,7 @@ Public Class ClassFolderwatcher
clsFilehandle = New ClassFilehandle()
End Sub
Public Function Restart_FolderWatch()
Public Function Restart_FolderWatch() As Boolean
Try
If FWFolderWatcher.EnableRaisingEvents = True Then
'Gestartet also Stoppen
@ -29,9 +29,11 @@ Public Class ClassFolderwatcher
My.UIConfig.Globix.FolderWatchStarted = True
My.UIConfigManager.Save()
End If
Return True
Catch ex As Exception
Logger.Info($"Error in Restart_FolderWatch: {ex.Message}")
Logger.Error(ex.Message)
Return False
End Try
End Function
Public Sub Restart_FolderWatchSCAN()

View File

@ -416,7 +416,7 @@ Public Class GlobixControls
Continue For
End If
oControlSql = Patterns.ReplaceUserValues(oControlSql, My.Application.User.GivenName, My.Application.User.Surname, My.Application.User.ShortName, My.Application.User.Language, My.Application.User.Email, My.Application.User.UserId, My.Application.Globix.CURRENT_DOCTYPE_ID)
oControlSql = Patterns.ReplaceUserValues(oControlSql, My.Application.Globix.CURRENT_DOCTYPE_ID)
oControlSql = Patterns.ReplaceInternalValues(oControlSql)
oControlSql = Patterns.ReplaceControlValues(oControlSql, Panel)

View File

@ -55,7 +55,7 @@ Public Class GlobixPatterns
result = ReplaceInternalValues(result)
result = ReplaceControlValues(result, panel)
result = ReplaceIDBAttributes(My.Application.Globix.CURRENT_IDB_OBJ_ID, result, pissql)
result = ReplaceUserValues(result, prename, surname, shortname, language, email, userId, profileId)
result = ReplaceUserValues(result, profileId)
_Logger.Debug($"inputString AFTER replacing: [{result}]")
Return result
Catch ex As Exception
@ -95,34 +95,33 @@ Public Class GlobixPatterns
End Try
End Function
Public Function ReplaceUserValues(input As String, prename As Object, surname As Object, shortname As Object, language As String, email As Object, userId As Object, profileId As Object) As String
Public Function ReplaceUserValues(input As String, profileId As Object) As String
Try
Dim result = input
While ContainsPatternAndValue(result, PATTERN_USER, USER_VALUE_PRENAME)
result = ReplacePattern(result, PATTERN_USER, prename)
result = ReplacePattern(result, PATTERN_USER, My.Application.User.GivenName)
End While
While ContainsPatternAndValue(result, PATTERN_USER, USER_VALUE_USER_ID)
result = ReplacePattern(result, PATTERN_USER, userId)
result = ReplacePattern(result, PATTERN_USER, My.Application.User.UserId)
End While
While ContainsPatternAndValue(result, PATTERN_USER, USER_VALUE_SURNAME)
result = ReplacePattern(result, PATTERN_USER, surname)
result = ReplacePattern(result, PATTERN_USER, My.Application.User.Surname)
End While
If IsDBNull(shortname) Then
shortname = ""
If IsDBNull(My.Application.User.ShortName) Then
My.Application.User.ShortName = ""
End If
While ContainsPatternAndValue(result, PATTERN_USER, USER_VALUE_SHORTNAME)
result = ReplacePattern(result, PATTERN_USER, shortname)
result = ReplacePattern(result, PATTERN_USER, My.Application.User.ShortName)
End While
While ContainsPatternAndValue(result, PATTERN_USER, USER_VALUE_LANGUAGE)
result = ReplacePattern(result, PATTERN_USER, language)
result = ReplacePattern(result, PATTERN_USER, My.Application.User.Language)
End While
While ContainsPatternAndValue(result, PATTERN_USER, USER_VALUE_EMAIL)
result = ReplacePattern(result, PATTERN_USER, email)
result = ReplacePattern(result, PATTERN_USER, My.Application.User.Email)
End While
While ContainsPatternAndValue(result, PATTERN_USER, USER_VALUE_PROFILE_ID)

View File

@ -23,6 +23,11 @@ Partial Class frmGlobix_Index
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmGlobix_Index))
Dim EditorButtonImageOptions1 As DevExpress.XtraEditors.Controls.EditorButtonImageOptions = New DevExpress.XtraEditors.Controls.EditorButtonImageOptions()
Dim SerializableAppearanceObject1 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject()
Dim SerializableAppearanceObject2 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject()
Dim SerializableAppearanceObject3 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject()
Dim SerializableAppearanceObject4 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject()
Me.RibbonControl1 = New DevExpress.XtraBars.Ribbon.RibbonControl()
Me.BarButtonItem2 = New DevExpress.XtraBars.BarButtonItem()
Me.BarButtonItem3 = New DevExpress.XtraBars.BarButtonItem()
@ -47,16 +52,16 @@ Partial Class frmGlobix_Index
Me.BarCheckItem2 = New DevExpress.XtraBars.BarCheckItem()
Me.SplitContainerControl1 = New DevExpress.XtraEditors.SplitContainerControl()
Me.pnlIndex = New System.Windows.Forms.Panel()
Me.ComboBoxEdit1 = New DevExpress.XtraEditors.ComboBoxEdit()
Me.Panel3 = New System.Windows.Forms.Panel()
Me.PictureEdit1 = New DevExpress.XtraEditors.PictureEdit()
Me.Panel1 = New System.Windows.Forms.Panel()
Me.Label1 = New System.Windows.Forms.Label()
Me.cmbDoctype = New System.Windows.Forms.ComboBox()
Me.DocumentViewer1 = New DigitalData.Controls.DocumentViewer.DocumentViewer()
Me.GlobixDataset = New DigitalData.GUIs.ZooFlow.GlobixDataset()
CType(Me.RibbonControl1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.SplitContainerControl1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SplitContainerControl1.SuspendLayout()
CType(Me.ComboBoxEdit1.Properties, System.ComponentModel.ISupportInitialize).BeginInit()
Me.Panel3.SuspendLayout()
CType(Me.PictureEdit1.Properties, System.ComponentModel.ISupportInitialize).BeginInit()
Me.Panel1.SuspendLayout()
@ -254,15 +259,30 @@ Partial Class frmGlobix_Index
'
'pnlIndex
'
Me.pnlIndex.BackColor = System.Drawing.Color.DimGray
Me.pnlIndex.BackColor = System.Drawing.Color.Silver
Me.pnlIndex.Dock = System.Windows.Forms.DockStyle.Fill
Me.pnlIndex.Font = New System.Drawing.Font("Segoe UI", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.pnlIndex.ForeColor = System.Drawing.Color.White
Me.pnlIndex.Location = New System.Drawing.Point(0, 58)
Me.pnlIndex.Location = New System.Drawing.Point(0, 33)
Me.pnlIndex.Name = "pnlIndex"
Me.pnlIndex.Size = New System.Drawing.Size(591, 375)
Me.pnlIndex.Size = New System.Drawing.Size(591, 400)
Me.pnlIndex.TabIndex = 3
'
'ComboBoxEdit1
'
Me.ComboBoxEdit1.Dock = System.Windows.Forms.DockStyle.Top
Me.ComboBoxEdit1.Location = New System.Drawing.Point(0, 0)
Me.ComboBoxEdit1.MenuManager = Me.RibbonControl1
Me.ComboBoxEdit1.Name = "ComboBoxEdit1"
SerializableAppearanceObject1.BackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(214, Byte), Integer), CType(CType(49, Byte), Integer))
SerializableAppearanceObject1.Options.UseBackColor = True
Me.ComboBoxEdit1.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo, "", 20, True, True, False, EditorButtonImageOptions1, New DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), SerializableAppearanceObject1, SerializableAppearanceObject2, SerializableAppearanceObject3, SerializableAppearanceObject4, "", Nothing, Nothing, DevExpress.Utils.ToolTipAnchor.[Default])})
Me.ComboBoxEdit1.Properties.ButtonsStyle = DevExpress.XtraEditors.Controls.BorderStyles.UltraFlat
Me.ComboBoxEdit1.Properties.NullText = "Bitte wählen Sie ein Profil"
Me.ComboBoxEdit1.Properties.Padding = New System.Windows.Forms.Padding(5)
Me.ComboBoxEdit1.Size = New System.Drawing.Size(591, 30)
Me.ComboBoxEdit1.TabIndex = 4
'
'Panel3
'
Me.Panel3.Controls.Add(Me.PictureEdit1)
@ -279,7 +299,7 @@ Partial Class frmGlobix_Index
Me.PictureEdit1.Location = New System.Drawing.Point(0, 0)
Me.PictureEdit1.MenuManager = Me.RibbonControl1
Me.PictureEdit1.Name = "PictureEdit1"
Me.PictureEdit1.Properties.Appearance.BackColor = System.Drawing.Color.DimGray
Me.PictureEdit1.Properties.Appearance.BackColor = System.Drawing.Color.Silver
Me.PictureEdit1.Properties.Appearance.Options.UseBackColor = True
Me.PictureEdit1.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Flat
Me.PictureEdit1.Properties.ShowCameraMenuItem = DevExpress.XtraEditors.Controls.CameraMenuItemVisibility.[Auto]
@ -289,38 +309,14 @@ Partial Class frmGlobix_Index
'
'Panel1
'
Me.Panel1.BackColor = System.Drawing.Color.DimGray
Me.Panel1.Controls.Add(Me.Label1)
Me.Panel1.Controls.Add(Me.cmbDoctype)
Me.Panel1.BackColor = System.Drawing.Color.Silver
Me.Panel1.Controls.Add(Me.ComboBoxEdit1)
Me.Panel1.Dock = System.Windows.Forms.DockStyle.Top
Me.Panel1.Location = New System.Drawing.Point(0, 0)
Me.Panel1.Name = "Panel1"
Me.Panel1.Size = New System.Drawing.Size(591, 58)
Me.Panel1.Size = New System.Drawing.Size(591, 33)
Me.Panel1.TabIndex = 0
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Font = New System.Drawing.Font("Segoe UI", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label1.ForeColor = System.Drawing.Color.White
Me.Label1.ImeMode = System.Windows.Forms.ImeMode.NoControl
Me.Label1.Location = New System.Drawing.Point(3, 3)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(212, 17)
Me.Label1.TabIndex = 2
Me.Label1.Text = "Bitte wählen Sie einen Ablage-Flow:"
'
'cmbDoctype
'
Me.cmbDoctype.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.cmbDoctype.Font = New System.Drawing.Font("Segoe UI", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.cmbDoctype.FormattingEnabled = True
Me.cmbDoctype.Location = New System.Drawing.Point(6, 27)
Me.cmbDoctype.Name = "cmbDoctype"
Me.cmbDoctype.Size = New System.Drawing.Size(555, 25)
Me.cmbDoctype.TabIndex = 0
'
'DocumentViewer1
'
Me.DocumentViewer1.Dock = System.Windows.Forms.DockStyle.Fill
@ -351,10 +347,10 @@ Partial Class frmGlobix_Index
CType(Me.RibbonControl1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.SplitContainerControl1, System.ComponentModel.ISupportInitialize).EndInit()
Me.SplitContainerControl1.ResumeLayout(False)
CType(Me.ComboBoxEdit1.Properties, System.ComponentModel.ISupportInitialize).EndInit()
Me.Panel3.ResumeLayout(False)
CType(Me.PictureEdit1.Properties, System.ComponentModel.ISupportInitialize).EndInit()
Me.Panel1.ResumeLayout(False)
Me.Panel1.PerformLayout()
CType(Me.GlobixDataset, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
Me.PerformLayout()
@ -384,12 +380,11 @@ Partial Class frmGlobix_Index
Friend WithEvents BarButtonItem1 As DevExpress.XtraBars.BarButtonItem
Friend WithEvents SplitContainerControl1 As DevExpress.XtraEditors.SplitContainerControl
Friend WithEvents Panel1 As Panel
Friend WithEvents cmbDoctype As ComboBox
Friend WithEvents DocumentViewer1 As Controls.DocumentViewer.DocumentViewer
Friend WithEvents Label1 As Label
Friend WithEvents BarHeaderItem1 As DevExpress.XtraBars.BarHeaderItem
Friend WithEvents pnlIndex As Panel
Friend WithEvents Panel3 As Panel
Friend WithEvents PictureEdit1 As DevExpress.XtraEditors.PictureEdit
Friend WithEvents GlobixDataset As GlobixDataset
Friend WithEvents ComboBoxEdit1 As DevExpress.XtraEditors.ComboBoxEdit
End Class

View File

@ -5,7 +5,9 @@ Imports System.IO
Imports System.Security.AccessControl
Imports System.Security.Principal
Imports System.Text.RegularExpressions
Imports DigitalData.GUIs.GlobalIndexer
Imports DigitalData.Modules.Logging
Imports DigitalData.Controls.LookupGrid
Imports Independentsoft
Public Class frmGlobix_Index
@ -35,6 +37,21 @@ Public Class frmGlobix_Index
Private clsPostProcessing As GlobixPostprocessing
Private _DataASorDB As ClassDataASorDB
Private _idbdata As ClassIDBData
Private _Patterns As GlobixPatterns
Private _Controls As DigitalData.GUIs.GlobalIndexer.ControlCreator
Public Class DocType
Public Property Guid
Public Property Name
Public Overrides Function ToString() As String
Return Name
End Function
End Class
Public Class ControlMeta
Public Property IndexName As String
Public Property IndexType As String
Public Property MultipleValues As Boolean = False
End Class
#End Region
Public Sub New(LogConfig As LogConfig)
@ -49,6 +66,7 @@ Public Class frmGlobix_Index
clsPatterns = New GlobixPatterns(LogConfig)
clsPostProcessing = New GlobixPostprocessing(LogConfig)
_idbdata = New ClassIDBData(LogConfig)
_Patterns = New GlobixPatterns(LogConfig)
End Sub
Private Sub frmGlobix_Index_Load(sender As Object, e As EventArgs) Handles MyBase.Load
@ -247,7 +265,15 @@ Public Class frmGlobix_Index
checkItemPreselection.Checked = True
If My.Application.Globix.CURRENT_LASTDOCTYPE <> "" Then
cmbDoctype.SelectedIndex = cmbDoctype.FindStringExact(My.Application.Globix.CURRENT_LASTDOCTYPE)
Dim oFoundDocType = ComboBoxEdit1.Properties.Items.
Cast(Of DocType)().
Where(Function(dt) dt.Name = My.Application.Globix.CURRENT_LASTDOCTYPE).
FirstOrDefault()
If oFoundDocType IsNot Nothing Then
ComboBoxEdit1.SelectedItem = oFoundDocType
End If
End If
Else
If My.Application.Globix.DTTBGI_REGEX_DOCTYPE.Rows.Count > 0 Then
@ -257,7 +283,14 @@ Public Class frmGlobix_Index
_Logger.Debug("There is a match on REGEX_DOCTYPE: [{0}]", oRoW.Item("DOCTYPE"))
_Logger.Debug("Regex: [{0}], FileName: [{1}]", oRoW.Item("Regex"), oOnlyFilename)
cmbDoctype.SelectedIndex = cmbDoctype.FindStringExact(oRoW.Item("DOCTYPE"))
Dim oFoundDocType = ComboBoxEdit1.Properties.Items.
Cast(Of DocType)().
Where(Function(dt) dt.Name = My.Application.Globix.CURRENT_LASTDOCTYPE).
FirstOrDefault()
If oFoundDocType IsNot Nothing Then
ComboBoxEdit1.SelectedItem = oFoundDocType
End If
Exit For
End If
Next
@ -277,26 +310,30 @@ Public Class frmGlobix_Index
Dim oSql = String.Format("select * from VWGI_DOCTYPE where UPPER(USERNAME) = UPPER('{0}') ORDER BY SEQUENCE", My.Application.User.UserName)
Dim oFilter = $"USERNAME like '%{My.Application.User.UserName}%'"
DT_DOKART = _DataASorDB.GetDatatable("DD_ECM", oSql, "VWGI_DOCTYPE", oFilter, "SEQUENCE")
cmbDoctype.DataSource = DT_DOKART
cmbDoctype.ValueMember = DT_DOKART.Columns("DOCTYPE_ID").ColumnName
cmbDoctype.DisplayMember = DT_DOKART.Columns("DOCTYPE").ColumnName
cmbDoctype.AutoCompleteMode = AutoCompleteMode.Suggest
cmbDoctype.AutoCompleteSource = AutoCompleteSource.ListItems
cmbDoctype.SelectedIndex = -1
'cmbDoctype.DataSource = DT_DOKART
'cmbDoctype.ValueMember = DT_DOKART.Columns("DOCTYPE_ID").ColumnName
'cmbDoctype.DisplayMember = DT_DOKART.Columns("DOCTYPE").ColumnName
'cmbDoctype.AutoCompleteMode = AutoCompleteMode.Suggest
'cmbDoctype.AutoCompleteSource = AutoCompleteSource.ListItems
'cmbDoctype.SelectedIndex = -1
For Each oRow As DataRow In DT_DOKART.Rows
ComboBoxEdit1.Properties.Items.Add(New DocType With {
.Guid = oRow.Item("DOCTYPE_ID"),
.Name = oRow.Item("DOCTYPE")
})
Next
Catch ex As Exception
_Logger.Warn("Unexpected error in Refresh_Dokart: " & vbNewLine & ex.Message)
MsgBox(ex.Message, MsgBoxStyle.Critical, "Unexpected error in Laden der Dokumentarten:")
End Try
End Sub
Private Sub cmbDoctype_SelectedValueChanged(sender As Object, e As EventArgs) Handles cmbDoctype.SelectedValueChanged
End Sub
Private Sub ComboBoxEdit1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBoxEdit1.SelectedIndexChanged
If ComboBoxEdit1.SelectedIndex <> -1 And FormLoaded = True Then
Dim oSelectedItem As DocType = ComboBoxEdit1.SelectedItem
Private Sub cmbDoctype_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cmbDoctype.SelectedIndexChanged
If cmbDoctype.SelectedIndex <> -1 And FormLoaded = True Then
If cmbDoctype.SelectedValue.GetType.ToString = "System.Int32" Then
My.Application.Globix.CURRENT_DOCTYPE_ID = cmbDoctype.SelectedValue
My.Application.Globix.CURRENT_DOCTYPE_ID = oSelectedItem.Guid
'lblhinweis.Visible = False
ClearNotice()
@ -304,17 +341,15 @@ Public Class frmGlobix_Index
'lblerror.Visible = False
ClearError()
Me.pnlIndex.Controls.Clear()
Dim oSql As String = "Select * from TBDD_DOKUMENTART WHERE GUID = " & cmbDoctype.SelectedValue.ToString
Dim oFilter = "GUID = " & cmbDoctype.SelectedValue.ToString
pnlIndex.Controls.Clear()
Dim oSql As String = "Select * from TBDD_DOKUMENTART WHERE GUID = " & oSelectedItem.Guid
Dim oFilter = "GUID = " & oSelectedItem.Guid
My.Application.Globix.CURR_DT_DOCTYPE = _DataASorDB.GetDatatable("DD_ECM", oSql, "TBDD_DOKUMENTART", oFilter, "")
My.Application.Globix.CURRENT_DOCTYPE_DuplicateHandling = My.Application.Globix.CURR_DT_DOCTYPE.Rows(0).Item("DUPLICATE_HANDLING").ToString
Refresh_IndexeMan(cmbDoctype.SelectedValue)
End If
Refresh_IndexeMan(My.Application.Globix.CURRENT_DOCTYPE_ID)
End If
End Sub
@ -355,11 +390,15 @@ Public Class frmGlobix_Index
Dim oControlCount As Integer = 1
Dim oLabelPosition As Integer = 11
Dim oControlPosition As Integer = 33
Dim oControls As New GlobixControls(_LogConfig, pnlIndex, Me)
' Dim oControls As New GlobixControls(_LogConfig, pnlIndex, Me)
Dim oControls As New DigitalData.GUIs.GlobalIndexer.ControlCreator(_LogConfig, pnlIndex, Me) With {
.OnControlChanged = AddressOf PrepareDependingControl,
.OnLookupData = AddressOf GetLookupData
}
_Controls = oControls
If DT_INDEXEMAN.Rows.Count = 0 Then
ShowError("Keine Manuellen Indizes für die " & vbNewLine & "Dokumentart " & cmbDoctype.Text & " definiert")
_Logger.Info(" - Keine Manuellen Indizes für die " & vbNewLine & "Dokumentart " & cmbDoctype.Text & " definiert")
ShowError("Keine Manuellen Indizes für die " & vbNewLine & "Dokumentart " & ComboBoxEdit1.Text & " definiert")
_Logger.Info(" - Keine Manuellen Indizes für die " & vbNewLine & "Dokumentart " & ComboBoxEdit1.Text & " definiert")
End If
For Each oRow As DataRow In DT_INDEXEMAN.Rows
@ -387,7 +426,8 @@ Public Class frmGlobix_Index
End If
Case "INTEGER"
If (oSQLSuggestion = True And oRow.Item("SQL_RESULT").ToString.Length > 0) Or MultiSelect = True Then
Dim oControl = oControls.AddVorschlag_ComboBox(oControlName, oControlPosition, oConnectionId, oRow.Item("SQL_RESULT"), MultiSelect, oDataType, oDefaultValue, AddNewItems, PreventDuplicates, oSQLSuggestion)
Dim oControl = oControls.AddLookupControl(oControlName, oControlPosition, MultiSelect, oDataType, oRow.Item("SQL_RESULT"), oConnectionId, oDefaultValue, AddNewItems, PreventDuplicates)
If Not IsNothing(oControl) Then
pnlIndex.Controls.Add(oControl)
End If
@ -400,7 +440,7 @@ Public Class frmGlobix_Index
End If
Case "VARCHAR"
If (oSQLSuggestion = True And oRow.Item("SQL_RESULT").ToString.Length > 0) Or MultiSelect = True Then
Dim oControl = oControls.AddVorschlag_ComboBox(oControlName, oControlPosition, oConnectionId, oRow.Item("SQL_RESULT"), MultiSelect, oDataType, oDefaultValue, AddNewItems, PreventDuplicates, oSQLSuggestion)
Dim oControl = oControls.AddLookupControl(oControlName, oControlPosition, MultiSelect, oDataType, oRow.Item("SQL_RESULT"), oConnectionId, oDefaultValue, AddNewItems, PreventDuplicates)
If Not IsNothing(oControl) Then
pnlIndex.Controls.Add(oControl)
End If
@ -419,7 +459,7 @@ Public Class frmGlobix_Index
End If
End If
Case "DATE"
Dim oPicker = oControls.AddDateTimePicker(oControlName, oControlPosition, oDataType, oDefaultValue)
Dim oPicker = oControls.AddDateTimePicker(oControlName, oControlPosition, oDataType)
pnlIndex.Controls.Add(oPicker)
Case Else
@ -452,6 +492,122 @@ Public Class frmGlobix_Index
MsgBox(ex.Message, MsgBoxStyle.Critical, "Unexpected error in LoadIndexe_Man:")
End Try
End Sub
Private Sub PrepareDependingControl(pControl As Control)
If TypeOf pControl Is Label Then
Exit Sub
End If
Try
Dim oMeta = DirectCast(pControl.Tag, ControlMeta)
Dim oIndexName As String = oMeta.IndexName
Dim oSQL = $"SELECT * FROM TBDD_INDEX_MAN WHERE SQL_RESULT LIKE '%{oIndexName}%'"
Dim oDatatable As DataTable = My.Database.GetDatatable(oSQL)
If Not IsNothing(oDatatable) Then
_Logger.Debug("Found [{0}] depending controls for [{1}]", oDatatable.Rows.Count, pControl.Name)
For Each oRow As DataRow In oDatatable.Rows
Dim oControlName As String = NotNull(oRow.Item("NAME"), "")
Dim oConnectionId As Integer = NotNull(oRow.Item("CONNECTION_ID"), -1)
Dim oControlSql As String = NotNull(oRow.Item("SQL_RESULT"), "")
If oConnectionId = -1 Or oControlSql = String.Empty Then
_Logger.Warn("Missing SQL Query or ConnectionId for Control [{0}]! Continuing.", oControlName)
Continue For
End If
oControlSql = _Patterns.ReplaceUserValues(oControlSql, My.Application.Globix.CURRENT_DOCTYPE_ID)
oControlSql = _Patterns.ReplaceInternalValues(oControlSql)
oControlSql = _Patterns.ReplaceControlValues(oControlSql, pnlIndex)
_Logger.Debug("Setting new value for [{0}]", oControlName)
SetDependingControlResult(oControlName, oControlSql, oConnectionId)
Next
End If
Catch ex As Exception
_Logger.Error(ex)
End Try
End Sub
Private Sub SetDependingControlResult(IndexName As String, pSqlCommand As String, SqlConnectionId As Integer)
Try
If pSqlCommand Is Nothing OrElse pSqlCommand = String.Empty Then
_Logger.Warn("New Value for Index [{0}] could not be set. Supplied SQL is empty.")
Exit Sub
End If
Dim oConnectionString = GetConnectionString(SqlConnectionId)
Dim oDatatable As DataTable = My.Database.GetDatatableWithConnection(pSqlCommand, oConnectionString)
Dim oFoundControl As Control = Nothing
For Each oControl As Control In pnlIndex.Controls
If TypeOf oControl Is Label Then
Continue For
End If
Dim oMeta = DirectCast(oControl.Tag, ControlMeta)
Dim oIndex As String = oMeta.IndexName
If oIndex = IndexName Then
oFoundControl = oControl
Exit For
End If
Next
If oFoundControl Is Nothing Then
_Logger.Warn("Depending Control for Index [{0}] not found!", IndexName)
End If
If oDatatable Is Nothing Then
_Logger.Warn("Error in SQL Command: {0}", pSqlCommand)
End If
Select Case oFoundControl.GetType.Name
Case GetType(DevExpress.XtraEditors.TextEdit).Name
If oDatatable.Rows.Count > 0 Then
Dim oFirstRow As DataRow = oDatatable.Rows.Item(0)
If oFirstRow.ItemArray.Length > 0 Then
Dim oValue = oFirstRow.Item(0).ToString()
_Logger.Debug("Setting Value for TextEdit [{0}]: [{1}]", oFoundControl.Name, oValue)
DirectCast(oFoundControl, DevExpress.XtraEditors.TextEdit).Text = oValue
End If
End If
Case GetType(LookupControl2).Name
_Logger.Debug("Setting Value for LookupControl [{0}]: [{1}]", oFoundControl.Name, "DATATABLE")
DirectCast(oFoundControl, LookupControl2).DataSource = oDatatable
Case GetType(ComboBox).Name
_Logger.Debug("Setting Value for Combobox [{0}]: [{1}]", oFoundControl.Name, "DATATABLE")
DirectCast(oFoundControl, ComboBox).DataSource = oDatatable
Case Else
_Logger.Debug("Could not set depending control result for [{0}]", oFoundControl.GetType.Name)
End Select
Catch ex As Exception
_Logger.Error(ex)
End Try
End Sub
Private Function GetLookupData(pLookup As LookupControl2, pSQLCommand As String, pConnectionId As Integer)
Dim oConnectionString = GetConnectionString(pConnectionId)
If oConnectionString IsNot Nothing And pSQLCommand.Length > 0 Then
_Logger.Debug("Connection String (redacted): [{0}]", oConnectionString.Substring(0, 30))
If _Patterns.HasComplexPatterns(pSQLCommand) Then
_Logger.Debug(" >>sql enthält Platzhalter und wird erst während der Laufzeit gefüllt!", False)
Return Nothing
Else
pSQLCommand = _Patterns.ReplaceInternalValues(pSQLCommand)
pSQLCommand = _Patterns.ReplaceUserValues(pSQLCommand, My.Application.Globix.CURRENT_DOCTYPE_ID)
Dim oDatatable = My.Database.GetDatatableWithConnection(pSQLCommand, oConnectionString)
Return oDatatable
End If
Else
_Logger.Warn("Connection String for control [{0}] is empty!", pLookup.Name)
Return Nothing
End If
End Function
Function GetPlaceholderValue(InputValue As String, FileName As String, UserShortName As String) As String
Dim oResult As String
@ -702,11 +858,13 @@ Public Class frmGlobix_Index
_Logger.Debug("Manuelle Indexe geladen")
If My.Application.Globix.CURR_DT_MAN_INDEXE.Rows.Count > 0 Then
My.Application.Globix.CURRENT_DOCTYPE_ID = Me.cmbDoctype.SelectedValue
If CheckWrite_IndexeMan(Me.cmbDoctype.SelectedValue) = True Then
Dim oDokart As DocType = ComboBoxEdit1.SelectedItem
My.Application.Globix.CURRENT_DOCTYPE_ID = oDokart.Guid
If CheckWrite_IndexeMan(ComboBoxEdit1.SelectedItem) = True Then
'##### Manuelle Indexe indexiert #####
_Logger.Info("Datei [" & My.Application.Globix.CURRENT_WORKFILE & "] wird nun indexiert...")
If FillIndexe_Autom(Me.cmbDoctype.SelectedValue) = True Then
If FillIndexe_Autom(oDokart.Guid) = True Then
_Logger.Debug(" ...FillIndexe_Autom durchlaufen")
'Den Zielnamen zusammenbauen
@ -719,7 +877,7 @@ Public Class frmGlobix_Index
'Die Datei verschieben
If Move_File2_Target() = True Then
_Logger.Debug(" ...Move_File2_Target durchlaufen")
My.Application.Globix.CURRENT_LASTDOCTYPE = cmbDoctype.Text
My.Application.Globix.CURRENT_LASTDOCTYPE = oDokart.Name
_Logger.Info("Datei '" & My.Application.Globix.CURRENT_NEWFILENAME & "' erfolgreich erzeugt.")
Dim oDEL As String = "DELETE FROM TBGI_FILES_USER WHERE GUID = " & My.Application.Globix.CURRENT_WORKFILE_GUID
My.Database.ExecuteNonQuery(oDEL)

View File

@ -57,6 +57,47 @@ Module ModuleHelpers
Dim oSQL = "select * from TBGI_FUNCTION_REGEX"
My.Application.Globix.DT_FUNCTION_REGEX = clsDataASorDB.GetDatatable("DD_ECM", oSQL, "TBGI_FUNCTION_REGEX", "", "")
End Sub
Public Function GetConnectionString(id As Integer)
Dim connectionString As String = ""
Try
Dim oSQL = "SELECT * FROM TBDD_CONNECTION WHERE GUID = " & id
Dim DTConnection As DataTable = clsDataASorDB.GetDatatable("DD_ECM", oSQL, "TBDD_CONNECTION", "GUID = " & id, "")
If DTConnection.Rows.Count = 1 Then
Dim CSType = DTConnection.Rows(0).Item("SQL_PROVIDER").ToString.ToUpper
Select Case CSType
Case "MS-SQL".ToUpper
If DTConnection.Rows(0).Item("USERNAME").ToString.ToLower = "winauth" Then
connectionString = "Data Source=" & DTConnection.Rows(0).Item("SERVER") & ";Initial Catalog= " & DTConnection.Rows(0).Item("DATENBANK") & ";Trusted_Connection=True;"
Else
connectionString = "Data Source=" & DTConnection.Rows(0).Item("SERVER") & ";Initial Catalog= " & DTConnection.Rows(0).Item("DATENBANK") & ";User Id=" & DTConnection.Rows(0).Item("USERNAME") & ";Password=" & DTConnection.Rows(0).Item("PASSWORD") & ";"
End If
Case "MS-SQLServer".ToUpper
If DTConnection.Rows(0).Item("USERNAME").ToString.ToLower = "winauth" Then
connectionString = "Data Source=" & DTConnection.Rows(0).Item("SERVER") & ";Initial Catalog= " & DTConnection.Rows(0).Item("DATENBANK") & ";Trusted_Connection=True;"
Else
connectionString = "Data Source=" & DTConnection.Rows(0).Item("SERVER") & ";Initial Catalog= " & DTConnection.Rows(0).Item("DATENBANK") & ";User Id=" & DTConnection.Rows(0).Item("USERNAME") & ";Password=" & DTConnection.Rows(0).Item("PASSWORD") & ";"
End If
Case "Oracle".ToUpper
If DTConnection.Rows(0).Item("BEMERKUNG").ToString.Contains("without tnsnames") Then
connectionString = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=" & DTConnection.Rows(0).Item("SERVER") & ")(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=" &
DTConnection.Rows(0).Item("DATENBANK") & ")));User Id=" & DTConnection.Rows(0).Item("USERNAME") & ";Password=" & DTConnection.Rows(0).Item("PASSWORD") & ";"
Else
connectionString = "Data Source=" & DTConnection.Rows(0).Item("SERVER") & ";Persist Security Info=True;User Id=" & DTConnection.Rows(0).Item("USERNAME") & ";Password=" & DTConnection.Rows(0).Item("PASSWORD") & ";Unicode=True"
End If
Case Else
MsgBox("ConnectionType not integrated", MsgBoxStyle.Critical, "Please check connection:")
End Select
End If
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "Error in GetConnectionString:")
End Try
Return connectionString
End Function
Public Function FilterDatatable(myDatatable As DataTable, myFilter As String, mycheckColumn As String, pSortString As String, returnDT As Boolean) As Object
Try
If myDatatable.Rows.Count = 0 Then

View File

@ -35,12 +35,12 @@ Public Class ClassControlCreator
Private Logger As Logger
Private Property Form As frmSearchStart
Private Property TabPage As XtraTabPage
Public Class ControlMeta
Public Property IndexName As String
Public Property IndexType As String
Public Property MultipleValues As Boolean = False
End Class
''' <summary>
''' Standard Eigenschaften für alle Controls
''' </summary>

View File

@ -384,7 +384,6 @@ Public Class frmFlowSearch
End Sub
Private Function GET_DATE_LIMITATION(pInput As String) As String
Try
Dim oReturn As String
If SEARCH_FACT_DATE_ATTRIBUTE = "ADDED_WHEN" Then
Return pInput.Replace("@ATTRIBUTE", "OBJ.ADDED_WHEN")
Else

View File

@ -62,6 +62,9 @@
<Reference Include="DevExpress.XtraLayout.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.XtraPrinting.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.XtraTreeList.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DigitalData.GUIs.GlobalIndexer">
<HintPath>..\GUIs.GlobalIndexer\bin\Debug\DigitalData.GUIs.GlobalIndexer.dll</HintPath>
</Reference>
<Reference Include="Independentsoft.Msg">
<HintPath>P:\Visual Studio Projekte\Bibliotheken\MSG .NET\Bin\22_11_19\Independentsoft.Msg.dll</HintPath>
</Reference>