コード例 #1
0
ファイル: ContentFolderService.cs プロジェクト: QuantumArt/QP
        public static Folder GetById(int id)
        {
            var factory = new ContentFolderFactory();
            var folder  = factory.CreateRepository().GetById(id);

            if (folder == null)
            {
                throw new Exception(string.Format(LibraryStrings.ContentFolderNotExists, id));
            }

            return(folder);
        }
コード例 #2
0
        public static ListResult <FolderFile> GetFileList(ListCommand command, int parentFolderId, LibraryFileFilter filter)
        {
            var factory    = new ContentFolderFactory();
            var repository = factory.CreateRepository();
            var folder     = repository.GetById(parentFolderId);

            if (folder == null)
            {
                throw new Exception(string.Format(LibraryStrings.ContentFolderNotExists, parentFolderId));
            }

            return(folder.GetFiles(command, filter));
        }
コード例 #3
0
        public static LibraryResult Library(int id, string subFolder)
        {
            if (!ContentRepository.Exists(id))
            {
                throw new Exception(string.Format(ContentStrings.ContentNotFound, id));
            }

            var factory    = new ContentFolderFactory();
            var repository = factory.CreateRepository();
            var folder     = repository.GetBySubFolder(id, subFolder);

            return(new LibraryResult {
                Folder = folder
            });
        }
コード例 #4
0
ファイル: PathSecurity.cs プロジェクト: AuthorProxy/QP
        private static PathSecurityResult CheckContentFolder(string pathToFind, int contentId)
        {
            var result        = new PathSecurityResult();
            var factory       = new ContentFolderFactory();
            var contentFolder = FindLongest(pathToFind, factory.CreateRepository().GetPaths(contentId));

            if (contentFolder != null)
            {
                result.Result   = SecurityRepository.IsEntityAccessible(EntityTypeCode.ContentFolder, contentFolder.Id, ActionTypeCode.Update);
                result.FolderId = contentFolder.Id;
            }
            else
            {
                result.Result = SecurityRepository.IsEntityAccessible(EntityTypeCode.Content, contentId, ActionTypeCode.Update);
            }

            return(result);
        }