jj - GridFunctions1

This commit is contained in:
Jonathan Jenne
2018-02-07 15:35:34 +01:00
parent 574a6dac49
commit 6835cda1a1
12 changed files with 314 additions and 191 deletions

View File

@@ -11,6 +11,11 @@ Public Class frmMain
Private UserLoggedin As Integer = 0
Private PROFILE_COUNT As Integer = 0
Private DTPROFIL As DataTable
Private RedDocuments As Integer = 0
Private YellowDocuments As Integer = 0
Private GreenDocuments As Integer = 0
Private Sub frmProfiles_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
Try
TBPM_USERTableAdapter.cmdLoginOut(False, Environment.MachineName, Environment.UserName)
@@ -29,12 +34,8 @@ Public Class frmMain
ClassLogger.Add("Error in Save FormLayout: " & ex.Message)
End Try
Try
Try
Dim XMLPath = GetXML_LayoutName()
GridViewProfile.SaveLayoutToXml(XMLPath)
Catch ex As Exception
End Try
Dim XMLPath = GetXML_LayoutName()
GridViewProfile.SaveLayoutToXml(XMLPath)
Catch ex As Exception
End Try
@@ -170,20 +171,35 @@ Public Class frmMain
' "AND T1.ACTIVE = 1 And (UPPER(T1.USERNAME) = UPPER('{0}')) Order By T1.PRIORITY", Environment.UserName)
Dim DTGRID As DataTable = ClassDatabase.Return_Datatable(sql, True)
If Not IsNothing(DTGRID) Then
' Spalte für Status Icon erstellen
Dim columnStateIcon As New DataColumn()
columnStateIcon.DataType = GetType(Image)
columnStateIcon.ColumnName = "ICON"
columnStateIcon.Caption = ""
DTGRID.Columns.Add(columnStateIcon)
RedDocuments = 0
YellowDocuments = 0
GreenDocuments = 0
For Each row As DataRow In DTGRID.Rows
Dim State As Integer = row.Item("TL_STATE")
Select Case State
Case 1
RedDocuments += 1
row.Item("ICON") = My.Resources.ampel_rot
Case 2
YellowDocuments += 1
row.Item("ICON") = My.Resources.ampel_gelb
Case 3
GreenDocuments += 1
row.Item("ICON") = My.Resources.ampel_gruen
End Select
Next
GridControlProfile.DataSource = DTGRID
GridControlProfile.ForceInitialize()
'Detail-Daten laden
'Dim SQL_DETAILS
'Try
' SQL_DETAILS = DTPROFIL.Rows(0).Item("DETAIL_SQL")
'Catch ex As Exception
' SQL_DETAILS = String.Empty
'End Try
'If SQL_DETAILS <> String.Empty Then
' Dim DT_DETAILS As DataTable = ClassDatabase.Return_Datatable(SQL_DETAILS, True)
'End If
'GridControlProfile.ForceInitialize()
Try
Dim XMLPath = GetXML_LayoutName()
@@ -198,11 +214,18 @@ Public Class frmMain
GridViewProfile.Columns.Item("PROFILE_ID").Visible = False
GridViewProfile.Columns.Item("FULL_FILE_PATH").Visible = False
GridViewProfile.Columns.Item("DOC_ID").Visible = False
GridViewProfile.Columns.Item("ICON").MaxWidth = 24
GridViewProfile.Columns.Item("ICON").MinWidth = 24
GridViewProfile.Columns.Item("ICON").AppearanceCell.BackColor = Color.White
GridViewProfile.Columns.Item("TL_STATE").SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Max
GridViewProfile.Columns.Item("TL_STATE").SummaryItem.DisplayFormat = "Max: {0}"
GridViewProfile.Columns.Item("TL_STATE").SummaryItem.FieldName = "TL_STATE"
GridViewProfile.Columns("Last edited").DisplayFormat.FormatType = FormatType.DateTime
GridViewProfile.Columns("Last edited").DisplayFormat.FormatString = "dd.MM.yyyy HH:MM:ss"
'GridViewProfile.OptionsBehavior.AlignGroupSummaryInGroupRow = True
GridViewProfile.OptionsView.ShowGroupPanel = False
GridViewProfile.OptionsBehavior.AutoExpandAllGroups = True
Catch ex As Exception
@@ -365,25 +388,43 @@ Public Class frmMain
Private Sub GridViewProfile_CustomDrawGroupRow(sender As Object, e As DevExpress.XtraGrid.Views.Base.RowObjectCustomDrawEventArgs) Handles GridViewProfile.CustomDrawGroupRow
Dim info As GridGroupRowInfo = TryCast(e.Info, GridGroupRowInfo)
Dim view As GridView = sender
If info.Column.FieldName = "TITLE" Then
info.GroupText = info.GroupValueText
info.Appearance.BackColor = Color.LightGray
End If
End Sub
Private Sub GridViewProfile_RowCellStyle(sender As Object, e As RowCellStyleEventArgs) Handles GridViewProfile.RowCellStyle
Private Sub GridViewProfile_RowStyle(sender As Object, e As RowStyleEventArgs) Handles GridViewProfile.RowStyle
Dim view As GridView = TryCast(sender, GridView)
Dim row As DataRow = view.GetDataRow(e.RowHandle)
If e.Column.FieldName = "TL_STATE" Then
If e.CellValue = "1" Then
e.Appearance.BackColor = Color.LightSalmon
ElseIf e.CellValue = "2" Then
e.Appearance.BackColor = Color.LightGoldenrodYellow
ElseIf e.CellValue = "3" Then
e.Appearance.BackColor = Color.LightGreen
End If
If IsNothing(row) Then
Exit Sub
End If
Dim state = row.Item("TL_STATE")
e.HighPriority = True
Select Case state
Case 1
e.Appearance.BackColor = Color.LightSalmon
Case 2
e.Appearance.BackColor = Color.LightGoldenrodYellow
Case 3
e.Appearance.BackColor = Color.LightGreen
End Select
End Sub
Private Sub GridViewProfile_Layout(sender As Object, e As EventArgs) Handles GridViewProfile.Layout
Try
Dim XMLPath = GetXML_LayoutName()
GridViewProfile.SaveLayoutToXml(XMLPath)
Catch ex As Exception
End Try
End Sub
End Class