Beispiel #1
0
 public FolderContentWrapperHelper(
     FileWrapperHelper fileWrapperHelper,
     FolderWrapperHelper folderWrapperHelper)
 {
     FileWrapperHelper   = fileWrapperHelper;
     FolderWrapperHelper = folderWrapperHelper;
 }
Beispiel #2
0
 public FileOperationWraperHelper(
     FolderWrapperHelper folderWrapperHelper,
     FileWrapperHelper filesWrapperHelper,
     IDaoFactory daoFactory,
     CommonLinkUtility commonLinkUtility)
 {
     FolderWrapperHelper = folderWrapperHelper;
     FilesWrapperHelper  = filesWrapperHelper;
     DaoFactory          = daoFactory;
     CommonLinkUtility   = commonLinkUtility;
 }
Beispiel #3
0
 public FolderContentWrapperHelper(
     FileSecurity fileSecurity,
     IDaoFactory daoFactory,
     FileWrapperHelper fileWrapperHelper,
     FolderWrapperHelper folderWrapperHelper)
 {
     FileSecurity        = fileSecurity;
     DaoFactory          = daoFactory;
     FileWrapperHelper   = fileWrapperHelper;
     FolderWrapperHelper = folderWrapperHelper;
 }
Beispiel #4
0
        public FolderContentWrapper <T> Get <T>(DataWrapper <T> folderItems, int startIndex)
        {
            var foldersIntWithRights    = GetFoldersIntWithRights <int>();
            var foldersStringWithRights = GetFoldersIntWithRights <string>();

            var result = new FolderContentWrapper <T>
            {
                Files = folderItems.Entries
                        .Where(r => r.FileEntryType == FileEntryType.File)
                        .Select(r =>
                {
                    FileEntryWrapper wrapper = null;
                    if (r is File <int> fol1)
                    {
                        wrapper = FileWrapperHelper.Get(fol1, foldersIntWithRights);
                    }
                    if (r is File <string> fol2)
                    {
                        wrapper = FileWrapperHelper.Get(fol2, foldersStringWithRights);
                    }

                    return(wrapper);
                }
                                )
                        .ToList(),
                Folders = folderItems.Entries
                          .Where(r => r.FileEntryType == FileEntryType.Folder)
                          .Select(r =>
                {
                    FileEntryWrapper wrapper = null;
                    if (r is Folder <int> fol1)
                    {
                        wrapper = FolderWrapperHelper.Get(fol1, foldersIntWithRights);
                    }
                    if (r is Folder <string> fol2)
                    {
                        wrapper = FolderWrapperHelper.Get(fol2, foldersStringWithRights);
                    }

                    return(wrapper);
                }
                                  ).ToList(),
                PathParts  = folderItems.FolderPathParts,
                StartIndex = startIndex
            };

            result.Current = FolderWrapperHelper.Get(folderItems.FolderInfo);
            result.Count   = result.Files.Count + result.Folders.Count;
            result.Total   = folderItems.Total;
            result.New     = folderItems.New;

            return(result);


            List <Tuple <FileEntry <T1>, bool> > GetFoldersIntWithRights <T1>()
            {
                var folderDao = DaoFactory.GetFolderDao <T1>();
                var folders   = folderDao.GetFolders(folderItems.Entries.OfType <FileEntry <T1> >().Select(r => r.FolderID).Distinct().ToList());

                return(FileSecurity.CanRead(folders));
            }
        }