jj_05_01_16
This commit is contained in:
@@ -1,6 +1,38 @@
|
||||
Namespace ControlLoader
|
||||
|
||||
Public Class _BaseControl
|
||||
|
||||
Public Shared Function ReplaceSqlCommandPlaceholders(sqlCommand As String, recordId As Integer, parentRecordId As Integer)
|
||||
sqlCommand = sqlCommand.Replace("@RECORD_ID", recordId)
|
||||
sqlCommand = sqlCommand.Replace("@RECORDID", recordId)
|
||||
sqlCommand = sqlCommand.Replace("@PARENTRECORD_ID", parentRecordId)
|
||||
sqlCommand = sqlCommand.Replace("@PARENTRECORDID", parentRecordId)
|
||||
|
||||
Return sqlCommand
|
||||
End Function
|
||||
|
||||
Public Shared Function LoadAutoValue(control As Windows.Forms.Label, RecordId As Integer, ParentRecordId As Integer)
|
||||
Dim AutoValue As String = String.Empty
|
||||
Dim ControlId As Integer = control.Tag
|
||||
Dim SQL As String = ClassDatabase.Execute_Scalar(String.Format("SELECT SQL_COMMAND_1 FROM TBPMO_CONTROL WHERE GUID = {0}", ControlId))
|
||||
SQL = ReplaceSqlCommandPlaceholders(SQL, RecordId, ParentRecordId)
|
||||
|
||||
If SQL = "" Or IsDBNull(SQL) Then
|
||||
Return control.Text
|
||||
End If
|
||||
|
||||
AutoValue = ClassDatabase.Execute_Scalar(SQL)
|
||||
|
||||
If String.IsNullOrEmpty(AutoValue) Or IsDBNull(AutoValue) Then
|
||||
SQL = String.Format("SELECT CONTROL_TEXT FROM TBPMO_CONTROL_SCREEN WHERE CONTROL_ID = {0}", ControlId)
|
||||
Dim value = ClassDatabase.Execute_Scalar(SQL)
|
||||
Return value
|
||||
Else
|
||||
Return AutoValue
|
||||
End If
|
||||
|
||||
End Function
|
||||
|
||||
End Class
|
||||
|
||||
Public Class _ListControl : Inherits _BaseControl
|
||||
@@ -58,14 +90,7 @@
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Shared Function ReplaceSqlCommandPlaceholders(sqlCommand As String, recordId As Integer, parentRecordId As Integer)
|
||||
sqlCommand = sqlCommand.Replace("@RECORD_ID", recordId)
|
||||
sqlCommand = sqlCommand.Replace("@RECORDID", recordId)
|
||||
sqlCommand = sqlCommand.Replace("@PARENTRECORD_ID", parentRecordId)
|
||||
sqlCommand = sqlCommand.Replace("@PARENTRECORDID", parentRecordId)
|
||||
|
||||
Return sqlCommand
|
||||
End Function
|
||||
|
||||
End Class
|
||||
|
||||
Public Structure DynamicValue
|
||||
@@ -75,9 +100,14 @@
|
||||
|
||||
Public Class Label : Inherits _BaseControl
|
||||
|
||||
Public Shared Sub LoadValue(control As Windows.Forms.Label, value As String)
|
||||
' TODO: LoadControlAutoValue aufrufen
|
||||
control.Text = value
|
||||
Public Shared Sub LoadValue(control As Windows.Forms.Label, recordId As Integer, parentRecordId As Integer, value As String)
|
||||
Dim autoValue = LoadAutoValue(control, recordId, parentRecordId)
|
||||
|
||||
If IsNothing(autoValue) Then
|
||||
control.Text = value
|
||||
Else
|
||||
control.Text = autoValue
|
||||
End If
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -179,14 +209,18 @@
|
||||
Public Class CheckedListBox : Inherits _ListControl
|
||||
|
||||
Public Shared Sub LoadValue(control As DevExpress.XtraEditors.CheckedListBoxControl, value As String)
|
||||
If IsNothing(value) Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
For Each item As String In control.Items
|
||||
|
||||
Dim pos = control.FindStringExact(value)
|
||||
control.SetItemCheckState(pos, CheckState.Checked)
|
||||
Dim values() As String = value.Split(";")
|
||||
|
||||
For Each v As String In values
|
||||
Dim pos = control.FindStringExact(v)
|
||||
If pos >= 0 Then
|
||||
control.SetItemCheckState(pos, CheckState.Checked)
|
||||
End If
|
||||
Next
|
||||
|
||||
End Sub
|
||||
|
||||
Public Shared Sub LoadList(control As DevExpress.XtraEditors.CheckedListBoxControl, formId As Integer, recordId As Integer, parentRecordId As Integer)
|
||||
@@ -195,11 +229,6 @@
|
||||
|
||||
If dynamic.StaticList IsNot Nothing Then
|
||||
control.DataSource = dynamic.StaticList
|
||||
|
||||
'For Each item As String In dynamic.StaticList
|
||||
' Dim pos = control.FindStringExact(item)
|
||||
' control.SetItemCheckState(pos, CheckState.Checked)
|
||||
'Next
|
||||
End If
|
||||
|
||||
If dynamic.DataTable IsNot Nothing AndAlso dynamic.DataTable.Rows.Count > 0 Then
|
||||
|
||||
Reference in New Issue
Block a user