This commit is contained in:
Digital Data - Marlon Schreiber
2017-09-19 12:52:35 +02:00
parent 96c08ada63
commit 3a175d04e5
19 changed files with 3463 additions and 3039 deletions

View File

@@ -14,6 +14,7 @@ Public Class ClassWindreamDocGrid
'Public Shared RESULT_DISPLAYNAME As String
Public Shared RESULT_CONFIG_IDS As Hashtable
Private Shared DATE_COLUMNS As New List(Of String)
Private Shared DATE_COLUMNS_CONFIG As New List(Of String)
Public Shared DT_RESULTFILES As DataTable
Private Shared DT_DROPDOWN_ITEMS As DataTable
@@ -155,8 +156,11 @@ Public Class ClassWindreamDocGrid
Dim columnTitle As String = row.Item("HEADER_CAPTION")
Dim type As Integer = row.Item("TYPE_ID")
If type = 4 Then
If type = 4 And isConfig = False Then
DATE_COLUMNS.Add(columnTitle)
ElseIf type = 4 And isConfig = True Then
DATE_COLUMNS_CONFIG.Add(columnTitle)
End If
If isConfig = True Then
@@ -297,72 +301,87 @@ Public Class ClassWindreamDocGrid
Public Shared Sub detailView_CustomRowCellEdit(grvw As GridView, e As CustomRowCellEditEventArgs)
If (e.Column.Name = "colVALUE") Then
Dim rowView As DataRowView = grvw.GetRow(e.RowHandle)
Dim configId As Integer = rowView.Item("CONFIG_ID")
Dim title = rowView.Item("HEADER_CAPTION")
Dim editable As Boolean = rowView.Item("EDITABLE")
Dim typeId As Integer = rowView.Item("TYPE_ID")
Try
If (e.Column.Name = "colVALUE") Then
Dim rowView As DataRowView = grvw.GetRow(e.RowHandle)
Dim configId As Integer = rowView.Item("CONFIG_ID")
Dim title = rowView.Item("HEADER_CAPTION")
Dim editable As Boolean = rowView.Item("EDITABLE")
Dim typeId As Integer = rowView.Item("TYPE_ID")
If typeId = 1 And editable Then
Dim textedit As New RepositoryItemTextEdit()
If typeId = 1 And editable Then
Dim textedit As New RepositoryItemTextEdit()
AddHandler textedit.Leave, _textValueChangedHandler
AddHandler textedit.Leave, _textValueChangedHandler
e.RepositoryItem = textedit
e.RepositoryItem = textedit
End If
If typeId = 2 Then
Dim checkEdit As New RepositoryItemCheckEdit()
checkEdit.ValueChecked = "True"
checkEdit.ValueUnchecked = "False"
checkEdit.GlyphAlignment = HorzAlignment.Near
checkEdit.Caption = String.Empty
AddHandler checkEdit.CheckedChanged, _checkValueChangedHandler
e.RepositoryItem = checkEdit
End If
If typeId = 4 Then
Dim dateedit As New RepositoryItemDateEdit()
' Brauchen wir Zeitangaben in den Custom Fields?
AddHandler dateedit.CustomDisplayText, Sub(sender As Object, _e As DevExpress.XtraEditors.Controls.CustomDisplayTextEventArgs)
Dim parsedDate As DateTime
If Not DateTime.TryParse(_e.Value, parsedDate) Then
Try
If _e.Value <> "" Then
parsedDate = DateTime.ParseExact(_e.Value, CURRENT_DATE_FORMAT, System.Globalization.DateTimeFormatInfo.InvariantInfo) '& " HH:MM:ss"
_e.DisplayText = parsedDate.ToString(CURRENT_DATE_FORMAT) '& " HH:MM:ss")
End If
Catch ex As Exception
If LogErrorsOnly = False Then ClassLogger.Add("Error in parse-Date: " & ex.Message, False)
End Try
End If
End Sub
AddHandler dateedit.EditValueChanged, _datepickerValueChangedHandler
e.RepositoryItem = dateedit
End If
If typeId = 3 Then
Dim dropdown As New RepositoryItemComboBox()
Dim matchingRows() As DataRow = DT_DROPDOWN_ITEMS.Select(String.Format("CONFIG_ID = {0}", configId), "SEQUENCE")
For Each matchingRow As DataRow In matchingRows
Dim item As New WindreamDocGridComboboxItem()
item.ConfigID = matchingRow.Item("CONFIG_ID")
item.Value = matchingRow.Item("VALUE")
dropdown.Items.Add(item)
Next
AddHandler dropdown.SelectedValueChanged, _dropdownValueChangedHandler
e.RepositoryItem = dropdown
End If
ElseIf (e.Column.Name <> "colVALUE") Then
' Erlaube Editieren nur für VALUE Spalte
e.Column.OptionsColumn.AllowEdit = False
End If
Catch ex As Exception
ClassLogger.Add("Error in detailView_CustomRowCellEdit: " & ex.Message, False)
End Try
If typeId = 2 Then
Dim checkEdit As New RepositoryItemCheckEdit()
checkEdit.ValueChecked = "True"
checkEdit.ValueUnchecked = "False"
checkEdit.GlyphAlignment = HorzAlignment.Near
checkEdit.Caption = String.Empty
AddHandler checkEdit.CheckedChanged, _checkValueChangedHandler
e.RepositoryItem = checkEdit
End If
If typeId = 4 Then
Dim dateedit As New RepositoryItemDateEdit()
AddHandler dateedit.EditValueChanged, _datepickerValueChangedHandler
' Brauchen wir Zeitangaben in den Custom Fields?
AddHandler dateedit.CustomDisplayText, Sub(sender As Object, _e As DevExpress.XtraEditors.Controls.CustomDisplayTextEventArgs)
Dim parsedDate As DateTime
If Not DateTime.TryParse(_e.Value, parsedDate) Then
parsedDate = DateTime.ParseExact(_e.Value, CURRENT_DATE_FORMAT & " HH:MM:ss", System.Globalization.DateTimeFormatInfo.InvariantInfo)
End If
_e.DisplayText = parsedDate.ToString(CURRENT_DATE_FORMAT & " HH:MM:ss")
End Sub
e.RepositoryItem = dateedit
End If
If typeId = 3 Then
Dim dropdown As New RepositoryItemComboBox()
Dim matchingRows() As DataRow = DT_DROPDOWN_ITEMS.Select(String.Format("CONFIG_ID = {0}", configId), "SEQUENCE")
For Each matchingRow As DataRow In matchingRows
Dim item As New WindreamDocGridComboboxItem()
item.ConfigID = matchingRow.Item("CONFIG_ID")
item.Value = matchingRow.Item("VALUE")
dropdown.Items.Add(item)
Next
AddHandler dropdown.SelectedValueChanged, _dropdownValueChangedHandler
e.RepositoryItem = dropdown
End If
ElseIf (e.Column.Name <> "colVALUE") Then
' Erlaube Editieren nur für VALUE Spalte
e.Column.OptionsColumn.AllowEdit = False
End If
End Sub
Private Shared Sub gridView_CustomColumnDisplayText(sender As Object, e As CustomColumnDisplayTextEventArgs)
@@ -381,6 +400,18 @@ Public Class ClassWindreamDocGrid
End If
e.DisplayText = parsedDate.ToString(CURRENT_DATE_FORMAT & " HH:MM:ss")
ElseIf DATE_COLUMNS_CONFIG.Contains(e.Column.FieldName) And e.ListSourceRowIndex <> DevExpress.XtraGrid.GridControl.InvalidRowHandle Then
If e.Value.ToString() = String.Empty Then
e.DisplayText = ""
Exit Sub
End If
If Not DateTime.TryParse(e.Value, parsedDate) Then
parsedDate = DateTime.ParseExact(e.Value, CURRENT_DATE_FORMAT, System.Globalization.DateTimeFormatInfo.InvariantInfo)
End If
e.DisplayText = parsedDate.ToString(CURRENT_DATE_FORMAT)
End If
End Sub