MS_30.05.2016

This commit is contained in:
SchreiberM
2016-05-31 09:46:07 +02:00
parent 6a20480e7c
commit ecb4161e6a
7 changed files with 302 additions and 100 deletions

View File

@@ -87,6 +87,21 @@ Public Class ClassControlBuilder
onRecordChangedHandler.Invoke(sender, e)
End If
End Sub
' GridControl hat andere Handler Signatur
Public Sub RecordChanged(sender As Object, ByVal e As DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs)
Dim onRecordChangedHandler As EventHandler = CType(Me.Events(_onRecordChangedName), EventHandler)
Dim ctrl As DevExpress.XtraGrid.Views.Grid.GridView = sender
' Dim ctrl As Control = sender 'DirectCast(sender, Control)
Dim controlId As Integer = DirectCast(ctrl.GridControl.Tag, ClassControlMetadata).Id
If Not ControlsChanged.Contains(controlId) Then
ControlsChanged.Add(controlId)
End If
If (onRecordChangedHandler IsNot Nothing And WatchRecordChanges) Then
onRecordChangedHandler.Invoke(sender, e)
End If
End Sub
Public Sub MouseHover(sender As Object, e As EventArgs)
Dim onMouseHoverHandler As EventHandler = CType(Me.Events(_onMouseHoverName), EventHandler)
@@ -564,6 +579,61 @@ Public Class ClassControlBuilder
End If
End Try
End Sub
Public Sub OnCheckedChanged(sender As Object, ByVal e As EventArgs)
If CURRENT_RECORD_ENABLED = False Then Exit Sub
Try
Dim GridView As DevExpress.XtraGrid.Views.Grid.GridView = sender
Dim control As Control = DirectCast(GridView.GridControl, Control)
Dim controlId As Integer = DirectCast(GridView.GridControl.Tag, ClassControlMetadata).Id
CONTROL_ID = controlId
control.Update()
'SQL für abhängige Auswahllisten
Dim SQL As String = String.Format("SELECT GUID, SQL_COMMAND_1,CONTROL_TYPE_ID,FORMAT_TYPE FROM TBPMO_CONTROL WHERE SQL_COMMAND_1 LIKE '%@{0}@%'", controlId)
'SQL für enable control
Dim SQLenable As String = String.Format("SELECT GUID, SQL_COMMAND_2,CONTROL_TYPE_ID,FORMAT_TYPE FROM TBPMO_CONTROL WHERE SQL_COMMAND_2 LIKE '%@{0}@%'", controlId)
'If CtrlCommandUI.IsInsert = True Then
' CtrlCommandUI.SaveRecord(0, CURRENT_FORM_ID, CURRENT_PARENT_ID)
'End If
Dim CONTROL_VALUE As String = ClassControlCommandsUI.GetControlValue(control)
If CURRENT_RECORD_ID = 0 Then
Exit Sub
End If
' Da wir beim Klick auf Hinzfügen einen Record anlegen,
' muss UpdateMultipleValues auch aufgerufen werden, wenn wir IsInsert = True ist
'If CtrlCommandUI.IsInsert = False Then
ClassControlCommandsUI.UpdateMultipleValues(controlId, CURRENT_RECORD_ID, CONTROL_VALUE)
'End If
Dim SQL1 As String = String.Format("SELECT * FROM VWPMO_VALUES WHERE RECORD_ID = {0}", CURRENT_RECORD_ID)
Dim DT_ControlValues As DataTable = ClassDatabase.Return_Datatable(SQL1, "LoadControlValues")
CURRENT_CONTROL_VALUES = DT_ControlValues
Dim datatable As DataTable = ClassDatabase.Return_Datatable(SQL)
Dim datatable1 As DataTable = ClassDatabase.Return_Datatable(SQLenable)
Depending_Controls(control, datatable, CONTROL_VALUE)
If IsNothing(CONTROL_VALUE) Then
Exit Sub
End If
Enable_Controls(control, datatable1, CONTROL_VALUE)
Dim values = New List(Of Object)(CONTROL_VALUE.Split(";").ToArray())
'Jetzt noch die checked Items setzen
' ClassControlValues.LoadControlValue(CURRENT_RECORD_ID, CURRENT_PARENT_ID, controlId, control, values, 99)
Catch ex As Exception
If ex.Message.Contains("Objektverweis") Or ex.Message.Contains("reference not set") Then
Else
MsgBox("Error in OnCheckedChanged - " & CONTROL_ID.ToString & ": " & ex.Message, MsgBoxStyle.Critical)
End If
End Try
End Sub
Public Sub CheckBoxChanged(sender As Object, ByVal e As EventArgs)
If CURRENT_RECORD_ENABLED = False Then Exit Sub
@@ -709,7 +779,11 @@ Public Class ClassControlBuilder
AddHandler gridview.CellValueChanged, AddressOf RecordChanged
AddHandler gridview.RowsRemoved, AddressOf RecordChanged
AddHandler gridview.EnabledChanged, AddressOf OnEnabledChanged
Case "GridControl"
Dim gridcontrol As DevExpress.XtraGrid.GridControl = CType(control, DevExpress.XtraGrid.GridControl)
Dim gridview As DevExpress.XtraGrid.Views.Grid.GridView = gridcontrol.MainView
AddHandler gridview.CellValueChanged, AddressOf RecordChanged
AddHandler gridview.CellValueChanged, AddressOf OnCheckedChanged
End Select
End Sub