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

@ -23,6 +23,7 @@ Public Class ClassWindowLayout
oPath = Path.Combine(Application.UserAppDataPath(), pForm.Name & "-Layout.xml")
oAlternatePath = oPath.Replace("frm", "frmfrm")
If File.Exists(oAlternatePath) Then
Dim oNewFilename = Path.GetFileName(oPath)

View File

@ -134,6 +134,10 @@ Public Class ClassValidator
For Each oControl As Control In pPanel.Controls
If oControl.Name.StartsWith("lbl") Then
Continue For
End If
' ========================= TEXTBOX =========================
If oControl.Name.StartsWith("txt") Then
Dim oTextBox As DevExpress.XtraEditors.TextEdit = oControl

View File

@ -4,8 +4,18 @@
Public Property DocTypeName As String
Public Property DocTypeId As Integer
''' <summary>
''' WD_INDEX, Name of the Attribute
''' </summary>
Public Property Name As String
Public Property Comment As String
''' <summary>
''' INDEXNAME, Internal Name for Admin
''' </summary>
Public Property InternalName As String
''' <summary>
''' COMMENT, Caption in Index Form
''' </summary>
Public Property LabelCaption As String
Public Property DataType As String
Public Property Sequence As Integer
@ -16,7 +26,6 @@
Public Property DefaultValue As String
Public Property IsOptional As Boolean
Public Property IsActive As Boolean
Public Property IsMultiselect As Boolean
Public Property AllowAddingItems As Boolean
Public Property PreventMultleValue As Boolean

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

View File

@ -328,19 +328,6 @@ Public Class frmFlowForm
Private Sub PictureBoxSearch1_Click(sender As Object, e As EventArgs) Handles PictureBoxSearch1.Click
Open_FlowSearch()
'Cursor = Cursors.WaitCursor
'If TheFormIsAlreadyLoaded("frmSearchStart") Then
' Cursor = Cursors.Default
' Exit Sub
'End If
'Dim oForm As New frmSearchStart(DTIDB_SEARCHES) 'frmFlowSearch(osql)
'oForm.Show()
'Cursor = Cursors.Default
'If TimerCheckActiveForms.Enabled = False Then
' TimerCheckActiveForms.Enabled = True
'End If
End Sub
Private Sub ZooFlowBeendenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ZooFlowBeendenToolStripMenuItem.Click
@ -467,26 +454,24 @@ Public Class frmFlowForm
TimerCheckDroppedFiles.Start()
Me.Cursor = Cursors.WaitCursor
End If
PictureBoxDragDrop.Image = My.Resources._1_LOGO_ZOO_FLOW1
End Sub
Private Sub PictureBox1_DragDrop(sender As Object, e As DragEventArgs) Handles PictureBoxDragDrop.DragDrop
DragDropForm(e)
End Sub
Private Sub TimerCheckDroppedFiles_Tick(sender As Object, e As EventArgs) Handles TimerCheckDroppedFiles.Tick
Private Async Sub TimerCheckDroppedFiles_Tick(sender As Object, e As EventArgs) Handles TimerCheckDroppedFiles.Tick
If Not My.Application.ModulesActive.Contains(ClassConstants.MODULE_GLOBAL_INDEXER) Then
Exit Sub
End If
TimerCheckDroppedFiles.Stop()
Globix_Check_Dropped_Files()
Await Globix_Check_Dropped_Files()
Me.Cursor = Cursors.Default
End Sub
Sub Globix_Check_Dropped_Files()
Private Async Function Globix_Check_Dropped_Files() As Threading.Tasks.Task
Try
My.DatabaseECM.ExecuteNonQuery($"DELETE FROM TBGI_FILES_USER WHERE WORKED = 1 AND UPPER(USER@WORK) = UPPER('{Environment.UserName}')")
Await My.DatabaseECM.ExecuteNonQueryAsync($"DELETE FROM TBGI_FILES_USER WHERE WORKED = 1 AND UPPER(USER@WORK) = UPPER('{Environment.UserName}')")
Dim i As Integer
For Each pFile As String In FileDrop.files_dropped
@ -503,7 +488,7 @@ Public Class frmFlowForm
Dim sql As String = "SELECT * FROM TBGI_FILES_USER WHERE WORKED = 0 AND UPPER(USER@WORK) = UPPER('" & Environment.UserName & "')"
My.Application.Globix.DTACTUAL_FILES = Nothing
My.Application.Globix.DTACTUAL_FILES = My.DatabaseECM.GetDatatable(sql)
My.Application.Globix.DTACTUAL_FILES = Await My.DatabaseECM.GetDatatableAsync(sql)
My.Application.Globix.ABORT_INDEXING = False
Dim oOnlyFilesFromFilesystem = True
@ -532,6 +517,7 @@ Public Class frmFlowForm
Logger.Info(" CURRENT_WORKFILE: {0}", My.Application.Globix.CurrentWorkfile)
If IO.File.Exists(My.Application.Globix.CurrentWorkfile.FilePath) = True And My.Application.Globix.DTACTUAL_FILES.Rows.Count > 0 Then
Globix_Open_IndexDialog()
PictureBoxDragDrop.Image = My.Resources._1_LOGO_ZOO_FLOW1
End If
Next
Show()
@ -540,7 +526,7 @@ Public Class frmFlowForm
Show()
End Try
End Sub
End Function
Sub Globix_Open_IndexDialog()
Try
IndexForm = New frmGlobix_Index(My.LogConfig)

View File

@ -1,10 +1,10 @@
Imports DigitalData.Modules.Database
Public Class Environment
Public User As State.UserState
Public Settings As State.SettingsState
Public Service As State.ServiceState
Public Database As MSSQLServer
Public DatabaseIDB As MSSQLServer
Public Modules As Dictionary(Of String, State.ModuleState)
Public Property User As State.UserState
Public Property Settings As State.SettingsState
Public Property Service As State.ServiceState
Public Property Database As MSSQLServer
Public Property DatabaseIDB As MSSQLServer
Public Property Modules As Dictionary(Of String, State.ModuleState)
End Class

View File

@ -16,6 +16,10 @@
Public Overrides Function ToString() As String
Return Name
End Function
Public Overrides Function GetHashCode() As Integer
Return Name.GetHashCode()
End Function
End Class
Public Class AutoAttributeValue

View File

@ -119,16 +119,16 @@ Namespace Methods.GlobalIndexer
For Each oRow As DataRow In oManualIndexes.Table.Rows
Dim oManualIndex As New ManualIndex With {
.Id = oRow.ItemEx(Of Integer)("GUID"),
.Name = oRow.ItemEx(Of String)("INDEXNAME"),
.ProfileId = oRow.ItemEx(Of Integer)("DOCTYPE_ID"),
.IsOptional = oRow.ItemEx(Of Boolean)("OPTIONAL"),
.IsMultiselect = oRow.ItemEx(Of String)("MULTISELECT"),
.SQLCommand = oRow.ItemEx(Of String)("SQL_RESULT"),
.SQLConnectionId = oRow.ItemEx(Of Integer)("CONNECTION_ID"),
.DefaultValue = oRow.ItemEx(Of String)("DEFAULT_VALUE"),
.DataType = oRow.ItemEx(Of String)("DATA_TYPE")
}
.Id = oRow.ItemEx(Of Integer)("GUID"),
.Name = oRow.ItemEx(Of String)("INDEXNAME"),
.ProfileId = oRow.ItemEx(Of Integer)("DOK_ID"),
.IsOptional = oRow.ItemEx(Of Boolean)("OPTIONAL"),
.IsMultiselect = oRow.ItemEx(Of String)("MULTISELECT"),
.SQLCommand = oRow.ItemEx(Of String)("SQL_RESULT"),
.SQLConnectionId = oRow.ItemEx(Of Integer)("CONNECTION_ID"),
.DefaultValue = oRow.ItemEx(Of String)("DEFAULT_VALUE"),
.DataType = oRow.ItemEx(Of String)("DATATYPE")
}
oIndexes.Add(oManualIndex)
Next