Ejemplo n.º 1
0
        public string GetXml(Guid solutionId)
        {
            StringBuilder result     = new StringBuilder();
            var           pageSize   = 100;
            var           page       = 1;
            long          totalItems = pageSize;

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

            if (data.Items.NotEmpty())
            {
                var result = data.Items.Select(x => (new SolutionComponentItem {
                    ObjectId = x.EntityPluginId, Name = x.AssemblyName, LocalizedName = x.ClassName, ComponentTypeName = PluginDefaults.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));
        }
Ejemplo n.º 3
0
        public IActionResult Index(EntityPluginModel model)
        {
            if (!model.LoadData)
            {
                return(DynamicResult(model));
            }
            FilterContainer <EntityPlugin> filter = FilterContainerBuilder.Build <EntityPlugin>();

            filter.And(n => n.IsVisibled == true);
            if (!model.EntityId.Equals(Guid.Empty))
            {
                filter.And(n => n.EntityId == model.EntityId);
            }

            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;

            var result = _entityPluginFinder.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));
        }