diff --git a/app/DD-Record-Organiser/ClassControlBuilder.vb b/app/DD-Record-Organiser/ClassControlBuilder.vb index 28d3d22..2a7b184 100644 --- a/app/DD-Record-Organiser/ClassControlBuilder.vb +++ b/app/DD-Record-Organiser/ClassControlBuilder.vb @@ -272,21 +272,24 @@ Public Class ClassControlBuilder If match.Success Then Dim sqlguid = String.Format("SELECT GUID FROM TBPMO_CONTROL_VALUE WHERE CONTROL_ID = {0} AND RECORD_ID = {1}", CONTROL_ID, CURRENT_RECORD_ID) Dim ctrlvalID = ClassDatabase.Execute_Scalar(sqlguid) - If Not IsNothing(ctrlvalID) Then - Dim upd1 = String.Format("UPDATE TBPMO_CONTROL_VALUE SET VALUE = '{0}' WHERE CONTROL_ID = {1} AND RECORD_ID = {2}", value.ToString, CONTROL_ID, CURRENT_RECORD_ID) - ClassDatabase.Execute_non_Query(upd1) - Else - If CURRENT_RECORD_ID <> 0 Then - Dim ins = String.Format("INSERT INTO TBPMO_CONTROL_VALUE (CONTROL_ID,RECORD_ID,VALUE,ADDED_WHO) VALUES ({0},{1},'{2}','{3}')", CONTROL_ID, CURRENT_RECORD_ID, value, Environment.UserName) - ClassDatabase.Execute_non_Query(ins) + + ' Diese Abfrage verhindert, dass Werte, die aus z.B. CheckedListBoxen kommen, + ' nicht überschrieben werden. Diese Werte werden bereits mit UpdateMultipleValues gespeichert + If (Not value.Contains(";")) Then + If Not IsNothing(ctrlvalID) Then + Dim upd1 = String.Format("UPDATE TBPMO_CONTROL_VALUE SET VALUE = '{0}' WHERE CONTROL_ID = {1} AND RECORD_ID = {2}", value.ToString, CONTROL_ID, CURRENT_RECORD_ID) + ClassDatabase.Execute_non_Query(upd1) + Else + If CURRENT_RECORD_ID <> 0 Then + Dim ins = String.Format("INSERT INTO TBPMO_CONTROL_VALUE (CONTROL_ID,RECORD_ID,VALUE,ADDED_WHO) VALUES ({0},{1},'{2}','{3}')", CONTROL_ID, CURRENT_RECORD_ID, value, Environment.UserName) + ClassDatabase.Execute_non_Query(ins) + End If + + ' If LogErrorsOnly = False Then ClassLogger.Add(" >> Value was nothing - Inserted the ControlValue '" & ins & "'") + 'End If End If - - ' If LogErrorsOnly = False Then ClassLogger.Add(" >> Value was nothing - Inserted the ControlValue '" & ins & "'") - 'End If End If - - ' DependingControlId bezeichnet das Control, das die Abhängigkeit enthält Dim dependingControlId As Integer = row.Item("GUID") Dim panel As Panel = CtrlBuilder.MasterPanel diff --git a/app/DD-Record-Organiser/ClassControlValueCache.vb b/app/DD-Record-Organiser/ClassControlValueCache.vb index 76af977..dc82335 100644 --- a/app/DD-Record-Organiser/ClassControlValueCache.vb +++ b/app/DD-Record-Organiser/ClassControlValueCache.vb @@ -33,6 +33,10 @@ Private Shared Property HintCache As New Dictionary(Of Integer, String) Public Shared Function LoadHint(controlId As Integer) As String If HintCache.ContainsKey(controlId) Then + Dim hint As String = HintCache.Item(controlId) + If hint.Length = 0 Then + Return Nothing + End If Return HintCache.Item(controlId) Else Return Nothing diff --git a/app/DD-Record-Organiser/frmConstructor_Main.Designer.vb b/app/DD-Record-Organiser/frmConstructor_Main.Designer.vb index c12faf6..1824153 100644 --- a/app/DD-Record-Organiser/frmConstructor_Main.Designer.vb +++ b/app/DD-Record-Organiser/frmConstructor_Main.Designer.vb @@ -22,7 +22,6 @@ Partial Class frmConstructor_Main 'Das Bearbeiten mit dem Code-Editor ist nicht möglich. _ Private Sub InitializeComponent() - Me.components = New System.ComponentModel.Container() Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmConstructor_Main)) Dim GridLevelNode1 As DevExpress.XtraGrid.GridLevelNode = New DevExpress.XtraGrid.GridLevelNode() Dim GridLevelNode2 As DevExpress.XtraGrid.GridLevelNode = New DevExpress.XtraGrid.GridLevelNode() @@ -30,12 +29,12 @@ Partial Class frmConstructor_Main Me.SplitContainerMain = New DevExpress.XtraEditors.SplitContainerControl() Me.SplitContainerTop = New DevExpress.XtraEditors.SplitContainerControl() Me.TreeViewMain = New System.Windows.Forms.TreeView() - Me.CMSEntity = New System.Windows.Forms.ContextMenuStrip(Me.components) + Me.CMSEntity = New System.Windows.Forms.ContextMenuStrip() Me.ResetEbenenAuswahlToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.DateiimportEntitätToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.FormDesignerToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.GridControlMain = New DevExpress.XtraGrid.GridControl() - Me.ContextMenuGrid = New System.Windows.Forms.ContextMenuStrip(Me.components) + Me.ContextMenuGrid = New System.Windows.Forms.ContextMenuStrip() Me.FunktionenDataGridToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.ToolStripSeparator1 = New System.Windows.Forms.ToolStripSeparator() Me.AnsichtUmschaltenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() @@ -59,7 +58,7 @@ Partial Class frmConstructor_Main Me.pnlDetails = New System.Windows.Forms.Panel() Me.TabWindream = New DevExpress.XtraTab.XtraTabPage() Me.GridControlDocSearch = New DevExpress.XtraGrid.GridControl() - Me.ContextMenuStripResultFiles = New System.Windows.Forms.ContextMenuStrip(Me.components) + Me.ContextMenuStripResultFiles = New System.Windows.Forms.ContextMenuStrip() Me.DateiÖffnenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.ToolStripSeparator7 = New System.Windows.Forms.ToolStripSeparator() Me.CopyToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() @@ -94,7 +93,7 @@ Partial Class frmConstructor_Main Me.Panel1 = New System.Windows.Forms.Panel() Me.GridControlPos = New DevExpress.XtraGrid.GridControl() Me.grvwGridPos = New DevExpress.XtraGrid.Views.Grid.GridView() - Me.BindingNavigatorPOS = New System.Windows.Forms.BindingNavigator(Me.components) + Me.BindingNavigatorPOS = New System.Windows.Forms.BindingNavigator() Me.BindingNavigatorAddNewItem = New System.Windows.Forms.ToolStripButton() Me.BindingNavigatorCountItem = New System.Windows.Forms.ToolStripLabel() Me.BindingNavigatorDeleteItem = New System.Windows.Forms.ToolStripButton() @@ -130,7 +129,7 @@ Partial Class frmConstructor_Main Me.GridControlParent = New DevExpress.XtraGrid.GridControl() Me.GridViewParent = New DevExpress.XtraGrid.Views.Grid.GridView() Me.btnRelinkParentID = New System.Windows.Forms.Button() - Me.BindingSource_Entity = New System.Windows.Forms.BindingSource(Me.components) + Me.BindingSource_Entity = New System.Windows.Forms.BindingSource() Me.NavPane = New DevExpress.XtraBars.Navigation.TileNavPane() Me.NavButtonHome = New DevExpress.XtraBars.Navigation.NavButton() Me.NavButtonRefresh = New DevExpress.XtraBars.Navigation.NavButton() @@ -139,18 +138,18 @@ Partial Class frmConstructor_Main Me.tsslblRecord = New System.Windows.Forms.ToolStripStatusLabel() Me.tsslblWorkflowstate = New System.Windows.Forms.ToolStripStatusLabel() Me.DD_ECMAdmin = New DD_Record_Organiser.DD_ECMAdmin() - Me.ImageCollection1 = New DevExpress.Utils.ImageCollection(Me.components) - Me.ttToolTip = New System.Windows.Forms.ToolTip(Me.components) - Me.ContextMenuDetails = New System.Windows.Forms.ContextMenuStrip(Me.components) + Me.ImageCollection1 = New DevExpress.Utils.ImageCollection() + Me.ttToolTip = New System.Windows.Forms.ToolTip() + Me.ContextMenuDetails = New System.Windows.Forms.ContextMenuStrip() Me.DD_DMSDataSet = New DD_Record_Organiser.DD_DMSDataSet() - Me.VWPMO_WF_USER_ACTIVEBindingSource = New System.Windows.Forms.BindingSource(Me.components) + Me.VWPMO_WF_USER_ACTIVEBindingSource = New System.Windows.Forms.BindingSource() Me.VWPMO_WF_USER_ACTIVETableAdapter = New DD_Record_Organiser.DD_DMSDataSetTableAdapters.VWPMO_WF_ACTIVETableAdapter() Me.TableAdapterManager = New DD_Record_Organiser.DD_DMSDataSetTableAdapters.TableAdapterManager() Me.TBPMO_FILES_USERTableAdapter = New DD_Record_Organiser.DD_DMSDataSetTableAdapters.TBPMO_FILES_USERTableAdapter() - Me.VWPMO_WF_ACTIVEBindingSource = New System.Windows.Forms.BindingSource(Me.components) + Me.VWPMO_WF_ACTIVEBindingSource = New System.Windows.Forms.BindingSource() Me.VWPMO_WF_ACTIVETableAdapter = New DD_Record_Organiser.DD_DMSDataSetTableAdapters.VWPMO_WF_ACTIVETableAdapter() - Me.TBPMO_FILES_USERBindingSource = New System.Windows.Forms.BindingSource(Me.components) - Me.ToolTipController = New DevExpress.Utils.ToolTipController(Me.components) + Me.TBPMO_FILES_USERBindingSource = New System.Windows.Forms.BindingSource() + Me.ToolTipController = New DevExpress.Utils.ToolTipController() CType(Me.SplitContainerMain, System.ComponentModel.ISupportInitialize).BeginInit() Me.SplitContainerMain.SuspendLayout() CType(Me.SplitContainerTop, System.ComponentModel.ISupportInitialize).BeginInit() diff --git a/app/DD-Record-Organiser/frmConstructor_Main.vb b/app/DD-Record-Organiser/frmConstructor_Main.vb index 5301ecd..ef4e455 100644 --- a/app/DD-Record-Organiser/frmConstructor_Main.vb +++ b/app/DD-Record-Organiser/frmConstructor_Main.vb @@ -156,6 +156,19 @@ Public Class frmConstructor_Main End Sub Private Sub frmForm_Constructor_Main_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing + 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 + ' Verhindert den Zeilenwechsel + e.Cancel = True + End Try + End If + + _FormClosing = True ' Check_Record_Changed() CloseWDDocview() @@ -676,6 +689,20 @@ Public Class frmConstructor_Main Return grvwGridPos.GetFocusedRowCellValue(grvwGrid.Columns(columnName)) End Function + Private Sub grvwGrid_BeforeLeaveRow(sender As Object, e As RowAllowEventArgs) Handles grvwGrid.BeforeLeaveRow + 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 + ' Verhindert den Zeilenwechsel + e.Allow = False + End Try + End If + End Sub + Private Sub grvwGrid_FocusedColumnChanged(sender As Object, e As FocusedColumnChangedEventArgs) Handles grvwGrid.FocusedColumnChanged Me.Cursor = Cursors.WaitCursor Column_Row_Handler() @@ -1329,6 +1356,24 @@ Public Class frmConstructor_Main Private Sub tsButtonSave_Click(sender As Object, e As EventArgs) Handles tsButtonSave.Click Save_Record() End Sub + + Sub Focus_Control(name As String) + Dim controls As Control.ControlCollection = pnlDetails.Controls + + For Each c As Control In controls + + Dim tag As Object = c.Tag + Dim controlName As String = DirectCast(tag, ClassControlMetadata).Name + If controlName = name Then + + c.Focus() + Exit Sub + + End If + + Next + End Sub + Function Save_Record() Try Me.Cursor = Cursors.WaitCursor @@ -1525,6 +1570,15 @@ 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 + DisableEditMode() End If End Sub @@ -1598,7 +1652,7 @@ Public Class frmConstructor_Main If USER_LANGUAGE = "de-DE" Then stg = "Bearbeiten" Else - stg = "Work record" + stg = "Edit record" End If Me.tsButtonEdit.Text = stg Me.tsButtonEdit.Text = stg @@ -2288,6 +2342,16 @@ Public Class frmConstructor_Main ClassDatabase.Execute_non_Query(del, True) End If + Dim ResultMessage + ' Wenn MussFelder nicht ausgefüllt werden, wird eine exception geworfen und abgefangen + 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 CtrlCommandUI.IsInsert = False RECORD_CHANGED = False @@ -2876,6 +2940,10 @@ Public Class frmConstructor_Main End If Dim errorMessage As String = msg + ' Das erste fehlende Control in den Fokus nehmen + Dim firstControlName = missingControlValues.First() + Focus_Control(firstControlName) + Throw New Exception(errorMessage) End If @@ -4551,6 +4619,7 @@ Public Class frmConstructor_Main End Sub + Private Sub grvwGridPos_CellValueChanged(sender As Object, e As CellValueChangedEventArgs) Handles grvwGridPos.CellValueChanged Try Dim column = e.Column.FieldName