Beispiel #1
0
        public ActionResult GetPlistPlugins(GetPlistResult requestModel)
        {
            if (!ModelState.IsValid)
            {
                return(ModelState.ToJsonResult());
            }
            var dataDics = GetRequiredService <IPluginQuery>().GetPlist(base.EntityType, () =>
            {
                RdbDescriptor rdb;
                if (!AcDomain.RdbSet.TryDb(base.EntityType.DatabaseId, out rdb))
                {
                    throw new GeneralException("意外配置的Plugin实体类型对象数据库标识" + base.EntityType.DatabaseId);
                }
                List <DbParameter> ps;
                var filterString = new SqlFilterStringBuilder().FilterString(rdb, requestModel.Filters, "a", out ps);
                if (!string.IsNullOrEmpty(filterString))
                {
                    filterString = " where " + filterString;
                }
                return(new SqlFilter(filterString, ps.ToArray()));
            }, requestModel);

            Debug.Assert(requestModel.Total != null, "requestModel.Total != null");
            var data = new MiniGrid <Dictionary <string, object> > {
                total = requestModel.Total.Value, data = dataDics
            };

            return(this.JsonResult(data));
        }
Beispiel #2
0
        public ActionResult GetPlistProcesses(GetPlistResult input)
        {
            if (!ModelState.IsValid)
            {
                return(ModelState.ToJsonResult());
            }
            EntityTypeState entityType;

            if (!AcDomain.EntityTypeSet.TryGetEntityType(new Coder("Edi", "Process"), out entityType))
            {
                throw new AnycmdException("意外的实体类型Edi.Process");
            }
            foreach (var filter in input.Filters)
            {
                PropertyState property;
                if (!AcDomain.EntityTypeSet.TryGetProperty(entityType, filter.field, out property))
                {
                    throw new ValidationException("意外的Process实体类型属性" + filter.field);
                }
            }
            int pageIndex = input.PageIndex;
            int pageSize  = input.PageSize;
            var queryable = AcDomain.NodeHost.Processs.Select(ProcessTr.Create).AsQueryable();

            foreach (var filter in input.Filters)
            {
                queryable = queryable.Where(filter.ToPredicate(), filter.value);
            }
            var list = queryable.OrderBy(input.SortField + " " + input.SortOrder).Skip(pageIndex * pageSize).Take(pageSize);

            return(this.JsonResult(new MiniGrid <ProcessTr> {
                total = queryable.Count(), data = list
            }));
        }
Beispiel #3
0
        public ActionResult GetPlistNodeOntologyCares(Guid ontologyId, GetPlistResult requestModel)
        {
            if (!ModelState.IsValid)
            {
                return(ModelState.ToJsonResult());
            }
            OntologyDescriptor ontology;

            if (!AcDomain.NodeHost.Ontologies.TryGetOntology(ontologyId, out ontology))
            {
                throw new ValidationException("意外的本体标识" + ontologyId);
            }
            var data = new List <OntologyAssignNodeTr>();

            foreach (var node in AcDomain.NodeHost.Nodes)
            {
                var      nodeOntologyCares = AcDomain.NodeHost.Nodes.GetNodeOntologyCares(node);
                var      id               = Guid.NewGuid();
                var      isAssigned       = false;
                DateTime?createOn         = null;
                var      nodeOntologyCare = nodeOntologyCares.FirstOrDefault(a => a.NodeId == node.Node.Id && a.OntologyId == ontology.Ontology.Id);
                if (nodeOntologyCare != null)
                {
                    id         = nodeOntologyCare.Id;
                    isAssigned = true;
                    createOn   = nodeOntologyCare.CreateOn;
                }
                data.Add(new OntologyAssignNodeTr
                {
                    Code       = node.Node.Code,
                    CreateOn   = createOn,
                    Icon       = node.Node.Icon,
                    Id         = id,
                    IsAssigned = isAssigned,
                    IsEnabled  = node.Node.IsEnabled,
                    Name       = node.Node.Name,
                    NodeId     = node.Node.Id,
                    OntologyId = ontology.Ontology.Id,
                    SortCode   = node.Node.SortCode
                });
            }
            int pageIndex = requestModel.PageIndex;
            int pageSize  = requestModel.PageSize;
            var queryable = data.AsQueryable();

            foreach (var filter in requestModel.Filters)
            {
                queryable = queryable.Where(filter.ToPredicate(), filter.value);
            }
            var list = queryable.OrderBy(requestModel.SortField + " " + requestModel.SortOrder).Skip(pageIndex * pageSize).Take(pageSize);

            return(this.JsonResult(new MiniGrid <OntologyAssignNodeTr> {
                total = queryable.Count(), data = list
            }));
        }
        public ActionResult GetPlistGroups(GetPlistResult requestModel)
        {
            if (!ModelState.IsValid)
            {
                return(ModelState.ToJsonResult());
            }
            var data = AcDomain.GetPlistGroups(requestModel);

            Debug.Assert(requestModel.Total != null, "requestModel.total != null");
            return(this.JsonResult(new MiniGrid {
                total = requestModel.Total.Value, data = data.Select(a => a.ToTableRowData())
            }));
        }
        public ActionResult GetPlistAppSystems(GetPlistResult input)
        {
            if (!ModelState.IsValid)
            {
                return(ModelState.ToJsonResult());
            }
            var data = AcDomain.GetPlistAppSystems(input);

            Debug.Assert(input.Total != null, "requestModel.total != null");
            return(this.JsonResult(new MiniGrid <AppSystemTr> {
                total = input.Total.Value, data = data
            }));
        }
        public ActionResult GetPlistUiViews(GetPlistResult requestData)
        {
            if (!ModelState.IsValid)
            {
                return(ModelState.ToJsonResult());
            }
            var data = AcDomain.GetPlistUiViews(requestData);

            Debug.Assert(requestData.Total != null, "requestData.total != null");
            return(this.JsonResult(new MiniGrid <UiViewTr> {
                total = requestData.Total.Value, data = data
            }));
        }
Beispiel #7
0
        public ActionResult GetPlistInfoDicItems(Guid?dicId, GetPlistResult input)
        {
            if (!ModelState.IsValid)
            {
                return(ModelState.ToJsonResult());
            }
            if (!dicId.HasValue)
            {
                throw new ValidationException("infoDicID参数是必须的");
            }
            InfoDicState infoDic;

            if (!AcDomain.NodeHost.InfoDics.TryGetInfoDic(dicId.Value, out infoDic))
            {
                throw new ValidationException("意外的信息字典标识" + dicId);
            }
            EntityTypeState entityType;

            if (!AcDomain.EntityTypeSet.TryGetEntityType(new Coder("Edi", "InfoDicItem"), out entityType))
            {
                throw new AnycmdException("意外的实体类型Edi.InfoDicItem");
            }
            foreach (var filter in input.Filters)
            {
                PropertyState property;
                if (!AcDomain.EntityTypeSet.TryGetProperty(entityType, filter.field, out property))
                {
                    throw new ValidationException("意外的InfoDicItem实体类型属性" + filter.field);
                }
            }
            int pageIndex = input.PageIndex;
            int pageSize  = input.PageSize;
            var queryable = AcDomain.NodeHost.InfoDics.GetInfoDicItems(infoDic).Select(InfoDicItemTr.Create).AsQueryable();

            foreach (var filter in input.Filters)
            {
                queryable = queryable.Where(filter.ToPredicate(), filter.value);
            }
            var list = queryable.OrderBy(input.SortField + " " + input.SortOrder).Skip(pageIndex * pageSize).Take(pageSize);

            return(this.JsonResult(new MiniGrid <InfoDicItemTr> {
                total = queryable.Count(), data = list
            }));
        }
        public ActionResult GetPlistActions(Guid?ontologyId, GetPlistResult input)
        {
            if (!ontologyId.HasValue)
            {
                throw new ValidationException("必须传入本体标识");
            }
            OntologyDescriptor ontology;

            if (!AcDomain.NodeHost.Ontologies.TryGetOntology(ontologyId.Value, out ontology))
            {
                throw new ValidationException("意外的本体标识" + ontologyId);
            }
            EntityTypeState entityType;

            if (!AcDomain.EntityTypeSet.TryGetEntityType(new Coder("Edi", "Action"), out entityType))
            {
                throw new GeneralException("意外的实体类型Edi.Action");
            }
            foreach (var filter in input.Filters)
            {
                PropertyState property;
                if (!AcDomain.EntityTypeSet.TryGetProperty(entityType, filter.field, out property))
                {
                    throw new ValidationException("意外的Action实体类型属性" + filter.field);
                }
            }
            int pageIndex = input.PageIndex;
            int pageSize  = input.PageSize;
            var queryable = ontology.Actions.Values.Select(ActionTr.Create).AsQueryable();

            foreach (var filter in input.Filters)
            {
                queryable = queryable.Where(filter.ToPredicate(), filter.value);
            }
            var list = queryable.OrderBy(input.SortField + " " + input.SortOrder).Skip(pageIndex * pageSize).Take(pageSize);

            return(this.JsonResult(new MiniGrid <ActionTr> {
                total = queryable.Count(), data = list
            }));
        }
        public static IQueryable<ButtonTr> GetPlistButtons(this IAcDomain acDomain, GetPlistResult requestData)
        {
            EntityTypeState buttonEntityType = acDomain.GetEntityType(new Coder("Ac", "Button"));
            foreach (var filter in requestData.Filters)
            {
                PropertyState property;
                if (!buttonEntityType.TryGetProperty(filter.field, out property))
                {
                    throw new ValidationException("意外的Button实体类型属性" + filter.field);
                }
            }
            int pageIndex = requestData.PageIndex;
            int pageSize = requestData.PageSize;
            var queryable = acDomain.ButtonSet.Select(ButtonTr.Create).AsQueryable();
            foreach (var filter in requestData.Filters)
            {
                queryable = queryable.Where(filter.ToPredicate(), filter.value);
            }
            requestData.Total = queryable.Count();

            return queryable.OrderBy(requestData.SortField + " " + requestData.SortOrder).Skip(pageIndex * pageSize).Take(pageSize);
        }
Beispiel #10
0
        public static IQueryable <UiViewTr> GetPlistUiViews(this IAcDomain acDomain, GetPlistResult requestData)
        {
            EntityTypeState viewEntityType = acDomain.GetEntityType(new Coder("Ac", "UIView"));

            foreach (var filter in requestData.Filters)
            {
                PropertyState property;
                if (!viewEntityType.TryGetProperty(filter.field, out property))
                {
                    throw new ValidationException("意外的UIView实体类型属性" + filter.field);
                }
            }
            int pageIndex = requestData.PageIndex;
            int pageSize  = requestData.PageSize;
            var queryable = acDomain.UiViewSet.Select(UiViewTr.Create).AsQueryable();

            foreach (var filter in requestData.Filters)
            {
                queryable = queryable.Where(filter.ToPredicate(), filter.value);
            }
            requestData.Total = queryable.Count();

            return(queryable.OrderBy(requestData.SortField + " " + requestData.SortOrder).Skip(pageIndex * pageSize).Take(pageSize));
        }
Beispiel #11
0
        public static IQueryable <IDsdSet> GetPlistDsdSets(this IAcDomain acDomain, GetPlistResult requestModel)
        {
            EntityTypeState roleEntityType = acDomain.GetEntityType(new Coder("Ac", "DsdSet"));

            foreach (var filter in requestModel.Filters)
            {
                PropertyState property;
                if (!roleEntityType.TryGetProperty(filter.field, out property))
                {
                    throw new ValidationException("意外的DsdSet实体类型属性" + filter.field);
                }
            }
            int pageIndex = requestModel.PageIndex;
            int pageSize  = requestModel.PageSize;
            var queryable = acDomain.DsdSetSet.AsQueryable();

            foreach (var filter in requestModel.Filters)
            {
                queryable = queryable.Where(filter.ToPredicate(), filter.value);
            }
            requestModel.Total = queryable.Count();

            return(queryable.OrderBy(requestModel.SortField + " " + requestModel.SortOrder).Skip(pageIndex * pageSize).Take(pageSize));
        }
        public ActionResult GetPlistInfoDicItems(Guid? dicId, GetPlistResult input)
        {
            if (!ModelState.IsValid)
            {
                return ModelState.ToJsonResult();
            }
            if (!dicId.HasValue)
            {
                throw new ValidationException("infoDicID参数是必须的");
            }
            InfoDicState infoDic;
            if (!AcDomain.NodeHost.InfoDics.TryGetInfoDic(dicId.Value, out infoDic))
            {
                throw new ValidationException("意外的信息字典标识" + dicId);
            }
            EntityTypeState entityType;
            if (!AcDomain.EntityTypeSet.TryGetEntityType(new Coder("Edi", "InfoDicItem"), out entityType))
            {
                throw new AnycmdException("意外的实体类型Edi.InfoDicItem");
            }
            foreach (var filter in input.Filters)
            {
                PropertyState property;
                if (!AcDomain.EntityTypeSet.TryGetProperty(entityType, filter.field, out property))
                {
                    throw new ValidationException("意外的InfoDicItem实体类型属性" + filter.field);
                }
            }
            int pageIndex = input.PageIndex;
            int pageSize = input.PageSize;
            var queryable = AcDomain.NodeHost.InfoDics.GetInfoDicItems(infoDic).Select(InfoDicItemTr.Create).AsQueryable();
            foreach (var filter in input.Filters)
            {
                queryable = queryable.Where(filter.ToPredicate(), filter.value);
            }
            var list = queryable.OrderBy(input.SortField + " " + input.SortOrder).Skip(pageIndex * pageSize).Take(pageSize);

            return this.JsonResult(new MiniGrid<InfoDicItemTr> { total = queryable.Count(), data = list });
        }
Beispiel #13
0
        public ActionResult GetPlistNodeOntologyCares(Guid ontologyId, GetPlistResult requestModel)
        {
            if (!ModelState.IsValid)
            {
                return ModelState.ToJsonResult();
            }
            OntologyDescriptor ontology;
            if (!AcDomain.NodeHost.Ontologies.TryGetOntology(ontologyId, out ontology))
            {
                throw new ValidationException("意外的本体标识" + ontologyId);
            }
            var data = new List<OntologyAssignNodeTr>();
            foreach (var node in AcDomain.NodeHost.Nodes)
            {
                var nodeOntologyCares = AcDomain.NodeHost.Nodes.GetNodeOntologyCares(node);
                var id = Guid.NewGuid();
                var isAssigned = false;
                DateTime? createOn = null;
                var nodeOntologyCare = nodeOntologyCares.FirstOrDefault(a => a.NodeId == node.Node.Id && a.OntologyId == ontology.Ontology.Id);
                if (nodeOntologyCare != null)
                {
                    id = nodeOntologyCare.Id;
                    isAssigned = true;
                    createOn = nodeOntologyCare.CreateOn;
                }
                data.Add(new OntologyAssignNodeTr
                {
                    Code = node.Node.Code,
                    CreateOn = createOn,
                    Icon = node.Node.Icon,
                    Id = id,
                    IsAssigned = isAssigned,
                    IsEnabled = node.Node.IsEnabled,
                    Name = node.Node.Name,
                    NodeId = node.Node.Id,
                    OntologyId = ontology.Ontology.Id,
                    SortCode = node.Node.SortCode
                });
            }
            int pageIndex = requestModel.PageIndex;
            int pageSize = requestModel.PageSize;
            var queryable = data.AsQueryable();
            foreach (var filter in requestModel.Filters)
            {
                queryable = queryable.Where(filter.ToPredicate(), filter.value);
            }
            var list = queryable.OrderBy(requestModel.SortField + " " + requestModel.SortOrder).Skip(pageIndex * pageSize).Take(pageSize);

            return this.JsonResult(new MiniGrid<OntologyAssignNodeTr> { total = queryable.Count(), data = list });
        }
Beispiel #14
0
        public ActionResult GetPlistSsdSets(GetPlistResult requestModel)
        {
            if (!ModelState.IsValid)
            {
                return ModelState.ToJsonResult();
            }
            var data = AcDomain.GetPlistSsdSets(requestModel);

            Debug.Assert(requestModel.Total != null, "requestModel.total != null");
            return this.JsonResult(new MiniGrid { total = requestModel.Total.Value, data = data.Select(a => a.ToTableRowData()) });
        }
        public ActionResult GetPlistAppSystems(GetPlistResult input)
        {
            if (!ModelState.IsValid)
            {
                return ModelState.ToJsonResult();
            }
            var data = AcDomain.GetPlistAppSystems(input);

            Debug.Assert(input.Total != null, "requestModel.total != null");
            return this.JsonResult(new MiniGrid<AppSystemTr> { total = input.Total.Value, data = data });
        }
Beispiel #16
0
        public ActionResult GetPlistNodes(GetPlistResult requestModel)
        {
            if (!ModelState.IsValid)
            {
                return ModelState.ToJsonResult();
            }
            EntityTypeState entityType;
            if (!AcDomain.EntityTypeSet.TryGetEntityType(new Coder("Edi", "Node"), out entityType))
            {
                throw new AnycmdException("意外的实体类型Edi.Node");
            }
            foreach (var filter in requestModel.Filters)
            {
                PropertyState property;
                if (!AcDomain.EntityTypeSet.TryGetProperty(entityType, filter.field, out property))
                {
                    throw new ValidationException("意外的Node实体类型属性" + filter.field);
                }
            }
            int pageIndex = requestModel.PageIndex;
            int pageSize = requestModel.PageSize;
            var queryable = AcDomain.NodeHost.Nodes.Select(NodeTr.Create).AsQueryable();
            foreach (var filter in requestModel.Filters)
            {
                queryable = queryable.Where(filter.ToPredicate(), filter.value);
            }
            var list = queryable.OrderBy(requestModel.SortField + " " + requestModel.SortOrder).Skip(pageIndex * pageSize).Take(pageSize);

            return this.JsonResult(new MiniGrid<NodeTr> { total = queryable.Count(), data = list });
        }
Beispiel #17
0
        public ActionResult GetPlistNodeElementActions(Guid?nodeId, Guid?elementId, GetPlistResult requestModel)
        {
            if (!nodeId.HasValue)
            {
                throw new ValidationException("nodeID是必须的");
            }
            if (!elementId.HasValue)
            {
                throw new ValidationException("elementID是必须的");
            }
            NodeDescriptor node;

            if (!AcDomain.NodeHost.Nodes.TryGetNodeById(nodeId.Value.ToString(), out node))
            {
                throw new ValidationException("意外的节点标识" + nodeId);
            }
            ElementDescriptor element;

            if (!AcDomain.NodeHost.Ontologies.TryGetElement(elementId.Value, out element))
            {
                throw new ValidationException("意外的本体元素标识" + elementId);
            }
            var elementActions = element.Element.ElementActions;
            var data           = new List <NodeElementAssignActionTr>();

            foreach (var action in element.Ontology.Actions.Values)
            {
                var    elementAction          = elementActions.ContainsKey(action.ActionVerb) ? elementActions[action.ActionVerb] : null;
                string elementActionAllowType = AllowType.ImplicitAllow.ToName();
                string elementActionAuditType = AuditType.ImplicitAudit.ToName();
                if (elementAction != null)
                {
                    elementActionAllowType = elementAction.AllowType.ToName();
                    elementActionAuditType = elementAction.AuditType.ToName();
                }
                var  nodeElementActions = AcDomain.NodeHost.Nodes.GetNodeElementActions(node, element).Values;
                var  id                = Guid.NewGuid();
                bool isAllowed         = false;
                bool isAudit           = false;
                var  nodeElementAction = nodeElementActions.FirstOrDefault(a => a.NodeId == node.Node.Id && a.ElementId == element.Element.Id && a.ActionId == action.Id);
                if (nodeElementAction != null)
                {
                    id        = nodeElementAction.Id;
                    isAllowed = nodeElementAction.IsAllowed;
                    isAudit   = nodeElementAction.IsAudit;
                }
                data.Add(new NodeElementAssignActionTr
                {
                    Id                   = id,
                    Name                 = action.Name,
                    NodeId               = node.Node.Id,
                    OntologyId           = action.OntologyId,
                    SortCode             = action.SortCode,
                    ActionId             = action.Id,
                    ActionIsAllow        = action.AllowType.ToName(),
                    ElementActionIsAllow = elementActionAllowType,
                    ElementActionIsAudit = elementActionAuditType,
                    ElementCode          = element.Element.Code,
                    ElementId            = element.Element.Id,
                    ElementName          = element.Element.Name,
                    IsAllowed            = isAllowed,
                    IsAudit              = isAudit,
                    Verb                 = action.Verb
                });
            }
            int pageIndex = requestModel.PageIndex;
            int pageSize  = requestModel.PageSize;
            var queryable = data.AsQueryable();

            foreach (var filter in requestModel.Filters)
            {
                queryable = queryable.Where(filter.ToPredicate(), filter.value);
            }
            var list = queryable.OrderBy(requestModel.SortField + " " + requestModel.SortOrder).Skip(pageIndex * pageSize).Take(pageSize);

            return(this.JsonResult(new MiniGrid <NodeElementAssignActionTr> {
                total = queryable.Count(), data = list
            }));
        }
Beispiel #18
0
        public static IQueryable<IRDatabase> GetPlistDatabases(this IAcDomain acDomain, GetPlistResult requestModel)
        {
            EntityTypeState entityType = acDomain.GetEntityType(new Coder("Ac", "RDatabase"));
            foreach (var filter in requestModel.Filters)
            {
                PropertyState property;
                if (!entityType.TryGetProperty(filter.field, out property))
                {
                    throw new ValidationException("意外的RDatabase实体类型属性" + filter.field);
                }
            }
            int pageIndex = requestModel.PageIndex;
            int pageSize = requestModel.PageSize;
            var queryable = acDomain.Rdbs.Select(a => a.Database).AsQueryable();
            foreach (var filter in requestModel.Filters)
            {
                queryable = queryable.Where(filter.ToPredicate(), filter.value);
            }
            requestModel.Total = queryable.Count();

            return queryable.OrderBy(requestModel.SortField + " " + requestModel.SortOrder).Skip(pageIndex * pageSize).Take(pageSize);
        }
Beispiel #19
0
        public ActionResult GetPlistUiViews(GetPlistResult requestData)
        {
            if (!ModelState.IsValid)
            {
                return ModelState.ToJsonResult();
            }
            var data = AcDomain.GetPlistUiViews(requestData);

            Debug.Assert(requestData.Total != null, "requestData.total != null");
            return this.JsonResult(new MiniGrid<UiViewTr> { total = requestData.Total.Value, data = data });
        }
Beispiel #20
0
        public ActionResult GetPlistNodeElementActions(Guid? nodeId, Guid? elementId, GetPlistResult requestModel)
        {
            if (!nodeId.HasValue)
            {
                throw new ValidationException("nodeID是必须的");
            }
            if (!elementId.HasValue)
            {
                throw new ValidationException("elementID是必须的");
            }
            NodeDescriptor node;
            if (!AcDomain.NodeHost.Nodes.TryGetNodeById(nodeId.Value.ToString(), out node))
            {
                throw new ValidationException("意外的节点标识" + nodeId);
            }
            ElementDescriptor element;
            if (!AcDomain.NodeHost.Ontologies.TryGetElement(elementId.Value, out element))
            {
                throw new ValidationException("意外的本体元素标识" + elementId);
            }
            var elementActions = element.Element.ElementActions;
            var data = new List<NodeElementAssignActionTr>();
            foreach (var action in element.Ontology.Actions.Values)
            {
                var elementAction = elementActions.ContainsKey(action.ActionVerb) ? elementActions[action.ActionVerb] : null;
                string elementActionAllowType = AllowType.ImplicitAllow.ToName();
                string elementActionAuditType = AuditType.ImplicitAudit.ToName();
                if (elementAction != null)
                {
                    elementActionAllowType = elementAction.AllowType.ToName();
                    elementActionAuditType = elementAction.AuditType.ToName();
                }
                var nodeElementActions = AcDomain.NodeHost.Nodes.GetNodeElementActions(node, element).Values;
                var id = Guid.NewGuid();
                bool isAllowed = false;
                bool isAudit = false;
                var nodeElementAction = nodeElementActions.FirstOrDefault(a => a.NodeId == node.Node.Id && a.ElementId == element.Element.Id && a.ActionId == action.Id);
                if (nodeElementAction != null)
                {
                    id = nodeElementAction.Id;
                    isAllowed = nodeElementAction.IsAllowed;
                    isAudit = nodeElementAction.IsAudit;
                }
                data.Add(new NodeElementAssignActionTr
                {
                    Id = id,
                    Name = action.Name,
                    NodeId = node.Node.Id,
                    OntologyId = action.OntologyId,
                    SortCode = action.SortCode,
                    ActionId = action.Id,
                    ActionIsAllow = action.AllowType.ToName(),
                    ElementActionIsAllow = elementActionAllowType,
                    ElementActionIsAudit = elementActionAuditType,
                    ElementCode = element.Element.Code,
                    ElementId = element.Element.Id,
                    ElementName = element.Element.Name,
                    IsAllowed = isAllowed,
                    IsAudit = isAudit,
                    Verb = action.Verb
                });
            }
            int pageIndex = requestModel.PageIndex;
            int pageSize = requestModel.PageSize;
            var queryable = data.AsQueryable();
            foreach (var filter in requestModel.Filters)
            {
                queryable = queryable.Where(filter.ToPredicate(), filter.value);
            }
            var list = queryable.OrderBy(requestModel.SortField + " " + requestModel.SortOrder).Skip(pageIndex * pageSize).Take(pageSize);

            return this.JsonResult(new MiniGrid<NodeElementAssignActionTr> { total = queryable.Count(), data = list });
        }
Beispiel #21
0
        public ActionResult GetPlistPlugins(GetPlistResult requestModel)
        {
            if (!ModelState.IsValid)
            {
                return ModelState.ToJsonResult();
            }
            var dataDics = GetRequiredService<IPluginQuery>().GetPlist(base.EntityType, () =>
            {
                RdbDescriptor rdb;
                if (!AcDomain.Rdbs.TryDb(base.EntityType.DatabaseId, out rdb))
                {
                    throw new AnycmdException("意外配置的Plugin实体类型对象数据库标识" + base.EntityType.DatabaseId);
                }
                List<DbParameter> ps;
                var filterString = new SqlFilterStringBuilder().FilterString(rdb, requestModel.Filters, "a", out ps);
                if (!string.IsNullOrEmpty(filterString))
                {
                    filterString = " where " + filterString;
                }
                return new SqlFilter(filterString, ps.ToArray());
            }, requestModel);
            Debug.Assert(requestModel.Total != null, "requestModel.Total != null");
            var data = new MiniGrid<Dictionary<string, object>> { total = requestModel.Total.Value, data = dataDics };

            return this.JsonResult(data);
        }