public SynchronousWorkflow(Entity workflow)
        {
            this.workflow = workflow;
            initialRank = Rank;

            // Stage
            if (workflow.GetAttributeValue<bool>("triggeroncreate"))
            {
                var stageCode = workflow.GetAttributeValue<OptionSetValue>("createstage");
                Stage = stageCode != null ? stageCode.Value : 40;
                Message = "Create";
            }
            else if (workflow.GetAttributeValue<bool>("triggeronupdate") ||
                !string.IsNullOrEmpty(workflow.GetAttributeValue<string>("triggeronupdateattributelist")))
            {
                var stageCode = workflow.GetAttributeValue<OptionSetValue>("updatestage");
                Stage = stageCode != null ? stageCode.Value : 40;
                Message = "Update";
            }
            else if (workflow.GetAttributeValue<bool>("triggerondelete"))
            {
                var stageCode = workflow.GetAttributeValue<OptionSetValue>("deletestage");
                Stage = stageCode != null ? stageCode.Value : 20;
                Message = "Delete";
            }
        }
        public SynchronousWorkflow(Entity workflow)
        {
            this.workflow = workflow;
            initialRank = Rank;

            // Stage
            if (workflow.GetAttributeValue<bool>("triggeroncreate"))
            {
                var stageCode = workflow.GetAttributeValue<OptionSetValue>("createstage");
                Stage = stageCode != null ? stageCode.Value : 40;
                Message = "Create";
            }
            else if (workflow.GetAttributeValue<bool>("triggeronupdate"))
            {
                var stageCode = workflow.GetAttributeValue<OptionSetValue>("updatestage");
                Stage = stageCode != null ? stageCode.Value : 40;
                Message = "Update";
            }
            else if (workflow.GetAttributeValue<bool>("triggerondelete"))
            {
                var stageCode = workflow.GetAttributeValue<OptionSetValue>("deletestage");
                Stage = stageCode != null ? stageCode.Value : 20;
                Message = "Delete";
            }
            else
            {
                // throw new Exception("Unexpected stage data");
            }
        }
Example #3
0
        public PluginStep(Entity pluginStep, IEnumerable<Entity> sdkMessageFilers, IEnumerable<Entity> sdkMessages)
        {
            this.pluginStep = pluginStep;
            initialRank = Rank;

            // EntityLogicalName
            var messageFilter = sdkMessageFilers.FirstOrDefault(
                    s => pluginStep.GetAttributeValue<EntityReference>("sdkmessagefilterid") != null &&
            s.Id == pluginStep.GetAttributeValue<EntityReference>("sdkmessagefilterid").Id);
            if (messageFilter != null)
            {
                EntityLogicalName = messageFilter.GetAttributeValue<string>("primaryobjecttypecode");

                if (EntityLogicalName.Length == 0)
                {
                    EntityLogicalName = "None";
                }

                var message = sdkMessages.FirstOrDefault(
                    m => m.Id == messageFilter.GetAttributeValue<EntityReference>("sdkmessageid").Id);
                if (message != null)
                {
                    Message = message.GetAttributeValue<string>("name");
                }
            }
            else
            {
                EntityLogicalName = "(none)";

                var message = sdkMessages.FirstOrDefault(
                  m => m.Id == pluginStep.GetAttributeValue<EntityReference>("sdkmessageid").Id);
                if (message != null)
                {
                    Message = message.GetAttributeValue<string>("name");
                }
            }
        }
Example #4
0
 public WebResource(Entity webResource, string filePath)
 {
     FilePath = filePath;
     WebResourceEntity = webResource;
     InitialBase64 = webResource.GetAttributeValue<string>("content");
 }