change control tag to be metadata class

This commit is contained in:
Jonathan Jenne
2019-10-17 13:54:26 +02:00
parent 0ec31f0cc3
commit 037b7c6748
4 changed files with 112 additions and 67 deletions

View File

@@ -345,7 +345,7 @@ Public Class frmMassValidator
CTRLS_Loaded = True
FillIndexValues()
For Each oControl As Control In pnldesigner.Controls
LoadSimpleData(oControl, oControl.Tag)
LoadSimpleData(oControl, DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).Guid)
Next
Catch ex As Exception
LOGGER.Info("Unvorhergesehener Fehler bei Load_Controls:" & ex.Message)
@@ -363,7 +363,7 @@ Public Class frmMassValidator
Dim oLOOKUPValue = SelectedValues.Item(0)
Dim oLOOKUPName = oLookup.Name
Dim oControlID = oLookup.Tag
Dim oControlID = DirectCast(oLookup.Tag, ClassControlCreator.ControlMetadata).Guid
Dim filteredData As DataTable = DTCONTROLS.Clone()
Dim oExpression = $"SQL_UEBERPRUEFUNG like '%#CTRL#{oLOOKUPName}%'"
DTCONTROLS.Select(oExpression).CopyToDataTable(filteredData, LoadOption.PreserveChanges)
@@ -382,7 +382,7 @@ Public Class frmMassValidator
Try
Dim oDependingLookup As LookupControl2 = pnldesigner.Controls.Find(oDEPENDING_CtrlName, False).FirstOrDefault()
For Each oControl As Control In pnldesigner.Controls
If oControl.Tag = oDEPENDING_GUID Then
If DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).Guid = oDEPENDING_GUID Then
Dim oDependingLookup1 As LookupControl2 = oControl
oDependingLookup1.DataSource = oDTDEPENDING_RESULT
_dependingControl_in_action = False
@@ -411,14 +411,14 @@ Public Class frmMassValidator
Dim resultvalue
Try
For Each inctrl As Control In Me.pnldesigner.Controls
For Each oControl As Control In Me.pnldesigner.Controls
Dim CONTROL_ID = inctrl.Tag
Dim CONTROL_ID = DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).Guid
Dim controlRow = (From form In DTCONTROLS.AsEnumerable' DD_DMSLiteDataSet.VWPM_CONTROL_INDEX.AsEnumerable()
Select form
Where form.Item("GUID") = CONTROL_ID).Single()
Dim Type As String = inctrl.GetType.ToString
Dim Type As String = oControl.GetType.ToString
Dim Typ As String = controlRow.Item("CTRL_TYPE")
If Typ = "LBL" Or Typ = "LINE" Then
Continue For
@@ -428,29 +428,29 @@ Public Class frmMassValidator
Dim defaultValue As String = NotNull(controlRow.Item("DEFAULT_VALUE"), String.Empty)
indexname = idxname
Dim LoadIDX As Boolean = controlRow.Item("LOAD_IDX_VALUE")
LOGGER.Debug("INDEX: " & idxname & " - CONTROLNAME: " & inctrl.Name & " - LOAD IDXVALUES: " & LoadIDX.ToString)
LOGGER.Debug("INDEX: " & idxname & " - CONTROLNAME: " & oControl.Name & " - LOAD IDXVALUES: " & LoadIDX.ToString)
Dim wertWD
Select Case Type
Case "System.Windows.Forms.TextBox"
Try
controltype = "Textbox"
If idxname = "" Then
MsgBox("Achtung fehlerhafte Konfiguration:" & vbNewLine & "Für das Control " & inctrl.Name & " wurde KEIN INDEX hinterlegt!" & vbNewLine & "Bitte prüfen Sie den Formulardesigner!", MsgBoxStyle.Critical)
MsgBox("Achtung fehlerhafte Konfiguration:" & vbNewLine & "Für das Control " & oControl.Name & " wurde KEIN INDEX hinterlegt!" & vbNewLine & "Bitte prüfen Sie den Formulardesigner!", MsgBoxStyle.Critical)
Exit For
End If
If idxname Is Nothing = False Then
If LoadIDX = False Or idxname = "DD PM-ONLY FOR DISPLAY" Then
' Wenn kein Index exisitiert, defaultValue laden
inctrl.Text = defaultValue
oControl.Text = defaultValue
LOGGER.Debug("Indexwert soll nicht geladen werden.")
Exit Select
End If
wertWD = GetWM_Value_Multiple_Docs(idxname)
If wertWD = "" And defaultValue <> "" Then
inctrl.Text = defaultValue
oControl.Text = defaultValue
Else
inctrl.Text = NotNull(wertWD, defaultValue)
oControl.Text = NotNull(wertWD, defaultValue)
End If
End If
@@ -467,9 +467,9 @@ Public Class frmMassValidator
Case "System.Windows.Forms.ComboBox"
controltype = "ComboBox"
Dim cmb As ComboBox = inctrl
Dim cmb As ComboBox = oControl
If idxname = "" Then
MsgBox("Achtung fehlerhafte Konfiguration:" & vbNewLine & "Für das Control " & inctrl.Name & " wurde KEIN INDEX hinterlegt!" & vbNewLine & "Bitte prüfen Sie den Formulardesigner!", MsgBoxStyle.Critical)
MsgBox("Achtung fehlerhafte Konfiguration:" & vbNewLine & "Für das Control " & oControl.Name & " wurde KEIN INDEX hinterlegt!" & vbNewLine & "Bitte prüfen Sie den Formulardesigner!", MsgBoxStyle.Critical)
Exit For
End If
If idxname Is Nothing = False Then
@@ -496,9 +496,9 @@ Public Class frmMassValidator
End If
Case "System.Windows.Forms.DataGridView"
controltype = "DataGridView"
Dim dgv As DataGridView = inctrl
Dim dgv As DataGridView = oControl
If idxname = "" Then
MsgBox("Achtung fehlerhafte Konfiguration:" & vbNewLine & "Für das Control " & inctrl.Name & " wurde KEIN INDEX hinterlegt!" & vbNewLine & "Bitte prüfen Sie den Formulardesigner!", MsgBoxStyle.Critical)
MsgBox("Achtung fehlerhafte Konfiguration:" & vbNewLine & "Für das Control " & oControl.Name & " wurde KEIN INDEX hinterlegt!" & vbNewLine & "Bitte prüfen Sie den Formulardesigner!", MsgBoxStyle.Critical)
Exit For
End If
If idxname Is Nothing = False Then
@@ -568,12 +568,12 @@ Public Class frmMassValidator
Case "System.Windows.Forms.CheckBox"
controltype = "CheckBox"
If idxname = "" Then
MsgBox("Achtung fehlerhafte Konfiguration:" & vbNewLine & "Für das Control " & inctrl.Name & " wurde KEIN INDEX hinterlegt!" & vbNewLine & "Bitte prüfen Sie den Formulardesigner!", MsgBoxStyle.Critical)
MsgBox("Achtung fehlerhafte Konfiguration:" & vbNewLine & "Für das Control " & oControl.Name & " wurde KEIN INDEX hinterlegt!" & vbNewLine & "Bitte prüfen Sie den Formulardesigner!", MsgBoxStyle.Critical)
Exit For
End If
If idxname Is Nothing = False Then
Dim chk As CheckBox = inctrl
Dim chk As CheckBox = oControl
If LoadIDX = False Then
LOGGER.Debug("Indexwert soll nicht geladen werden.")
@@ -634,14 +634,14 @@ Public Class frmMassValidator
End If
Case "System.Windows.Forms.DateTimePicker"
controltype = "DateTimePicker"
Dim DTP As DateTimePicker = inctrl
Dim DTP As DateTimePicker = oControl
If idxname = "" Then
MsgBox("Achtung fehlerhafte Konfiguration:" & vbNewLine & "Für das Control " & inctrl.Name & " wurde KEIN INDEX hinterlegt!" & vbNewLine & "Bitte prüfen Sie den Formulardesigner!", MsgBoxStyle.Critical)
MsgBox("Achtung fehlerhafte Konfiguration:" & vbNewLine & "Für das Control " & oControl.Name & " wurde KEIN INDEX hinterlegt!" & vbNewLine & "Bitte prüfen Sie den Formulardesigner!", MsgBoxStyle.Critical)
Exit For
End If
Case "DigitalData.Controls.LookupGrid.LookupControl2"
Try
Dim oLookup As LookupControl2 = inctrl
Dim oLookup As LookupControl2 = oControl
Dim oWindreamValue = GetWM_Value_Multiple_Docs(idxname)
If Not IsNothing(oWindreamValue) Then
@@ -1136,24 +1136,24 @@ Public Class frmMassValidator
Dim CTRL_ID = element.Value.Substring(2, element.Value.Length - 3)
CTRL_ID = CTRL_ID.Replace("CTRLID", "")
Dim value_from_control
For Each inctrl As Control In Me.pnldesigner.Controls
If IsNothing(inctrl.Tag) Then
For Each oControl As Control In Me.pnldesigner.Controls
If IsNothing(oControl.Tag) Then
Continue For
End If
If inctrl.Tag = CTRL_ID Then
If DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).Guid = CTRL_ID Then
'######
Dim Type As String = inctrl.GetType.ToString
Dim Type As String = oControl.GetType.ToString
Select Case Type
Case "System.Windows.Forms.TextBox"
Try
value_from_control = inctrl.Text
value_from_control = oControl.Text
Catch ex As Exception
LOGGER.Error(ex)
value_from_control = String.Empty
End Try
Case "System.Windows.Forms.ComboBox"
Dim cmb As ComboBox = inctrl
Dim cmb As ComboBox = oControl
Try
value_from_control = cmb.Text
Catch ex As Exception
@@ -1161,7 +1161,7 @@ Public Class frmMassValidator
value_from_control = String.Empty
End Try
Case "System.Windows.Forms.DateTimePicker"
Dim dtp As DateTimePicker = inctrl
Dim dtp As DateTimePicker = oControl
Try
value_from_control = dtp.Value.ToString
Catch ex As Exception
@@ -1170,7 +1170,7 @@ Public Class frmMassValidator
End Try
Case "System.Windows.Forms.CheckBox"
Dim chk As CheckBox = inctrl
Dim chk As CheckBox = oControl
Try
value_from_control = chk.Checked
Catch ex As Exception