Esempio n. 1
0
 /// <summary>
 /// Creates a transaction to launch a workflow for this entity.
 /// </summary>
 /// <param name="workflowTypeId">The workflow type identifier.</param>
 /// <param name="workflowName">Name of the workflow.</param>
 /// <param name="workflowAttributeValues">Any workflow attribute values that should be set.</param>
 public void LaunchWorkflow(int?workflowTypeId, string workflowName = "", Dictionary <string, string> workflowAttributeValues = null)
 {
     if (workflowTypeId.HasValue)
     {
         var transaction = new Rock.Transactions.LaunchWorkflowTransaction <T>(workflowTypeId.Value, workflowName, Id);
         if (workflowAttributeValues != null)
         {
             transaction.WorkflowAttributeValues = workflowAttributeValues;
         }
         Rock.Transactions.RockQueue.TransactionQueue.Enqueue(transaction);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Creates a transaction to launch a workflow for this entity.
        /// </summary>
        /// <param name="workflowTypeId">The workflow type identifier.</param>
        /// <param name="workflowName">Name of the workflow.</param>
        /// <param name="workflowAttributeValues">Any workflow attribute values that should be set.</param>
        /// <param name="initiatorPersonAliasId">The Initiator Person Alias Identifier.</param>
        public void LaunchWorkflow(int?workflowTypeId, string workflowName, Dictionary <string, string> workflowAttributeValues, int?initiatorPersonAliasId)
        {
            if (workflowTypeId.HasValue)
            {
                var transaction = new Rock.Transactions.LaunchWorkflowTransaction <T>(workflowTypeId.Value, workflowName, Id);
                if (workflowAttributeValues != null)
                {
                    transaction.WorkflowAttributeValues = workflowAttributeValues;
                }
                transaction.InitiatorPersonAliasId = initiatorPersonAliasId;

                Rock.Transactions.RockQueue.TransactionQueue.Enqueue(transaction);
            }
        }
Esempio n. 3
0
        public void LaunchWorkflow(int id, int workflowTypeId, string workflowName, [FromBody] Dictionary <string, string> workflowAttributeValues)
        {
            T entity = null;

            if (id > 0)
            {
                entity = Get(id);
            }

            if (entity != null)
            {
                entity.LaunchWorkflow(workflowTypeId, workflowName, workflowAttributeValues);
            }
            else
            {
                var transaction = new Rock.Transactions.LaunchWorkflowTransaction(workflowTypeId, workflowName);
                if (workflowAttributeValues != null)
                {
                    transaction.WorkflowAttributeValues = workflowAttributeValues;
                }
                Rock.Transactions.RockQueue.TransactionQueue.Enqueue(transaction);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Triggers the workflows.
        /// </summary>
        /// <param name="primaryMember">The primary member record that entered all their information.</param>
        /// <param name="secondaryMembers">The secondary members that were also added to the group.</param>
        private void TriggerWorkflows(GroupMember primaryMember, List <GroupMember> secondaryMembers)
        {
            if (!RegistrationWorkflowGuid.HasValue)
            {
                return;
            }

            var workflowType = WorkflowTypeCache.Get(RegistrationWorkflowGuid.Value);

            if (workflowType == null)
            {
                return;
            }

            var initatorAliasId = primaryMember.Person.PrimaryAliasId;

            // Launch the workflow for the main person who entered all
            // their information.
            var transaction = new Rock.Transactions.LaunchWorkflowTransaction <GroupMember>(workflowType.Guid, primaryMember.Id)
            {
                InitiatorPersonAliasId = initatorAliasId
            };

            transaction.Enqueue();

            // Launch the workflow for each family member that was also
            // added to the group.
            foreach (var member in secondaryMembers)
            {
                transaction = new Rock.Transactions.LaunchWorkflowTransaction <GroupMember>(workflowType.Guid, member.Id)
                {
                    InitiatorPersonAliasId = initatorAliasId
                };
                transaction.Enqueue();
            }
        }
Esempio n. 5
0
        protected void btnGenerate_Click(object sender, EventArgs e)
        {
            var reviewDataView             = GetAttributeValue("DefaultReviewDataView").AsGuid();
            var statementGeneratorWorkflow = GetAttributeValue("StatementGeneratorWorkflow").AsGuid();

            foreach (GivingGroup givingGroup in GetSelectedGivingUnits())
            {
                // Setup the attribute values
                var workflowAttributeValues = new Dictionary <string, string>();
                workflowAttributeValues.Add("Version", tbVersion.Text);
                workflowAttributeValues.Add("StatementDateRange", drpStatementDate.LowerValue.Value.ToString("s") + "," + drpStatementDate.UpperValue.Value.ToString("s"));
                workflowAttributeValues.Add("GivingId", givingGroup.GivingId);

                var transaction = new Rock.Transactions.LaunchWorkflowTransaction(statementGeneratorWorkflow, "Contribution Statement for " + givingGroup.GivingGroupName);
                transaction.WorkflowAttributeValues = workflowAttributeValues;
                Rock.Transactions.RockQueue.TransactionQueue.Enqueue(transaction);
            }
            pnlProgressText.Controls.Add(new Label()
            {
                Text = GetSelectedGivingUnits().Count() + " contribution statement generation requests submitted."
            });
            pnlProgressBar.Visible = true;
            pnlSettings.Visible    = false;
        }