diff --git a/app/DD_PM_WINDREAM/ClassControlCreator.vb b/app/DD_PM_WINDREAM/ClassControlCreator.vb index a818507..5b91e46 100644 --- a/app/DD_PM_WINDREAM/ClassControlCreator.vb +++ b/app/DD_PM_WINDREAM/ClassControlCreator.vb @@ -47,7 +47,7 @@ Public Class ClassControlCreator Public Class ControlMetadata Public Guid As Integer - Public [ReadOnly] As Boolean + Public [ReadOnly] As Boolean = False End Class Private Shared Function TransformDataRow(row As DataRow) As ControlDBProps @@ -82,7 +82,6 @@ Public Class ClassControlCreator .Guid = props.Guid, .ReadOnly = props.ReadOnly } - 'ctrl.Tag = props.Guid ctrl.Name = props.Name ctrl.Location = props.Location ctrl.Font = props.Font @@ -93,7 +92,7 @@ Public Class ClassControlCreator End If If props.ReadOnly Then - ctrl.BackColor = Color.Gray + ctrl.BackColor = Color.LightGray End If Return ctrl @@ -243,6 +242,7 @@ Public Class ClassControlCreator control.AcceptsReturn = True control.ReadOnly = row.Item("READ_ONLY") control.TabStop = Not row.Item("READ_ONLY") + control.BackColor = IIf(row.Item("READ_ONLY"), Color.LightGray, Color.White) Else control.ReadOnly = True End If @@ -267,10 +267,10 @@ Public Class ClassControlCreator If Not designMode Then control.Enabled = Not row.Item("READ_ONLY") control.TabStop = Not row.Item("READ_ONLY") + control.BackColor = IIf(row.Item("READ_ONLY"), Color.LightGray, Color.White) control.AutoCompleteMode = AutoCompleteMode.SuggestAppend control.AutoCompleteSource = AutoCompleteSource.ListItems - End If Return control @@ -332,6 +332,7 @@ Public Class ClassControlCreator Public Shared Function CreateExistingLookupControl(row As DataRow, designMode As Boolean) As LookupControl2 Dim control As LookupControl2 = CreateBaseControl(New LookupControl2(), row, designMode) control.Width = row.Item("WIDTH") + control.ReadOnly = row.Item("READ_ONLY") If designMode Then control.Cursor = Cursors.Hand diff --git a/app/DD_PM_WINDREAM/ClassFinalIndex.vb b/app/DD_PM_WINDREAM/ClassFinalIndex.vb index eb0cb3f..3fc0f9e 100644 --- a/app/DD_PM_WINDREAM/ClassFinalIndex.vb +++ b/app/DD_PM_WINDREAM/ClassFinalIndex.vb @@ -46,12 +46,6 @@ End If Return value - - 'If isVector Then - ' Return $"{PREFIX_VECTOR}{value}" - 'Else - ' Return value - 'End If Catch ex As Exception LOGGER.Error(ex) MsgBox($"Error in GetValue: {ex.Message}", MsgBoxStyle.Critical) diff --git a/app/DD_PM_WINDREAM/ClassVectorBehaviourListConverter.vb b/app/DD_PM_WINDREAM/ClassVectorBehaviourListConverter.vb new file mode 100644 index 0000000..7bb0430 --- /dev/null +++ b/app/DD_PM_WINDREAM/ClassVectorBehaviourListConverter.vb @@ -0,0 +1,23 @@ +Imports System.ComponentModel +Imports System.Globalization + +Public Class ClassVectorBehaviourListConverter + Inherits TypeConverter + + Public Overrides Function GetStandardValuesSupported(context As ITypeDescriptorContext) As Boolean + Return True + End Function + + Public Overrides Function GetStandardValues(context As ITypeDescriptorContext) As StandardValuesCollection + Dim oBehaviourList = DirectCast(context.Instance, FinalIndexProperties).VectorBehaviourType + Return New StandardValuesCollection(oBehaviourList) + End Function + + Public Overrides Function ConvertTo(context As ITypeDescriptorContext, culture As CultureInfo, value As Object, destinationType As Type) As Object + If IsNothing(value) Then + Return "" + Else + Return value.ToString() + End If + End Function +End Class diff --git a/app/DD_PM_WINDREAM/DD_PM_WINDREAM.vbproj b/app/DD_PM_WINDREAM/DD_PM_WINDREAM.vbproj index aaa8a85..59d6ca9 100644 --- a/app/DD_PM_WINDREAM/DD_PM_WINDREAM.vbproj +++ b/app/DD_PM_WINDREAM/DD_PM_WINDREAM.vbproj @@ -220,6 +220,7 @@ + diff --git a/app/DD_PM_WINDREAM/ModuleFinalIndexProperties.vb b/app/DD_PM_WINDREAM/ModuleFinalIndexProperties.vb index 593e2df..6358fdb 100644 --- a/app/DD_PM_WINDREAM/ModuleFinalIndexProperties.vb +++ b/app/DD_PM_WINDREAM/ModuleFinalIndexProperties.vb @@ -65,7 +65,8 @@ Module ModuleFinalIndexProperties - + + Public Property VectorBehaviour As String @@ -77,6 +78,8 @@ Module ModuleFinalIndexProperties Public Property Indicies As List(Of String) Public Property IndiciesType As List(Of Integer) + + Public Property VectorBehaviourType As List(Of String) Public Sub VectorIndexBooleanProvider(attrs As PropertyAttributes) MaybeSetReadOnlyIfNotVectorIndex(attrs) @@ -107,6 +110,10 @@ Module ModuleFinalIndexProperties MaybeSetReadOnlyIfSQLHasNoValue(attrs) End Sub + Public Sub VectorIndexOnlyProvider(attrs As PropertyAttributes) + MaybeSetBrowsable(attrs, {ClassFinalIndex.INDEX_TYPE_VECTOR_STRING}) + End Sub + Public Sub MaybeSetReadOnlyIfSQLHasNoValue(attrs As PropertyAttributes) Dim hasSQLValue As Boolean = (SQLCommand.Value <> String.Empty) diff --git a/app/DD_PM_WINDREAM/frmAdministration.resx b/app/DD_PM_WINDREAM/frmAdministration.resx index 0f56975..7632de4 100644 --- a/app/DD_PM_WINDREAM/frmAdministration.resx +++ b/app/DD_PM_WINDREAM/frmAdministration.resx @@ -2812,7 +2812,7 @@ der Wertänderungen nutzen wollen: Neu hinzufügen - 127, 24 + 128, 24 von {0} finalen Indexen @@ -2978,7 +2978,7 @@ der Wertänderungen nutzen wollen: 9, 133 - 798, 27 + 679, 27 92 diff --git a/app/DD_PM_WINDREAM/frmAdministration.vb b/app/DD_PM_WINDREAM/frmAdministration.vb index b836f1d..9a101f9 100644 --- a/app/DD_PM_WINDREAM/frmAdministration.vb +++ b/app/DD_PM_WINDREAM/frmAdministration.vb @@ -952,7 +952,7 @@ Public Class frmAdministration Dim description As String = NotNull(focusedRow.Item("DESCRIPTION"), "") Dim preventDuplicates As Boolean = NotNull(focusedRow.Item("PREVENT_DUPLICATES"), False) Dim allowNewValues As Boolean = NotNull(focusedRow.Item("ALLOW_NEW_VALUES"), False) - Dim VectorBehaviour As String = NotNull(focusedRow.Item("IF_VEKTOR_BEHAVIOUR"), False) + Dim VectorBehaviour As String = NotNull(focusedRow.Item("IF_VEKTOR_BEHAVIOUR"), "Add") CURRENT_INDEX_ID = guid @@ -1003,6 +1003,10 @@ Public Class frmAdministration obj.Indicies = Windream_Indicies obj.IndiciesType = Windream_Indicies_Types obj.IndexName = index + obj.VectorBehaviourType = New List(Of String) From { + "Add", + "Overwrite" + } If Not index Is Nothing Then Dim indexType As Integer = ClassFinalIndex.GetIndexType(index, Windream_Indicies, Windream_Indicies_Types) @@ -1168,13 +1172,4 @@ Public Class frmAdministration LOGGER.Error(ex) End Try End Sub - - - 'Private Sub viewFinalIndex_ValidateRow(sender As Object, e As Views.Base.ValidateRowEventArgs) Handles viewFinalIndex.ValidateRow - ' Dim rowView As DataRowView = e.Row - - ' If rowView.IsNew Then - ' Dim props As FinalIndexProperties = PropertyGrid1.SelectedObject - ' End If - 'End Sub End Class \ No newline at end of file diff --git a/app/DD_PM_WINDREAM/frmFormDesigner.vb b/app/DD_PM_WINDREAM/frmFormDesigner.vb index 82c1560..5197d1c 100644 --- a/app/DD_PM_WINDREAM/frmFormDesigner.vb +++ b/app/DD_PM_WINDREAM/frmFormDesigner.vb @@ -437,26 +437,32 @@ Public Class frmFormDesigner End Function Sub SetActiveControlColor() - CurrentControl.BackColor = Color.DarkOrange + If DirectCast(CurrentControl.Tag, ClassControlCreator.ControlMetadata).ReadOnly = False Then + CurrentControl.BackColor = Color.DarkOrange + End If ' Reset Color of all other controls - For Each inctrl As Control In Me.pnldesigner.Controls - If inctrl.Name <> CurrentControl.Name Then - Dim Type As String = inctrl.GetType.ToString - Select Case Type - Case "System.Windows.Forms.TextBox" - inctrl.BackColor = Color.White - Case "System.Windows.Forms.ComboBox" - inctrl.BackColor = Color.White - Case "System.Windows.Forms.Label" - inctrl.BackColor = Color.Transparent - Case "System.Windows.Forms.CheckBox" - inctrl.BackColor = Color.Transparent - Case "DD_PM_WINDREAM.ClassControlCreator+LineLabel" - inctrl.BackColor = inctrl.ForeColor - Case "DigitalData.Controls.LookupGrid.LookupControl2" - inctrl.BackColor = Color.White - End Select + For Each oControl As Control In Me.pnldesigner.Controls + If oControl.Name <> CurrentControl.Name Then + Dim oMetadata = DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata) + + If oMetadata.ReadOnly = False Then + Dim Type As String = oControl.GetType.ToString + Select Case Type + Case "System.Windows.Forms.TextBox" + oControl.BackColor = Color.White + Case "System.Windows.Forms.ComboBox" + oControl.BackColor = Color.White + Case "System.Windows.Forms.Label" + oControl.BackColor = Color.Transparent + Case "System.Windows.Forms.CheckBox" + oControl.BackColor = Color.Transparent + Case "DD_PM_WINDREAM.ClassControlCreator+LineLabel" + oControl.BackColor = oControl.ForeColor + Case "DigitalData.Controls.LookupGrid.LookupControl2" + oControl.BackColor = Color.White + End Select + End If End If Next End Sub @@ -622,6 +628,12 @@ Public Class frmFormDesigner Dim CurrentPosition = CurrentControl.Location Dim OldPosition As Point = DirectCast(pgControls.SelectedObject, BaseProperties).Location + If CurrentPosition.X = OldPosition.X + 2 And CurrentPosition.Y = OldPosition.Y + 2 Then + CurrentControl.Location = New Point(CurrentPosition.X - 2, CurrentPosition.Y - 2) + MyBase.Cursor = Cursors.Default + Exit Sub + End If + If Not Point.op_Inequality(CurrentPosition, OldPosition) Then MyBase.Cursor = Cursors.Default Exit Sub diff --git a/app/DD_PM_WINDREAM/frmMain.vb b/app/DD_PM_WINDREAM/frmMain.vb index 3a42cf3..3fd1209 100644 --- a/app/DD_PM_WINDREAM/frmMain.vb +++ b/app/DD_PM_WINDREAM/frmMain.vb @@ -1528,17 +1528,16 @@ Public Class frmMain 'If e.Button = MouseButtons.Left Then ' wenn in eine Group Row Doppelt geklickt wurde.. If hi.InGroupRow And Not groupRowButtonClicked Then - ' Ein/Ausklappen verhindern - DXMouseEventArgs.GetMouseArgs(e).Handled = True - GridViewItem_Clicked = "GROUP" - CURRENT_CLICKED_PROFILE_ID = GridView_Docs.GetRowCellValue(GridView_Docs.GetDataRowHandleByGroupRowHandle(hi.RowHandle), GridView_Docs.Columns("PROFILE_ID")) - ElseIf hi.InDataRow Then - GridViewItem_Clicked = "ROW" - Dim profileid = CURRENT_CLICKED_PROFILE_ID - Else - GridViewItem_Clicked = Nothing - End If - 'End If + ' Ein/Ausklappen verhindern + DXMouseEventArgs.GetMouseArgs(e).Handled = True + GridViewItem_Clicked = "GROUP" + CURRENT_CLICKED_PROFILE_ID = GridView_Docs.GetRowCellValue(GridView_Docs.GetDataRowHandleByGroupRowHandle(hi.RowHandle), GridView_Docs.Columns("PROFILE_ID")) + ElseIf hi.InDataRow Then + GridViewItem_Clicked = "ROW" + CURRENT_CLICKED_PROFILE_ID = GridView_Docs.GetRowCellValue(GridView_Docs.GetDataRowHandleByGroupRowHandle(hi.RowHandle), GridView_Docs.Columns("PROFILE_ID")) + Else + GridViewItem_Clicked = Nothing + End If End Sub Private Sub GridView_Docs_ColumnWidthChanged(sender As Object, e As Views.Base.ColumnEventArgs) Handles GridView_Docs.ColumnWidthChanged diff --git a/app/DD_PM_WINDREAM/frmMassValidator.vb b/app/DD_PM_WINDREAM/frmMassValidator.vb index 3fe5da7..0525954 100644 --- a/app/DD_PM_WINDREAM/frmMassValidator.vb +++ b/app/DD_PM_WINDREAM/frmMassValidator.vb @@ -135,7 +135,7 @@ Public Class frmMassValidator Dim oCount = 0 For Each oControlRow As DataRow In DTCONTROLS.Rows - Dim ctrl As Control + Dim oControl As Control Select Case oControlRow.Item("CTRL_TYPE").ToString.ToUpper Case "TXT" @@ -146,161 +146,170 @@ Public Class frmMassValidator AddHandler txt.LostFocus, AddressOf OnTextBoxLostFocus AddHandler txt.KeyUp, AddressOf OnTextBoxKeyUp - ctrl = txt + oControl = txt Case "LBL" LOGGER.Debug("Versuch LBL zu laden") - ctrl = ClassControlCreator.CreateExistingLabel(oControlRow, False) + oControl = ClassControlCreator.CreateExistingLabel(oControlRow, False) Case "CMB" LOGGER.Debug("Versuch CMB zu laden") - Dim cmb = ClassControlCreator.CreateExistingCombobox(oControlRow, False) + If oControlRow.Item("READ_ONLY") Then + Dim cmbReadonly = ClassControlCreator.CreateExistingTextbox(oControlRow, False) + oControl = cmbReadonly + Else + Dim cmb = ClassControlCreator.CreateExistingCombobox(oControlRow, False) - AddHandler cmb.SelectedValueChanged, AddressOf OnCmbselectedIndex + AddHandler cmb.SelectedValueChanged, AddressOf OnCmbselectedIndex #Region "CONTROL LIST" - If ClassControlCreator.GET_CONTROL_PROPERTIES(DTCONTROLS, cmb.Name) = 0 Then - MsgBox("Unexpected Error in getting control-properties (CMB load) - Check the log and inform Your sysadmin!", MsgBoxStyle.Critical) - Exit Sub - End If - Dim CURR_SQL_PROVIDER As String - If CURRENT_CONTROL_ID > 0 Then - If CURR_CON_ID > 0 Then - Dim commandsql = CURR_SELECT_CONTROL - If commandsql <> "" Then - LOGGER.Debug("ConID > 0 And commandsql <> ''") - Dim connectionString As String + If ClassControlCreator.GET_CONTROL_PROPERTIES(DTCONTROLS, cmb.Name) = 0 Then + MsgBox("Unexpected Error in getting control-properties (CMB load) - Check the log and inform Your sysadmin!", MsgBoxStyle.Critical) + Exit Sub + End If + Dim CURR_SQL_PROVIDER As String + If CURRENT_CONTROL_ID > 0 Then + If CURR_CON_ID > 0 Then + Dim commandsql = CURR_SELECT_CONTROL + If commandsql <> "" Then + LOGGER.Debug("ConID > 0 And commandsql <> ''") + Dim connectionString As String - Dim ConRow As DataRow() = ClassControlCreator.GET_CONNECTION_INFO(CURR_CON_ID) - If ConRow Is Nothing Then - MsgBox("Unexpected Error in getting Coninfo (CMB load) - Check the log and inform Your sysadmin!", MsgBoxStyle.Critical) - Exit Sub - End If + Dim ConRow As DataRow() = ClassControlCreator.GET_CONNECTION_INFO(CURR_CON_ID) + If ConRow Is Nothing Then + MsgBox("Unexpected Error in getting Coninfo (CMB load) - Check the log and inform Your sysadmin!", MsgBoxStyle.Critical) + Exit Sub + End If - For Each row As DataRow In ConRow - Select Case row("SQL_PROVIDER").ToString.ToLower - Case "ms-sql" - CURR_SQL_PROVIDER = "ms-sql" - If row("USERNAME") = "WINAUTH" Then - connectionString = "Data Source=" & row("SERVER") & ";Initial Catalog=" & row("DATENBANK") & ";Trusted_Connection=True;" - Else - connectionString = "Data Source=" & row("SERVER") & ";Initial Catalog= " & row("DATENBANK") & ";User Id=" & row("USERNAME") & ";Password=" & row("PASSWORD") & ";" + For Each row As DataRow In ConRow + Select Case row("SQL_PROVIDER").ToString.ToLower + Case "ms-sql" + CURR_SQL_PROVIDER = "ms-sql" + If row("USERNAME") = "WINAUTH" Then + connectionString = "Data Source=" & row("SERVER") & ";Initial Catalog=" & row("DATENBANK") & ";Trusted_Connection=True;" + Else + connectionString = "Data Source=" & row("SERVER") & ";Initial Catalog= " & row("DATENBANK") & ";User Id=" & row("USERNAME") & ";Password=" & row("PASSWORD") & ";" + End If + LOGGER.Debug("ConnString Sql-Server: " & connectionString) + Case "oracle" + CURR_SQL_PROVIDER = "oracle" + Dim conn As New OracleConnectionStringBuilder + Dim connstr As String + If row("SERVER") <> "" And row("DATENBANK").GetType.ToString <> "system.dbnull" Then + connstr = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=" & row("SERVER") & ")(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=" & + row("DATENBANK") & ")));User Id=" & row("USERNAME") & ";Password=" & row("PASSWORD") & ";" + Else + conn.DataSource = row("SERVER") + conn.UserID = row("USERNAME") + conn.Password = row("PASSWORD") + conn.PersistSecurityInfo = True + conn.ConnectionTimeout = 120 + connstr = conn.ConnectionString + End If + + connectionString = connstr + Case Else + LOGGER.Info("ConnectionString-Type not integrated") + MsgBox("ConnectionString-Type not integrated", MsgBoxStyle.Critical) + Exit Sub + End Select + + + Next + + If connectionString Is Nothing = False And CURR_SQL_PROVIDER = "ms-sql" Then + Try + Dim sqlCnn As SqlClient.SqlConnection + Dim sqlCmd As SqlClient.SqlCommand + Dim adapter As New SqlClient.SqlDataAdapter + Dim NewDataset As New DataSet + Dim i As Integer + + + 'sql = ClassPatterns.ReplaceAllValues(sql, pnldesigner, aktivesDokument) + If clsPatterns.HasOnlySimplePatterns(CURR_SELECT_CONTROL) Then + CURR_SELECT_CONTROL = clsPatterns.ReplaceInternalValues(CURR_SELECT_CONTROL) + CURR_SELECT_CONTROL = clsPatterns.ReplaceControlValues(CURR_SELECT_CONTROL, pnldesigner) + + sqlCnn = New SqlClient.SqlConnection(connectionString) + ' Try + sqlCnn.Open() + sqlCmd = New SqlClient.SqlCommand(CURR_SELECT_CONTROL, sqlCnn) + adapter.SelectCommand = sqlCmd + adapter.Fill(NewDataset) + + For i = 0 To NewDataset.Tables(0).Rows.Count - 1 + cmb.Items.Add(NewDataset.Tables(0).Rows(i).Item(0)) + Next + adapter.Dispose() + sqlCmd.Dispose() + sqlCnn.Close() End If - LOGGER.Debug("ConnString Sql-Server: " & connectionString) - Case "oracle" - CURR_SQL_PROVIDER = "oracle" - Dim conn As New OracleConnectionStringBuilder - Dim connstr As String - If row("SERVER") <> "" And row("DATENBANK").GetType.ToString <> "system.dbnull" Then - connstr = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=" & row("SERVER") & ")(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=" & - row("DATENBANK") & ")));User Id=" & row("USERNAME") & ";Password=" & row("PASSWORD") & ";" - Else - conn.DataSource = row("SERVER") - conn.UserID = row("USERNAME") - conn.Password = row("PASSWORD") - conn.PersistSecurityInfo = True - conn.ConnectionTimeout = 120 - connstr = conn.ConnectionString - End If - - connectionString = connstr - Case Else - LOGGER.Info("ConnectionString-Type not integrated") - MsgBox("ConnectionString-Type not integrated", MsgBoxStyle.Critical) - Exit Sub - End Select - - - Next - - If connectionString Is Nothing = False And CURR_SQL_PROVIDER = "ms-sql" Then - Try - Dim sqlCnn As SqlClient.SqlConnection - Dim sqlCmd As SqlClient.SqlCommand - Dim adapter As New SqlClient.SqlDataAdapter - Dim NewDataset As New DataSet - Dim i As Integer - - - 'sql = ClassPatterns.ReplaceAllValues(sql, pnldesigner, aktivesDokument) - If clsPatterns.HasOnlySimplePatterns(CURR_SELECT_CONTROL) Then - CURR_SELECT_CONTROL = clsPatterns.ReplaceInternalValues(CURR_SELECT_CONTROL) - CURR_SELECT_CONTROL = clsPatterns.ReplaceControlValues(CURR_SELECT_CONTROL, pnldesigner) - - sqlCnn = New SqlClient.SqlConnection(connectionString) - ' Try - sqlCnn.Open() - sqlCmd = New SqlClient.SqlCommand(CURR_SELECT_CONTROL, sqlCnn) - adapter.SelectCommand = sqlCmd - adapter.Fill(NewDataset) - - For i = 0 To NewDataset.Tables(0).Rows.Count - 1 - cmb.Items.Add(NewDataset.Tables(0).Rows(i).Item(0)) - Next - adapter.Dispose() - sqlCmd.Dispose() - sqlCnn.Close() - End If - Catch ex As Exception - LOGGER.Error(ex) - LOGGER.Info("Unexpected Error in running depending sql-command: " & ex.Message) - Clipboard.SetText("Error: " & ex.Message & vbNewLine & "SQL: " & CURR_SELECT_CONTROL) - MsgBox(ex.Message, MsgBoxStyle.Critical, "Unexpected Error in running depending sql-command:") - End Try + Catch ex As Exception + LOGGER.Error(ex) + LOGGER.Info("Unexpected Error in running depending sql-command: " & ex.Message) + Clipboard.SetText("Error: " & ex.Message & vbNewLine & "SQL: " & CURR_SELECT_CONTROL) + MsgBox(ex.Message, MsgBoxStyle.Critical, "Unexpected Error in running depending sql-command:") + End Try + End If + Else + LOGGER.Debug("Else Row 571") End If Else - LOGGER.Debug("Else Row 571") - End If - Else - If CURR_CHOICE_LIST <> "" Then - LOGGER.Debug("In add_ComboBox - AListe: " & CURR_CHOICE_LIST) - Dim liste = WINDREAM.GetValuesfromAuswahlliste(CURR_CHOICE_LIST) - If liste IsNot Nothing Then - cmb.Items.Add("") - For Each index As String In liste - cmb.Items.Add(index) - Next - cmb.SelectedIndex = -1 - Else - MsgBox("Resultliste windream is nothing!", MsgBoxStyle.Exclamation, CURR_CHOICE_LIST) + If CURR_CHOICE_LIST <> "" Then + LOGGER.Debug("In add_ComboBox - AListe: " & CURR_CHOICE_LIST) + Dim liste = WINDREAM.GetValuesfromAuswahlliste(CURR_CHOICE_LIST) + If liste IsNot Nothing Then + cmb.Items.Add("") + For Each index As String In liste + cmb.Items.Add(index) + Next + cmb.SelectedIndex = -1 + Else + MsgBox("Resultliste windream is nothing!", MsgBoxStyle.Exclamation, CURR_CHOICE_LIST) + End If End If End If End If - End If #End Region - Dim maxWith As Integer = cmb.Width - Using g As Graphics = Me.CreateGraphics - For Each oItem As Object In cmb.Items 'Für alle Einträge... - Dim g1 As Graphics = cmb.CreateGraphics - If g1.MeasureString(Text, cmb.Font).Width + 30 > maxWith Then - maxWith = g1.MeasureString(Text, cmb.Font).Width + 30 - End If - g1.Dispose() - Next oItem - End Using - cmb.DropDownWidth = maxWith + Dim maxWith As Integer = cmb.Width + Using g As Graphics = Me.CreateGraphics + For Each oItem As Object In cmb.Items 'Für alle Einträge... + Dim g1 As Graphics = cmb.CreateGraphics + If g1.MeasureString(Text, cmb.Font).Width + 30 > maxWith Then + maxWith = g1.MeasureString(Text, cmb.Font).Width + 30 + End If + g1.Dispose() + Next oItem + End Using + cmb.DropDownWidth = maxWith + + oControl = cmb + End If + + + - ctrl = cmb Case "DTP" LOGGER.Debug("Versuch DTP zu laden") - ctrl = ClassControlCreator.CreateExistingDatepicker(oControlRow, False) + oControl = ClassControlCreator.CreateExistingDatepicker(oControlRow, False) Case "DGV" LOGGER.Debug("Versuch DGV zu laden") Dim dgv = ClassControlCreator.CreateExistingDataGridView(oControlRow, False) AddHandler dgv.RowValidating, AddressOf onDGVRowValidating - ctrl = dgv + oControl = dgv Case "CHK" LOGGER.Debug("Versuch Checkbox zu laden") - ctrl = ClassControlCreator.CreateExisingCheckbox(oControlRow, False) + oControl = ClassControlCreator.CreateExisingCheckbox(oControlRow, False) Case "LINE" LOGGER.Debug("Versuch Linie zu laden") - ctrl = ClassControlCreator.CreateExistingLine(oControlRow, False) + oControl = ClassControlCreator.CreateExistingLine(oControlRow, False) Case "LOOKUP" Dim lookup As LookupControl2 = ClassControlCreator.CreateExistingLookupControl(oControlRow, False) - ctrl = lookup + oControl = lookup lookup.PreventDuplicates = oControlRow.Item("VKT_PREVENT_MULTIPLE_VALUES") lookup.AllowAddNewValues = oControlRow.Item("VKT_ADD_ITEM") lookup.MultiSelect = oControlRow.Item("MULTISELECT") @@ -312,7 +321,7 @@ Public Class frmMassValidator ''Wenn Multiselect false dann prüfen ob abhängiges Control If CBool(oControlRow.Item("MULTISELECT")) = False Then Dim filteredData As DataTable = DTCONTROLS.Clone() - Dim oExpression = $"SQL_UEBERPRUEFUNG like '%#CTRL#{ctrl.Name}%'" + Dim oExpression = $"SQL_UEBERPRUEFUNG like '%#CTRL#{oControl.Name}%'" DTCONTROLS.Select(oExpression).CopyToDataTable(filteredData, LoadOption.PreserveChanges) If filteredData.Rows.Count = 1 Then AddHandler lookup.SelectedValuesChanged, AddressOf onLookUp1 @@ -329,14 +338,14 @@ Public Class frmMassValidator Where r.CONTROL_ID = oControlRow.Item("GUID") Select r).ToList() - ctrl = ClassControlCreator.CreateExistingGridControl(oControlRow, columns, False) + oControl = ClassControlCreator.CreateExistingGridControl(oControlRow, columns, False) End Select - If ctrl IsNot Nothing AndAlso TypeOf ctrl IsNot Label Then - ctrl.TabIndex = oCount + If oControl IsNot Nothing AndAlso TypeOf oControl IsNot Label Then + oControl.TabIndex = oCount End If - pnldesigner.Controls.Add(ctrl) + pnldesigner.Controls.Add(oControl) oCount += 1 Next diff --git a/app/DD_PM_WINDREAM/frmValidator.vb b/app/DD_PM_WINDREAM/frmValidator.vb index 70e11ab..9772ddf 100644 --- a/app/DD_PM_WINDREAM/frmValidator.vb +++ b/app/DD_PM_WINDREAM/frmValidator.vb @@ -662,144 +662,157 @@ Public Class frmValidator oMyControl = ClassControlCreator.CreateExistingLabel(oControlRow, False) Case "CMB" LOGGER.Debug("Versuch CMB zu laden") + If oControlRow.Item("READ_ONLY") Then + Dim cmbReadonly = ClassControlCreator.CreateExistingTextbox(oControlRow, False) + oMyControl = cmbReadonly + Else + Dim cmb = ClassControlCreator.CreateExistingCombobox(oControlRow, False) - Dim cmb = ClassControlCreator.CreateExistingCombobox(oControlRow, False) - - AddHandler cmb.SelectedValueChanged, AddressOf OnCmbselectedIndex - + AddHandler cmb.SelectedValueChanged, AddressOf OnCmbselectedIndex + AddHandler cmb.GotFocus, Sub(sender As Control, e As EventArgs) + If DirectCast(cmb.Tag, ClassControlCreator.ControlMetadata).ReadOnly = False Then + cmb.BackColor = Color.Lime + End If + End Sub + AddHandler cmb.LostFocus, Sub(sender As Control, e As EventArgs) + If DirectCast(cmb.Tag, ClassControlCreator.ControlMetadata).ReadOnly = False Then + cmb.BackColor = Color.White + End If + End Sub #Region "CONTROL LIST" - Dim ControlID = TBPM_PROFILE_CONTROLSTableAdapter.cmdGetGUID(CURRENT_ProfilGUID, cmb.Name) - LOGGER.Debug("In add_ComboBox - GUID: " & ControlID) - If ControlID > 0 Then - LOGGER.Debug(" >>ControlID > 0") - Dim ConID = Me.TBPM_PROFILE_CONTROLSTableAdapter.cmdgetConnectionID(ControlID) - If ConID Is Nothing = False Then - Dim commandsql = TBPM_PROFILE_CONTROLSTableAdapter.cmdGetSQL(ControlID) - LOGGER.Debug("ConID Is Nothing = False") - If ConID > 0 And commandsql <> "" Then - LOGGER.Debug("CConID > 0 And TBPM_PROFILE_CONTROLSTableAdapter.cmdGetSQL(ControlID)") - Dim connectionString As String - TBDD_CONNECTIONTableAdapter.FillByID(DD_DMSLiteDataSet.TBDD_CONNECTION, ConID) - Dim DTConnection As DataTable = DD_DMSLiteDataSet.TBDD_CONNECTION - Dim drConnection As DataRow - For Each drConnection In DTConnection.Rows - Select Case drConnection.Item("SQL_PROVIDER").ToString.ToLower - Case "ms-sql" - If drConnection.Item("USERNAME") = "WINAUTH" Then - connectionString = "Data Source=" & drConnection.Item("SERVER") & ";Initial Catalog=" & drConnection.Item("DATENBANK") & ";Trusted_Connection=True;" - Else - connectionString = "Data Source=" & drConnection.Item("SERVER") & ";Initial Catalog= " & drConnection.Item("DATENBANK") & ";User Id=" & drConnection.Item("USERNAME") & ";Password=" & drConnection.Item("PASSWORD") & ";" - End If - LOGGER.Debug("ConnString Sql-Server: " & connectionString) - Case "oracle" - Dim conn As New OracleConnectionStringBuilder - Dim connstr As String - If drConnection.Item("SERVER") <> "" And drConnection.Item("DATENBANK").GetType.ToString <> "system.dbnull" Then - connstr = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=" & drConnection.Item("SERVER") & ")(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=" & - drConnection.Item("DATENBANK") & ")));User Id=" & drConnection.Item("USERNAME") & ";Password=" & drConnection.Item("PASSWORD") & ";" - Else - conn.DataSource = drConnection.Item("SERVER") - conn.UserID = drConnection.Item("USERNAME") - conn.Password = drConnection.Item("PASSWORD") - conn.PersistSecurityInfo = True - conn.ConnectionTimeout = 120 - connstr = conn.ConnectionString - End If + Dim ControlID = TBPM_PROFILE_CONTROLSTableAdapter.cmdGetGUID(CURRENT_ProfilGUID, cmb.Name) + LOGGER.Debug("In add_ComboBox - GUID: " & ControlID) + If ControlID > 0 Then + LOGGER.Debug(" >>ControlID > 0") + Dim ConID = Me.TBPM_PROFILE_CONTROLSTableAdapter.cmdgetConnectionID(ControlID) + If ConID Is Nothing = False Then + Dim commandsql = TBPM_PROFILE_CONTROLSTableAdapter.cmdGetSQL(ControlID) + LOGGER.Debug("ConID Is Nothing = False") + If ConID > 0 And commandsql <> "" Then + LOGGER.Debug("CConID > 0 And TBPM_PROFILE_CONTROLSTableAdapter.cmdGetSQL(ControlID)") + Dim connectionString As String + TBDD_CONNECTIONTableAdapter.FillByID(DD_DMSLiteDataSet.TBDD_CONNECTION, ConID) + Dim DTConnection As DataTable = DD_DMSLiteDataSet.TBDD_CONNECTION + Dim drConnection As DataRow + For Each drConnection In DTConnection.Rows + Select Case drConnection.Item("SQL_PROVIDER").ToString.ToLower + Case "ms-sql" + If drConnection.Item("USERNAME") = "WINAUTH" Then + connectionString = "Data Source=" & drConnection.Item("SERVER") & ";Initial Catalog=" & drConnection.Item("DATENBANK") & ";Trusted_Connection=True;" + Else + connectionString = "Data Source=" & drConnection.Item("SERVER") & ";Initial Catalog= " & drConnection.Item("DATENBANK") & ";User Id=" & drConnection.Item("USERNAME") & ";Password=" & drConnection.Item("PASSWORD") & ";" + End If + LOGGER.Debug("ConnString Sql-Server: " & connectionString) + Case "oracle" + Dim conn As New OracleConnectionStringBuilder + Dim connstr As String + If drConnection.Item("SERVER") <> "" And drConnection.Item("DATENBANK").GetType.ToString <> "system.dbnull" Then + connstr = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=" & drConnection.Item("SERVER") & ")(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=" & + drConnection.Item("DATENBANK") & ")));User Id=" & drConnection.Item("USERNAME") & ";Password=" & drConnection.Item("PASSWORD") & ";" + Else + conn.DataSource = drConnection.Item("SERVER") + conn.UserID = drConnection.Item("USERNAME") + conn.Password = drConnection.Item("PASSWORD") + conn.PersistSecurityInfo = True + conn.ConnectionTimeout = 120 + connstr = conn.ConnectionString + End If - connectionString = connstr - Case Else - LOGGER.Info(" - ConnectionType nicht integriert") - MsgBox("ConnectionType nicht integriert", MsgBoxStyle.Critical, "Bitte Konfiguration Connection überprüfen!") - End Select - Next - If connectionString Is Nothing = False Then - Try - Dim sqlCnn As SqlClient.SqlConnection - Dim sqlCmd As SqlClient.SqlCommand - Dim adapter As New SqlClient.SqlDataAdapter - Dim NewDataset As New DataSet - Dim i As Integer - Dim sql As String - - - sql = TBPM_PROFILE_CONTROLSTableAdapter.cmdGetSQL(ControlID) - - 'sql = ClassPatterns.ReplaceAllValues(sql, pnldesigner, CURRENT_WMFILE) - - 'If ClassPatterns.HasOnlySimplePatterns(sql) Then - If clsPatterns.HasOnlySimplePatterns(sql) Then - sql = clsPatterns.ReplaceInternalValues(sql) - sql = clsPatterns.ReplaceControlValues(sql, pnldesigner) - LOGGER.Debug(">>> sql after HasOnlySimplePatterns: " & sql) - sqlCnn = New SqlClient.SqlConnection(connectionString) - ' Try - sqlCnn.Open() - sqlCmd = New SqlClient.SqlCommand(sql, sqlCnn) - adapter.SelectCommand = sqlCmd - adapter.Fill(NewDataset) - Dim msg As String - For i = 0 To NewDataset.Tables(0).Rows.Count - 1 - cmb.Items.Add(NewDataset.Tables(0).Rows(i).Item(0)) - Next - adapter.Dispose() - sqlCmd.Dispose() - sqlCnn.Close() - End If - Catch ex As Exception - LOGGER.Error(ex) - LOGGER.Info(" - Unvorhergesehener Fehler bei GetValues SQL - Fehler: " & vbNewLine & ex.Message) - MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler bei GetValues SQL:") - End Try - End If - Else - LOGGER.Debug("Else Row 571") - End If - Else - LOGGER.Debug("AListe Handling") - Dim AListe As String = TBPM_PROFILE_CONTROLSTableAdapter.cmdGetChoiceListName(ControlID) - LOGGER.Debug("In add_ComboBox - AListe: " & AListe) - If AListe Is Nothing = False Then - 'Dim liste = _windreamPM.GetValuesfromAuswahlliste(AListe) - Dim liste = WINDREAM.GetValuesfromAuswahlliste(AListe) - If liste IsNot Nothing Then - cmb.Items.Add("") - For Each index As String In liste - cmb.Items.Add(index) + connectionString = connstr + Case Else + LOGGER.Info(" - ConnectionType nicht integriert") + MsgBox("ConnectionType nicht integriert", MsgBoxStyle.Critical, "Bitte Konfiguration Connection überprüfen!") + End Select Next - cmb.SelectedIndex = -1 + If connectionString Is Nothing = False Then + Try + Dim sqlCnn As SqlClient.SqlConnection + Dim sqlCmd As SqlClient.SqlCommand + Dim adapter As New SqlClient.SqlDataAdapter + Dim NewDataset As New DataSet + Dim i As Integer + Dim sql As String + + + sql = TBPM_PROFILE_CONTROLSTableAdapter.cmdGetSQL(ControlID) + + 'sql = ClassPatterns.ReplaceAllValues(sql, pnldesigner, CURRENT_WMFILE) + + 'If ClassPatterns.HasOnlySimplePatterns(sql) Then + If clsPatterns.HasOnlySimplePatterns(sql) Then + sql = clsPatterns.ReplaceInternalValues(sql) + sql = clsPatterns.ReplaceControlValues(sql, pnldesigner) + LOGGER.Debug(">>> sql after HasOnlySimplePatterns: " & sql) + sqlCnn = New SqlClient.SqlConnection(connectionString) + ' Try + sqlCnn.Open() + sqlCmd = New SqlClient.SqlCommand(sql, sqlCnn) + adapter.SelectCommand = sqlCmd + adapter.Fill(NewDataset) + Dim msg As String + For i = 0 To NewDataset.Tables(0).Rows.Count - 1 + cmb.Items.Add(NewDataset.Tables(0).Rows(i).Item(0)) + Next + adapter.Dispose() + sqlCmd.Dispose() + sqlCnn.Close() + End If + Catch ex As Exception + LOGGER.Error(ex) + LOGGER.Info(" - Unvorhergesehener Fehler bei GetValues SQL - Fehler: " & vbNewLine & ex.Message) + MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler bei GetValues SQL:") + End Try + End If Else - MsgBox("Resultliste windream is nothing!", MsgBoxStyle.Exclamation, AListe) + LOGGER.Debug("Else Row 571") End If Else - MsgBox("AListe from database is nothing!", MsgBoxStyle.Exclamation, AListe) + LOGGER.Debug("AListe Handling") + Dim AListe As String = TBPM_PROFILE_CONTROLSTableAdapter.cmdGetChoiceListName(ControlID) + LOGGER.Debug("In add_ComboBox - AListe: " & AListe) + If AListe Is Nothing = False Then + 'Dim liste = _windreamPM.GetValuesfromAuswahlliste(AListe) + Dim liste = WINDREAM.GetValuesfromAuswahlliste(AListe) + If liste IsNot Nothing Then + cmb.Items.Add("") + For Each index As String In liste + cmb.Items.Add(index) + Next + cmb.SelectedIndex = -1 + Else + MsgBox("Resultliste windream is nothing!", MsgBoxStyle.Exclamation, AListe) + End If + Else + MsgBox("AListe from database is nothing!", MsgBoxStyle.Exclamation, AListe) + End If End If + + End If - - - End If #End Region - Dim maxWith As Integer = cmb.Width - Using g As Graphics = Me.CreateGraphics - For Each oItem As Object In cmb.Items 'Für alle Einträge... - Dim g1 As Graphics = cmb.CreateGraphics - If g1.MeasureString(Text, cmb.Font).Width + 30 > maxWith Then - maxWith = g1.MeasureString(Text, cmb.Font).Width + 30 - End If - g1.Dispose() - Next oItem - End Using - cmb.DropDownWidth = maxWith + Dim maxWith As Integer = cmb.Width + Using g As Graphics = Me.CreateGraphics + For Each oItem As Object In cmb.Items 'Für alle Einträge... + Dim g1 As Graphics = cmb.CreateGraphics + If g1.MeasureString(Text, cmb.Font).Width + 30 > maxWith Then + maxWith = g1.MeasureString(Text, cmb.Font).Width + 30 + End If + g1.Dispose() + Next oItem + End Using + cmb.DropDownWidth = maxWith + + oMyControl = cmb + End If + - oMyControl = cmb - 'add_ComboBox(dr.Item("GUID"), dr.Item("CTRL_NAME"), CInt(dr.Item("X_LOC")), CInt(dr.Item("Y_LOC")), CInt(dr.Item("WIDTH")), CInt(dr.Item("HEIGHT")), dr.Item("READ_ONLY"), dr.Item("LOAD_IDX_VALUE")) 'dr.Item("INDEX_NAME"), Case "DTP" LOGGER.Debug("Versuch DTP zu laden") oMyControl = ClassControlCreator.CreateExistingDatepicker(oControlRow, False) - 'add_DTP(dr.Item("GUID"), dr.Item("NAME"), CInt(dr.Item("X_LOC")), CInt(dr.Item("Y_LOC")), CInt(dr.Item("WIDTH")), CInt(dr.Item("HEIGHT")), dr.Item("READ_ONLY"), dr.Item("LOAD_IDX_VALUE")) 'dr.Item("INDEX_NAME"), Case "DGV" LOGGER.Debug("Versuch DGV zu laden") Dim dgv = ClassControlCreator.CreateExistingDataGridView(oControlRow, False) @@ -832,15 +845,24 @@ Public Class frmValidator End If End If + AddHandler lookup.GotFocus, Sub(sender As Control, e As EventArgs) + If DirectCast(lookup.Tag, ClassControlCreator.ControlMetadata).ReadOnly = False Then + lookup.BackColor = Color.Lime + End If + End Sub + AddHandler lookup.LostFocus, Sub(sender As Control, e As EventArgs) + If DirectCast(lookup.Tag, ClassControlCreator.ControlMetadata).ReadOnly = False Then + lookup.BackColor = Color.White + End If + End Sub + 'Return filteredData 'AddHandler lookup.Leave, AddressOf onLookUp0 - 'add_DGV(dr.Item("GUID"), dr.Item("CTRL_NAME"), dr.Item("HEIGHT"), dr.Item("WIDTH"), CInt(dr.Item("X_LOC")), CInt(dr.Item("Y_LOC")), dr.Item("READ_ONLY"), dr.Item("LOAD_IDX_VALUE")) 'dr.Item("INDEX_NAME"), Case "CHK" LOGGER.Debug("Versuch Checkbox zu laden") oMyControl = ClassControlCreator.CreateExisingCheckbox(oControlRow, False) - 'add_Checkbox(dr.Item("GUID"), dr.Item("CTRL_NAME"), dr.Item("CTRL_TEXT"), CInt(dr.Item("X_LOC")), CInt(dr.Item("Y_LOC")), dr.Item("READ_ONLY"), dr.Item("LOAD_IDX_VALUE")) Case "TABLE" LOGGER.Debug("Versuch Tabelle zu laden") @@ -909,12 +931,18 @@ Public Class frmValidator Public Sub OnTextBoxFocus(sender As Object, e As EventArgs) Dim box As TextBox = sender - box.BackColor = Color.Lime - box.SelectAll() + + If DirectCast(box.Tag, ClassControlCreator.ControlMetadata).ReadOnly = False Then + box.BackColor = Color.Lime + box.SelectAll() + End If End Sub Public Sub OnTextBoxLostFocus(sender As System.Object, e As System.EventArgs) Dim box As TextBox = sender - box.BackColor = Color.White + + If DirectCast(box.Tag, ClassControlCreator.ControlMetadata).ReadOnly = False Then + box.BackColor = Color.White + End If End Sub Public Sub OnTextBoxKeyUp(sender As Object, e As KeyEventArgs) If ControlHandleStarted = True Then