Ejemplo n.º 1
0
        public IActionResult SolutionComponents([FromQuery] GetSolutionComponentsModel model)
        {
            var data = _entityMapFinder.QueryPaged(x => x.Page(model.Page, model.PageSize), model.SolutionId, model.InSolution);

            if (data.Items.NotEmpty())
            {
                var entities = _entityFinder.FindAll();
                var result   = data.Items.Select(x => (new SolutionComponentItem {
                    ObjectId = x.EntityMapId, Name = x.SourceEnttiyName + "-" + x.TargetEnttiyName, LocalizedName = (entities.Find(e => e.EntityId == x.SourceEntityId).LocalizedName + "-" + entities.Find(e => e.EntityId == x.TargetEntityId).LocalizedName), ComponentTypeName = DataMappingDefaults.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.º 2
0
        public IActionResult Index(EntityMapModel model)
        {
            if (!model.LoadData)
            {
                return(DynamicResult(model));
            }
            FilterContainer <EntityMap> filter = FilterContainerBuilder.Build <EntityMap>();

            filter.And(x => x.ParentEntityMapId == Guid.Empty);
            if (!model.EntityId.Equals(Guid.Empty))
            {
                filter.And(n => n.TargetEntityId == 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;
            PagedList <EntityMap> result = _entityMapFinder.QueryPaged(x => x
                                                                       .Page(model.Page, model.PageSize)
                                                                       .Where(filter)
                                                                       .Sort(n => n.OnFile(model.SortBy).ByDirection(model.SortDirection))
                                                                       );

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

            while (totalItems == pageSize)
            {
                var data = _entityMapFinder.QueryPaged(x => x.Page(page, pageSize), solutionId, true);
                totalItems = data.TotalItems;
                if (totalItems > 0)
                {
                    result.Append(data.Items.SerializeToXml());
                }
                page++;
            }
            return(result.ToString());
        }