예제 #1
0
        public ActionResult GetElementActions(GetElementActions input)
        {
            ElementDescriptor element;

            if (!AcDomain.NodeHost.Ontologies.TryGetElement(input.ElementId, out element))
            {
                throw new ValidationException("意外的本体元素标识" + input.ElementId);
            }
            var list = new List <ElementAssignActionTr>();

            foreach (var action in element.Ontology.Actions.Values)
            {
                Guid   id;
                string isAllowed;
                string isAudit;
                if (element.Element.ElementActions.ContainsKey(action.ActionVerb))
                {
                    var elementAction = element.Element.ElementActions[action.ActionVerb];
                    id        = elementAction.Id;
                    isAllowed = elementAction.IsAllowed;
                    isAudit   = elementAction.IsAudit;
                }
                else
                {
                    id        = Guid.NewGuid();
                    isAllowed = AllowType.ImplicitAllow.ToName();
                    isAudit   = AuditType.ImplicitAudit.ToName();
                }
                var elementAssignAction = new ElementAssignActionTr
                {
                    ActionId      = action.Id,
                    ActionIsAllow = action.AllowType.ToName(),
                    ElementCode   = element.Element.Code,
                    ElementId     = element.Element.Id,
                    ElementName   = element.Element.Name,
                    Id            = id,
                    IsAllowed     = isAllowed,
                    IsAudit       = isAudit,
                    Name          = action.Name,
                    OntologyId    = action.OntologyId,
                    Verb          = action.Verb
                };
                list.Add(elementAssignAction);
            }
            var data = new MiniGrid <ElementAssignActionTr> {
                total = list.Count, data = list
            };

            return(this.JsonResult(data));
        }
예제 #2
0
        public ActionResult GetElementActions(GetElementActions input)
        {
            ElementDescriptor element;
            if (!AcDomain.NodeHost.Ontologies.TryGetElement(input.ElementId, out element))
            {
                throw new ValidationException("意外的本体元素标识" + input.ElementId);
            }
            var list = new List<ElementAssignActionTr>();
            foreach (var action in element.Ontology.Actions.Values)
            {
                Guid id;
                string isAllowed;
                string isAudit;
                if (element.Element.ElementActions.ContainsKey(action.ActionVerb))
                {
                    var elementAction = element.Element.ElementActions[action.ActionVerb];
                    id = elementAction.Id;
                    isAllowed = elementAction.IsAllowed;
                    isAudit = elementAction.IsAudit;
                }
                else
                {
                    id = Guid.NewGuid();
                    isAllowed = AllowType.ImplicitAllow.ToName();
                    isAudit = AuditType.ImplicitAudit.ToName();
                }
                var elementAssignAction = new ElementAssignActionTr
                {
                    ActionId = action.Id,
                    ActionIsAllow = action.AllowType.ToName(),
                    ElementCode = element.Element.Code,
                    ElementId = element.Element.Id,
                    ElementName = element.Element.Name,
                    Id = id,
                    IsAllowed = isAllowed,
                    IsAudit = isAudit,
                    Name = action.Name,
                    OntologyId = action.OntologyId,
                    Verb = action.Verb
                };
                list.Add(elementAssignAction);
            }
            var data = new MiniGrid<ElementAssignActionTr> { total = list.Count, data = list };

            return this.JsonResult(data);
        }