// creates a workflow application, binds parameters, links extensions and run it
        public WorkflowApplication CreateAndRun(WorkFlowPayment rfp)
        {
            // input parameters for the WF program
            IDictionary <string, object> inputs = new Dictionary <string, object>();

            inputs.Add("RackRateData", rfp);

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

            instance.InstanceStore    = store;
            instance.PersistableIdle += OnIdleAndPersistable;
            instance.Completed       += OnWorkflowCompleted;
            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);
        }
Beispiel #2
0
        private void SavePayments()
        {
            foreach (MultiplePayment multiplePayment in multiplePaymentList.MultiplePayments)
            {
                WorkFlowPayment payment = this.CurrentObjectSpace.CreateObject <WorkFlowPayment>();

                payment.Workflow      = CurrentObjectSpace.GetObject(multiplePayment.Workflow);
                payment.PaymentAmount = multiplePayment.PaymentAmount;
                payment.PaymentDate   = multiplePayment.PaymentDate;
                payment.PaymentType   = multiplePayment.PaymentType;

                payment.Save();
            }
        }