Пример #1
0
        private static List <DynamicObj> PrepareButtonNLinks(StackAppContext appContext, IDBEntity entity)
        {
            var actions = EntityActionService.GetActions(appContext, entity.EntityId, EntityLayoutType.View);

            var coll = new List <DynamicObj>();

            foreach (var f in actions)
            {
                var d = new DynamicObj();
                d.Add("Id", f.Id);
                d.Add("Text", f.Text);
                coll.Add(d);
            }

            return(coll);
        }
Пример #2
0
        protected override void CompileActions(TView view)
        {
            if (this.FormContext.Context.UserInfo.HasAccess(FormContext.Entity.EntityId, AccessType.Update))
            {
                var actionContext = new ActionContext(FormContext, ActionType.Edit, "BTN_EDIT");
                actionContext.Query = FormContext.RequestQuery.Clone();
                FormContext.Actions.Add(PageActionCreator.Create(actionContext));
            }

            if (view.Commands != null)
            {
                foreach (var command in view.Commands)
                {
                    var c = EntityActionService.GetViewAction(this.FormContext.Context, this.FormContext.Entity.EntityId, FormContext.EntityLayoutType, command.Id);
                    if (c != null)
                    {
                        this.FormContext.Actions.Add(PageActionCreator.BuildActionFromDefinition(c, this.FormContext));
                    }
                }
            }
        }