MS_22042016
This commit is contained in:
@@ -163,9 +163,7 @@ Public Class ClassControlValues
|
||||
|
||||
For Each control As Control In controls
|
||||
Dim ControlId As Integer = DirectCast(control.Tag, ClassControlMetadata).Id
|
||||
If ControlId = 810 Then
|
||||
Console.WriteLine("Obacht")
|
||||
End If
|
||||
|
||||
' Wert per LINQ aus DT_ControlValues suchen der zur aktuellen controlId passt
|
||||
Dim values As List(Of Object) = (From row In DT_ControlValues.AsEnumerable()
|
||||
Where row.Item("CONTROL_ID") = ControlId
|
||||
@@ -225,9 +223,7 @@ Public Class ClassControlValues
|
||||
Try
|
||||
' Für die meisten Controls wird nur das erste Element der Liste benötigt
|
||||
Dim value As String = Nothing
|
||||
If controlId = 810 Then
|
||||
Console.WriteLine("Obacht")
|
||||
End If
|
||||
|
||||
If values.Count > 0 Then
|
||||
value = values.Item(0)
|
||||
End If
|
||||
@@ -277,7 +273,7 @@ Public Class ClassControlValues
|
||||
ClassLogger.Add(" >> Sub LoadControlValue - Control-Type nicht berücksichtigt: " & GetType(Control).ToString(), False)
|
||||
End Select
|
||||
Catch ex As Exception
|
||||
ClassLogger.Add("Unexpected Error in LoadControlValue - ControlID: " & controlId.ToString & " - Error: " & ex.Message, True)
|
||||
ClassLogger.Add("Unexpected Error in LoadControlValue: " & ex.Message, True)
|
||||
MsgBox("Error in LoadControlValue:" & vbNewLine & ex.Message)
|
||||
End Try
|
||||
|
||||
@@ -483,16 +479,25 @@ Public Class ClassControlValues
|
||||
|
||||
Case GetType(DataGridView)
|
||||
Dim dgv As DataGridView = DirectCast(control, DataGridView)
|
||||
dgv.Rows.Clear()
|
||||
Dim ds = dgv.DataSource
|
||||
|
||||
If (IsNothing(ds)) Then
|
||||
dgv.Rows.Clear()
|
||||
dgv.Refresh()
|
||||
Else
|
||||
dgv.DataSource = Nothing
|
||||
dgv.Refresh()
|
||||
End If
|
||||
Console.WriteLine("Clearing DataGridView")
|
||||
|
||||
End Select
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
#Region "LoadDefaultValue"
|
||||
Public Shared Sub LoadDefaultValues(FormID As Integer, RecordID As Integer, controls As Control.ControlCollection)
|
||||
Public Shared Sub LoadDefaultValues(FormID As Integer, RecordID As Integer, controls As Control.ControlCollection, ParentRecordId As Integer, entity_ID As Integer)
|
||||
'' Zuerst alle Controls leeren
|
||||
'ClearControlValues(controls)
|
||||
ClearControlValues(controls)
|
||||
|
||||
Dim i = 0
|
||||
For Each control As Control In controls
|
||||
@@ -503,10 +508,10 @@ Public Class ClassControlValues
|
||||
End If
|
||||
|
||||
If TypeOf control Is GroupBox Then
|
||||
LoadDefaultValues(FormID, RecordID, DirectCast(control, GroupBox).Controls)
|
||||
LoadDefaultValues(FormID, RecordID, DirectCast(control, GroupBox).Controls, ParentRecordId, entity_ID)
|
||||
End If
|
||||
|
||||
LoadDefaultValue(CONTROL_ID, RecordID, control)
|
||||
LoadDefaultValue(CONTROL_ID, RecordID, control, ParentRecordId, entity_ID)
|
||||
|
||||
'Den Focus auf das erste Steuerelement setzen
|
||||
If i = 1 Then
|
||||
@@ -516,7 +521,7 @@ Public Class ClassControlValues
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Public Shared Sub LoadDefaultValue(ControlID As Integer, RecordID As Integer, control As Control)
|
||||
Public Shared Sub LoadDefaultValue(ControlID As Integer, RecordID As Integer, control As Control, ParentRecordId As Integer, entity_ID As Integer)
|
||||
Try
|
||||
Dim SQL = String.Format("SELECT CONTROL_DEF_VALUE FROM VWPMO_CONTROL_SCREEN WHERE CONTROL_ID = {0}", ControlID)
|
||||
Dim autoValue = ClassDatabase.Execute_Scalar(SQL)
|
||||
@@ -586,6 +591,33 @@ Public Class ClassControlValues
|
||||
' Mit EditValue kann man auch den angezeigten Wert leeren
|
||||
'datepicker.DateTime = autoValue
|
||||
datepicker.EditValue = autoValue
|
||||
Case GetType(Label)
|
||||
Dim lbl As Label = DirectCast(control, Label)
|
||||
Dim CONNID = ClassDatabase.Execute_Scalar(String.Format("SELECT CONNECTION_ID_1 FROM TBPMO_CONTROL WHERE GUID = {0}", ControlID))
|
||||
Dim SQL_AUTOVALUE As String = ClassDatabase.Execute_Scalar(String.Format("SELECT SQL_COMMAND_1 FROM TBPMO_CONTROL WHERE GUID = {0}", ControlID))
|
||||
SQL_AUTOVALUE = ClassControlValues.ReplaceSqlCommandPlaceholders(SQL_AUTOVALUE, RecordID, ParentRecordId, entity_ID)
|
||||
If ControlID = 984 Then
|
||||
Console.WriteLine("VertragsNr")
|
||||
End If
|
||||
|
||||
If SQL_AUTOVALUE = "" Or IsDBNull(SQL_AUTOVALUE) Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If SQL_AUTOVALUE.ToUpper.StartsWith("select RECORD_ENTITY_ID FROM TBPMO_RECORD WHERE".ToUpper) Then
|
||||
SQL_AUTOVALUE = "SELECT MAX(RECORD_ENTITY_ID) + 1 FROM TBPMO_RECORD WHERE FORM_ID = " & entity_ID
|
||||
End If
|
||||
If Not IsNothing(CONNID) Then
|
||||
autoValue = ClassDatabase.Execute_ScalarWithConnection(CONNID, SQL_AUTOVALUE)
|
||||
Else
|
||||
autoValue = ClassDatabase.Execute_Scalar(SQL_AUTOVALUE, True)
|
||||
End If
|
||||
' AutoValue = ClassDatabase.Execute_Scalar(SQL)
|
||||
|
||||
If Not String.IsNullOrEmpty(autoValue) And Not IsDBNull(autoValue) Then
|
||||
lbl.Text = autoValue
|
||||
End If
|
||||
|
||||
End Select
|
||||
Catch ex As Exception
|
||||
MsgBox("Unexpected Error in LoadDefaultValue:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
||||
|
||||
Reference in New Issue
Block a user