コード例 #1
0
ファイル: ReportingView.cs プロジェクト: Plankankul/Zenity
        private void UpdateRecentlyAddedResourceView()
        {
            IList <Resource> dataSource = null;
            Dictionary <Guid, IEnumerable <string> > userPermissions = null;

            using (ResourceDataAccess dataAccess = new ResourceDataAccess(this.CreateContext()))
            {
                if (!IsSecurityAwareControl)
                {
                    dataSource = dataAccess.GetLatestAddedResources(null, PageSize);
                }
                else
                {
                    if (this.AuthenticatedToken != null)
                    {
                        dataSource      = dataAccess.GetLatestAddedResources(this.AuthenticatedToken, this.PageSize);
                        userPermissions = GetPermissions(this.AuthenticatedToken, dataSource);
                    }
                }
            }

            ResourceListView.DataSource.Clear();
            foreach (Resource resource in dataSource)
            {
                ResourceListView.DataSource.Add(resource);
            }

            ResourceListView.UserPermissions = userPermissions;
            ResourceListView.SortDirection   = SortDirection.Descending;
            ResourceListView.SortExpression  = _dateAddedProperty;
            ResourceListView.ShowDate        = DateType.DateAdded;
            ResourceListView.SortDataSource(SortDirection.Descending, _dateAddedProperty);
            ResourceListView.DataBind();
        }