public ActionResult HrDocs(string libraryName, string name, string folderPath)
        {

            var tempHrDocs = new HrDocs() { Name = name, LibraryName = libraryName, RelativePath = folderPath, };
            var hrDocs = HrDocsToHrDocsModel(HrDocsService.GetHrDocsItems(tempHrDocs));

            ViewBag.UploadPath = folderPath;
            ViewBag.LibraryName = libraryName;
            ViewBag.Name = name;

            return hrDocs.HasTopView ? View("HrDocsTopView", hrDocs) : View(hrDocs);
        }
 public byte[] GetFileStream(HrDocs hrDocs)
 {
     return HrDocsDao.GetFileStream(hrDocs);
 }
 public HrDocs GetHrDocsItems(HrDocs hrDocs)
 {
     return HrDocsDao.GetHrDocsItems(hrDocs);
 }
 public FileResult PdfViewer(string documentName, string libraryName, string folderPath)
 {
     var hrdocs = new HrDocs { FolderPath = folderPath, LibraryName = libraryName, Name = documentName };
     var data = HrDocsService.GetFileStream(hrdocs);
     return File(data, "application/pdf");
 }
        public virtual ActionResult OpenDocument(string folderPath, string libraryName, string name)
        {
            var hrdocs = new HrDocs() { FolderPath = folderPath, LibraryName = libraryName, Name = name };
            var extenstionArr = name.Split('.');
            var contentType = (extenstionArr.Length > 0)
                ? MimeTypeMap.GetMimeType(extenstionArr[extenstionArr.Length - 1])
                : "text/plain";

            var data = HrDocsService.GetFileStream(hrdocs);
            return File(data, contentType, name);
        }
        private HrDocsModel HrDocsToHrDocsModel(HrDocs item)
        {
            var hrdocmodel = HrDocModelItem(item);

            foreach (var child in item.HrChild)
            {
                var hrDocsChlid = HrDocModelItem(child);

                foreach (var subchild in child.HrChild)
                {
                    hrDocsChlid.HrChild.Add(HrDocModelItem(subchild));
                }

                hrdocmodel.HrChild.Add(hrDocsChlid);
            }

            return hrdocmodel;
        }
 private HrDocsModel HrDocModelItem(HrDocs item)
 {
     return new HrDocsModel()
            {
                Name = item.Name,
                PageTitle = item.PageTitle,
                LibraryName = item.LibraryName,
                Description = item.Description,
                ContentType = item.ContentType,
                FolderPath = item.FolderPath,
                RelativePath = item.RelativePath,
                ImgSrc = item.ImgSrc,
                HrChild = new List<HrDocsModel>(),
                Comment = item.Comment,
                HasTopView = item.HasTopView
            };
 }