Example #1
0
        public async Task <IActionResult> ListDocuments(DataSourceRequest command, DocumentListModel model)
        {
            var documents = await _documentViewModelService.PrepareDocumentListModel(model, command.Page, command.PageSize);

            var gridModel = new DataSourceResult {
                Data  = documents.documetListModel,
                Total = documents.totalCount
            };

            return(Json(gridModel));
        }
Example #2
0
        public async Task <IActionResult> ListDocuments(DataSourceRequest command, DocumentListModel model)
        {
            if (!string.IsNullOrEmpty(model.CustomerId))
            {
                model.SearchEmail = (await _customerService.GetCustomerById(model.CustomerId))?.Email;
            }

            var documents = await _documentViewModelService.PrepareDocumentListModel(model, command.Page, command.PageSize);

            var gridModel = new DataSourceResult {
                Data  = documents.documetListModel,
                Total = documents.totalCount
            };

            return(Json(gridModel));
        }
        public async Task <IActionResult> DocumentList()
        {
            DocumentListModel model = new DocumentListModel();

            model.Docs =
                await db.Documents
                .Select(x => new DocumentModel
            {
                Name        = x.Name,
                Path        = x.Path,
                Extension   = x.Extension,
                CreatedDate = x.CreateDate
            }).ToListAsync();

            return(View(model));
        }
        //if useSqlText = false - filter is used
        public async Task Refresh()
        {
            Workspace.IsBusy = true;
            DocumentListModel docList = null;

            try
            {
                if (this.IsSqlEditMode)
                {
                    docList = await _model.GetDocuments(this.SqlText, null, this.MaxItems);
                }
                else
                {
                    docList = await _model.GetDocuments(this.Filter.JoinedFilter, this.MaxItems);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show($"Error on performing query:{Environment.NewLine}{e.Message}");
            }
            if (docList != null)
            {
                var docs = new ObservableCollection <DocumentModel>(docList.Documents);
                this.AvailableProperties.Clear();
                foreach (var doc in docs)
                {
                    foreach (var jp in doc.Json.Children())
                    {
                        addAvailableProperty(jp);
                    }
                }
                this.Documents = docs; //later - the Collection view is attached to PropertyChanged of this and needs the available properties
                this.SqlText   = docList.Sql;
                updateSelectedViewInConfig();
            }
            Workspace.IsBusy = false;
        }
Example #5
0
        public virtual async Task <(IEnumerable <DocumentModel> documetListModel, int totalCount)> PrepareDocumentListModel(DocumentListModel model, int pageIndex, int pageSize)
        {
            var documents = await _documentService.GetAll(customerId : "", name : model.SearchName, number : model.SearchNumber,
                                                          email : model.SearchEmail, reference : model.Reference, objectId : model.ObjectId, status : model.StatusId, pageIndex : pageIndex - 1, pageSize : pageSize);

            var documentListModel = new List <DocumentModel>();

            foreach (var x in documents)
            {
                var docModel = x.ToModel();
                documentListModel.Add(docModel);
            }
            return(documentListModel, documents.TotalCount);
        }
Example #6
0
        public virtual async Task <(IEnumerable <DocumentModel> documetListModel, int totalCount)> PrepareDocumentListModel(DocumentListModel model, int pageIndex, int pageSize)
        {
            var documents = await _documentService.GetAll("", model.SearchName, model.SearchNumber, model.SearchEmail, model.StatusId, pageIndex - 1, pageSize);

            var documentListModel = new List <DocumentModel>();

            foreach (var x in documents)
            {
                var docModel = x.ToModel();
                documentListModel.Add(docModel);
            }
            return(documentListModel, documents.TotalCount);
        }