Esempio n. 1
0
        public void Merge(Step step)
        {
            if (!step.FilteringAttributes.Any())
            {
                DoNotFilterAttributes = true;
            }

            FilteringAttributes.AddRange(step.FilteringAttributes);

            if (step.PreImageAllAttributes)
            {
                PreImageAllAttributes = true;
                PreImageAttributes.Clear();
            }
            else
            {
                PreImageAttributes.AddRange(step.PreImageAttributes);
            }

            if (step.PostImageAllAttributes)
            {
                PostImageAllAttributes = true;
                PostImageAttributes.Clear();
            }
            else
            {
                PostImageAttributes.AddRange(step.PostImageAttributes);
            }

            MethodNames.AddRange(step.MethodNames);
        }
 public Step(string messageName, PipelineStage stage, object primaryEntity, FilteringAttributes filteringAttributes, string runningUser = "******")
 {
 }
 public Image(ImageType type, FilteringAttributes fields, string name1, string name2)
 {
 }
 public Image(ImageType type, FilteringAttributes fields)
 {
 }
        protected override void Execute(CodeActivityContext executionContext)
        {
            ITracingService tracer = executionContext.GetExtension <ITracingService>();

            tracer.Trace("Inicialize context");
            IWorkflowContext context = executionContext.GetExtension <IWorkflowContext>();

            //Create an Organization Service
            tracer.Trace("Inicialize serviceFactory");
            IOrganizationServiceFactory serviceFactory = executionContext.GetExtension <IOrganizationServiceFactory>();

            tracer.Trace("Inicialize orgService");
            IOrganizationService orgService = serviceFactory.CreateOrganizationService(context.InitiatingUserId);

            //Registered Step Guid
            var pluginStepGuid = Guid.Empty;

            try
            {
                //Plugin Step object
                tracer.Trace("Inicialize pluginStep");
                CrmPluginStep pluginStep = new CrmPluginStep();

                pluginStep.PrimaryEntity = PrimaryEntity.Get <string>(executionContext);
                tracer.Trace("PrimaryEntity: " + pluginStep.PrimaryEntity);

                pluginStep.PluginAssemblyName = AssemblyName.Get <string>(executionContext);
                tracer.Trace("PluginAssemblyName: " + pluginStep.PluginAssemblyName);

                pluginStep.EventHandler = EventHandler.Get <string>(executionContext);
                tracer.Trace("EventHandler: " + pluginStep.EventHandler);

                pluginStep.Mode = Mode.Get <int>(executionContext);
                tracer.Trace("Mode: " + pluginStep.Mode);

                pluginStep.Rank = Rank.Get <int>(executionContext);
                tracer.Trace("Rank: " + pluginStep.Rank);

                pluginStep.FilteringAttributes = FilteringAttributes.Get <string>(executionContext);
                tracer.Trace("FilteringAttributes: " + pluginStep.FilteringAttributes);

                pluginStep.InvocationSource = InvocationSource.Get <int>(executionContext);
                tracer.Trace("InvocationSource: " + pluginStep.InvocationSource);

                pluginStep.Stage = Stage.Get <int>(executionContext);
                tracer.Trace("Stage: " + pluginStep.Stage);

                pluginStep.Deployment = Deployment.Get <int>(executionContext);
                tracer.Trace("Deployment: " + pluginStep.Deployment);

                pluginStep.Message = Message.Get <string>(executionContext);
                tracer.Trace("Message: " + pluginStep.Message);

                pluginStep.Name = pluginStep.EventHandler + ": " + pluginStep.Message + " of " + pluginStep.PrimaryEntity;
                tracer.Trace("Name: " + pluginStep.Name);

                pluginStep.tracer = tracer;

                tracer.Trace("--- Register Plugin Step --- ");
                //Register Step
                pluginStepGuid = pluginStep.RegisterPluginStep(ref orgService);

                tracer.Trace("pluginStepGuid: " + pluginStepGuid);
                PluginStepGuid.Set(executionContext, pluginStepGuid.ToString());
            }
            catch (Exception e)
            {
                throw new InvalidPluginExecutionException("(RegisterPluginStep) Error! " + e.Message);
            }
        }