private NewsTypeCollectionModel GetNewsTypeCollectionModel(string libraryName, string name, string folderPath, string sortField, string sortDir, string type)
        {
            //Fetch all news contents
            var newsModel = new NewsModel() { LibraryName = libraryName, Name = name, FolderPath = folderPath, SortDir = sortDir, SortField = sortField };
            var news = new News() { LibraryName = newsModel.LibraryName, Name = newsModel.Name, FolderPath = newsModel.FolderPath, SortDir = newsModel.SortDir, SortField = newsModel.SortField };

            var documents = NewsService.GetAllContents(news);
            var output = new List<NewsModel>();
            ViewBag.UploadPath = folderPath;
            ViewBag.LibraryName = libraryName;

            foreach (var model in documents)
            {
                output.Add(new NewsModel() { Name = model.Name, Body = model.Body, CreatedDate = model.CreatedDate, CreatedBy = model.CreatedBy, LastUpdated = model.LastUpdated, LibraryName = libraryName, FolderPath = folderPath });
            }

            //Fetch all Business Updates contents
            string businessUpdate = ApplicationConfiguration.BusinessUpdates;
            string events = ApplicationConfiguration.Events;

            newsModel = new NewsModel() { LibraryName = businessUpdate, Name = businessUpdate, FolderPath = businessUpdate.StartWithSlash(), SortDir = sortDir, SortField = sortField };
            news = new News() { LibraryName = newsModel.LibraryName, Name = newsModel.Name, FolderPath = newsModel.FolderPath, SortDir = newsModel.SortDir, SortField = newsModel.SortField };

            documents = NewsService.GetAllContents(news);
            var businessUpdateModel = new List<NewsModel>();

            foreach (var model in documents)
            {
                businessUpdateModel.Add(new NewsModel() { Name = model.Name, Body = model.Body, CreatedDate = model.CreatedDate, CreatedBy = model.CreatedBy, LastUpdated = model.LastUpdated, LibraryName = businessUpdate, FolderPath = businessUpdate.StartWithSlash() });
            }

            //Fetch all ECS Events contents
            newsModel = new NewsModel() { LibraryName = events, Name = events, FolderPath = events.StartWithSlash(), SortDir = sortDir, SortField = sortField };
            news = new News() { LibraryName = newsModel.LibraryName, Name = newsModel.Name, FolderPath = newsModel.FolderPath, SortDir = newsModel.SortDir, SortField = newsModel.SortField };

            documents = NewsService.GetAllContents(news);
            var ecsEventsModel = new List<NewsModel>();

            foreach (var model in documents)
            {
                ecsEventsModel.Add(new NewsModel() { Name = model.Name, Body = model.Body, CreatedDate = model.CreatedDate, CreatedBy = model.CreatedBy, LastUpdated = model.LastUpdated, LibraryName = events, FolderPath = events.StartWithSlash() });
            }

            return new NewsTypeCollectionModel()
            {
                BusinessUpdatesModel = businessUpdateModel,
                EcsEventsModel = ecsEventsModel,
                NewsModel = output
            };
        }
        public ActionResult GetContent(string libraryName, string name, string folderPath, string type)
        {
            try
            {
                var newsModel = new NewsModel() { LibraryName = libraryName, Name = name, FolderPath = folderPath };
                var news = new News() { LibraryName = newsModel.LibraryName, Name = newsModel.Name, FolderPath = newsModel.FolderPath };

                var model = NewsService.GetAllContent(news);
                ViewBag.UploadPath = folderPath;
                ViewBag.LibraryName = libraryName;

                var output = new NewsModel() { Name = model.Name, Body = model.Body, CreatedDate = model.CreatedDate, CreatedBy = model.CreatedBy, LastUpdated = model.LastUpdated };

                return View("ShowNews", output);
            }
            catch (Exception ex) { throw ex; }
        }
        public ActionResult GetImage(string libraryName, string name, string folderPath)
        {
            var news = new News() { FolderPath = folderPath, LibraryName = libraryName, Name = name };
            var data = NewsService.GetFileStream(news);

            return Json(new { base64imgage = Convert.ToBase64String(data) }, JsonRequestBehavior.AllowGet);
        }
        public ActionResult Content(string libraryName, string name, string folderPath, string sortField, string sortDir, string type)
        {
            try
            {
                var newsModel = new NewsModel() { LibraryName = libraryName, Name = name, FolderPath = folderPath, SortDir = sortDir, SortField = sortField };
                var news = new News() { LibraryName = newsModel.LibraryName, Name = newsModel.Name, FolderPath = newsModel.FolderPath, SortDir = newsModel.SortDir, SortField = newsModel.SortField };

                var documents = NewsService.GetAllContents(news);
                var output = new List<NewsModel>();
                ViewBag.UploadPath = folderPath;
                ViewBag.LibraryName = libraryName;

                foreach (var model in documents)
                {
                    output.Add(new NewsModel() { Name = model.Name, Body = model.Body, CreatedDate = model.CreatedDate, CreatedBy = model.CreatedBy, LastUpdated = model.LastUpdated });
                }
                return View("NewsTopic", output);
            }
            catch (Exception ex) { throw ex; }
        }
 public byte[] GetFileStream(News news) {
     return LegacyNewsDao.GetFileStream(news);
 }
 public List<News> GetHomePageContent(News news)
 { return LegacyNewsDao.GetHomePageContent(news); }
 public List<News> GetAllContents(News news)
 {
     return LegacyNewsDao.GetAllContents(news);
 }        
 public News GetAllContent(News news)
 {
     return LegacyNewsDao.GetAllContent(news);
 }