Esempio n. 1
0
        public IActionResult Index(WorkFlowModel model)
        {
            if (!model.LoadData)
            {
                return(DynamicResult(model));
            }
            FilterContainer <WorkFlow> filter = FilterContainerBuilder.Build <WorkFlow>();

            if (model.Name.IsNotEmpty())
            {
                filter.And(n => n.Name.Like(model.Name));
            }

            if (model.GetAll)
            {
                model.Page     = 1;
                model.PageSize = WebContext.PlatformSettings.MaxFetchRecords;
            }
            else if (!model.PageSizeBySeted && CurrentUser.UserSettings.PagingLimit > 0)
            {
                model.PageSize = CurrentUser.UserSettings.PagingLimit;
            }
            model.PageSize = model.PageSize > WebContext.PlatformSettings.MaxFetchRecords ? WebContext.PlatformSettings.MaxFetchRecords : model.PageSize;
            PagedList <WorkFlow> result = _workFlowFinder.QueryPaged(x => x
                                                                     .Page(model.Page, model.PageSize)
                                                                     .Where(filter)
                                                                     .Sort(n => n.OnFile(model.SortBy).ByDirection(model.SortDirection))
                                                                     , SolutionId.Value, true);

            model.Items      = result.Items;
            model.TotalItems = result.TotalItems;
            model.SolutionId = SolutionId.Value;
            return(DynamicResult(model));
        }
Esempio n. 2
0
        public string GetXml(Guid solutionId)
        {
            StringBuilder result     = new StringBuilder();
            var           pageSize   = 100;
            var           page       = 1;
            long          totalItems = pageSize;

            while (totalItems == pageSize)
            {
                var data = _workFlowFinder.QueryPaged(x => x.Page(page, pageSize), solutionId, true);
                totalItems = data.TotalItems;
                if (totalItems > 0)
                {
                    result.Append(data.Items.SerializeToXml());
                }
                page++;
            }
            return(result.ToString());
        }
Esempio n. 3
0
        public IActionResult SolutionComponents([FromQuery] GetSolutionComponentsModel model)
        {
            var data = _workFlowFinder.QueryPaged(x => x.Page(model.Page, model.PageSize), model.SolutionId, model.InSolution);

            if (data.Items.NotEmpty())
            {
                var result = data.Items.Select(x => (new SolutionComponentItem {
                    ObjectId = x.WorkFlowId, Name = x.Name, LocalizedName = x.Name, ComponentTypeName = WorkFlowDefaults.ModuleName, CreatedOn = x.CreatedOn
                })).ToList();
                return(JOk(new PagedList <SolutionComponentItem>()
                {
                    CurrentPage = model.Page
                    ,
                    ItemsPerPage = model.PageSize
                    ,
                    Items = result
                    ,
                    TotalItems = data.TotalItems
                    ,
                    TotalPages = data.TotalPages
                }));
            }
            return(JOk(data));
        }