public static List <Folder> GetBreadCrumbs(object folderId, IFolderDao folderDao) { var breadCrumbs = GetFilesSecurity().FilterRead(folderDao.GetParentFolders(folderId)).ToList(); var firstVisible = breadCrumbs.ElementAtOrDefault(0); if (firstVisible != null && firstVisible.FolderType == FolderType.DEFAULT) //not first level { Folder root = null; if (string.IsNullOrEmpty(firstVisible.ProviderName)) { root = folderDao.GetFolder(folderDao.GetFolderIDShare(false)); } else { switch (firstVisible.RootFolderType) { case FolderType.USER: root = folderDao.GetFolder(folderDao.GetFolderIDUser(false)); break; case FolderType.COMMON: root = folderDao.GetFolder(folderDao.GetFolderIDCommon(false)); break; } } if (root != null) { firstVisible.ParentFolderID = root.ID; breadCrumbs.Insert(0, root); } } return(breadCrumbs); }
public static List<Folder> GetBreadCrumbs(object folderId, IFolderDao folderDao) { var breadCrumbs = GetFilesSecurity().FilterRead(folderDao.GetParentFolders(folderId)).ToList(); var firstVisible = breadCrumbs.ElementAtOrDefault(0); if (firstVisible != null && firstVisible.FolderType == FolderType.DEFAULT) //not first level { Folder root = null; if (string.IsNullOrEmpty(firstVisible.ProviderName)) { root = folderDao.GetFolder(folderDao.GetFolderIDShare(false)); } else { switch (firstVisible.RootFolderType) { case FolderType.USER: root = folderDao.GetFolder(folderDao.GetFolderIDUser(false)); break; case FolderType.COMMON: root = folderDao.GetFolder(folderDao.GetFolderIDCommon(false)); break; } } if (root != null) { firstVisible.ParentFolderID = root.ID; breadCrumbs.Insert(0, root); } } return breadCrumbs; }