Пример #1
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;
                    }
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Handles selected index change event and repopulate tree view based on selection of root node.
        /// </summary>
        /// <param name="sender">Sender Object</param>
        /// <param name="e">Event Arguments</param>
        private void RootNodeDropDown_SelectedIndexChanged(object sender, EventArgs e)
        {
            using (ResourceDataAccess resourceAccess = new ResourceDataAccess(base.CreateContext()))
            {
                this._rootCategoryNode = resourceAccess.GetCategoryNodeWithHierarchy(
                    new Guid(RootNodeDropDown.SelectedValue));

                if (IsSecurityAwareControl && _rootCategoryNode != null)
                {
                    _authorizedCategoryNodeIds = GetAuthorizedCategoryNodes(AuthenticatedToken, _rootCategoryNode, resourceAccess);
                }
            }

            TreeView.Nodes.Clear();
            FillCategoryNodes();
        }