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