This commit is contained in:
2023-06-15 17:08:47 +02:00
26 changed files with 1171 additions and 1856 deletions

View File

@@ -7,6 +7,7 @@ Imports DigitalData.Modules.Language.Utils
Imports System.IO
Imports DigitalData.Modules.EDMI.API.DatabaseWithFallback
Imports DigitalData.Modules.EDMI.API.Constants
Imports DevExpress.XtraEditors
Public Class frmMassValidator
Private DTCONTROLS As DataTable
@@ -24,6 +25,7 @@ Public Class frmMassValidator
Private CTRLS_Loaded As Boolean = False
Private FORM_Shown As Boolean = False
Private _dependingControl_in_action As Boolean = False
Private ControlCreator As ClassControlCreator
Private oErrorMessage As String
Private _windream As New ClassWindream_allgemein
@@ -42,6 +44,7 @@ Public Class frmMassValidator
'_windreamPM = New ClassPMWindream()
'_windreamPM.Create_Session()
ControlCreator = New ClassControlCreator(LOGCONFIG)
LOGGER.Debug("windream initialized frmMassValidator")
@@ -143,9 +146,9 @@ Public Class frmMassValidator
Dim oControl As Control
oLastControl = $"CtrlName {oControlRow.Item("NAME")}, CtrlIndexname: {oControlRow.Item("INDEX_NAME")}"
Select Case oControlRow.Item("CTRL_TYPE").ToString.ToUpper
Case "TXT"
Case ClassControlCreator.PREFIX_TEXTBOX
LOGGER.Debug("Versuch TXT zu laden")
Dim txt As TextBox = ClassControlCreator.CreateExistingTextbox(oControlRow, False)
Dim txt As TextEdit = ControlCreator.CreateExistingTextbox(oControlRow, False)
AddHandler txt.GotFocus, AddressOf OnTextBoxFocus
AddHandler txt.LostFocus, AddressOf OnTextBoxLostFocus
@@ -154,19 +157,19 @@ Public Class frmMassValidator
oControl = txt
Case "LBL"
LOGGER.Debug("Versuch LBL zu laden")
oControl = ClassControlCreator.CreateExistingLabel(oControlRow, False)
oControl = ControlCreator.CreateExistingLabel(oControlRow, False)
Case "CMB"
LOGGER.Debug("Versuch CMB zu laden")
If oControlRow.Item("READ_ONLY") Then
Dim cmbReadonly = ClassControlCreator.CreateExistingTextbox(oControlRow, False)
Dim cmbReadonly = ControlCreator.CreateExistingTextbox(oControlRow, False)
oControl = cmbReadonly
Else
Dim cmb = ClassControlCreator.CreateExistingCombobox(oControlRow, False)
Dim cmb = ControlCreator.CreateExistingCombobox(oControlRow, False)
AddHandler cmb.SelectedValueChanged, AddressOf OnCmbselectedIndex
#Region "CONTROL LIST"
If ClassControlCreator.GET_CONTROL_PROPERTIES(DTCONTROLS, cmb.Name) = 0 Then
If ControlCreator.GET_CONTROL_PROPERTIES(DTCONTROLS, cmb.Name) = 0 Then
MsgBox("Unexpected Error in getting control-properties (CMB load) - Check the log and inform Your sysadmin!", MsgBoxStyle.Critical)
Exit Sub
End If
@@ -178,7 +181,7 @@ Public Class frmMassValidator
LOGGER.Debug("ConID > 0 And commandsql <> ''")
Dim connectionString As String
Dim ConRow As DataRow() = ClassControlCreator.GET_CONNECTION_INFO(CURR_CON_ID)
Dim ConRow As DataRow() = ControlCreator.GET_CONNECTION_INFO(CURR_CON_ID)
If ConRow Is Nothing Then
MsgBox("Unexpected Error in getting Coninfo (CMB load) - Check the log and inform Your sysadmin!", MsgBoxStyle.Critical)
Exit Sub
@@ -276,26 +279,7 @@ Public Class frmMassValidator
End If
#End Region
'Dim oMaxWidth As Integer = cmb.Width
'Using oGraphics As Graphics = cmb.CreateGraphics()
' Dim oStringLength = oGraphics.MeasureString(Text, cmb.Font).Width
' If oStringLength + 30 > oMaxWidth Then
' oMaxWidth = oStringLength + 30
' End If
'End Using
'Using g As Graphics = Me.CreateGraphics
' For Each oItem As Object In cmb.Items 'Für alle Einträge...
' Dim g1 As Graphics = cmb.CreateGraphics
' If g1.MeasureString(Text, cmb.Font).Width + 30 > oMaxWidth Then
' oMaxWidth = g1.MeasureString(Text, cmb.Font).Width + 30
' End If
' g1.Dispose()
' Next oItem
'End Using
'cmb.DropDownWidth = oMaxWidth
@@ -310,10 +294,10 @@ Public Class frmMassValidator
Case "DTP"
LOGGER.Debug("Versuch DTP zu laden")
oControl = ClassControlCreator.CreateExistingDatepicker(oControlRow, False)
oControl = ControlCreator.CreateExistingDatepicker(oControlRow, False)
Case "DGV"
LOGGER.Debug("Versuch DGV zu laden")
Dim dgv = ClassControlCreator.CreateExistingDataGridView(oControlRow, False)
Dim dgv = ControlCreator.CreateExistingDataGridView(oControlRow, False)
AddHandler dgv.RowValidating, AddressOf onDGVRowValidating
@@ -321,20 +305,20 @@ Public Class frmMassValidator
Case "CHK"
LOGGER.Debug("Versuch Checkbox zu laden")
oControl = ClassControlCreator.CreateExisingCheckbox(oControlRow, False)
oControl = ControlCreator.CreateExisingCheckbox(oControlRow, False)
Case "LINE"
LOGGER.Debug("Versuch Linie zu laden")
oControl = ClassControlCreator.CreateExistingLine(oControlRow, False)
oControl = ControlCreator.CreateExistingLine(oControlRow, False)
Case "LOOKUP"
Dim oMultiselect = oControlRow.Item("MULTISELECT")
Dim oReadonly = oControlRow.Item("READ_ONLY")
If oMultiselect = False And oReadonly = True Then
Dim lookupReadonly = ClassControlCreator.CreateExistingTextbox(oControlRow, False)
Dim lookupReadonly = ControlCreator.CreateExistingTextbox(oControlRow, False)
oControl = lookupReadonly
Else
Dim lookup As LookupControl3 = ClassControlCreator.CreateExistingLookupControl(oControlRow, False)
Dim lookup As LookupControl3 = ControlCreator.CreateExistingLookupControl(oControlRow, False)
lookup.Properties.PreventDuplicates = oControlRow.Item("VKT_PREVENT_MULTIPLE_VALUES")
lookup.Properties.AllowAddNewValues = oControlRow.Item("VKT_ADD_ITEM")
@@ -372,7 +356,7 @@ Public Class frmMassValidator
LOGGER.Debug("Versuch Tabelle zu laden")
Dim oDTMyColumns As DataTable = DatabaseFallback.GetDatatableECM($"SELECT * FROM TBPM_CONTROL_TABLE WHERE CONTROL_ID = {oControlRow.Item("GUID")} ORDER BY SEQUENCE") ', "MV_LoadControls1")
oControl = ClassControlCreator.CreateExistingGridControl(oControlRow, oDTMyColumns, False)
oControl = ControlCreator.CreateExistingGridControl(oControlRow, oDTMyColumns, False)
End Select
If oControl IsNot Nothing AndAlso TypeOf oControl IsNot Label Then
@@ -450,7 +434,6 @@ Public Class frmMassValidator
Sub FillIndexValues()
Dim controltype As String
Dim indexname As String
Dim resultvalue
Try
For Each oControl As Control In Me.pnldesigner.Controls
@@ -472,8 +455,8 @@ Public Class frmMassValidator
Dim LoadIDX As Boolean = controlRow.Item("LOAD_IDX_VALUE")
LOGGER.Debug("INDEX: " & idxname & " - CONTROLNAME: " & oControl.Name & " - LOAD IDXVALUES: " & LoadIDX.ToString)
Dim wertWD
Select Case Type
Case "System.Windows.Forms.TextBox"
Select Case oControl.GetType
Case GetType(DevExpress.XtraEditors.TextEdit)
Try
controltype = "Textbox"
If idxname = "" Then
@@ -507,9 +490,9 @@ Public Class frmMassValidator
Exit Sub
End Try
Case "System.Windows.Forms.ComboBox"
Case GetType(System.Windows.Forms.ComboBox)
controltype = "ComboBox"
Dim cmb As ComboBox = oControl
Dim cmb As Windows.Forms.ComboBox = oControl
If idxname = "" Then
MsgBox("wrong config:" & vbNewLine & "there is no attribute for control: " & oControl.Name & vbNewLine & "Please check formdesigner as Admin!", MsgBoxStyle.Critical)
Exit For
@@ -536,7 +519,7 @@ Public Class frmMassValidator
cmb.SelectedIndex = cmb.FindStringExact(wertWD)
End If
End If
Case "System.Windows.Forms.DataGridView"
Case GetType(System.Windows.Forms.DataGridView)
controltype = "DataGridView"
Dim dgv As DataGridView = oControl
If idxname = "" Then
@@ -607,7 +590,7 @@ Public Class frmMassValidator
End If
End If
Case "System.Windows.Forms.CheckBox"
Case GetType(System.Windows.Forms.CheckBox)
controltype = "CheckBox"
If idxname = "" Then
MsgBox("wrong config:" & vbNewLine & "there is no attribute for control: " & oControl.Name & vbNewLine & "Please check formdesigner as Admin!", MsgBoxStyle.Critical)
@@ -674,14 +657,14 @@ Public Class frmMassValidator
End If
End If
Case "System.Windows.Forms.DateTimePicker"
Case GetType(System.Windows.Forms.DateTimePicker)
controltype = "DateTimePicker"
Dim DTP As DateTimePicker = oControl
If idxname = "" Then
MsgBox("wrong config:" & vbNewLine & "there is no attribute for control: " & oControl.Name & vbNewLine & "Please check formdesigner as Admin!", MsgBoxStyle.Critical)
Exit For
End If
Case "DigitalData.Controls.LookupGrid.LookupControl3"
Case GetType(DigitalData.Controls.LookupGrid.LookupControl3)
Try
Dim oLookup As LookupControl3 = oControl
Dim oWindreamValue = GetWM_Value_Multiple_Docs(idxname)
@@ -726,11 +709,7 @@ Public Class frmMassValidator
LOGGER.Info(">> Unexpected Error in FillIndexValues(MIs: " & ex.Message, True)
LOGGER.Info(">> Controltype: " & controltype)
LOGGER.Info(">> Indexname windream: " & indexname)
End Try
End Sub
Private Function GetWM_Value_Multiple_Docs(idxname As String)
Try
@@ -838,26 +817,26 @@ Public Class frmMassValidator
End Function
Public Sub OnTextBoxFocus(sender As Object, e As EventArgs)
Dim box As TextBox = sender
Dim box As TextEdit = sender
box.BackColor = Color.LightSteelBlue
box.SelectAll()
End Sub
Public Sub OnTextBoxLostFocus(sender As System.Object, e As System.EventArgs)
Dim box As TextBox = sender
Dim box As TextEdit = sender
box.BackColor = Color.White
End Sub
Public Sub OnTextBoxKeyUp(sender As Object, e As KeyEventArgs)
Dim box As TextBox = sender
Dim box As TextEdit = sender
If box.Text <> String.Empty And me_closing = False And CTRLS_Loaded = True And FORM_Shown = True Then
If (e.KeyCode = Keys.Return) Or (e.KeyCode = Keys.Tab) Or (e.KeyCode = Keys.Enter) Then
Try
If ClassControlCreator.GET_CONTROL_PROPERTIES(DTCONTROLS, box.Name) = 0 Then
If ControlCreator.GET_CONTROL_PROPERTIES(DTCONTROLS, box.Name) = 0 Then
MsgBox("Unexpected Error in getting control-properties - Check the log and inform Your sysadmin!", MsgBoxStyle.Critical)
Exit Sub
End If
If ClassControlCreator.GET_DEPENDING_CONTROLS(DTCONTROLS, box.Name) = False Then
If ControlCreator.GetDependingControls(DTCONTROLS, box.Name) = False Then
MsgBox("Unexpected Error in getting dependent controls - Check the log and inform Your sysadmin!", MsgBoxStyle.Critical)
Exit Sub
End If
@@ -908,7 +887,7 @@ Public Class frmMassValidator
If displayboxname.StartsWith(ClassControlCreator.PREFIX_COMBOBOX) Then
LOGGER.Debug("Filling Combobox with Results")
Dim oCombobox As ComboBox = pnldesigner.Controls(displayboxname)
Dim oCombobox As Windows.Forms.ComboBox = pnldesigner.Controls(displayboxname)
If IsNothing(oCombobox) Then
Exit Sub
@@ -956,15 +935,15 @@ Public Class frmMassValidator
End Try
End Sub
Public Sub OnCmbselectedIndex(sender As System.Object, e As System.EventArgs)
Dim cmb As ComboBox = sender
Dim cmb As Windows.Forms.ComboBox = sender
If cmb.SelectedIndex <> -1 And CTRLS_Loaded = True And FORM_Shown = True Then
' Try
If ClassControlCreator.GET_CONTROL_PROPERTIES(DTCONTROLS, cmb.Name) = 0 Then
If ControlCreator.GET_CONTROL_PROPERTIES(DTCONTROLS, cmb.Name) = 0 Then
MsgBox("Unexpected Error in getting control-properties CMB - Check the log and inform Your sysadmin!", MsgBoxStyle.Critical)
Exit Sub
End If
If ClassControlCreator.GET_DEPENDING_CONTROLS(DTCONTROLS, cmb.Name) = False Then
If ControlCreator.GetDependingControls(DTCONTROLS, cmb.Name) = False Then
MsgBox("Unexpected Error in getting dependent controls CMB- Check the log and inform Your sysadmin!", MsgBoxStyle.Critical)
Exit Sub
End If
@@ -1002,12 +981,12 @@ Public Class frmMassValidator
Public Sub onDGVRowValidating(ByVal sender As Object, ByVal e As DataGridViewCellCancelEventArgs)
Dim dgv As DataGridView = sender
Try
If ClassControlCreator.GET_CONTROL_PROPERTIES(DTCONTROLS, dgv.Name) = 0 Then
If ControlCreator.GET_CONTROL_PROPERTIES(DTCONTROLS, dgv.Name) = 0 Then
MsgBox("Unexpected Error in getting control-properties DGV - Check the log and inform Your sysadmin!", MsgBoxStyle.Critical)
Exit Sub
End If
If ClassControlCreator.GET_DEPENDING_CONTROLS(DTCONTROLS, dgv.Name) = False Then
If ControlCreator.GetDependingControls(DTCONTROLS, dgv.Name) = False Then
MsgBox("Unexpected Error in getting dependent controls DGV- Check the log and inform Your sysadmin!", MsgBoxStyle.Critical)
Exit Sub
End If
@@ -1097,7 +1076,7 @@ Public Class frmMassValidator
End If
Dim oValue
If TypeOf control Is TextBox Then
If TypeOf control Is TextEdit Then
Try
Dim firstRow As DataRow = dt.Rows(0)
Dim value = firstRow.Item(0)
@@ -1108,9 +1087,9 @@ Public Class frmMassValidator
LOGGER.Error(ex)
clsLogger.Add("Error in LoadSimpleData for TextBox: " & ex.Message)
End Try
ElseIf TypeOf control Is ComboBox Then
ElseIf TypeOf control Is Windows.Forms.ComboBox Then
Try
Dim comboxBox As ComboBox = control
Dim comboxBox As Windows.Forms.ComboBox = control
Dim list As New List(Of String)
For Each _row As DataRow In dt.Rows
@@ -1221,9 +1200,8 @@ Public Class frmMassValidator
End If
If DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).Guid = CTRL_ID Then
'######
Dim Type As String = oControl.GetType.ToString
Select Case Type
Case "System.Windows.Forms.TextBox"
Select Case oControl.GetType
Case GetType(DevExpress.XtraEditors.TextEdit)
Try
value_from_control = oControl.Text
Catch ex As Exception
@@ -1231,15 +1209,15 @@ Public Class frmMassValidator
value_from_control = String.Empty
End Try
Case "System.Windows.Forms.ComboBox"
Dim cmb As ComboBox = oControl
Case GetType(System.Windows.Forms.ComboBox)
Dim cmb As Windows.Forms.ComboBox = oControl
Try
value_from_control = cmb.Text
Catch ex As Exception
LOGGER.Error(ex)
value_from_control = String.Empty
End Try
Case "System.Windows.Forms.DateTimePicker"
Case GetType(System.Windows.Forms.DateTimePicker)
Dim dtp As DateTimePicker = oControl
Try
value_from_control = dtp.Value.ToString
@@ -1248,7 +1226,7 @@ Public Class frmMassValidator
value_from_control = String.Empty
End Try
Case "System.Windows.Forms.CheckBox"
Case GetType(System.Windows.Forms.CheckBox)
Dim chk As CheckBox = oControl
Try
value_from_control = chk.Checked
@@ -1433,9 +1411,8 @@ Public Class frmMassValidator
LOGGER.Info(" >> Indexname is unexpected empty.")
Continue For
End If
Dim Type As String = oControl.GetType.ToString
Select Case Type
Case "DigitalData.Controls.LookupGrid.LookupControl3"
Select Case oControl.GetType
Case GetType(DigitalData.Controls.LookupGrid.LookupControl3)
Try
Dim myLookup As LookupControl3 = oControl
@@ -1521,7 +1498,7 @@ Public Class frmMassValidator
Catch ex As Exception
LOGGER.Error(ex)
End Try
Case "System.Windows.Forms.TextBox"
Case GetType(DevExpress.XtraEditors.TextEdit)
Try
'Als erstes überprüfen ob überhaupt etwas eingetragen worden ist
If Check_Missing(oControl, "txt") = True And _MUSSEINGABE = True Then 'NICHTS EINGETRAGEN
@@ -1575,7 +1552,7 @@ Public Class frmMassValidator
End Try
Case "System.Windows.Forms.DateTimePicker"
Case GetType(System.Windows.Forms.DateTimePicker)
Dim dtp As DateTimePicker = oControl
'Wenn kein Wert ausgewählt wurde und der Index aber gesetzt werden muss
If _MUSSEINGABE = True And dtp.Value.ToString = String.Empty Then
@@ -1615,7 +1592,7 @@ Public Class frmMassValidator
Else
LOGGER.Debug("DateValue is 01.01.0001 00:00:00")
End If
Case "System.Windows.Forms.CheckBox"
Case GetType(System.Windows.Forms.CheckBox)
Dim chk As CheckBox = oControl
oMyControlInput = chk.Checked.ToString
@@ -1662,7 +1639,7 @@ Public Class frmMassValidator
End If
End If
Case "System.Windows.Forms.DataGridView"
Case GetType(System.Windows.Forms.DataGridView)
Dim dgv As DataGridView = oControl
Dim Zeilen As Integer = 0
@@ -1742,11 +1719,14 @@ Public Class frmMassValidator
Function Check_Missing(control As Control, typ As String)
Select Case typ
Case "txt"
If control.Text = String.Empty Or control.Text = "(Different values)" Or control.Text = "(Untersch. Werte)" Then
Dim oTextBox As TextEdit = control
If oTextBox.Text = String.Empty Or oTextBox.Text = "(Different values)" Or oTextBox.Text = "(Untersch. Werte)" Then
Return True
End If
Return False
End Select
Return False
End Function
Private Function IndexMultipleFiles(idxxname As String, idxvalue As Object)
@@ -1949,18 +1929,4 @@ Public Class frmMassValidator
FORM_Shown = True
End Sub
Private Sub frmMassValidator_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
'If Viewer = "docview" Then
' CloseWDDocview()
'End If
'If vpdfviewer = "system" Then
' Kill_PDFAcrobat()
'Else
' If pdfxchange = True Or sumatra = True Then
' Close_PDF_Viewer(Document_Path)
' End If
' KillU_Viewer()
'End If
End Sub
End Class