public List <FolderDTO> GetAllFolders(int uid, int pid)
 {
     return(FolderBO.GetAllMainFoldersByUser(uid, pid));
 }
        public void GetMetaData(int uid, int pid)
        {
            FolderDTO        main       = FolderBO.GetFolder(uid, pid);
            List <FolderDTO> folderList = FolderBO.GetAllMainFoldersByUser(uid, pid);
            String           dest       = "D:\\Extras\\MetaData.pdf";
            var writer   = new PdfWriter(dest);
            var pdf      = new PdfDocument(writer);
            var document = new Document(pdf);

            document.Add(new Paragraph("Meta Information of Folder: " + main.Name));
            document.Add(new Paragraph("Name: " + main.Name));
            document.Add(new Paragraph("Type: Folder"));
            document.Add(new Paragraph("Size: None"));
            if (main.ParentFolderId == -1)
            {
                document.Add(new Paragraph("Parent: Root"));
            }
            else
            {
                FolderDTO folder1 = FolderBO.GetFolder(main.CreatedBy, main.ParentFolderId);
                document.Add(new Paragraph("Parent: " + folder1.Name));
            }
            int count = folderList.Count;
            Queue <FolderDTO> foldersQueue = new Queue <FolderDTO>();

            for (int i = 0; i < count; i++)
            {
                foldersQueue.Enqueue(folderList[i]);
            }

            List <FileDTO> fileList = FileBO.GetAllFiles(uid, pid);

            count = fileList.Count;
            Queue <FileDTO> filesQueue = new Queue <FileDTO>();

            for (int i = 0; i < count; i++)
            {
                filesQueue.Enqueue(fileList[i]);
            }

            while (foldersQueue.Count > 0)
            {
                FolderDTO folder = foldersQueue.Dequeue();
                document.Add(new Paragraph("Name: " + folder.Name));
                document.Add(new Paragraph("Type: Folder"));
                document.Add(new Paragraph("Size: None"));
                if (folder.ParentFolderId == -1)
                {
                    document.Add(new Paragraph("Parent: Root"));
                }
                else
                {
                    FolderDTO folder1 = FolderBO.GetFolder(folder.CreatedBy, folder.ParentFolderId);
                    document.Add(new Paragraph("Parent: " + folder1.Name));
                }
                document.Add(new Paragraph(""));
                folder.ParentFolderId = folder.Id;
                folderList            = FolderBO.GetAllMainFoldersByUser(folder.CreatedBy, folder.ParentFolderId);
                count = folderList.Count;
                for (int i = 0; i < count; i++)
                {
                    foldersQueue.Enqueue(folderList[i]);
                }

                fileList = FileBO.GetAllFiles(folder.CreatedBy, folder.ParentFolderId);
                count    = fileList.Count;
                for (int i = 0; i < count; i++)
                {
                    filesQueue.Enqueue(fileList[i]);
                }
            }



            while (filesQueue.Count > 0)
            {
                FileDTO file = filesQueue.Dequeue();
                document.Add(new Paragraph("Name: " + file.Name));
                document.Add(new Paragraph("Type: File"));
                document.Add(new Paragraph("Size: " + file.FileSizeInKB + " KB"));
                if (file.ParentFolderId == -1)
                {
                    document.Add(new Paragraph("Parent: Root"));
                }
                else
                {
                    FolderDTO folder1 = FolderBO.GetFolder(uid, file.ParentFolderId);
                    document.Add(new Paragraph("Parent: " + folder1.Name));
                }
                document.Add(new Paragraph(""));
            }
            document.Add(new Paragraph(""));
            document.Close();
            return;
        }