jj 18.05
This commit is contained in:
@@ -59,11 +59,17 @@ Public Class ClassControlBuilder
|
||||
' ==================================================================================
|
||||
' Handler für alle Controls
|
||||
' ==================================================================================
|
||||
Public ControlsChanged As New List(Of Integer)
|
||||
|
||||
Public Sub RecordChanged(sender As Object, ByVal e As EventArgs)
|
||||
Dim onRecordChangedHandler As EventHandler = CType(Me.Events(_onRecordChangedName), EventHandler)
|
||||
Dim ctrl As Control = DirectCast(sender, Control)
|
||||
Dim controlId As Integer = DirectCast(ctrl.Tag, ClassControlMetadata).Id
|
||||
If Not ControlsChanged.Contains(controlId) Then
|
||||
ControlsChanged.Add(controlId)
|
||||
End If
|
||||
|
||||
If (onRecordChangedHandler IsNot Nothing And WatchRecordChanges) Then
|
||||
Console.WriteLine("RecordChanged")
|
||||
onRecordChangedHandler.Invoke(sender, e)
|
||||
End If
|
||||
End Sub
|
||||
@@ -71,8 +77,13 @@ Public Class ClassControlBuilder
|
||||
' CheckedListBox hat andere Handler Signatur
|
||||
Public Sub RecordChanged(sender As Object, ByVal e As DevExpress.XtraEditors.Controls.ItemCheckEventArgs)
|
||||
Dim onRecordChangedHandler As EventHandler = CType(Me.Events(_onRecordChangedName), EventHandler)
|
||||
Dim ctrl As Control = DirectCast(sender, Control)
|
||||
Dim controlId As Integer = DirectCast(ctrl.Tag, ClassControlMetadata).Id
|
||||
If Not ControlsChanged.Contains(controlId) Then
|
||||
ControlsChanged.Add(controlId)
|
||||
End If
|
||||
|
||||
If (onRecordChangedHandler IsNot Nothing) Then
|
||||
If (onRecordChangedHandler IsNot Nothing And WatchRecordChanges) Then
|
||||
onRecordChangedHandler.Invoke(sender, e)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -493,6 +493,10 @@ Public Class ClassControlCommandsUI
|
||||
|
||||
Private Sub UpdateAllControls(FormID As Integer, RecordID As Integer, controls As Control.ControlCollection)
|
||||
Try
|
||||
Dim sw As New SW("UpdateAllControls")
|
||||
|
||||
Dim VALUE_EXISTS_DT As DataTable = ClassDatabase.Return_Datatable(String.Format("SELECT RECORD_ID, CONTROL_ID FROM VWPMO_VALUES WHERE RECORD_ID = {0}", RecordID))
|
||||
|
||||
For Each ctrl As Control In controls
|
||||
Console.WriteLine("Updating Control " + ctrl.Name)
|
||||
|
||||
@@ -524,9 +528,15 @@ Public Class ClassControlCommandsUI
|
||||
Continue For
|
||||
End If
|
||||
|
||||
Dim ValueExists = ClassDatabase.Execute_Scalar(String.Format("SELECT RECORD_ID FROM VWPMO_VALUES WHERE RECORD_ID = {0} AND CONTROL_ID = {1}", RecordID, CONTROL_ID))
|
||||
'Dim ValueExists = ClassDatabase.Execute_Scalar(String.Format("SELECT RECORD_ID FROM VWPMO_VALUES WHERE RECORD_ID = {0} AND CONTROL_ID = {1}", RecordID, CONTROL_ID))
|
||||
Dim ValueExists = VALUE_EXISTS_DT.Select(String.Format("CONTROL_ID = {0}", CONTROL_ID))
|
||||
Dim ValueChanged As Boolean = CtrlBuilder.ControlsChanged.Contains(CONTROL_ID)
|
||||
|
||||
If IsNothing(ValueExists) Then ' Neues Control
|
||||
If Not ValueChanged Then
|
||||
Continue For
|
||||
End If
|
||||
|
||||
If ValueExists.Length = 0 Then ' Neues Control
|
||||
'If CONTROL_ID = 995 Or CONTROL_ID = 996 Or CONTROL_ID = 997 Or CONTROL_ID = 810 Then
|
||||
' Console.WriteLine("sdasd")
|
||||
'End If
|
||||
@@ -540,10 +550,14 @@ Public Class ClassControlCommandsUI
|
||||
End If
|
||||
Else ' Update Control
|
||||
If Not IsNothing(CONTROL_VALUE) Then
|
||||
Dim sw2 As New SW("UpdateControlValue")
|
||||
UpdateControlValue(CONTROL_ID, RecordID, CONTROL_VALUE)
|
||||
sw2.Done()
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
sw.Done()
|
||||
Catch ex As Exception
|
||||
MsgBox("Unexpected Error in UpdateAllControls: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
||||
End Try
|
||||
|
||||
@@ -395,4 +395,22 @@
|
||||
Return Guid.NewGuid().ToString().GetHashCode().ToString("x")
|
||||
End Function
|
||||
|
||||
Public Class SW
|
||||
Public label As String
|
||||
Public stopwatch As Stopwatch
|
||||
|
||||
Public Sub New(label As String)
|
||||
Me.label = label
|
||||
stopwatch = New Stopwatch()
|
||||
stopwatch.Start()
|
||||
End Sub
|
||||
|
||||
Public Sub Done()
|
||||
stopwatch.Stop()
|
||||
Console.WriteLine("{0} took {1} milliseconds to complete", label, stopwatch.ElapsedMilliseconds)
|
||||
End Sub
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
End Module
|
||||
|
||||
@@ -794,7 +794,9 @@ Public Class frmConstructor_Main
|
||||
sw.Start()
|
||||
' muss vor show selected record data kommen,
|
||||
' sodass die datasource für die angehakten werte existiert (checked list box)
|
||||
CtrlBuilder.WatchRecordChanges = False
|
||||
ClassControlValues.LoadControlValuesListWithPlaceholders(ENTITY_ID, Grid_RecordID, PARENT_ID, CtrlBuilder.AllControls, ENTITY_ID)
|
||||
CtrlBuilder.WatchRecordChanges = True
|
||||
Show_Selected_Record_Data(Grid_RecordID, False)
|
||||
Dim sw1 As New Stopwatch
|
||||
sw1.Start()
|
||||
@@ -821,8 +823,13 @@ Public Class frmConstructor_Main
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
'Liste der geänderten Control Values leeren
|
||||
CtrlBuilder.ControlsChanged.Clear()
|
||||
|
||||
elapsed = sw.Elapsed.TotalSeconds
|
||||
sw.Stop()
|
||||
Console.WriteLine("Column_Row_Handler took {0}ms to load", sw.ElapsedMilliseconds)
|
||||
sw.Reset()
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >>>> Column/Row Change took " & Format(elapsed, "0.000000000") & " seconds", False)
|
||||
End Sub
|
||||
@@ -1579,14 +1586,16 @@ Public Class frmConstructor_Main
|
||||
If RECORD_ENABLED = False Then
|
||||
EnableEditMode()
|
||||
Else
|
||||
Dim ResultMessage As String
|
||||
Try
|
||||
ResultMessage = Update_Record_OnChange()
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Error in saving Record")
|
||||
Me.Cursor = Cursors.Default
|
||||
Exit Sub
|
||||
End Try
|
||||
If RECORD_CHANGED Then
|
||||
Dim ResultMessage As String
|
||||
Try
|
||||
ResultMessage = Update_Record_OnChange()
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Error in saving Record")
|
||||
Me.Cursor = Cursors.Default
|
||||
Exit Sub
|
||||
End Try
|
||||
End If
|
||||
|
||||
DisableEditMode()
|
||||
End If
|
||||
@@ -1615,7 +1624,6 @@ Public Class frmConstructor_Main
|
||||
ClassRecordState.LockRecord(SELECTED_RECORD_ID)
|
||||
End If
|
||||
|
||||
|
||||
Lock_RecordControls(False)
|
||||
tsmi_RecordDelete.Enabled = True
|
||||
Me.tsButtonAdd.Enabled = True
|
||||
|
||||
Reference in New Issue
Block a user