Files
Nuvolar/Nuvolar.Module/Mobile/MobileListDashboardsVC.vb
T
2017-03-08 11:21:27 +01:00

51 lines
1.6 KiB
VB.net

Imports System
Imports System.ComponentModel
Imports System.Collections.Generic
Imports System.Diagnostics
Imports System.Text
Imports DevExpress.ExpressApp
Imports DevExpress.ExpressApp.Actions
Imports DevExpress.Persistent.Base
Imports DevExpress.Persistent.BaseImpl
Imports DevExpress.Data.Filtering
Public Class MobileListDashboardsVC
Inherits DevExpress.ExpressApp.ViewController
Public Sub New()
MyBase.New()
'This call is required by the Component Designer.
InitializeComponent()
RegisterActions(components)
End Sub
Protected Overrides Sub OnActivated()
MyBase.OnActivated()
If View.Id = "MobileListDashboards_ListView_User" Then
Dim _Collectionsource As CollectionSource = TryCast(View, ListView).CollectionSource
Dim _User As User = TryCast(SecuritySystem.CurrentUser, User)
Dim _s As String = ""
Dim _i As Long = 0
_Collectionsource.BeginUpdateCriteria()
For Each _Role As Role In _User.Roles
If _i = 0 Then
_s = "Role.Oid in ('" & _Role.Oid.ToString & "'"
Else
_s += ",'" & _Role.Oid.ToString & "'"
End If
_i += 1
Next
If _s = "" Then
_Collectionsource.Criteria("ByRole") = CriteriaOperator.Parse("1=2")
Else
_s += ")"
_Collectionsource.Criteria("ByRole") = CriteriaOperator.Parse(_s)
End If
_Collectionsource.EndUpdateCriteria()
End If
End Sub
End Class