Пример #1
0
        private List <ResourceType> GetResourceTypeList()
        {
            List <ResourceType> resTypeList = null;

            using (ResourceDataAccess dataAccess = new ResourceDataAccess(base.CreateContext()))
            {
                resTypeList = dataAccess.GetResourceTypes().ToList();
                resTypeList = resTypeList.Where(tuple => tuple.Name != "Identity").ToList();
                resTypeList = resTypeList.Where(tuple => tuple.Name != "Group").ToList();
                resTypeList = resTypeList.Where(tuple => tuple.Name != "CategoryNode").ToList();
            }
            if (string.IsNullOrEmpty(ResourceHierarchy))
            {
                resTypeList = resTypeList.Where(tuple => tuple.Name != "Tag").ToList();
                resTypeList = resTypeList.Where(tuple => tuple.Name != "CategoryNode").ToList();
                resTypeList = resTypeList.Where(tuple => tuple.Name != "Contact").ToList();
                resTypeList = resTypeList.Where(tuple => tuple.Name != "Person").ToList();
                resTypeList = resTypeList.Where(tuple => tuple.Name != "Organization").ToList();
            }
            else
            {
                resTypeList = resTypeList.Where(tuple => tuple.Name != "Tag").ToList();
            }
            return(resTypeList);
        }
Пример #2
0
        /// <summary>
        /// Gets the data source.
        /// </summary>
        protected override void GetDataSource()
        {
            if (!this.Page.IsPostBack)
            {
                using (ResourceDataAccess resourceAccess = new ResourceDataAccess(base.CreateContext()))
                {
                    switch (BrowseBy)
                    {
                    case BrowseByCriteria.BrowseByYear:
                        if (!IsSecurityAwareControl)
                        {
                            this._yearRange = resourceAccess.GetYear(null);
                        }
                        else if (this.AuthenticatedToken != null)
                        {
                            this._yearRange = resourceAccess.GetYear(this.AuthenticatedToken);
                        }

                        break;

                    case BrowseByCriteria.BrowseByAuthors:
                        if (!IsSecurityAwareControl)
                        {
                            this._authorList = resourceAccess.GetAuthors(null).ToList();
                        }
                        else if (this.AuthenticatedToken != null)
                        {
                            this._authorList = resourceAccess.GetAuthors(this.AuthenticatedToken).ToList();
                        }
                        break;

                    case BrowseByCriteria.BrowseByResourceType:
                        this._resTypeList = resourceAccess.GetResourceTypes().ToList();
                        _resTypeList      = CoreHelper.FilterSecurityResourceTypes(_resTypeList).ToList();
                        break;

                    case BrowseByCriteria.BrowseByCategoryHierarchy:
                        PopulateRootNodeDropDown();
                        if (!string.IsNullOrEmpty(RootNodeDropDown.SelectedValue))
                        {
                            this._rootCategoryNode = resourceAccess.GetCategoryNodeWithHierarchy(
                                new Guid(RootNodeDropDown.SelectedValue));
                            if (IsSecurityAwareControl && _rootCategoryNode != null)
                            {
                                _authorizedCategoryNodeIds = GetAuthorizedCategoryNodes(AuthenticatedToken, _rootCategoryNode, resourceAccess);
                            }
                        }
                        break;
                    }
                }
            }
        }