Esempio n. 1
0
        // creates a workflow application, binds parameters, links extensions and run it
        public WorkflowApplication CreateAndRunViewAction(Int32 PaymentMemoid)
        {
            // input parameters for the WF program
            IDictionary <string, object> inputs = new Dictionary <string, object>();

            inputs.Add("PaymentMemoID", PaymentMemoid);

            // create and run the WF instance
            Activity                 wf       = new BrokerageOnline.Workflow.BaseRackRateView();
            WorkflowApplication      instance = new WorkflowApplication(wf, inputs);
            XmlWorkflowInstanceStore store    = new XmlWorkflowInstanceStore(instance.Id);

            instance.InstanceStore    = store;
            instance.PersistableIdle += OnIdleAndPersistable;
            instance.Completed       += OnWorkflowViewCompleted;
            instance.Idle            += OnIdle;

            //Create the persistence Participant and add it to the workflow instance
            XmlPersistenceParticipant xmlPersistenceParticipant = new XmlPersistenceParticipant(instance.Id);

            instance.Extensions.Add(xmlPersistenceParticipant);

            // add a tracking participant
            instance.Extensions.Add(new SaveAllEventsToTrackingParticipant());

            // add instance to the host list of running instances
            this.instances.Add(instance.Id, instance);

            // continue executing this instance
            instance.Run();

            return(instance);
        }
Esempio n. 2
0
        // load and resume a workflow instance. If the instance is in memory,
        // will return the version from memory. If not, will load it from the
        // persistent store
        public WorkflowApplication LoadInstance(Guid instanceId)
        {
            // if the instance is in memory, return it
            if (this.instances.ContainsKey(instanceId))
            {
                return(this.instances[instanceId]);
            }

            // load the instance
            XmlWorkflowInstanceStore instStore = new XmlWorkflowInstanceStore(instanceId);
            WorkflowApplication      instance  = new WorkflowApplication(new BrokerageOnline.Workflow.BaseRackRate());

            instance.InstanceStore = instStore;
            instance.Completed    += OnWorkflowCompleted;
            instance.Idle         += OnIdle;

            // add a tracking participant
            instance.Extensions.Add(new SaveAllEventsToTrackingParticipant());

            // add the instance to the list of running instances in the host
            instance.Load(instanceId);
            this.instances.Add(instanceId, instance);
            return(instance);
        }