jj fix date format

This commit is contained in:
Jonathan Jenne
2017-08-17 11:21:50 +02:00
parent 2a396414b9
commit 96c08ada63
2 changed files with 52 additions and 7 deletions

View File

@@ -4,6 +4,7 @@ Imports DevExpress.XtraGrid.Columns
Imports DevExpress.XtraGrid.Views.Grid
Imports DevExpress.XtraEditors
Imports DevExpress.XtraEditors.Repository
Imports DevExpress.XtraGrid.Views.Base
Public Class ClassWindreamDocGrid
Public Shared SELECTED_DOC_PATH As String
@@ -12,6 +13,7 @@ Public Class ClassWindreamDocGrid
Public Shared SELECTED_DOC_ID As Integer
'Public Shared RESULT_DISPLAYNAME As String
Public Shared RESULT_CONFIG_IDS As Hashtable
Private Shared DATE_COLUMNS As New List(Of String)
Public Shared DT_RESULTFILES As DataTable
Private Shared DT_DROPDOWN_ITEMS As DataTable
@@ -38,7 +40,7 @@ Public Class ClassWindreamDocGrid
DT_RESULTFILES = Nothing
Return False
End Try
End Function
Public Shared Sub GetDocItems(gridView As GridView)
If Init_Table() = True Then
@@ -149,10 +151,15 @@ Public Class ClassWindreamDocGrid
For Each row As DataRow In DT_WINDREAM_RESULTLIST.Rows
Dim isConfig As Boolean = row.Item("CONFIG_COLUMNS")
Dim guid As Integer = row.Item("GUID")
Dim guid As Integer = row.Item("GUID")
Dim columnTitle As String = row.Item("HEADER_CAPTION")
Dim type As Integer = row.Item("TYPE_ID")
If isConfig Then
If type = 4 Then
DATE_COLUMNS.Add(columnTitle)
End If
If isConfig = True Then
RESULT_CONFIG_IDS.Add(columnTitle, guid)
End If
Next
@@ -241,6 +248,19 @@ Public Class ClassWindreamDocGrid
End Try
AddHandler gridView.MasterRowExpanded, AddressOf gridView_MasterRowExpanded
AddHandler gridView.CustomColumnDisplayText, AddressOf gridView_CustomColumnDisplayText
For Each row As DataRow In DT_WINDREAM_RESULTLIST.Rows
Dim col As GridColumn = gridView.Columns(row.Item("HEADER_CAPTION"))
Dim type As Integer = row.Item("TYPE_ID")
Dim isConfig As Boolean = row.Item("CONFIG_COLUMNS")
If Not IsNothing(col) And type = 4 And isConfig Then
col.DisplayFormat.FormatType = FormatType.DateTime
col.DisplayFormat.FormatString = CURRENT_DATE_FORMAT & " HH:MM:ss"
End If
Next
gridView.Columns.Item("ICON").MaxWidth = 24
gridView.Columns.Item("ICON").MinWidth = 24
@@ -274,6 +294,8 @@ Public Class ClassWindreamDocGrid
Next
End Sub
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)
@@ -343,6 +365,25 @@ Public Class ClassWindreamDocGrid
End If
End Sub
Private Shared Sub gridView_CustomColumnDisplayText(sender As Object, e As CustomColumnDisplayTextEventArgs)
Dim view As ColumnView = sender
Dim parsedDate As DateTime
If DATE_COLUMNS.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 & " HH:MM:ss", System.Globalization.DateTimeFormatInfo.InvariantInfo)
End If
e.DisplayText = parsedDate.ToString(CURRENT_DATE_FORMAT & " HH:MM:ss")
End If
End Sub
Public Shared Sub gridView_MasterRowExpanded(sender As GridView, e As DevExpress.XtraGrid.Views.Grid.CustomMasterRowEventArgs)
Dim GW As GridView = sender

View File

@@ -1374,6 +1374,10 @@ Public Class frmConstructor_Main
' Exit Sub
'End If
'Try
'CURRENT_DATE_FORMAT = USER_DATE_FORMAT
If NODE_NAVIGATION = True Then
If NODE_NAVIGATION_LOADED = True Then
Exit Sub
@@ -1397,10 +1401,10 @@ Public Class frmConstructor_Main
' CONSTRUCT_EXPAND = result.Item("EXPAND")
Dim FORM_DATE_FORMAT = result.Item("DATE_FORMAT")
If FORM_DATE_FORMAT <> USER_DATE_FORMAT Then
CURRENT_DATE_FORMAT = FORM_DATE_FORMAT
Else
CURRENT_DATE_FORMAT = USER_DATE_FORMAT
End If
CURRENT_DATE_FORMAT = USER_DATE_FORMAT
Else
CURRENT_DATE_FORMAT = FORM_DATE_FORMAT
End If
LOCK_CONTROLS_BG_LOAD = result.Item("LOCK_CONTROLS_BG_LOAD")
If NODE_NAVIGATION = True Then
If SelectedNode.Tag.ToString.Contains("RECORD_ID") Then