Exemple #1
0
        /// <summary>
        /// Returns list of items to be used as a destination list.
        /// </summary>
        /// <returns>List of destination items.</returns>
        protected override IList GetDestinationItems()
        {
            IList resources = null;

            using (ResourceDataAccess dataAccess = new ResourceDataAccess(base.CreateContext()))
            {
                NavigationProperty property = dataAccess.GetNavigationProperty(this.Page.Cache,
                                                                               typeName, _predicateDropDownList.SelectedItem.Text);

                if (IsSecurityAwareControl)
                {
                    if (AuthenticatedToken != null)
                    {
                        resources = dataAccess.GetRelatedResources(SubjectItemId, property, AuthenticatedToken, Constants.PermissionRequiredForAssociation);
                    }
                }
                else
                {
                    resources = dataAccess.GetRelatedResources(SubjectItemId, property, null, Constants.PermissionRequiredForAssociation);
                }
            }
            return(resources);
        }
        private List <Resource> GetRelatedResources(Guid resourceId, NavigationProperty navigationProperty)
        {
            List <Resource> relatedResources = null;

            if (resourceId != Guid.Empty && navigationProperty != null)
            {
                using (ResourceDataAccess dataAccess = new ResourceDataAccess(this.CreateContext()))
                {
                    relatedResources = dataAccess.GetRelatedResources(resourceId, navigationProperty, null, UserResourcePermissions.Read);
                }
            }

            return(relatedResources);
        }
        private List <File> GetRelatedFiles(Guid fileId, NavigationProperty navigationProperty)
        {
            List <File> relatedResources = null;

            if (fileId != Guid.Empty && navigationProperty != null)
            {
                using (ResourceDataAccess dataAccess = new ResourceDataAccess(this.CreateContext()))
                {
                    var resources = dataAccess.GetRelatedResources(fileId, navigationProperty, null, UserResourcePermissions.Read);
                    if (resources != null)
                    {
                        relatedResources = resources.Select(tuple => tuple as File).ToList();
                    }
                }
            }

            return(relatedResources);
        }
        private IEnumerable <ResourcePermissions <Resource> > GetRelatedResources(AuthenticatedToken token, Guid resourceId,
                                                                                  NavigationProperty navigationProperty)
        {
            IEnumerable <ResourcePermissions <Resource> > resPermissions = null;

            if (resourceId != Guid.Empty && navigationProperty != null)
            {
                using (ResourceDataAccess dataAccess = new ResourceDataAccess(this.CreateContext()))
                {
                    List <Resource> relatedResources = dataAccess.GetRelatedResources(resourceId, navigationProperty, null, UserResourcePermissions.Read);

                    if (relatedResources != null)
                    {
                        resPermissions = dataAccess.GetResourcePermissions(token, relatedResources);
                    }
                }
            }
            return(resPermissions);
        }
        private IEnumerable <ResourcePermissions <File> > GetRelatedFiles(AuthenticatedToken token, Guid fileId,
                                                                          NavigationProperty navigationProperty)
        {
            IEnumerable <ResourcePermissions <File> > resPermissions = null;

            if (fileId != Guid.Empty && navigationProperty != null)
            {
                using (ResourceDataAccess dataAccess = new ResourceDataAccess(this.CreateContext()))
                {
                    var resources = dataAccess.GetRelatedResources(fileId, navigationProperty, null, UserResourcePermissions.Read);

                    if (resources != null)
                    {
                        List <File> relatedFiles = resources.Select(tuple => tuple as File).ToList();
                        resPermissions = dataAccess.GetResourcePermissions <File>(token, relatedFiles);
                    }
                }
            }
            return(resPermissions);
        }