예제 #1
0
        public IQueryable <vw_Documents> GetDocuments(int CaseID, long?SessionID, Guid?ParentFolder = null)
        {
            Guid FolderID;

            if (ParentFolder.HasValue)
            {
                FolderID = ParentFolder.Value;
            }
            else
            {
                FolderID = FoldersRepository.GetParentFolderID(CaseID, SessionID);
            }
            return(DocumentsRepository.GetDocuments(CaseID, SessionID).Where(p => p.FolderID == FolderID));
        }
예제 #2
0
        public ActionResult Index()
        {
            var user = Session["user"] as User;

            if (user != null)
            {
                ViewBag.Title = "Документы";

                var documents   = _documentsRepository.GetDocuments();
                var documentsVM = new List <ViewModels.DocumentViewModel>();
                foreach (var document in documents)
                {
                    documentsVM.Add(CreateViewModelDocument(document));
                }

                if (Request.IsAjaxRequest())
                {
                    return(PartialView("IndexPartial", documentsVM));
                }
                else
                {
                    return(View(documentsVM));
                }
            }
            else
            {
                return(RedirectToAction("Index", "Account"));
            }
        }
예제 #3
0
        public async Task <DocumentDTO> GetDocument()
        {
            var documentSet = await documentsRepository.GetDocuments();

            var rootDocument = documentSet.Where(document => document.ParentID == null);

            // todo: przeksztalcenie  listy w drzewo
            throw new NotImplementedException();
        }
예제 #4
0
        public ActionResult Get()
        {
            var documents = db.GetDocuments();

            if (documents == null)
            {
                return(NotFound());
            }
            return(new OkObjectResult(documents));
        }
예제 #5
0
        private void OnPageLoad()
        {
            var documents = _documentRepository.GetDocuments();

            var documentsVM = new List <ViewModels.DocumentViewModel>();

            foreach (var document in documents)
            {
                documentsVM.Add(CreateViewModelDocument(document));
            }

            _view.DocumentsList = documentsVM;
        }
예제 #6
0
        public IQueryable <DocumentContractModel> GetDocuments()
        {
            IQueryable <DocumentContractModel> documents = null;

            documents = repo.GetDocuments().Select(x => new DocumentContractModel
            {
                DocumentId       = x.DocumentId,
                Name             = x.Name,
                Size             = x.Size,
                Type             = x.Type,
                UploadDate       = x.UploadDate,
                Username         = x.Username,
                LastDownloadDate = x.LastDownloadDate
            });

            return(documents.OrderByDescending(x => x.UploadDate));
        }
예제 #7
0
        /// <summary>
        /// Gets all documents in specified date range (inclusive) and returns number or repository calls made
        /// </summary>
        /// <param name="repo">document repository</param>
        /// <param name="startDateTime">start date</param>
        /// <param name="endDateTime">end date</param>
        /// <param name="apiCalls">number of api calls executed</param>
        /// <returns>List of documents</returns>
        public List <Document> GetDocumentsInRange(IDocumentsRepository repo, string startDateTime, string endDateTime, out long apiCalls)
        {
            var documentList = new List <Document>();

            apiCalls = 0;

            NormalizeInputDates(startDateTime, endDateTime, out DateTime startDate, out DateTime endDate);
            string[] callList = PrepareApiCalls(startDate, endDate);

            foreach (var call in callList)
            {
                documentList.AddRange(repo.GetDocuments(call));
                apiCalls++;
            }

            documentList.Sort();

            return(documentList);
        }