fix Controls2B_EnDisabled_on_Load, remove enable_sql_conn_id
This commit is contained in:
parent
266a1f1da8
commit
403d23db93
@ -2139,34 +2139,32 @@ Public Class frmValidator
|
||||
End If
|
||||
Next
|
||||
|
||||
|
||||
|
||||
Catch ex As Exception
|
||||
LOGGER.Error(ex)
|
||||
End Try
|
||||
End Sub
|
||||
Private Sub Controls2beDisabled()
|
||||
Try
|
||||
Dim oFilteredDatatable As DataTable = DT_CONTROLS.Clone()
|
||||
Dim oExpression = $"LEN(SQL_ENABLE) > 0"
|
||||
DT_CONTROLS.Select(oExpression).CopyToDataTable(oFilteredDatatable, LoadOption.PreserveChanges)
|
||||
If oFilteredDatatable.Rows.Count > 0 Then
|
||||
LOGGER.Debug($"We got {oFilteredDatatable.Rows.Count} controls which need to be disabled!!")
|
||||
End If
|
||||
For Each oRowEnablingControl As DataRow In oFilteredDatatable.Rows
|
||||
Dim oENABLE_GUID = oRowEnablingControl.Item("GUID")
|
||||
Dim oENABLE_CtrlName = oRowEnablingControl.Item("NAME")
|
||||
For Each oControl As Control In PanelValidatorControl.Controls
|
||||
If oENABLE_GUID = DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).Guid Then
|
||||
oControl.Enabled = False
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
Catch ex As Exception
|
||||
LOGGER.Error(ex)
|
||||
End Try
|
||||
End Sub
|
||||
'Private Sub Controls2beDisabled()
|
||||
' Try
|
||||
' Dim oFilteredDatatable As DataTable = DT_CONTROLS.Clone()
|
||||
' Dim oExpression = $"LEN(SQL_ENABLE) > 0"
|
||||
' DT_CONTROLS.Select(oExpression).CopyToDataTable(oFilteredDatatable, LoadOption.PreserveChanges)
|
||||
' If oFilteredDatatable.Rows.Count > 0 Then
|
||||
' LOGGER.Debug($"We got {oFilteredDatatable.Rows.Count} controls which need to be disabled!!")
|
||||
' End If
|
||||
' For Each oRowEnablingControl As DataRow In oFilteredDatatable.Rows
|
||||
' Dim oENABLE_GUID = oRowEnablingControl.Item("GUID")
|
||||
' Dim oENABLE_CtrlName = oRowEnablingControl.Item("NAME")
|
||||
' For Each oControl As Control In PanelValidatorControl.Controls
|
||||
' If oENABLE_GUID = DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).Guid Then
|
||||
' oControl.Enabled = False
|
||||
' Exit For
|
||||
' End If
|
||||
' Next
|
||||
' Next
|
||||
' Catch ex As Exception
|
||||
' LOGGER.Error(ex)
|
||||
' End Try
|
||||
'End Sub
|
||||
Private Sub Controls2B_EnDisabled_on_Load()
|
||||
Try
|
||||
Dim oFilteredDatatable As DataTable = DT_CONTROLS.Clone()
|
||||
@ -2181,31 +2179,22 @@ Public Class frmValidator
|
||||
For Each oControl As Control In PanelValidatorControl.Controls
|
||||
If oENABLE_GUID = DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).Guid Then
|
||||
LOGGER.Debug($"Found the Control on panel which needs to be checked [{oENABLE_GUID}]...")
|
||||
Dim oSqlCommand = IIf(IsDBNull(oRowEnablingControl.Item("SQL_ENABLE_ON_LOAD")), "", oRowEnablingControl.Item("SQL_ENABLE_ON_LOAD"))
|
||||
Dim oConID = oRowEnablingControl.Item("SQL_ENABLE_ON_LOAD_CONID")
|
||||
If Not IsDBNull(oConID) Then
|
||||
oSqlCommand = clsPatterns.ReplaceAllValues(oSqlCommand, PanelValidatorControl, True)
|
||||
|
||||
Dim oConnectionId As Integer = oRowEnablingControl.Item("CONNECTION_ID")
|
||||
Dim oENABLERESULT As Boolean = False
|
||||
'Dim oSqlCommand = IIf(IsDBNull(oRowEnablingControl.Item("SQL_ENABLE_ON_LOAD")), "", oRowEnablingControl.Item("SQL_ENABLE_ON_LOAD"))
|
||||
'Dim oConID = oRowEnablingControl.Item("SQL_ENABLE_ON_LOAD_CONID")
|
||||
|
||||
oENABLERESULT = DatabaseFallback.GetScalarValueWithConnection(oSqlCommand, oConnectionId)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Try
|
||||
LOGGER.Debug($"oENABLERESULT [{oENABLERESULT}]...")
|
||||
oControl.Enabled = oENABLERESULT
|
||||
Catch ex As Exception
|
||||
LOGGER.Warn($"Error en/disabling control onLoad: [{ex.Message}]")
|
||||
End Try
|
||||
Else
|
||||
LOGGER.Warn($"Attention SQL_ENABLE_ON_LOAD_CONID seems to be null!")
|
||||
End If
|
||||
Dim oConnectionId As Integer = oRowEnablingControl.ItemEx("CONNECTION_ID", 0)
|
||||
Dim oSqlCommand = oRowEnablingControl.ItemEx("SQL_ENABLE_ON_LOAD", String.Empty)
|
||||
oSqlCommand = clsPatterns.ReplaceAllValues(oSqlCommand, PanelValidatorControl, True)
|
||||
|
||||
Dim oResult = DatabaseFallback.GetScalarValueWithConnection(oSqlCommand, oConnectionId)
|
||||
|
||||
Try
|
||||
LOGGER.Debug($"Result of Enable SQL [{oResult}]...")
|
||||
oControl.Enabled = oResult
|
||||
Catch ex As Exception
|
||||
LOGGER.Warn($"Error en/disabling control onLoad: [{ex.Message}]")
|
||||
End Try
|
||||
|
||||
End If
|
||||
Next
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user