ZooFlow: switch to Checkedit, small changes in frmIndex

This commit is contained in:
Jonathan Jenne 2021-12-15 13:53:30 +01:00
parent df2eed96e8
commit 3820c1a611
8 changed files with 106 additions and 78 deletions

View File

@ -18,6 +18,7 @@ Public Class ControlCreator
Private Const TYPE_BOOLEAN = "BOOLEAN"
Private Const TYPE_DATE = "DATE"
Private Const TYPE_INTEGER = "INTEGER"
Private Const TYPE_VARCHAR = "VARCHAR"
Private Const PLACEHOLDER_NULL = "$NULL"
Private Const VECTORSEPARATOR = ""
@ -34,11 +35,14 @@ 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 ControlType 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
@ -46,6 +50,17 @@ Public Class ControlCreator
Me.Logger = LogConfig.GetLogger
End Sub
Function AddLabel(pIndexName As String, hinweis As String, ylbl As Integer, anz As String) As Label
Dim lbl As New Label With {
.Name = "lbl" & pIndexName,
.AutoSize = True,
.Text = hinweis,
.Location = New Point(11, ylbl)
}
Return lbl
End Function
Public Function AddDateTimePicker(pIndexname As String, pY As Integer, pDefaultValue As String) As DateEdit
Dim oPicker As New DateEdit With {
.Name = "dtp" & pIndexname,
@ -53,7 +68,8 @@ Public Class ControlCreator
.Location = New Point(DEFAULT_POSITION_X, pY),
.Tag = New ControlMeta() With {
.IndexName = pIndexname,
.IndexType = TYPE_DATE
.IndexType = TYPE_DATE,
.ControlType = "dtp"
}
}
@ -73,9 +89,10 @@ Public Class ControlCreator
.Name = "txt" & pIndexname,
.Size = New Size(DEFAULT_WIDTH, DEFAULT_HEIGHT),
.Location = New Point(DEFAULT_POSITION_X, pY),
.Tag = New ControlMeta() With {
.Tag = New ControlMeta() With {
.IndexName = pIndexname,
.IndexType = pDataType
.IndexType = pDataType,
.ControlType = "txt"
}
}
@ -98,12 +115,12 @@ Public Class ControlCreator
Return oEdit
End Function
Public Sub OnTextBoxFocus(sender As TextEdit, e As EventArgs)
Private Sub OnTextBoxFocus(sender As TextEdit, e As EventArgs)
sender.BackColor = HightlightColor
sender.SelectAll()
End Sub
Public Sub OnTextBoxTextChanged(sender As TextEdit, e As System.EventArgs)
Private Sub OnTextBoxTextChanged(sender As TextEdit, e As System.EventArgs)
Using oGraphics As Graphics = sender.CreateGraphics()
Dim oNewWidth = oGraphics.MeasureString(sender.Text, sender.Font).Width + 15
If oNewWidth >= DEFAULT_WIDTH Then
@ -112,11 +129,11 @@ Public Class ControlCreator
End Using
End Sub
Public Sub OnTextBoxLostFocus(sender As TextEdit, e As EventArgs)
Private Sub OnTextBoxLostFocus(sender As TextEdit, e As EventArgs)
sender.BackColor = Color.White
End Sub
Public Sub OnTextBoxKeyUp(sender As TextEdit, e As KeyEventArgs)
Private Sub OnTextBoxKeyUp(sender As TextEdit, e As KeyEventArgs)
If sender.Text = String.Empty Then
Exit Sub
End If
@ -130,17 +147,18 @@ Public Class ControlCreator
End If
End Sub
Public Function AddCheckBox(pIndexname As String, pY As Integer, pDefaultValue As String, pCaption As String)
Public Function AddCheckBox(pIndexname As String, pY As Integer, pDefaultValue As String, pCaption As String) As CheckEdit
Try
Dim oValue As Boolean = False
Dim oCheckBox As New CheckBox With {
Dim oCheckBox As New CheckEdit With {
.Name = "chk" & pIndexname,
.AutoSize = False,
.Size = New Size(DEFAULT_WIDTH, DEFAULT_HEIGHT),
.Location = New Point(DEFAULT_POSITION_X, pY),
.Tag = New ControlMeta() With {
.IndexName = pIndexname,
.IndexType = TYPE_BOOLEAN
.IndexType = TYPE_BOOLEAN,
.ControlType = "chk"
}
}
@ -178,7 +196,8 @@ Public Class ControlCreator
.Name = "cmbMulti" & pIndexname,
.Tag = New ControlMeta() With {
.IndexName = pIndexname,
.IndexType = pDataType
.IndexType = pDataType,
.ControlType = "cmbMulti"
}
}

View File

@ -1,4 +1,4 @@
Public Class ControlMeta
Public Class _ControlMeta
Public Property IndexName As String
Public Property IndexType As String
Public Property MultipleValues As Boolean = False

View File

@ -1,5 +1,4 @@
Imports System.ComponentModel
Imports DigitalData.GUIs.ZooFlow.My
Imports DigitalData.Modules.Logging
Public Class ClassInitLoader
@ -76,7 +75,7 @@ Public Class ClassInitLoader
Dim oPercentComplete As Integer = CInt(Math.Truncate(oStepCounter / Steps.Count * 100))
_Worker.ReportProgress(oPercentComplete)
Threading.Thread.Sleep(200)
Threading.Thread.Sleep(100)
Next
e.Result = oMyApplication

View File

@ -5,6 +5,8 @@ Imports DigitalData.GUIs.ZooFlow.frmGlobix_Index
Imports DigitalData.Modules.EDMI.API
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
Imports DigitalData.Modules.Logging
Imports DigitalData.GUIs.GlobalIndexer.ControlCreator
Imports DevExpress.XtraEditors
Public Class ClassValidator
Inherits BaseClass
@ -18,19 +20,30 @@ Public Class ClassValidator
ManualIndexes = pManualIndexes
End Sub
Public Function GetControlMeta(pControl As Control) As ControlMeta
Dim oMeta As ControlMeta = Nothing
If TypeOf pControl.Tag Is ControlMeta Then
oMeta = DirectCast(pControl.Tag, ControlMeta)
End If
Return oMeta
End Function
Function ValidateControls(pPanel As Panel, pDocType As DocType) As Boolean
Try
Logger.Debug("Starting [ValidateControls]")
Dim result As Boolean = True
For Each oControl As Control In pPanel.Controls
Dim oMeta As ControlMeta = GetControlMeta(oControl)
If oControl.Name.StartsWith("lbl") Then
' Labels do not need to validated
If TypeOf oControl Is Label Then
Continue For
End If
' ========================= TEXT BOX =========================
If oControl.Name.StartsWith("txt") Then
If oMeta.ControlType = "txt" Then
Dim oTextBox As DevExpress.XtraEditors.TextEdit = oControl
If oTextBox.Text = "" Then
Dim oIndexName = GetIndexName(oTextBox, "txt")
@ -45,7 +58,7 @@ Public Class ClassValidator
End If
' ========================= LOOKUP =========================
If oControl.Name.StartsWith("cmbMulti") Then
If oMeta.ControlType = "cmbMulti" Then
Dim oLookup = DirectCast(oControl, LookupControl3)
Dim oValues As List(Of String) = oLookup.Properties.SelectedValues
@ -60,7 +73,8 @@ Public Class ClassValidator
End If
End If
ElseIf oControl.Name.StartsWith("cmbSingle") Then
End If
If oMeta.ControlType = "cmbSingle" Then
Dim cmbSingle As TextBox = oControl
If cmbSingle.Text = "" Then
@ -73,9 +87,10 @@ Public Class ClassValidator
Return False
End If
End If
End If
ElseIf oControl.Name.StartsWith("cmb") Then
Dim cmb As ComboBox = oControl
If oMeta.ControlType = "cmb" Then
Dim cmb As Windows.Forms.ComboBox = oControl
If cmb.Text = "" Then
Dim oIndexName = GetIndexName(cmb, "cmb")
Dim oOptional = TestIsIndexOptional(pDocType, oIndexName)
@ -86,11 +101,10 @@ Public Class ClassValidator
Return False
End If
End If
End If
' ========================= DATE PICKER =========================
If oControl.Name.StartsWith("dtp") Then
If oMeta.ControlType = "dtp" Then
Dim dtp As DevExpress.XtraEditors.DateEdit = oControl
Dim oIndexName As String = GetIndexName(dtp, "dtp")
@ -106,19 +120,11 @@ Public Class ClassValidator
End If
' ========================= CHECK BOX =========================
If oControl.Name.StartsWith("chk") Then
Dim chk As CheckBox = oControl
If oMeta.ControlType = "chk" Then
'TODO: Implement Itermediate state and then validation for checkbox
Dim chk As CheckEdit = oControl
'result = True
End If
'If TypeOf (oControl) Is Button Then
' Continue For
'End If
'If oControl.Name.StartsWith("lbl") = False And result = False Then
' Logger.Info("Die Überprüfung der manuellen Indices ist fehlerhaft. Bitte informieren Sie den Systembetreuer")
' Return False
'End If
Next
Return True
@ -133,13 +139,15 @@ Public Class ClassValidator
Dim oAttributeValues As New List(Of UserAttributeValue)
For Each oControl As Control In pPanel.Controls
Dim oMeta As ControlMeta = GetControlMeta(oControl)
If oControl.Name.StartsWith("lbl") Then
' Labels do not have values
If TypeOf oControl Is Label Then
Continue For
End If
' ========================= TEXTBOX =========================
If oControl.Name.StartsWith("txt") Then
If oMeta.ControlType = "txt" Then
Dim oTextBox As DevExpress.XtraEditors.TextEdit = oControl
Dim oIndexName = GetIndexName(oTextBox, "txt")
@ -155,7 +163,7 @@ Public Class ClassValidator
End If
' ========================= LOOKUP =========================
If oControl.Name.StartsWith("cmbMulti") Then
If oMeta.ControlType = "cmbMulti" Then
Dim oLookup = DirectCast(oControl, LookupControl3)
Dim oValues As List(Of String) = oLookup.Properties.SelectedValues
Dim oIndexName = GetIndexName(oLookup, "cmbMulti")
@ -170,7 +178,9 @@ Public Class ClassValidator
})
ElseIf oControl.Name.StartsWith("cmbSingle") Then
End If
If oMeta.ControlType = "cmbSingle" Then
Dim cmbSingle As TextBox = oControl
Dim oIndexName = GetIndexName(cmbSingle, "cmbSingle")
@ -178,12 +188,13 @@ Public Class ClassValidator
End If
oAttributeValues.Add(New UserAttributeValue With {
.Name = oIndexName,
.Values = WrapIndexValue(cmbSingle.Text),
.ControlName = cmbSingle.Name
})
.Name = oIndexName,
.Values = WrapIndexValue(cmbSingle.Text),
.ControlName = cmbSingle.Name
})
End If
ElseIf oControl.Name.StartsWith("cmb") Then
If oMeta.ControlType = "cmb" Then
Dim cmb As ComboBox = oControl
Dim oIndexName = GetIndexName(cmb, "cmb")
@ -198,7 +209,7 @@ Public Class ClassValidator
End If
' ========================= DATE PICKER =========================
If oControl.Name.StartsWith("dtp") Then
If oMeta.ControlType = "dtp" Then
Dim dtp As DevExpress.XtraEditors.DateEdit = oControl
Dim oIndexName As String = GetIndexName(dtp, "dtp")
@ -210,8 +221,8 @@ Public Class ClassValidator
End If
' ========================= CHECK BOX =========================
If oControl.Name.StartsWith("chk") Then
Dim chk As CheckBox = oControl
If oMeta.ControlType = "chk" Then
Dim chk As CheckEdit = oControl
Dim oIndexName As String = GetIndexName(chk, "chk")

View File

@ -113,9 +113,7 @@ Partial Class frmGlobix_Index
'
'checkItemTopMost
'
Me.checkItemTopMost.BindableChecked = True
Me.checkItemTopMost.Caption = "Andere Fenster überdecken"
Me.checkItemTopMost.Checked = True
Me.checkItemTopMost.Id = 6
Me.checkItemTopMost.ImageOptions.SvgImage = CType(resources.GetObject("checkItemTopMost.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage)
Me.checkItemTopMost.Name = "checkItemTopMost"

View File

@ -520,6 +520,6 @@
</value>
</data>
<metadata name="GlobixDataset.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
<value>189, 17</value>
</metadata>
</root>

View File

@ -14,6 +14,7 @@ Imports DigitalData.Modules.Language
Imports DigitalData.Modules.Language.Utils
Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.Patterns
Imports DevExpress.XtraEditors
Public Class frmGlobix_Index
#Region "+++++ Variablen ++++++"
@ -69,7 +70,7 @@ Public Class frmGlobix_Index
My.Application.Globix.INDEXING_ACTIVE = True
End Sub
Private Sub frmGlobix_Index_Shown(sender As Object, e As EventArgs) Handles Me.Shown
Private Async Sub frmGlobix_Index_Shown(sender As Object, e As EventArgs) Handles Me.Shown
Cursor = Cursors.Default
SplashScreenManager.ShowWaitForm()
@ -85,7 +86,7 @@ Public Class frmGlobix_Index
My.Application.Globix.CURRENT_ISATTACHMENT = False
Dim oSql = $"SELECT HANDLE_TYPE FROM TBGI_FILES_USER WHERE GUID = {My.Application.Globix.CurrentWorkfile.Id}"
DropType = My.DatabaseECM.GetScalarValue(oSql)
DropType = Await My.DatabaseECM.GetScalarValueAsync(oSql)
My.Application.Globix.DeleteOriginalFile = My.UIConfig.Globix.DeleteOriginalFile
SplitContainerControl1.SplitterPosition = My.UIConfig.Globix.SplitterDistanceViewer
@ -111,7 +112,7 @@ Public Class frmGlobix_Index
SetFilePreview(My.UIConfig.Globix.FilePreview)
MultifileCount = My.DatabaseECM.GetScalarValue("SELECT COUNT(*) FROM TBGI_FILES_USER WHERE WORKED = 0 AND GUID <> " & My.Application.Globix.CurrentWorkfile.Id & " AND UPPER(USER@WORK) = UPPER('" & Environment.UserName & "')")
MultifileCount = Await My.DatabaseECM.GetScalarValueAsync("SELECT COUNT(*) FROM TBGI_FILES_USER WHERE WORKED = 0 AND GUID <> " & My.Application.Globix.CurrentWorkfile.Id & " AND UPPER(USER@WORK) = UPPER('" & Environment.UserName & "')")
My.Application.Globix.MULTIINDEXING_ACTIVE = False
If MultifileCount > 0 Then
@ -146,7 +147,7 @@ Public Class frmGlobix_Index
End If
Else
oSql = "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)
Dim oRegexDoctypeTable = Database.GetDatatable("DTTBGI_REGEX_DOCTYPE", oSql, ECM)
For Each oRoW As DataRow In oRegexDoctypeTable.Rows
Dim oOnlyFilename = Path.GetFileName(My.Application.Globix.CurrentWorkfile.FilePath)
@ -380,23 +381,6 @@ Public Class frmGlobix_Index
End Try
End Function
Sub addLabel(pIndexName As String, hinweis As String, ylbl As Integer, anz As String)
Dim lbl As New Label With {
.Name = "lbl" & pIndexName,
.AutoSize = True,
.Text = hinweis,
.Location = New Point(11, ylbl)
}
pnlIndex.Controls.Add(lbl)
End Sub
Sub ShowError(text As String)
'lblerror.Visible = True
'lblerror.Text = text
'lblerror.ForeColor = Color.Red
labelError.Visibility = DevExpress.XtraBars.BarItemVisibility.Always
labelError.Caption = text
End Sub
Private Sub LoadIndexe_Man(pManualIndexes As List(Of ManualIndex))
Try
@ -430,7 +414,7 @@ Public Class frmGlobix_Index
Dim oDataType = oIndex.DataType
If oDataType <> "BOOLEAN" Then
addLabel(oControlName, oIndex.LabelCaption, oLabelPosition, oControlCount)
oControls.AddLabel(oControlName, oIndex.LabelCaption, oLabelPosition, oControlCount)
End If
'Dim oDefaultValue = Check_HistoryValues(oControlName, oIndex.DocTypeName)
@ -444,7 +428,7 @@ Public Class frmGlobix_Index
Select Case oIndex.DataType
Case "BOOLEAN"
Dim oCheckbox As CheckBox = oControls.AddCheckBox(oControlName, oControlPosition, oDefaultValue, oIndex.LabelCaption)
Dim oCheckbox = oControls.AddCheckBox(oControlName, oControlPosition, oDefaultValue, oIndex.LabelCaption)
oControl = oCheckbox
Case "INTEGER"
@ -504,7 +488,7 @@ Public Class frmGlobix_Index
End If
Try
Dim oMeta = DirectCast(pControl.Tag, GlobalIndexer.ControlMeta)
Dim oMeta = DirectCast(pControl.Tag, ControlCreator.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)
@ -552,7 +536,7 @@ Public Class frmGlobix_Index
Continue For
End If
Dim oMeta = DirectCast(oControl.Tag, GlobalIndexer.ControlMeta)
Dim oMeta = DirectCast(oControl.Tag, ControlCreator.ControlMeta)
Dim oIndex As String = oMeta.IndexName
If oIndex = IndexName Then
@ -628,6 +612,10 @@ Public Class frmGlobix_Index
Return oResult
End Function
Sub ShowError(text As String)
labelError.Visibility = DevExpress.XtraBars.BarItemVisibility.Always
labelError.Caption = text
End Sub
Sub ClearError()
labelError.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
@ -783,7 +771,6 @@ Public Class frmGlobix_Index
Logger.Info("Imported file got ObjectId [{0}]", oResult.ObjectId)
If oResult.OK Then
MsgBox("Die Datei wurde erfolgreich verarbeitet!", MsgBoxStyle.Information, Text)
Return True
Else
Logger.Warn("Import failed with message: [{0}] and details [{1}]", oResult.ErrorMessage, oResult.ErrorDetails)
@ -812,6 +799,16 @@ Public Class frmGlobix_Index
Logger.Info("Importing file with DocumentType [{0}]", oDokart.Name)
Dim oResult = Await GlobixFlowNew(oDokart)
If oResult = True Then
'Dim oArgs As New XtraMessageBoxArgs With {
' .LookAndFeel = LookAndFeel,
' .Text = "Die Datei wurde erfolgreich verarbeitet!",
' .Caption = Text
'}
'oArgs.AutoCloseOptions.Delay = 3000
'oArgs.AutoCloseOptions.ShowTimerOnDefaultButton = True
''oArgs.DoNotShowAgainCheckBoxVisible = True
'XtraMessageBox.Show(oArgs)
DocumentViewer1.CloseDocument()
DocumentViewer1.Done()
@ -821,11 +818,15 @@ Public Class frmGlobix_Index
End Sub
Private Sub PreviewItem_CheckedChanged(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles PreviewItem.CheckedChanged
SetFilePreview(PreviewItem.Checked)
If FormLoaded Then
SetFilePreview(PreviewItem.Checked)
End If
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()
If FormLoaded Then
My.UIConfig.Globix.TopMost = checkItemTopMost.Checked
My.UIConfigManager.Save()
End If
End Sub
End Class

View File

@ -85,7 +85,7 @@ namespace ZUGFeRDRESTService.Controllers
{
_logger.Debug("Start processing request to ValidationController");
CrossIndustryDocumentType oDocument;
object oDocument;
PropertyValues.CheckPropertyValuesResult oResult = new PropertyValues.CheckPropertyValuesResult();
try