This commit is contained in:
JenneJ
2016-08-24 15:06:55 +02:00
parent 08a93d1338
commit 8cac2cf09e
4 changed files with 128 additions and 33 deletions

View File

@@ -163,16 +163,64 @@ Public Class ClassControlBuilder
Public Sub OnTextBoxFocus(sender As Object, ByVal e As EventArgs)
Dim box As TextBox = sender
box.BackColor = Color.LemonChiffon
box.SelectAll()
If CURRENT_RECORD_ENABLED = False Then Exit Sub
CURRENT_TEXTBOX_SELECTED_TEXT = DirectCast(sender, TextBox).Text
End Sub
Public Sub OnTextBoxLostFocus(sender As Object, ByVal e As EventArgs)
Dim box As TextBox = sender
box.BackColor = Color.White
End Sub
Public Sub OnTextBoxTextChanged(sender As Object, ByVal e As EventArgs)
If CURRENT_RECORD_ENABLED = False Then Exit Sub
CURRENT_RECORD_ENABLED = False
Try
Dim control As Control = DirectCast(sender, Control)
Dim textbox As TextBox = DirectCast(control, TextBox)
Dim controlId As Integer = DirectCast(control.Tag, ClassControlMetadata).Id
CONTROL_ID = controlId
Dim expression As String
expression = "ENTITY_ID = " & CURRENT_FORM_ID
Dim foundControls() As DataRow
' Use the Select method to find all rows matching the filter.
foundControls = CURRENT_DT_TBPMO_ENTITY_RIGHT_CONTROLS.Select(expression)
Dim i As Integer
Dim NODE_CONFIG_ID
' Check if control is one of rightcontrols
For i = 0 To foundControls.GetUpperBound(0)
If foundControls(i)("CONTROL_ID") = CONTROL_ID Then
RIGHT_CONTROL_CHANGED = True
Dim msg = MSG_RIGHTMODULE_DE
If USER_LANGUAGE <> "de-DE" Then
msg = MSG_RIGHTMODULE_EN_US
End If
Dim result As MsgBoxResult
result = MessageBox.Show(msg, "Confirmation needed:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If result = MsgBoxResult.No Then
CtrlBuilder.ControlsChanged.Remove(controlId)
' Y U NO WORK??
Dim text = CURRENT_TEXTBOX_SELECTED_TEXT
textbox.Text = text
CURRENT_RECORD_ENABLED = True
Exit Sub
End If
End If
Next
Catch ex As Exception
If ex.Message.Contains("Objektverweis") Or ex.Message.Contains("reference not set") Then
Else
MsgBox("Error in OnTextBoxLostFocus - " & CONTROL_ID.ToString & ": " & ex.Message, MsgBoxStyle.Critical)
End If
Finally
CURRENT_RECORD_ENABLED = True
End Try
End Sub
Public Sub OnComboBoxFocus(sender As Object, ByVal e As EventArgs)
Dim combo As CustomComboBox = sender
combo.BackColor = Color.LemonChiffon
@@ -489,16 +537,20 @@ Public Class ClassControlBuilder
Dim control As Control = DirectCast(sender, Control)
Dim controlId As Integer = DirectCast(control.Tag, ClassControlMetadata).Id
CURRENT_COMBOBOX_SELECTED_INDEX = DirectCast(control, CustomComboBox).SelectedIndex
CURRENT_COMBOBOX_SELECTED_TEXT = DirectCast(control, CustomComboBox).Text
Catch ex As Exception
MsgBox("Error in OnComboBoxFocused - " & CONTROL_ID.ToString & ": " & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Public Sub OnComboBoxValueChanged(sender As Object, ByVal e As EventArgs)
If CURRENT_RECORD_ENABLED = False Then Exit Sub
' Verhindert, dass OnComboBoxFocues unkontrolliert feuert!
CURRENT_RECORD_ENABLED = False
Try
Dim control As Control = DirectCast(sender, Control)
Dim combo As CustomComboBox = DirectCast(control, CustomComboBox)
Dim controlId As Integer = DirectCast(control.Tag, ClassControlMetadata).Id
CONTROL_ID = controlId
@@ -513,9 +565,35 @@ Public Class ClassControlBuilder
For i = 0 To foundControls.GetUpperBound(0)
If foundControls(i)("CONTROL_ID") = CONTROL_ID Then
RIGHT_CONTROL_CHANGED = True
Exit For
Dim msg = MSG_RIGHTMODULE_DE
If USER_LANGUAGE <> "de-DE" Then
msg = MSG_RIGHTMODULE_EN_US
End If
Dim result As MsgBoxResult
result = MessageBox.Show(msg, "Confirmation needed:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If result = MsgBoxResult.No Then
CtrlBuilder.ControlsChanged.Remove(controlId)
' Y U NO WORK??
Dim text = CURRENT_COMBOBOX_SELECTED_TEXT
combo.SelectedIndex = -1
combo.SelectedText = text
combo.Text = text
CURRENT_RECORD_ENABLED = True
Exit Sub
End If
End If
Next
Dim onRecordChangedHandler As EventHandler = CType(Me.Events(_onRecordChangedName), EventHandler)
If Not ControlsChanged.Contains(controlId) Then
ControlsChanged.Add(controlId)
End If
If (onRecordChangedHandler IsNot Nothing And WatchRecordChanges) Then
onRecordChangedHandler.Invoke(sender, e)
End If
'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)
Dim value
@@ -538,9 +616,11 @@ Public Class ClassControlBuilder
value = DirectCast(control, CustomComboBox).Text
If String.IsNullOrEmpty(value) Then
CURRENT_RECORD_ENABLED = True
Exit Sub
End If
If CURRENT_RECORD_ID = 0 And CtrlCommandUI.IsInsert = True Then
CURRENT_RECORD_ENABLED = True
Exit Sub
End If
@@ -549,7 +629,7 @@ Public Class ClassControlBuilder
Depending_Controls(control, datatable, value)
Enable_Controls(control, datatable1, value)
Console.WriteLine("value changed")
CURRENT_RECORD_ENABLED = True
Catch ex As Exception
If ex.Message.Contains("Objektverweis") Or ex.Message.Contains("reference not set") Then
@@ -588,6 +668,12 @@ Public Class ClassControlBuilder
If result = MsgBoxResult.No Then
RIGHT_CONTROL_CHANGED = False
CtrlBuilder.ControlsChanged.Remove(controlId)
Dim loadedValues As List(Of Object) = (From row In CURRENT_CONTROL_VALUES.AsEnumerable()
Where row.Item("CONTROL_ID") = controlId
Select row.Item("VALUE")).ToList()
ClassControlValues.LoadControlValue(CURRENT_RECORD_ID, CURRENT_PARENT_RECORD_ID, CONTROL_ID, control, loadedValues, CURRENT_FORM_ID)
RECORD_CHANGED = False
Exit Sub
End If
@@ -787,15 +873,15 @@ Public Class ClassControlBuilder
AddHandler textbox.TextChanged, AddressOf RecordChanged
AddHandler textbox.GotFocus, AddressOf OnTextBoxFocus
AddHandler textbox.LostFocus, AddressOf OnTextBoxLostFocus
AddHandler textbox.TextChanged, AddressOf OnTextBoxTextChanged
AddHandler textbox.ReadOnlyChanged, AddressOf OnReadOnlyChanged
Case "CustomComboBox"
Dim combo As CustomComboBox = CType(control, CustomComboBox)
AddHandler combo.GotFocus, AddressOf OnComboBoxFocused
AddHandler combo.SelectedValueChanged, AddressOf RecordChanged
'AddHandler combo.GotFocus, AddressOf OnComboBoxFocused
AddHandler combo.Enter, AddressOf OnComboBoxFocused
AddHandler combo.SelectedValueChanged, AddressOf OnComboBoxValueChanged
AddHandler combo.TextChanged, AddressOf RecordChanged
'AddHandler combo.TextChanged, AddressOf RecordChanged
'AddHandler combo.GotFocus, AddressOf OnComboBoxFocus
'AddHandler combo.LostFocus, AddressOf OnComboBoxLostFocus
AddHandler combo.EnabledChanged, AddressOf OnEnabledChanged
@@ -2275,7 +2361,9 @@ Public Class ClassControlBuilder
Next
End If
Me.SetEventHandlers(control)
If Not _designMode Then
Me.SetEventHandlers(control)
End If
Me.CurrentControl = DirectCast(control, DevExpress.XtraEditors.CheckedListBoxControl)
If Not IsNothing(parent) Then
control.Parent = parent

View File

@@ -431,6 +431,9 @@
Exit Sub
End If
CURRENT_RECORD_ENABLED = False
control.UnCheckAll()
For Each v As String In values
'For i As Integer = 0 To control.ItemCount - 1
@@ -439,6 +442,7 @@
Dim posBefore As Integer = 0
While (control.FindStringExact(v, posBefore) > -1)
Dim pos = control.FindStringExact(v, posBefore)
' Wenn v gefunden wurde, anhaken
If pos >= 0 Then
control.SetItemCheckState(pos, CheckState.Checked)
@@ -449,9 +453,9 @@
Exit While
End If
End While
Next
CURRENT_RECORD_ENABLED = True
End Sub
Public Shared Sub LoadList(control As DevExpress.XtraEditors.CheckedListBoxControl, formId As Integer, conn_Id As Object, SQLCommand As String)

View File

@@ -101,6 +101,8 @@
Public RECORD_CHANGED As Boolean = False
Public CURRENT_COMBOBOX_SELECTED_INDEX As Integer = 0
Public CURRENT_COMBOBOX_SELECTED_TEXT As String = ""
Public CURRENT_TEXTBOX_SELECTED_TEXT As String = ""
Public RIGHT_CONTROL_CHANGED As Boolean = False
Public MSG_RIGHTMODULE_DE = "Achtung: " & vbNewLine & "Sie haben Änderungen an Rechte-relevanten Eingaben vorgenommen!" & vbNewLine & _
"Alle Rechte der zu diesem Datensatz gespeicherten Dateien werden nach Speichern serverseitig und im Hintergrund überprüft!" & vbNewLine & _

View File

@@ -386,7 +386,7 @@ Public Class frmConstructor_Main
If ACT_EBENE_STRING Is Nothing Then
Exit Sub
End If
Dim XMLPath = Get_DocGRid_Layout_Filename()
GridViewDoc_Search.SaveLayoutToXml(XMLPath)
' Update_Status_Label(True, "Grid Layout Loaded")
@@ -464,7 +464,7 @@ Public Class frmConstructor_Main
settings.Add(New ClassSetting("SplitViewTopSplitterPosition", SplitContainerTop.SplitterPosition))
settings.Add(New ClassSetting("SplitViewMainSplitterPosition", SplitContainer1.SplitterPosition))
End If
layout.Save(settings)
Catch ex As Exception
MsgBox("Error in Save_Splitter_Layout:" & vbNewLine & ex.Message)
@@ -1600,7 +1600,7 @@ Public Class frmConstructor_Main
Catch ex As Exception
MsgBox("Unexpected Error in Load TreeView:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Sub Create_variable_node()
@@ -2038,21 +2038,21 @@ Public Class frmConstructor_Main
End If
If RIGHT_CONTROL_CHANGED = True Then
Dim msg = MSG_RIGHTMODULE_DE
If USER_LANGUAGE <> "de-DE" Then
msg = MSG_RIGHTMODULE_EN_US
End If
Dim result As MsgBoxResult
result = MessageBox.Show(msg, "Confirmation needed:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If result = MsgBoxResult.No Then
RIGHT_CONTROL_CHANGED = False
RECORD_CHANGED = False
DisableEditMode()
Show_Selected_Record_Data(SELECTED_RECORD_ID, False)
Return True
End If
End If
'If RIGHT_CONTROL_CHANGED = True Then
' Dim msg = MSG_RIGHTMODULE_DE
' If USER_LANGUAGE <> "de-DE" Then
' msg = MSG_RIGHTMODULE_EN_US
' End If
' Dim result As MsgBoxResult
' result = MessageBox.Show(msg, "Confirmation needed:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
' If result = MsgBoxResult.No Then
' RIGHT_CONTROL_CHANGED = False
' RECORD_CHANGED = False
' DisableEditMode()
' Show_Selected_Record_Data(SELECTED_RECORD_ID, False)
' Return True
' End If
'End If
If TrySave_User() = False Then
@@ -2062,6 +2062,7 @@ Public Class frmConstructor_Main
Else
If CtrlCommandUI.IsInsert Then
ActivateAllTabs()
DisableEditMode()
End If
End If
@@ -2246,7 +2247,7 @@ Public Class frmConstructor_Main
'End If
If TrySave_Automatic() = True Then
DisableEditMode()
End If
End If
End Sub
@@ -5714,7 +5715,7 @@ Public Class frmConstructor_Main
End Try
End If
End If
End If
End Sub