Merge branch 'master' of http://scmadmin@172.24.11.74:90/scm/git/RecordOrganizer
This commit is contained in:
@@ -49,6 +49,28 @@
|
|||||||
|
|
||||||
' +++ Public Functions +++
|
' +++ Public Functions +++
|
||||||
|
|
||||||
|
Public Shared Function GetParentRecordId(RecordId As Integer) As Integer
|
||||||
|
Try
|
||||||
|
Dim parentId = ClassDatabase.Execute_Scalar("SELECT RECORD1_ID FROM TBPMO_RECORD_CONNECT WHERE RECORD2_ID = " & RecordId)
|
||||||
|
If IsNothing(parentId) Then
|
||||||
|
Return 0
|
||||||
|
Else
|
||||||
|
Return parentId
|
||||||
|
End If
|
||||||
|
Catch ex As Exception
|
||||||
|
MsgBox("Error in GetFormId:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
||||||
|
End Try
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Shared Function GetFormId(RecordId As Integer) As Integer
|
||||||
|
Try
|
||||||
|
Dim FormId = ClassDatabase.Execute_Scalar("SELECT FORM_ID FROM VWPMO_VALUES WHERE RECORD_ID = " & RecordId)
|
||||||
|
Return FormId
|
||||||
|
Catch ex As Exception
|
||||||
|
MsgBox("Error in GetFormId:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
||||||
|
End Try
|
||||||
|
End Function
|
||||||
|
|
||||||
Public Shared Function GetControlGuid(name As String)
|
Public Shared Function GetControlGuid(name As String)
|
||||||
Try
|
Try
|
||||||
Dim sql = "SELECT GUID FROM TBPMO_CONTROL WHERE UPPER(NAME) = UPPER('" & name & "')"
|
Dim sql = "SELECT GUID FROM TBPMO_CONTROL WHERE UPPER(NAME) = UPPER('" & name & "')"
|
||||||
|
|||||||
@@ -2,9 +2,10 @@
|
|||||||
Imports System.Text.RegularExpressions
|
Imports System.Text.RegularExpressions
|
||||||
|
|
||||||
Public Class ClassRecordView
|
Public Class ClassRecordView
|
||||||
|
Public RecordId As Integer
|
||||||
|
|
||||||
Private DTControls As DataTable
|
Private DTControls As DataTable
|
||||||
Private DTValues As DataTable
|
Private DTValues As DataTable
|
||||||
Private RecordId As Integer
|
|
||||||
Private FormId As Integer
|
Private FormId As Integer
|
||||||
Private Panel As Panel
|
Private Panel As Panel
|
||||||
|
|
||||||
@@ -23,8 +24,11 @@ Public Class ClassRecordView
|
|||||||
''' </summary>
|
''' </summary>
|
||||||
Public Sub LoadRecord(recordId As Integer)
|
Public Sub LoadRecord(recordId As Integer)
|
||||||
Me.RecordId = recordId
|
Me.RecordId = recordId
|
||||||
Me.LoadControls(Me.Panel)
|
Me.LoadControls()
|
||||||
Me.LoadValues(Me.Panel.Controls)
|
Me.LoadValues(Me.Panel.Controls)
|
||||||
|
Me.PreventControlValueChanges()
|
||||||
|
|
||||||
|
JUMP_RECORD_ID = 0
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
#Region "Helper Functions"
|
#Region "Helper Functions"
|
||||||
@@ -94,16 +98,29 @@ Public Class ClassRecordView
|
|||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Function ReplaceStaticPlaceholders(sqlcommand As String) As String
|
Private Function ReplaceStaticPlaceholders(sqlcommand As String) As String
|
||||||
If (New Regex(STATIC_PATTERN).IsMatch(sqlcommand)) Then
|
Try
|
||||||
|
If (New Regex(STATIC_PATTERN).IsMatch(sqlcommand)) Then
|
||||||
|
|
||||||
sqlcommand = sqlcommand _
|
Dim FormId As Integer = ClassControlCommands.GetFormId(Me.RecordId)
|
||||||
.Replace("@RECORD_ID", Me.RecordId) _
|
Dim ParentRecordId As Integer = ClassControlCommands.GetParentRecordId(Me.RecordId)
|
||||||
.Replace("@RECORDID", Me.RecordId)
|
|
||||||
' TODO: Add more placeholders
|
|
||||||
|
|
||||||
End If
|
sqlcommand = sqlcommand _
|
||||||
|
.Replace("@RECORD_ID", Me.RecordId) _
|
||||||
|
.Replace("@RECORDID", Me.RecordId) _
|
||||||
|
.Replace("@FORM_ID", FormId) _
|
||||||
|
.Replace("@ENTITY_ID", FormId)
|
||||||
|
|
||||||
Return sqlcommand
|
If ParentRecordId > 0 Then
|
||||||
|
sqlcommand = sqlcommand _
|
||||||
|
.Replace("@PARENTRECORDID", ParentRecordId) _
|
||||||
|
.Replace("@PARENTRECORD_ID", ParentRecordId)
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
Return sqlcommand
|
||||||
|
Catch ex As Exception
|
||||||
|
Return sqlcommand
|
||||||
|
End Try
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Function LoadSQLList(props As ControlProps) As DataTable
|
Private Function LoadSQLList(props As ControlProps) As DataTable
|
||||||
@@ -156,7 +173,7 @@ Public Class ClassRecordView
|
|||||||
|
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
Private Sub LoadControls(panel As Panel)
|
Private Sub LoadControls()
|
||||||
Dim controls As New List(Of Control)
|
Dim controls As New List(Of Control)
|
||||||
DTControls = ClassDatabase.Return_Datatable(String.Format("SELECT * FROM VWPMO_CONTROL_SCREEN WHERE FORM_ID = {0}", GetFormId()))
|
DTControls = ClassDatabase.Return_Datatable(String.Format("SELECT * FROM VWPMO_CONTROL_SCREEN WHERE FORM_ID = {0}", GetFormId()))
|
||||||
|
|
||||||
@@ -183,6 +200,8 @@ Public Class ClassRecordView
|
|||||||
control = LoadCheckBox(props)
|
control = LoadCheckBox(props)
|
||||||
Case "Radiobutton"
|
Case "Radiobutton"
|
||||||
control = LoadRadioButton(props)
|
control = LoadRadioButton(props)
|
||||||
|
Case "Picturebox"
|
||||||
|
control = LoadPictureBox(props)
|
||||||
End Select
|
End Select
|
||||||
|
|
||||||
If control IsNot Nothing Then
|
If control IsNot Nothing Then
|
||||||
@@ -190,8 +209,24 @@ Public Class ClassRecordView
|
|||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
|
|
||||||
panel.Controls.Clear()
|
Me.Panel.Controls.Clear()
|
||||||
panel.Controls.AddRange(controls.ToArray())
|
Me.Panel.Controls.AddRange(controls.ToArray())
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub PreventControlValueChanges()
|
||||||
|
|
||||||
|
For Each c As Control In Me.Panel.Controls
|
||||||
|
Dim type As String = DirectCast(c.Tag, ControlProps).Type
|
||||||
|
|
||||||
|
If type = "CheckedListBox" Then
|
||||||
|
Dim checklistbox = DirectCast(c, CheckedListBoxControl)
|
||||||
|
AddHandler checklistbox.ItemChecking, Sub(sender As Object, e As DevExpress.XtraEditors.Controls.ItemCheckingEventArgs)
|
||||||
|
e.Cancel = True
|
||||||
|
End Sub
|
||||||
|
End If
|
||||||
|
|
||||||
|
Next
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub LoadValues(controlCollection As Control.ControlCollection)
|
Private Sub LoadValues(controlCollection As Control.ControlCollection)
|
||||||
@@ -203,13 +238,14 @@ Public Class ClassRecordView
|
|||||||
|
|
||||||
For Each control As Control In controls
|
For Each control As Control In controls
|
||||||
Dim controlId As Integer = DirectCast(control.Tag, ControlProps).Id
|
Dim controlId As Integer = DirectCast(control.Tag, ControlProps).Id
|
||||||
|
Dim controlType As String = DirectCast(control.Tag, ControlProps).Type
|
||||||
|
|
||||||
Dim values As List(Of Object) = (From row In DTValues.AsEnumerable()
|
Dim values As List(Of Object) = (From row In DTValues.AsEnumerable()
|
||||||
Where row.Item("CONTROL_ID") = controlId
|
Where row.Item("CONTROL_ID") = controlId
|
||||||
Select row.Item("VALUE")).ToList()
|
Select row.Item("VALUE")).ToList()
|
||||||
|
|
||||||
' Wenn kein Wert existiert, keinen Wert laden
|
' Wenn kein Wert existiert, keinen Wert laden
|
||||||
If values.Count = 0 Then
|
If values.Count = 0 And Not controlType = "Picturebox" Then
|
||||||
Continue For
|
Continue For
|
||||||
Else
|
Else
|
||||||
LoadValue(control, values)
|
LoadValue(control, values)
|
||||||
@@ -222,8 +258,6 @@ Public Class ClassRecordView
|
|||||||
Dim value = Nothing
|
Dim value = Nothing
|
||||||
If values.Count > 0 Then
|
If values.Count > 0 Then
|
||||||
value = values(0)
|
value = values(0)
|
||||||
Else
|
|
||||||
Exit Sub
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Select Case controlType
|
Select Case controlType
|
||||||
@@ -235,24 +269,27 @@ Public Class ClassRecordView
|
|||||||
Case "Combobox"
|
Case "Combobox"
|
||||||
DirectCast(control, TextBox).Text = value.ToString()
|
DirectCast(control, TextBox).Text = value.ToString()
|
||||||
Case "Datepicker"
|
Case "Datepicker"
|
||||||
|
Dim dtp As TextBox = DirectCast(control, TextBox)
|
||||||
Try
|
Try
|
||||||
DirectCast(control, TextBox).Text = DateTime.Parse(value).ToShortDateString()
|
dtp.Text = DateTime.Parse(value).ToShortDateString()
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
|
dtp.text = "Invalid Date"
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
Case "Checkbox"
|
Case "Checkbox"
|
||||||
|
Dim checkbox = DirectCast(control, CheckBox)
|
||||||
Try
|
Try
|
||||||
DirectCast(control, CheckBox).Checked = Boolean.Parse(value)
|
checkbox.Checked = Boolean.Parse(value)
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
DirectCast(control, CheckBox).Checked = False
|
checkbox.Checked = False
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
Case "RadioButton"
|
Case "RadioButton"
|
||||||
|
Dim radio = DirectCast(control, RadioButton)
|
||||||
Try
|
Try
|
||||||
DirectCast(control, RadioButton).Checked = Boolean.Parse(value)
|
radio.Checked = Boolean.Parse(value)
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
DirectCast(control, RadioButton).Checked = False
|
radio.Checked = False
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
Case "Datagridview"
|
Case "Datagridview"
|
||||||
@@ -260,7 +297,7 @@ Public Class ClassRecordView
|
|||||||
Dim datagridview As ListBoxControl = DirectCast(control, ListBoxControl)
|
Dim datagridview As ListBoxControl = DirectCast(control, ListBoxControl)
|
||||||
datagridview.Items.AddRange(values.ToArray())
|
datagridview.Items.AddRange(values.ToArray())
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
|
' Keine Items hinzufügen
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
Case "ListBox"
|
Case "ListBox"
|
||||||
@@ -268,7 +305,7 @@ Public Class ClassRecordView
|
|||||||
Dim listbox As ListBoxControl = DirectCast(control, ListBoxControl)
|
Dim listbox As ListBoxControl = DirectCast(control, ListBoxControl)
|
||||||
listbox.Items.AddRange(values.ToArray())
|
listbox.Items.AddRange(values.ToArray())
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
|
' Keine Items hinzufügen
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
Case "CheckedListBox"
|
Case "CheckedListBox"
|
||||||
@@ -290,9 +327,25 @@ Public Class ClassRecordView
|
|||||||
End While
|
End While
|
||||||
Next
|
Next
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
|
' Keine Items anchecken
|
||||||
End Try
|
End Try
|
||||||
|
Case "Picturebox"
|
||||||
|
Try
|
||||||
|
Dim pb As PictureBox = DirectCast(control, PictureBox)
|
||||||
|
Dim controlId As Integer = DirectCast(control.Tag, ControlProps).Id
|
||||||
|
Dim sql = String.Format("SELECT IMG FROM TBPMO_CONTROL_IMAGE WHERE RECORD_ID = {0} AND CONTROL_ID = {1}", Me.RecordId, controlId)
|
||||||
|
Dim bimg() As Byte = ClassDatabase.Execute_Scalar(sql)
|
||||||
|
|
||||||
|
If Not IsNothing(bimg) Then
|
||||||
|
Dim img As Bitmap = ByteArrayToBitmap(bimg)
|
||||||
|
|
||||||
|
pb.BackgroundImage = img
|
||||||
|
pb.BackgroundImageLayout = ImageLayout.Zoom
|
||||||
|
End If
|
||||||
|
Catch ex As Exception
|
||||||
|
' Kein Bild laden
|
||||||
|
MsgBox(ex.Message)
|
||||||
|
End Try
|
||||||
End Select
|
End Select
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
@@ -303,24 +356,26 @@ Public Class ClassRecordView
|
|||||||
Public Name As String
|
Public Name As String
|
||||||
Public Type As String
|
Public Type As String
|
||||||
Public Caption As String
|
Public Caption As String
|
||||||
|
|
||||||
' Position/Size Props
|
' Position/Size Props
|
||||||
Public X As Integer
|
Public X As Integer
|
||||||
Public Y As Integer
|
Public Y As Integer
|
||||||
Public Height As Integer
|
Public Height As Integer
|
||||||
Public Width As Integer
|
Public Width As Integer
|
||||||
|
|
||||||
' Font/Color Props
|
' Font/Color Props
|
||||||
Public FontColor As Color
|
Public FontColor As Color
|
||||||
Public FontSize As Integer
|
Public FontSize As Integer
|
||||||
Public FontStyle As FontStyle
|
Public FontStyle As FontStyle
|
||||||
Public FontFamily As String
|
Public FontFamily As String
|
||||||
Public Font As Font
|
Public Font As Font
|
||||||
|
|
||||||
Public BackColor As Color
|
Public BackColor As Color
|
||||||
|
|
||||||
' Flag Props
|
' Flag Props
|
||||||
Public IsRequired As Boolean
|
Public IsRequired As Boolean
|
||||||
Public IsReadOnly As Boolean
|
Public IsReadOnly As Boolean
|
||||||
Public IsMultiline As Boolean
|
Public IsMultiline As Boolean
|
||||||
|
|
||||||
' Data Props
|
' Data Props
|
||||||
Public SqlCommand1 As String
|
Public SqlCommand1 As String
|
||||||
Public SqlCommand2 As String
|
Public SqlCommand2 As String
|
||||||
@@ -339,7 +394,8 @@ Public Class ClassRecordView
|
|||||||
label.Text = props.Caption
|
label.Text = props.Caption
|
||||||
label.Font = props.Font
|
label.Font = props.Font
|
||||||
label.ForeColor = props.FontColor
|
label.ForeColor = props.FontColor
|
||||||
label.BackColor = props.BackColor
|
'label.BackColor = props.BackColor
|
||||||
|
label.BackColor = Color.White
|
||||||
label.AutoSize = True
|
label.AutoSize = True
|
||||||
|
|
||||||
props = LoadDataSource(props)
|
props = LoadDataSource(props)
|
||||||
@@ -364,7 +420,8 @@ Public Class ClassRecordView
|
|||||||
textbox.BorderStyle = BorderStyle.FixedSingle
|
textbox.BorderStyle = BorderStyle.FixedSingle
|
||||||
textbox.Font = props.Font
|
textbox.Font = props.Font
|
||||||
textbox.ForeColor = props.FontColor
|
textbox.ForeColor = props.FontColor
|
||||||
textbox.BackColor = props.BackColor
|
'textbox.BackColor = props.BackColor
|
||||||
|
textbox.BackColor = Color.White
|
||||||
textbox.ReadOnly = True
|
textbox.ReadOnly = True
|
||||||
|
|
||||||
Return textbox
|
Return textbox
|
||||||
@@ -377,7 +434,8 @@ Public Class ClassRecordView
|
|||||||
combo.BorderStyle = BorderStyle.FixedSingle
|
combo.BorderStyle = BorderStyle.FixedSingle
|
||||||
combo.Font = props.Font
|
combo.Font = props.Font
|
||||||
combo.ForeColor = props.FontColor
|
combo.ForeColor = props.FontColor
|
||||||
combo.BackColor = props.BackColor
|
'combo.BackColor = props.BackColor
|
||||||
|
combo.BackColor = Color.White
|
||||||
combo.ReadOnly = True
|
combo.ReadOnly = True
|
||||||
|
|
||||||
Return combo
|
Return combo
|
||||||
@@ -390,7 +448,8 @@ Public Class ClassRecordView
|
|||||||
dtp.BorderStyle = BorderStyle.FixedSingle
|
dtp.BorderStyle = BorderStyle.FixedSingle
|
||||||
dtp.Font = props.Font
|
dtp.Font = props.Font
|
||||||
dtp.ForeColor = props.FontColor
|
dtp.ForeColor = props.FontColor
|
||||||
dtp.BackColor = props.BackColor
|
'dtp.BackColor = props.BackColor
|
||||||
|
dtp.BackColor = Color.White
|
||||||
dtp.ReadOnly = True
|
dtp.ReadOnly = True
|
||||||
|
|
||||||
Return dtp
|
Return dtp
|
||||||
@@ -400,7 +459,7 @@ Public Class ClassRecordView
|
|||||||
Dim check As CheckBox = SetBaseProps(New CheckBox, props)
|
Dim check As CheckBox = SetBaseProps(New CheckBox, props)
|
||||||
|
|
||||||
check.Text = props.Caption
|
check.Text = props.Caption
|
||||||
check.Enabled = False
|
check.AutoCheck = False
|
||||||
|
|
||||||
Return check
|
Return check
|
||||||
End Function
|
End Function
|
||||||
@@ -409,7 +468,7 @@ Public Class ClassRecordView
|
|||||||
Dim radio As RadioButton = SetBaseProps(New RadioButton, props)
|
Dim radio As RadioButton = SetBaseProps(New RadioButton, props)
|
||||||
|
|
||||||
radio.Text = props.Caption
|
radio.Text = props.Caption
|
||||||
radio.Enabled = False
|
radio.AutoCheck = False
|
||||||
|
|
||||||
Return radio
|
Return radio
|
||||||
End Function
|
End Function
|
||||||
@@ -431,6 +490,10 @@ Public Class ClassRecordView
|
|||||||
|
|
||||||
props = LoadDataSource(props)
|
props = LoadDataSource(props)
|
||||||
|
|
||||||
|
If Not IsNothing(props.StaticList) Then
|
||||||
|
checklistbox.DataSource = props.StaticList
|
||||||
|
End If
|
||||||
|
|
||||||
If Not IsNothing(props.DataSource) Then
|
If Not IsNothing(props.DataSource) Then
|
||||||
If props.DataSource.GetType() Is GetType(DataTable) Then
|
If props.DataSource.GetType() Is GetType(DataTable) Then
|
||||||
Dim dt As DataTable = props.DataSource
|
Dim dt As DataTable = props.DataSource
|
||||||
@@ -451,5 +514,13 @@ Public Class ClassRecordView
|
|||||||
Return checklistbox
|
Return checklistbox
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Private Function LoadPictureBox(props As ControlProps) As PictureBox
|
||||||
|
Dim pb As PictureBox = SetBaseProps(New PictureBox, props)
|
||||||
|
|
||||||
|
pb.BorderStyle = BorderStyle.FixedSingle
|
||||||
|
|
||||||
|
Return pb
|
||||||
|
End Function
|
||||||
|
|
||||||
#End Region
|
#End Region
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ Public Class frmRecordView
|
|||||||
Public hIcon As IntPtr
|
Public hIcon As IntPtr
|
||||||
Public hProcess As IntPtr
|
Public hProcess As IntPtr
|
||||||
End Structure
|
End Structure
|
||||||
|
|
||||||
Private Sub frmRecordView_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
Private Sub frmRecordView_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||||
If USER_LANGUAGE <> "de-DE" Then
|
If USER_LANGUAGE <> "de-DE" Then
|
||||||
Me.Text = "Detailview Record"
|
Me.Text = "Detailview Record"
|
||||||
@@ -38,6 +39,10 @@ Public Class frmRecordView
|
|||||||
End If
|
End If
|
||||||
recordView = New ClassRecordView(pnlDetails)
|
recordView = New ClassRecordView(pnlDetails)
|
||||||
recordView.LoadRecord(JUMP_RECORD_ID)
|
recordView.LoadRecord(JUMP_RECORD_ID)
|
||||||
|
|
||||||
|
'Titel updaten
|
||||||
|
Me.Text &= " " + recordView.RecordId.ToString()
|
||||||
|
|
||||||
RUN_WDSEARCH_GRID()
|
RUN_WDSEARCH_GRID()
|
||||||
Load_Tasks()
|
Load_Tasks()
|
||||||
End Sub
|
End Sub
|
||||||
|
|||||||
Reference in New Issue
Block a user