ZooFlow/EDMIService: clean up, fix column names in sql

This commit is contained in:
Jonathan Jenne
2021-12-14 15:50:35 +01:00
parent 1dd8639835
commit 55ef1c016d
8 changed files with 79 additions and 70 deletions

View File

@@ -26,7 +26,6 @@ Public Class frmGlobix_Index
Private Const TEXT_MISSING_INPUT = "Bitte vervollständigen Sie die Eingaben!"
Private Property MultifileCount As Integer
Public Property DT_VWGI_DOCTYPE As DataTable
Public Property FormLoaded As Boolean = False
Public Property DropType As String
@@ -39,11 +38,11 @@ Public Class frmGlobix_Index
Private Property Database As DatabaseWithFallback
Private Property Patterns2 As Patterns2
Public Class ControlMeta
Public Property IndexName As String
Public Property IndexType As String
Public Property MultipleValues As Boolean = False
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(pLogConfig As LogConfig)
@@ -153,7 +152,7 @@ Public Class frmGlobix_Index
End If
Else
Dim oSQL As String = "SELECT DISTINCT T1.DOCTYPE as DocType, T.* FROM TBGI_REGEX_DOCTYPE T, VWGI_DOCTYPE T1 WHERE T.DOCTYPE_ID = T1.DOCTYPE_ID"
Dim oSQL As String = "SELECT DISTINCT T1.DOCTYPE as DocType, T.* FROM TBGI_REGEX_DOCTYPE T, VWGI_DOCTYPE_USER T1 WHERE T.DOCTYPE_ID = T1.DOCTYPE_ID"
Dim oRegexDoctypeTable = Database.GetDatatable("DTTBGI_REGEX_DOCTYPE", oSQL, ECM)
For Each oRoW As DataRow In oRegexDoctypeTable.Rows
@@ -296,21 +295,24 @@ Public Class frmGlobix_Index
End Sub
Sub Refresh_Dokart()
Try
Dim oSql = String.Format("SELECT * FROM VWGI_DOCTYPE_IDB where UPPER(USERNAME) = UPPER('{0}') ORDER BY SEQUENCE", My.Application.User.UserName)
DT_VWGI_DOCTYPE = Database.GetDatatable("VWGI_DOCTYPE_IDB", oSql, ECM, pSortByColumn:="SEQUENCE")
Dim oDocTypes As New List(Of DocType)
Dim oSql = String.Format("SELECT * FROM VWGI_DOCTYPE_USER WHERE AKTIV = 1 AND USERNAME = '{0}' ORDER BY SEQUENCE", My.Application.User.UserName)
Dim oTable = Database.GetDatatable("VWGI_DOCTYPE_USER", oSql, ECM,
pSortByColumn:="SEQUENCE",
pFilterExpression:=$"AKTIV = 1 AND USERNAME = '{My.Application.User.UserName}'")
For Each oRow As DataRow In DT_VWGI_DOCTYPE.Rows
For Each oRow As DataRow In oTable.Rows
Dim oDocType = New DocType With {
.Guid = oRow.Item("DOCTYPE_ID"),
.Name = oRow.Item("DOCTYPE"),
.ObjectStore = oRow.Item("OBJECT_STORE")
.ObjectStore = oRow.Item("OBJECT_ST_NAME")
}
oDocTypes.Add(oDocType)
cmbDocType.Properties.Items.Add(oDocType)
Next
DocTypes = oDocTypes
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:")
@@ -331,7 +333,7 @@ Public Class frmGlobix_Index
'My.Application.Globix.CURRENT_DOCTYPE_DuplicateHandling = My.Application.Globix.CURR_DT_DOCTYPE.Rows(0).Item("DUPLICATE_HANDLING").ToString
ManualIndexes = Refresh_IndexeMan(oSelectedItem.Guid)
LoadIndexe_Man()
LoadIndexe_Man(ManualIndexes)
End If
End Sub
@@ -342,13 +344,13 @@ Public Class frmGlobix_Index
T1.BEZEICHNUNG AS DOKUMENTART, T.*
FROM TBDD_INDEX_MAN T,
TBDD_DOKUMENTART T1
WHERE T.ACTIVE = 1 AND
T.DOK_ID = T1.GUID AND
WHERE T.DOK_ID = T1.GUID AND
T.DOK_ID = {dokartid}
ORDER BY T.SEQUENCE"
Dim oFilter = "DOK_ID = " & dokartid
Dim oTable = My.Database.GetDatatable("DT_INDEXE_MAN", oSql, Modules.EDMI.API.Constants.DatabaseType.ECM, pSortByColumn:="SEQUENCE")
Dim oTable = My.Database.GetDatatable("VWDDINDEX_MAN", oSql, ECM,
pSortByColumn:="SEQUENCE")
Dim oManualIndexes As New List(Of ManualIndex)
@@ -357,8 +359,9 @@ Public Class frmGlobix_Index
.Id = oRow.ItemEx(Of Integer)("GUID"),
.DocTypeId = oRow.ItemEx(Of Integer)("DOK_ID"),
.DocTypeName = oRow.ItemEx(Of String)("DOKUMENTART"),
.Name = oRow.ItemEx(Of String)("NAME"),
.Comment = oRow.ItemEx(Of String)("COMMENT"),
.Name = oRow.ItemEx(Of String)("WD_INDEX"),
.InternalName = oRow.ItemEx(Of String)("INDEXNAME"),
.LabelCaption = oRow.ItemEx(Of String)("COMMENT"),
.DataType = oRow.ItemEx(Of String)("DATATYPE"),
.Sequence = oRow.ItemEx("SEQUENCE", 0),
.SQLCommand = oRow.ItemEx("SQL_RESULT", String.Empty),
@@ -366,7 +369,6 @@ Public Class frmGlobix_Index
.SQLSuggestion = oRow.ItemEx("SUGGESTION", String.Empty),
.DefaultValue = oRow.ItemEx("DEFAULT_VALUE", String.Empty),
.IsOptional = oRow.ItemEx(Of Integer)("OPTIONAL", False),
.IsActive = oRow.ItemEx("ACTIVE", False),
.IsMultiselect = oRow.ItemEx("MULTISELECT", False)
}
@@ -399,7 +401,7 @@ Public Class frmGlobix_Index
labelError.Caption = text
End Sub
Private Sub LoadIndexe_Man()
Private Sub LoadIndexe_Man(pManualIndexes As List(Of ManualIndex))
Try
Dim oScreen As New DigitalData.Modules.Windows.Screen()
Dim oDpiScale = oScreen.GetScreenScaling(Me)
@@ -417,22 +419,21 @@ Public Class frmGlobix_Index
Logger.Info("Loading Indicies for Screen Scaling Factor [{0}]", oDpiScale)
If ManualIndexes Is Nothing OrElse ManualIndexes.Count = 0 Then
If pManualIndexes Is Nothing OrElse pManualIndexes.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")
End If
For Each oIndex As ManualIndex In ManualIndexes
For Each oIndex As ManualIndex In pManualIndexes
Dim MultiSelect As Boolean = oIndex.IsMultiselect
Dim AddNewItems As Boolean = oIndex.AllowAddingItems
Dim PreventDuplicates As Boolean = oIndex.PreventMultleValue
Dim oControlName As String = oIndex.Name
Dim oConnectionId = oIndex.SQLConnection
Dim oSQLSuggestion = oIndex.SQLSuggestion
Dim oDataType = oIndex.DataType
If oDataType <> "BOOLEAN" Then
addLabel(oControlName, oIndex.Comment, oLabelPosition, oControlCount)
addLabel(oControlName, oIndex.LabelCaption, oLabelPosition, oControlCount)
End If
'Dim oDefaultValue = Check_HistoryValues(oControlName, oIndex.DocTypeName)
@@ -440,14 +441,13 @@ Public Class frmGlobix_Index
' 'oDefaultValue = GetPlaceholderValue(oIndex.DefaultValue, My.Application.Globix.CURRENT_WORKFILE)
'End If
Dim oDefaultValue = GetPlaceholderValue(oIndex.DefaultValue, My.Application.Globix.CurrentWorkfile.FilePath)
Dim oControl As Control = Nothing
Dim oHasSqlCommand = (oSQLSuggestion = True And oIndex.SQLCommand.Length > 0)
Dim oHasSqlCommand = (oConnectionId > 0 And oIndex.SQLCommand.Length > 0)
Dim oNeedsLookup As Boolean = oHasSqlCommand Or MultiSelect = True
Select Case oIndex.DataType
Case "BOOLEAN"
Dim oCheckbox As CheckBox = oControls.AddCheckBox(oControlName, oControlPosition, oDefaultValue, oIndex.Comment)
Dim oCheckbox As CheckBox = oControls.AddCheckBox(oControlName, oControlPosition, oDefaultValue, oIndex.LabelCaption)
oControl = oCheckbox
Case "INTEGER"
@@ -474,7 +474,7 @@ Public Class frmGlobix_Index
MsgBox("Please check Datatype of Indexvalue!", MsgBoxStyle.Critical, "Warning:")
End If
Logger.Warn(" - Datentyp nicht hinterlegt - LoadIndexe_Man")
Logger.Warn("DataType [{0}] not implemented!", oIndex.DataType)
End Select
If Not IsNothing(oControl) Then
@@ -507,7 +507,7 @@ Public Class frmGlobix_Index
End If
Try
Dim oMeta = DirectCast(pControl.Tag, ControlMeta)
Dim oMeta = DirectCast(pControl.Tag, GlobalIndexer.ControlMeta)
Dim oIndexName As String = oMeta.IndexName
Dim oSQL = $"SELECT * FROM TBDD_INDEX_MAN WHERE SQL_RESULT LIKE '%{oIndexName}%' AND DOK_ID = {SelectedDocType.Guid}"
Dim oDatatable As DataTable = My.DatabaseECM.GetDatatable(oSQL)
@@ -555,7 +555,7 @@ Public Class frmGlobix_Index
Continue For
End If
Dim oMeta = DirectCast(oControl.Tag, ControlMeta)
Dim oMeta = DirectCast(oControl.Tag, GlobalIndexer.ControlMeta)
Dim oIndex As String = oMeta.IndexName
If oIndex = IndexName Then
@@ -790,7 +790,7 @@ Public Class frmGlobix_Index
Return True
Else
Logger.Warn("Import failed with message: [{0}] and details [{1}]", oResult.ErrorMessage, oResult.ErrorDetails)
MsgBox($"Die Datei wurde nicht verarbeitet. Fehler: [{oResult.ErrorMessage}]", MsgBoxStyle.Critical, Text)
MsgBox($"Die Datei wurde nicht verarbeitet.{vbNewLine}{vbNewLine}Fehler: {oResult.ErrorMessage}", MsgBoxStyle.Critical, Text)
Return False
End If
@@ -826,4 +826,9 @@ Public Class frmGlobix_Index
Private Sub PreviewItem_CheckedChanged(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles PreviewItem.CheckedChanged
SetFilePreview(PreviewItem.Checked)
End Sub
Private Sub checkItemTopMost_CheckedChanged(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles checkItemTopMost.CheckedChanged
My.UIConfig.Globix.TopMost = checkItemTopMost.Checked
My.UIConfigManager.Save()
End Sub
End Class