Ejemplo n.º 1
0
        /// <exclude />
        public static string GetInlineElementActionScriptCode(EntityToken entityToken, ActionToken actionToken, Dictionary <string, string> piggyBag)
        {
            StringBuilder sb = new StringBuilder();

            StringConversionServices.SerializeKeyValuePair(sb, "EntityToken", EntityTokenSerializer.Serialize(entityToken, false));
            StringConversionServices.SerializeKeyValuePair(sb, "ActionToken", ActionTokenSerializer.Serialize(actionToken, true));
            StringConversionServices.SerializeKeyValuePair(sb, "PiggyBag", PiggybagSerializer.Serialize(piggyBag));

            string scriptAction = string.Format(@"SystemAction.invokeInlineAction(""{0}"");", Convert.ToBase64String(Encoding.UTF8.GetBytes(sb.ToString())));

            return(scriptAction);
        }
        /// <exclude />
        protected override void OnAddAction(Action <ElementAction> actionAdder, EntityToken entityToken, TreeNodeDynamicContext dynamicContext, DynamicValuesHelperReplaceContext dynamicValuesHelperReplaceContext)
        {
            var payload = new StringBuilder();

            this.Serialize(payload);

            if (this.ParentIdEntries.Count > 0)
            {
                List <EntityToken> entityTokens = dynamicContext.Piggybag.GetParentEntityTokens().ToList();
                entityTokens.Reverse();

                entityTokens.Add(dynamicContext.CurrentEntityToken);
                entityTokens.Add(entityToken);

                entityTokens.Reverse();

                foreach (ParentIdEntry parentIdEntry in this.ParentIdEntries)
                {
                    DataEntityToken dataEntityToken = entityTokens.FindDataEntityToken(parentIdEntry.TargetInterface);
                    if (dataEntityToken == null)
                    {
                        continue;
                    }

                    IData data = dataEntityToken.Data;

                    object keyValue = parentIdEntry.TargetPropertyInfo.GetValue(data, null);

                    StringConversionServices.SerializeKeyValuePair(payload, parentIdEntry.SourcePropertyName, keyValue);
                }
            }

            StringConversionServices.SerializeKeyValuePair(payload, "_InterfaceType_", InterfaceType);
            StringConversionServices.SerializeKeyValuePair(payload, "_IconResourceName_", Icon.ResourceName);

            if (!String.IsNullOrEmpty(CustomFormMarkupPath))
            {
                StringConversionServices.SerializeKeyValuePair(payload, "_CustomFormMarkupPath_", CustomFormMarkupPath);
            }

            actionAdder(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.C1Console.Trees.Workflows.GenericAddDataWorkflow"), this.PermissionTypes)
            {
                Payload = payload.ToString(),
                DoIgnoreEntityTokenLocking = true,
                ExtraPayload = PiggybagSerializer.Serialize(dynamicContext.Piggybag.PreparePiggybag(dynamicContext.CurrentTreeNode, dynamicContext.CurrentEntityToken))
            }))
            {
                VisualData = CreateActionVisualizedData(dynamicValuesHelperReplaceContext)
            });
        }
Ejemplo n.º 3
0
        }                                                   // Requried


        protected override void OnAddAction(Action <ElementAction> actionAdder, EntityToken entityToken, TreeNodeDynamicContext dynamicContext, DynamicValuesHelperReplaceContext dynamicValuesHelperReplaceContext)
        {
            WorkflowActionToken actionToken = new WorkflowActionToken(
                WorkflowFacade.GetWorkflowType(TypeManager.SerializeType(this.WorkflowType)),
                this.PermissionTypes)
            {
                Payload      = this.Serialize(),
                ExtraPayload = PiggybagSerializer.Serialize(dynamicContext.Piggybag.PreparePiggybag(dynamicContext.CurrentTreeNode, dynamicContext.CurrentEntityToken)),
                DoIgnoreEntityTokenLocking = true
            };


            actionAdder(new ElementAction(new ActionHandle(actionToken))
            {
                VisualData = CreateActionVisualizedData(dynamicValuesHelperReplaceContext)
            });
        }
        /// <exclude />
        protected override void OnAddAction(Action <ElementAction> actionAdder, EntityToken entityToken, TreeNodeDynamicContext dynamicContext, DynamicValuesHelperReplaceContext dynamicValuesHelperReplaceContext)
        {
            StringBuilder payload = new StringBuilder();

            StringConversionServices.SerializeKeyValuePair(payload, "TreeId", this.OwnerNode.Tree.TreeId);
            StringConversionServices.SerializeKeyValuePair(payload, "ActionId", this.Id);

            WorkflowActionToken actionToken = new WorkflowActionToken(
                WorkflowFacade.GetWorkflowType("Composite.C1Console.Trees.Workflows.ReportFunctionActionWorkflow"),
                this.PermissionTypes)
            {
                Payload      = this.Serialize(),
                ExtraPayload = PiggybagSerializer.Serialize(dynamicContext.Piggybag.PreparePiggybag(dynamicContext.CurrentTreeNode, dynamicContext.CurrentEntityToken)),
                DoIgnoreEntityTokenLocking = true
            };


            actionAdder(new ElementAction(new ActionHandle(actionToken))
            {
                VisualData = CreateActionVisualizedData(dynamicValuesHelperReplaceContext)
            });
        }