Public Class frmCockpit
    Private Shared _Instance As frmCockpit = Nothing
    Public Shared Function Instance() As frmCockpit
        If _Instance Is Nothing OrElse _Instance.IsDisposed = True Then
            _Instance = New frmCockpit
        End If
        _Instance.BringToFront()
        Return _Instance
    End Function
    Sub Load_Task_Over_All()
        Try


            Dim sql = String.Format("SELECT WF_ID AS [Workflow-ID], RECORD_ID AS [Record-ID], RECORD_DESCRIPTION as 'Beschreibung',dbo.FNPMO_GETOBJECTCAPTION('{0}', 'TASK_TITLE' + CONVERT(VARCHAR(5), WF_ID), 1) AS [Workflow-Title], " & _
                         "dbo.FNPMO_GETOBJECTCAPTION('{0}', " & _
                        "'FORMVIEW_TITLE' + CONVERT(VARCHAR(5), FORM_VIEW_ID), 1) AS 'Entity-Title', dbo.FNPMO_GETOBJECTCAPTION('{0}', 'WF_STATE_TITLE' + CONVERT(VARCHAR(5), STATE_ID), 1) AS 'State-Title', " & _
                        "COMMENT, DUE_DATE, ADDED_WHEN, CHANGED_WHO, CHANGED_WHEN, TASK_DATE, FINAL, COLOR FROM VWPMO_WF_ACTIVE AS T " & _
                        "WHERE (WF_TASK_ID NOT IN (SELECT WF_TASK_ID FROM VWPMO_WF_USER_EXCLUSIV " & _
                        "WHERE (WF_TASK_ID NOT IN (SELECT WF_TASK_ID FROM VWPMO_WF_USER_EXCLUSIV AS VWPMO_WF_USER_EXCLUSIV_1 WHERE (UPPER(USERNAME) = UPPER('{1}'))))))", USER_LANGUAGE, USER_USERNAME)
            Dim DT As DataTable = MYDB_ECM.GetDatatable(sql)
            If Not DT Is Nothing Then
                GridControl1.DataSource = DT
                Dim captiongrbx
                captiongrbx = DT.Rows.Count & " Tasks - Team/Group"
                grbxTasksGeneral.Text = captiongrbx
                Dim i As Integer
                Dim _col As Color = Color.White


                For Each row As DataRow In CURRENT_TASKS_GENERAL.Rows
                    'Dim i = row.Item(0)
                    'Dim y = row.Item(1)
                    Dim _string = row.Item("WF_ID").ToString & "-" & row.Item("WF_TITLE") & "/" & row.Item("ENTITY_TITLE")

                    With ListViewTasksGeneral.Items.Add(_string.ToString, 0)
                        '.SubItems.Add(row.Item(1))
                        '.SubItems.Add("Dritte Spalte")
                        .Tag = row.Item(0)
                        .BackColor = _col
                    End With
                    i += 1
                    '   ListViewTasksGeneral.Items(i).BackColor = _col
                    If _col = Color.White Then
                        _col = Color.Lavender
                    Else
                        _col = Color.White
                    End If


                Next
            End If
                
        Catch ex As Exception

        End Try
    End Sub

    Private Sub frmCockpit_Load(sender As Object, e As EventArgs) Handles Me.Load
        Load_Task_Over_All()
    End Sub
End Class