jj 15.03 datagridview can add rows
This commit is contained in:
parent
7726db9872
commit
15b08db258
@ -220,9 +220,54 @@ Public Class ClassControlBuilder
|
||||
Case "CheckedListBoxControl"
|
||||
Dim chklistbox As DevExpress.XtraEditors.CheckedListBoxControl = CType(control, DevExpress.XtraEditors.CheckedListBoxControl)
|
||||
AddHandler chklistbox.ItemCheck, AddressOf RecordChanged
|
||||
'Case "DataGridView"
|
||||
' Dim gridview As DataGridView = CType(control, DataGridView)
|
||||
' AddHandler gridview.UserDeletingRow, AddressOf UserDeletingRow
|
||||
' AddHandler gridview.CellEndEdit, AddressOf CellEndEdit
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
'Private Function GetAllItems(dgv As DataGridView) As List(Of String)
|
||||
' Dim list As New List(Of String)
|
||||
|
||||
' For Each row As DataGridViewRow In dgv.Rows
|
||||
' Dim cell As DataGridViewCell = row.Cells(0)
|
||||
' If Not IsNothing(cell.Value) Then
|
||||
' list.Add(cell.Value)
|
||||
' End If
|
||||
' Next
|
||||
|
||||
' Return list
|
||||
'End Function
|
||||
|
||||
'Private Sub SaveAllItems(controlId As Integer, items As String)
|
||||
' Try
|
||||
' Dim SQL As String = String.Format("UPDATE TBPMO_CONTROL SET STATIC_LIST='{0}' WHERE GUID = {1}", items, controlId)
|
||||
' ClassDatabase.Execute_non_Query(SQL)
|
||||
' Catch ex As Exception
|
||||
' MsgBox("Error in SaveAllItems:" & vbNewLine & ex.Message)
|
||||
' End Try
|
||||
'End Sub
|
||||
|
||||
'Private Sub UserDeletingRow(ByVal sender As Object, ByVal e As DataGridViewRowCancelEventArgs)
|
||||
' Dim dgv As DataGridView = DirectCast(sender, DataGridView)
|
||||
' Dim id As Integer = DirectCast(dgv.Tag, ClassControlMetadata).Id
|
||||
' Dim list As List(Of String) = GetAllItems(dgv)
|
||||
' list.RemoveAt(e.Row.Index)
|
||||
' Dim items As String = String.Join(";", list.ToArray())
|
||||
|
||||
' SaveAllItems(id, items)
|
||||
'End Sub
|
||||
|
||||
'Private Sub CellEndEdit(ByVal sender As Object, e As DataGridViewCellEventArgs)
|
||||
' Dim dgv As DataGridView = DirectCast(sender, DataGridView)
|
||||
' Dim id As Integer = DirectCast(dgv.Tag, ClassControlMetadata).Id
|
||||
' Dim list As List(Of String) = GetAllItems(dgv)
|
||||
' Dim items As String = String.Join(";", list.ToArray())
|
||||
|
||||
' SaveAllItems(id, items)
|
||||
'End Sub
|
||||
|
||||
Private Sub SetDragDropHandler(groupbox As GroupBox)
|
||||
If Not IsNothing(_group_box_drag_drop_handler) Then
|
||||
AddHandler groupbox.DragDrop, Me._group_box_drag_drop_handler
|
||||
@ -1096,18 +1141,16 @@ Public Class ClassControlBuilder
|
||||
|
||||
control.Name = name
|
||||
control.BackgroundColor = SystemColors.ControlDark
|
||||
control.AllowUserToAddRows = False
|
||||
control.AllowUserToDeleteRows = False
|
||||
control.AllowUserToAddRows = True
|
||||
control.AllowUserToDeleteRows = True
|
||||
control.AllowUserToResizeColumns = False
|
||||
control.AllowUserToResizeRows = False
|
||||
control.Parent = _master_panel
|
||||
control.ReadOnly = read_only
|
||||
|
||||
|
||||
|
||||
'column.HeaderText = ""
|
||||
'column.Name = "column1"
|
||||
'control.Columns.Add(column)
|
||||
column.HeaderText = "Data"
|
||||
column.Name = "column1"
|
||||
control.Columns.Add(column)
|
||||
|
||||
If _new And IsNothing(parent) Then
|
||||
control.Location = Me.GetCursorPosition()
|
||||
|
||||
@ -233,18 +233,6 @@
|
||||
DEFAULTVALUE = properties.DefaultValue
|
||||
End If
|
||||
|
||||
'If type = "TextBox" OrElse
|
||||
' type = "ComboBox" OrElse
|
||||
' type = "CheckBox" OrElse
|
||||
' type = "RadioButton" OrElse
|
||||
' type = "CheckedListBoxControl" OrElse
|
||||
' type = "ListBoxControl" Then
|
||||
|
||||
' SHOW_COLUMN = BoolToInt(properties.ShowColumn)
|
||||
'Else
|
||||
' SHOW_COLUMN = BoolToInt(True)
|
||||
'End If
|
||||
|
||||
If propExists(properties, "ShowColumn") Then
|
||||
SHOW_COLUMN = BoolToInt(properties.ShowColumn)
|
||||
End If
|
||||
|
||||
@ -501,6 +501,12 @@ Public Class ClassControlCommandsUI
|
||||
Continue For
|
||||
End If
|
||||
|
||||
If TypeOf ctrl Is Windows.Forms.DataGridView Then
|
||||
Dim id As Integer = DirectCast(ctrl.Tag, ClassControlMetadata).Id
|
||||
UpdateMultipleValues(id, RecordID, CONTROL_VALUE)
|
||||
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))
|
||||
|
||||
If ValueExists Then ' Control Updaten
|
||||
@ -654,6 +660,20 @@ Public Class ClassControlCommandsUI
|
||||
Case "ListBoxControl"
|
||||
Dim listbox As DevExpress.XtraEditors.ListBoxControl = DirectCast(ctrl, DevExpress.XtraEditors.ListBoxControl)
|
||||
Return listbox.SelectedValue
|
||||
|
||||
Case "DataGridView"
|
||||
Dim list As New List(Of String)
|
||||
Dim dgv As DataGridView = DirectCast(ctrl, DataGridView)
|
||||
|
||||
For Each row As DataGridViewRow In dgv.Rows
|
||||
Dim cell As DataGridViewCell = row.Cells(0)
|
||||
If Not IsNothing(cell.Value) Then
|
||||
list.Add(cell.Value)
|
||||
End If
|
||||
Next
|
||||
|
||||
Return String.Join(";", list)
|
||||
|
||||
Case Else
|
||||
Return Nothing
|
||||
End Select
|
||||
|
||||
@ -399,15 +399,11 @@
|
||||
|
||||
Public Class DataGridView : Inherits _ListControl
|
||||
|
||||
Public Shared Sub LoadList(control As Windows.Forms.DataGridView, formId As Integer, ConnId As Object, SQLCommand As String)
|
||||
Dim controlId As Integer = DirectCast(control.Tag, ClassControlMetadata).Id
|
||||
Dim dynamic As DynamicValue = GetDynamicValue(DirectCast(control.Tag, ClassControlMetadata).Id, formId, ConnId, SQLCommand)
|
||||
|
||||
' SQLCommand ignorieren
|
||||
If dynamic.StaticList IsNot Nothing Then
|
||||
control.DataSource = dynamic.StaticList
|
||||
End If
|
||||
|
||||
Public Shared Sub LoadValue(control As Windows.Forms.DataGridView, values As List(Of Object))
|
||||
control.Rows.Clear()
|
||||
For Each item In values
|
||||
control.Rows.Add(item.ToString)
|
||||
Next
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
@ -401,7 +401,6 @@ Module ClassControlProperties
|
||||
Inherits CommonProperties
|
||||
|
||||
Private _show_column As Boolean
|
||||
Private _static_list As String
|
||||
|
||||
<LocalizedCategoryAttribute("category_view")>
|
||||
<LocalizedDescriptionAttribute("desc_showcolumn")>
|
||||
@ -413,17 +412,6 @@ Module ClassControlProperties
|
||||
_show_column = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
<LocalizedCategoryAttribute("category_data")>
|
||||
<LocalizedDescriptionAttribute("desc_staticlist")>
|
||||
Public Property StaticList() As String
|
||||
Get
|
||||
Return _static_list
|
||||
End Get
|
||||
Set(value As String)
|
||||
_static_list = value
|
||||
End Set
|
||||
End Property
|
||||
End Class
|
||||
Public Class PictureBoxProperties
|
||||
Inherits CommonProperties
|
||||
|
||||
@ -233,6 +233,11 @@ Public Class ClassControlValues
|
||||
Dim picturebox = DirectCast(control, PictureBox)
|
||||
LoadImage(recordId, controlId, picturebox)
|
||||
|
||||
Case GetType(DataGridView)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(">> Sub LoadControlValueNeu - GetType(DataGridView) ", False)
|
||||
Dim gridview = DirectCast(control, DataGridView)
|
||||
ControlLoader.DataGridView.LoadValue(gridview, values)
|
||||
|
||||
Case Else
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(">> Sub LoadControlValue - Control-Type nicht berücksichtigt: " & GetType(Control).ToString(), False)
|
||||
End Select
|
||||
@ -297,11 +302,6 @@ Public Class ClassControlValues
|
||||
Dim chlistbox = DirectCast(Ctrl, DevExpress.XtraEditors.CheckedListBoxControl)
|
||||
ControlLoader.CheckedListBox.LoadList(chlistbox, FormID, ConnID, sqlcommand)
|
||||
|
||||
Case GetType(DataGridView)
|
||||
Dim gridview = DirectCast(Ctrl, DataGridView)
|
||||
Dim noSQL As String = ""
|
||||
ControlLoader.DataGridView.LoadList(gridview, FormID, ConnID, noSQL)
|
||||
|
||||
End Select
|
||||
|
||||
swcontrol.Stop()
|
||||
|
||||
@ -150,7 +150,6 @@
|
||||
CType(r.Item("CTRLSCR_FONT_STYLE"), FontStyle))
|
||||
props.ColumnTitle = ClassConverter.ToStringOrDefault(r.Item("CONTROL_COL_NAME"), ctrl.Name)
|
||||
props.ShowColumn = ClassConverter.ToBooleanOrDefault(r.Item("CONTROL_SHOW_COLUMN"), True)
|
||||
props.StaticList = NotNull(r.Item("CONTROL_STATIC_LIST"), "")
|
||||
props.SQLCommand = New SQLValue(NotNull(r.Item("CONTROL_SQLCOMMAND_1"), ""))
|
||||
props.IsRequired = r.Item("CONTROL_REQUIRED")
|
||||
props.IsReadOnly = r.Item("CONTROL_READ_ONLY")
|
||||
@ -538,7 +537,6 @@
|
||||
lblStatus.Visible = True
|
||||
Else
|
||||
lblStatus.Visible = False
|
||||
' MsgBox("Änderungen gespeichert!", MsgBoxStyle.Information)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@ -574,7 +572,6 @@
|
||||
ctrl.BackColor = newValue
|
||||
End Select
|
||||
|
||||
|
||||
lblStatus.Text = "Ausstehende Änderungen"
|
||||
lblStatus.Visible = True
|
||||
End Sub
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user