Beispiel #1
0
 private void ApprovalLevel_DataBind(object sender, ReplicatorChildEventArgs e)
 {
     ApprovalLevel activity = e.Activity as ApprovalLevel;
     ApprovalLevelInfo data = e.InstanceData as ApprovalLevelInfo;
     data.FormOption = AssociationObj.TaskFormOption;
     data.EndAtFirstRejection = AssociationObj.EndOnFirstReject;
     activity.ApprovalData = data;
 }
Beispiel #2
0
 private void MultiTaskReplicator_ChildInitialized(object sender, ReplicatorChildEventArgs e)
 {
     ApprovalUnitWrapper activity = e.Activity as ApprovalUnitWrapper;
     currentTaskInfo = e.InstanceData as TaskInfo;
     activity.TaskInfo = currentTaskInfo;
 }
 private void replicatorForReviewTasks_ChildInitialized(object sender, ReplicatorChildEventArgs e)
 {
     notifyReviewersOfAgenda.TaskAssignedTo = e.InstanceData.ToString();
     notifyReviewersOfAgenda.TaskTitle = string.Format("Review content for Board Agenda - {0}", AgendaTitle);
     notifyReviewersOfAgenda.TaskDescription = string.Format("This task is for reviewing the content for a board agenda titled - {0}", AgendaTitle);
     notifyReviewersOfAgenda.TaskDueDate = DateTime.Today.AddDays(3);
     notifyReviewersOfAgenda.Source = "Paperless Board";
     notifyReviewersOfAgenda.Action = "Review";
 }
Beispiel #4
0
        /// <summary>
        /// Handles the ChildInitialized event of the ForEachResolvedFilter activity.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="ReplicatorChildEventArgs"/> instance containing the event data.</param>
        private void ForEachResolvedFilter_ChildInitialized(object sender, ReplicatorChildEventArgs e)
        {
            Logger.Instance.WriteMethodEntry(EventIdentifier.FindResourcesForEachResolvedFilterChildInitialized);

            try
            {
                this.ResolvedFilter = e.InstanceData as string;

                if (!string.IsNullOrEmpty(this.ResolvedFilter))
                {
                    // If there are more than "/" at the start of the search filter, keep only one.
                    this.ResolvedFilter = "/" + this.ResolvedFilter.Trim().TrimStart('/');
                }
            }
            finally
            {
                Logger.Instance.WriteMethodExit(EventIdentifier.FindResourcesForEachResolvedFilterChildInitialized, "XPathFilter: '{0}'. ResolvedFilter: '{1}'.", this.XPathFilter, this.ResolvedFilter);
            }
        }
 private void ChildInitializer(object sender, ReplicatorChildEventArgs args)
 {
     // Using the InstanceData passed in (which comes from the "childData" ArrayList above)
     // populate a property on the SampleReplicatorChildActivity
     (args.Activity as SampleReplicatorChildActivity).InstanceData = args.InstanceData as string;
 }
Beispiel #6
0
        /// <summary>
        /// Handles the ChildCompleted event of the ForEachIteration ReplicatorActivity.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="ReplicatorChildEventArgs"/> instance containing the event data.</param>
        private void ForEachIteration_ChildCompleted(object sender, ReplicatorChildEventArgs e)
        {
            Logger.Instance.WriteMethodEntry(EventIdentifier.UpdateResourcesForEachIterationChildCompleted, "Iteration: '{0}' of '{1}'. ", this.iterations, this.ForEachIteration.InitialChildData.Count);

            try
            {
                var variableCache = this.ActivityExpressionEvaluator.VariableCache;
                this.breakIteration = Convert.ToBoolean(variableCache[ExpressionEvaluator.ReservedVariableBreakIteration], CultureInfo.InvariantCulture);
            }
            finally
            {
                Logger.Instance.WriteMethodExit(EventIdentifier.UpdateResourcesForEachIterationChildCompleted, "Iteration: '{0}' of '{1}'. Break Iteration '{2}'.", this.iterations, this.ForEachIteration.InitialChildData.Count, this.breakIteration);
            }
        }
 private void replicatorActivity1_ChildCompleted(object sender, ReplicatorChildEventArgs e)
 {
     CreateSingleTask currentChildActivity = (CreateSingleTask)e.Activity;
     int childTaskId = currentChildActivity.ListItemId;
     taskIdQueue.Add(childTaskId);
 }
Beispiel #8
0
        /// <summary>
        /// Handles the ChildCompleted event of the ForEachResponse ReplicatorActivity.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="ReplicatorChildEventArgs"/> instance containing the event data.</param>
        private void ForEachResponse_ChildCompleted(object sender, ReplicatorChildEventArgs e)
        {
            Logger.Instance.WriteMethodEntry(EventIdentifier.ResolveLookupsForEachResponseChildCompleted);

            try
            {
                // Evaluate the approval response to determine if its creator
                // represents an approver
                ResourceType approvalResponse = ((ReadResourceActivity)e.Activity).Resource;
                if (approvalResponse == null || approvalResponse["Decision"] == null || approvalResponse["Creator"] == null ||
                    approvalResponse["CreatedTime"] == null ||
                    !approvalResponse["Decision"].ToString().Equals("Approved", StringComparison.OrdinalIgnoreCase))
                {
                    return;
                }

                // Get the approver and the approval date from the approval response
                // and add the information to the dictionary
                Guid approver;
                ((UniqueIdentifier)approvalResponse["Creator"]).TryGetGuid(out approver);
                DateTime approvalDate = (DateTime)approvalResponse["CreatedTime"];
                if (approver == Guid.Empty)
                {
                    return;
                }

                // Check if approver approved multiple times
                if (!this.approvers.ContainsKey(approver))
                {
                    this.approvers.Add(approver, approvalDate);
                }
                else
                {
                    if (approvalDate > this.approvers[approver])
                    {
                        this.approvers[approver] = approvalDate;
                    }
                }

                Logger.Instance.WriteVerbose(EventIdentifier.ResolveLookupsForEachResponseChildCompleted, "The approval '{0}' - '{1}' added to the approver dictionary.", approver, approvalDate);
            }
            finally
            {
                Logger.Instance.WriteMethodExit(EventIdentifier.ResolveLookupsForEachResponseChildCompleted);
            }
        }
        private void replicatorForExecutiveTasks_ChildInitialized(object sender, ReplicatorChildEventArgs e)
        {
            notifyTaskOwner.TaskAssignedTo = e.InstanceData.ToString();

            StringBuilder sb = new StringBuilder();

            if (actionsOwed.Count() > 1)
            {
                notifyTaskOwner.TaskTitle = string.Format("{0} - Action(s) required", taskSource);
                notifyTaskOwner.Action = "Mulitple Actions in task";
            }
            else if (actionsOwed.Count() == 1)
            {
                notifyTaskOwner.TaskTitle = string.Format("{0} - {1}", taskSource, actionsOwed[0]);
                notifyTaskOwner.Action = GetTaskAction(actionsOwed[0]);
            }

            sb.Append("You are required to take the following actions.");

            foreach (string actionOwed in actionsOwed)
            {
                sb.Append(actionOwed);
                sb.Append(Environment.NewLine);
            }
            notifyTaskOwner.TaskDescription = sb.ToString();

            notifyTaskOwner.TaskDueDate = (this.workflowProperties.Item["DelegateDueDate"] != null) ? Convert.ToDateTime(this.workflowProperties.Item["DelegateDueDate"]) : DateTime.Today.AddBusinessDays(dueDays);
            notifyTaskOwner.Source = string.Format("Executive Task ({0})", taskSource);
        }
 private void replicatorForContributorTask_ChildInitialized(object sender, ReplicatorChildEventArgs e)
 {
     notifyAgendaContributor1.TaskAssignedTo = e.InstanceData.ToString();
     notifyAgendaContributor1.TaskTitle = string.Format("Add Content for Board Agenda - {0}", AgendaTitle);
     notifyAgendaContributor1.TaskDescription = string.Format("This task is for adding content for the board agenda titled: {0}", AgendaTitle);
     notifyAgendaContributor1.TaskDueDate = DateTime.Today.AddDays(3);
     notifyAgendaContributor1.Source = "Paperless Board";
     notifyAgendaContributor1.Action = "Submit";
 }
Beispiel #11
0
 private void initializedChild_ExecuteCode(object sender, ReplicatorChildEventArgs e)
 {
     (e.Activity as ApprovalWorkflow).ApprovalName = e.InstanceData.ToString();
 }
Beispiel #12
0
 private void completedChild_ExecuteCode(object sender, ReplicatorChildEventArgs e)
 {
     _intChildCompleted++;
     //return status of activity
     if (!string.IsNullOrEmpty((e.Activity as ApprovalWorkflow).Status))
         this.Status = (e.Activity as ApprovalWorkflow).Status;
 }
        private void replicatorActivity1_ChildInitialized(object sender, ReplicatorChildEventArgs e)
        {
            SPWorkflowTaskProperties childTaskProperties = new SPWorkflowTaskProperties();
            childTaskProperties.Title = "Need Approval for " + workflowProperties.Item.Title;
            childTaskProperties.AssignedTo = (string)e.InstanceData;
            childTaskProperties.PercentComplete = 0;
            childTaskProperties.ExtendedProperties["WF"] = WFNameID;
            childTaskProperties.SendEmailNotification = false;

            CreateSingleTask currentChildActivity = (CreateSingleTask)e.Activity;
            currentChildActivity.__Context = createCustodianTask___Context1;
            currentChildActivity.ContentTypeId = ApproveRejectRemarkContentTypeID;
            currentChildActivity.Subject = string.Format("CorsecSP {0} [ {1} ] Need Approval", RequestCode.PERMINTAAN_DOKUMEN, workflowProperties.Item.Title);
            currentChildActivity.Body = string.Format(EmailNotificationTemplate, "{0}", "Permintaan Dokumen Task", workflowProperties.Item.Title, OriginatorName, "need your approval" + Util.GenerateApprovalInformation(scInfo), "{1}");
            currentChildActivity.TaskProperties = childTaskProperties;
        }
        private void replicatorActivity1_ChildCompleted(object sender, ReplicatorChildEventArgs e)
        {
            try
            {
                CreateSingleTask currentChildActivity = (CreateSingleTask)e.Activity;
                taskID = currentChildActivity.ListItemId;
                ListItemIdCollection.Add(taskID);
                SPSecurity.RunWithElevatedPrivileges(delegate()
                {
                    SPWeb web = workflowProperties.Item.Web;

                    SPListItem item = web.Lists[workflowProperties.TaskListId].GetItemById(taskID);
                    ApprovalStatus = item["ApproveOrReject"].ToString();

                    NApprovalName = item["AssignedTo"].ToString().Split(new string[] { ";#" }, StringSplitOptions.RemoveEmptyEntries)[1];

                    if (item["Remarks"] != null)
                        Remarks = item["Remarks"].ToString();
                    else
                        Remarks = string.Empty;
                });

                scInfo.Add(string.Format("{0};{1};{2};{3}", (2 + ListItemIdCollection.Count), NApprovalName, DateTime.Now, ApprovalStatus));
            }
            catch
            {
            }
        }
Beispiel #15
0
        private void replicatorActivity1_ChildInitialized(object sender, ReplicatorChildEventArgs e)
        {
            ApprovalLevelInfo approvalInfo = (ApprovalLevelInfo)e.InstanceData;
            ApprovalUnitWrapper approvalControl = (ApprovalUnitWrapper)e.Activity;

            approvalControl.ApprovalInfo = approvalInfo;
            approvalControl.TaskContentTypeId = approvalInfo.TaskContenType;

            approvalControl.TaskSequenceType = approvalInfo.TaskSequenceType;
        }
Beispiel #16
0
        /// <summary>
        /// Handles the ChildCompleted event of the ForEachResource ReplicatorActivity.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="ReplicatorChildEventArgs"/> instance containing the event data.</param>
        private void ForEachResource_ChildCompleted(object sender, ReplicatorChildEventArgs e)
        {
            Logger.Instance.WriteMethodEntry(EventIdentifier.ResolveLookupsForEachResourceChildCompleted, "ReadResource: '{0}'. PerformRead: '{1}'.", e.InstanceData, this.performRead);

            try
            {
                // Evaluate the read resource
                ReadResourceActivity read = e.Activity as ReadResourceActivity;
                if (!this.performRead || read == null || read.Resource == null)
                {
                    return;
                }

                foreach (string attribute in this.reads[this.resourceKey].Where(attribute => read.Resource[attribute] != null))
                {
                    this.Publish(string.Format(CultureInfo.InvariantCulture, "{0}/{1}", this.resourceKey, attribute), read.Resource[attribute]);
                }
            }
            finally
            {
                Logger.Instance.WriteMethodExit(EventIdentifier.ResolveLookupsForEachResourceChildCompleted, "ReadResource: '{0}'. PerformRead: '{1}'.", e.InstanceData, this.performRead);
            }
        }
Beispiel #17
0
        /// <summary>
        /// Handles the ChildInitialized event of the ForEachResource ReplicatorActivity.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="ReplicatorChildEventArgs"/> instance containing the event data.</param>
        private void ForEachResource_ChildInitialized(object sender, ReplicatorChildEventArgs e)
        {
            Logger.Instance.WriteMethodEntry(EventIdentifier.ResolveLookupsForEachResourceChildInitialized, "ReadResource: '{0}'.", e.InstanceData);

            try
            {
                // The instance data represents the Guid of the resource to read
                // Assign this Guid as the resource to be read by the read resource activity
                if (e.InstanceData != null)
                {
                    this.ReadResource = (Guid)((Guid?)e.InstanceData);
                }
            }
            finally
            {
                Logger.Instance.WriteMethodExit(EventIdentifier.ResolveLookupsForEachResourceChildInitialized, "ReadResource: '{0}'.  Read Attributes: '{1}'.", e.InstanceData, this.ReadAttributes == null ? null : string.Join(",", this.ReadAttributes));
            }
        }
Beispiel #18
0
 private void ApprovalLevelComplete(object sender, ReplicatorChildEventArgs e)
 {
     count++;
 }
Beispiel #19
0
        /// <summary>
        /// Handles the ChildInitialized event of the ForEachResponse ReplicatorActivity.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="ReplicatorChildEventArgs"/> instance containing the event data.</param>
        private void ForEachResponse_ChildInitialized(object sender, ReplicatorChildEventArgs e)
        {
            Logger.Instance.WriteMethodEntry(EventIdentifier.ResolveLookupsForEachResponseChildInitialized, "ApprovalResponse: '{0}'.", e.InstanceData);

            try
            {
                // The instance data represents the Guid of the approval response
                // Assign this Guid as the resource to be read by the ReadResponse read resource activity
                if (e.InstanceData != null)
                {
                    this.ApprovalResponse = (Guid)((Guid?)e.InstanceData);
                }
            }
            finally
            {
                Logger.Instance.WriteMethodExit(EventIdentifier.ResolveLookupsForEachResponseChildInitialized, "ApprovalResponse: '{0}'.", e.InstanceData);
            }
        }
Beispiel #20
0
        /// <summary>
        /// Handles the ChildInitialized event of the ForEachRequest ReplicatorActivity.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="ReplicatorChildEventArgs"/> instance containing the event data.</param>
        private void ForEachRequest_ChildInitialized(object sender, ReplicatorChildEventArgs e)
        {
            Logger.Instance.WriteMethodEntry(EventIdentifier.FindRequestConflictForEachRequestChildInitialized, "ComparedRequest: '{0}'.", e.InstanceData);

            try
            {
                // Purge any resolved values for [//ComparedRequest/...] lookups
                // from the expression evaluator so they can be repopulated via resolution
                // against the request currently being evaluated
                List<string> comparedRequestLookups = this.ComparedRequestLookups.Keys.ToList();
                foreach (string lookup in comparedRequestLookups)
                {
                    this.ExpressionEvaluator.LookupCache[lookup] = null;
                    this.ComparedRequestLookups[lookup] = null;
                }

                // Retrieve the Guid of the request from the instance data
                // Fetch the resolve lookups activity and supply the currently evaluated request as the compared request
                // This will ensure it is used for the resolution of all [//ComparedRequest/...] expressions
                Guid request = new Guid();
                if (e.InstanceData != null)
                {
                    request = (Guid)(Guid?)e.InstanceData;
                }

                ResolveLookups resolveCompared = e.Activity as ResolveLookups;

                if (resolveCompared == null)
                {
                    return;
                }

                resolveCompared.ComparedRequestId = request;

                Logger.Instance.WriteVerbose(EventIdentifier.FindRequestConflictForEachRequestChildInitialized, "The resolve lookups activity will use the request '{0}' to resolve all [//ComparedRequest/...] expressions.", request);
            }
            finally
            {
                Logger.Instance.WriteMethodExit(EventIdentifier.FindRequestConflictForEachRequestChildInitialized, "ComparedRequest: '{0}'.", e.InstanceData);
            }
        }
        private void replicatorActivity1_ChildInitialized(object sender, ReplicatorChildEventArgs e)
        {
            SPWorkflowTaskProperties childTaskProperties = new SPWorkflowTaskProperties();
            childTaskProperties.Title = this.TaskTitle;
            childTaskProperties.AssignedTo = (string)e.InstanceData;
            childTaskProperties.PercentComplete = 0;
            childTaskProperties.ExtendedProperties["WF"] = this.WFName;
            childTaskProperties.HasCustomEmailBody = true;
            childTaskProperties.SendEmailNotification = false;

            CreateSingleTask currentChildActivity = (CreateSingleTask)e.Activity;
            currentChildActivity.__Context = __Context;
            currentChildActivity.ContentTypeId = this.ContentTypeId;
            currentChildActivity.Subject = Subject;
            currentChildActivity.Body = Body;

            currentChildActivity.TaskProperties = childTaskProperties;
        }
Beispiel #22
0
        /// <summary>
        /// Handles the ChildCompleted event of the ForEachRequest ReplicatorActivity.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="ReplicatorChildEventArgs"/> instance containing the event data.</param>
        private void ForEachRequest_ChildCompleted(object sender, ReplicatorChildEventArgs e)
        {
            Logger.Instance.WriteMethodEntry(EventIdentifier.FindRequestConflictForEachRequestChildCompleted, "ComparedRequest: '{0}'.", e.InstanceData);

            try
            {
                // Retrieve the Guid of the request from the instance data
                Guid request = new Guid();
                if (e.InstanceData != null)
                {
                    request = (Guid)(Guid?)e.InstanceData;
                }

                // Compared request lookups will be resolved to the dedicated dictionary to prevent repeated resolution of standard lookups
                // Add the resolved values to the expression evaluator lookup cache to facilitate match condition evaluation
                foreach (string lookup in this.ComparedRequestLookups.Keys)
                {
                    this.ExpressionEvaluator.LookupCache[lookup] = this.ComparedRequestLookups[lookup];
                }

                // Now that all [//ComparedRequest/...] lookups have been resolved against
                // the request currently being evaluated, determine if the supplied match condition
                // is satisfied
                object resolved = this.ExpressionEvaluator.ResolveExpression(this.MatchCondition);
                if (!(bool)resolved)
                {
                    return;
                }

                this.ConflictFound = true;
                this.ConflictingRequest = request;
            }
            finally
            {
                Logger.Instance.WriteMethodExit(EventIdentifier.FindRequestConflictForEachRequestChildCompleted, "ComparedRequest: '{0}'. Conflict Found: '{1}'.", e.InstanceData, this.ConflictFound);
            }
        }
Beispiel #23
0
        /// <summary>
        /// Handles the ChildInitialized event of the ForEachIteration ReplicatorActivity.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="ReplicatorChildEventArgs"/> instance containing the event data.</param>
        private void ForEachIteration_ChildInitialized(object sender, ReplicatorChildEventArgs e)
        {
            Logger.Instance.WriteMethodEntry(EventIdentifier.UpdateResourcesForEachIterationChildInitialized, "Current Iteration Value: '{0}'.", e.InstanceData);

            try
            {
                // Get the instance value so it can be used to resolve associated expressions
                // and clear previous resolutions
                this.Value = e.InstanceData;

                // Increment current iteration count
                this.iterations += 1;
            }
            finally
            {
                Logger.Instance.WriteMethodExit(EventIdentifier.UpdateResourcesForEachIterationChildInitialized, "Current Iteration Value: '{0}'.", e.InstanceData);
            }
        }
Beispiel #24
0
        /// <summary>
        /// Handles the ChildInitialized event of the ForEachQuery ReplicatorActivity.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="ReplicatorChildEventArgs"/> instance containing the event data.</param>
        private void ForEachQuery_ChildInitialized(object sender, ReplicatorChildEventArgs e)
        {
            Logger.Instance.WriteMethodEntry(EventIdentifier.ResolveQueriesForEachQueryChildInitialized);

            string queryXPathFilter = null;
            try
            {
                // Prepare for the execution of the query by pulling the XPath filter
                // from the definition and assigning it to the find resources activity
                Definition definition = e.InstanceData as Definition;
                FindResources runQuery = e.Activity as FindResources;

                if (runQuery == null || definition == null)
                {
                    return;
                }

                queryXPathFilter = definition.Right;
                runQuery.XPathFilter = queryXPathFilter;

                // Also add results from any previous queries
                // so that the first query could also be used in the filter criteria for the second query
                // providing for the ability to further refine the result set.
                runQuery.QueryResults = this.QueryResults;
            }
            finally
            {
                Logger.Instance.WriteMethodExit(EventIdentifier.ResolveQueriesForEachQueryChildInitialized, "Query XPath filter: '{0}'.", queryXPathFilter);
            }
        }
 private void initializedChild_ExecuteCode(object sender, ReplicatorChildEventArgs e)
 {
     EntryApproval entryApproval = (EntryApproval)e.Activity;
     entryApproval.ApprovalKey = e.InstanceData.ToString();//entryApprovalName
     entryApproval.ApprovalListId = _entryApprovalListId;
 }
Beispiel #26
0
        /// <summary>
        /// Handles the ChildCompleted event of the ForEachQuery ReplicatorActivity.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="ReplicatorChildEventArgs"/> instance containing the event data.</param>
        private void ForEachQuery_ChildCompleted(object sender, ReplicatorChildEventArgs e)
        {
            Logger.Instance.WriteMethodEntry(EventIdentifier.ResolveQueriesForEachQueryChildCompleted);

            try
            {
                // Load the results into the query results dictionary
                // Results will be added even if no resources were found
                Definition definition = e.InstanceData as Definition;
                FindResources runQuery = e.Activity as FindResources;

                if (definition != null && runQuery != null)
                {
                    this.QueryResults.Add(definition.Left, runQuery.FoundIds);
                }
            }
            finally
            {
                Logger.Instance.WriteMethodExit(EventIdentifier.ResolveQueriesForEachQueryChildCompleted);
            }
        }
 private void replicatorActivity1_ChildInitialized(object sender, ReplicatorChildEventArgs e)
 {
     AcquireDigitalSignatureActivity.TaskAssignedTo = e.InstanceData.ToString();
     AcquireDigitalSignatureActivity.TaskTitle = string.Format("Confirm that resolution was digitally signed (for {0})", AgendaTitle);
     AcquireDigitalSignatureActivity.TaskDescription = string.Format("This task is for confirming that the resolution document was digitally signed by the owner of this task. The agenda for which this task was created is titled {0}.", AgendaTitle);
     AcquireDigitalSignatureActivity.TaskDueDate = DateTime.Today.AddDays(3);
     AcquireDigitalSignatureActivity.Source = "Paperless Board";
     AcquireDigitalSignatureActivity.Action = "Sign";
 }
Beispiel #28
0
        /// <summary>
        /// Handles the ChildInitialized event of the ForEachRead ReplicatorActivity.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="ReplicatorChildEventArgs"/> instance containing the event data.</param>
        private void ForEachRead_ChildInitialized(object sender, ReplicatorChildEventArgs e)
        {
            Logger.Instance.WriteMethodEntry(EventIdentifier.ResolveLookupsForEachReadChildInitialized, "ResourceKey: '{0}'.", e.InstanceData);

            try
            {
                // Since we are looping through keys in the read dictionary, we will recieve the resource key to be read
                // For example: Target/Manager
                // If we didn't find a matching Guid for the resource, or if there are no attributes to be read,
                // stop the read resource activity from being executed
                // Otherwise, prepare to read the attribute from each associated resource
                this.resourceKey = e.InstanceData.ToString();
                if (!this.resources.ContainsKey(this.resourceKey) || this.resources[this.resourceKey].Count == 0 || this.reads[this.resourceKey].Count == 0)
                {
                    this.performRead = false;
                }
                else
                {
                    this.performRead = true;
                    this.ReadResources = this.resources[this.resourceKey];
                    this.ReadAttributes = this.reads[this.resourceKey].ToArray();

                    Logger.Instance.WriteVerbose(EventIdentifier.ResolveLookupsForEachReadChildInitialized, "ResourceKey: '{0}'. Read Attributes: '{1}'.", e.InstanceData, string.Join(",", this.ReadAttributes));
                }
            }
            finally
            {
                Logger.Instance.WriteMethodExit(EventIdentifier.ResolveLookupsForEachReadChildInitialized, "ResourceKey: '{0}'. Perform Read: '{1}'.", e.InstanceData, this.performRead);
            }
        }
        private void replicatorActivity1_ChildInitialized(object sender, ReplicatorChildEventArgs e)
        {
            string strApprover = (string)e.InstanceData;
            ApprovalUnit approvalActivity = (ApprovalUnit)e.Activity;
            if (ApprovalInfo.ExpendGroup)
            {

                string[] strUsers = strApprover.Split(';');
                //SPUserCollection users = new SPUserCollection(workflowProperties.Web, strUsers);
                //users.GetCollection(strApprover.Split(';'));
                SPFieldUserValueCollection readers = new SPFieldUserValueCollection(workflowProperties.Web, strApprover);

                foreach (string strUser in strUsers)
                {
                    SPGroup spApprovalGroup = workflowProperties.Web.Groups[strUser];
                    if (spApprovalGroup != null)
                    {
                        foreach (SPUser userInGroup in spApprovalGroup.Users)
                        {
                            strApprover += userInGroup.LoginName + ";";
                        }
                    }
                    else
                    {
                        strApprover += strUser + ";";
                    }
                }
            }
            else approvalActivity.Approver = strApprover;

            approvalActivity.DueDate = ApprovalInfo.DueDate;
            approvalActivity.DurationPerTask = ApprovalInfo.DurationPerTask;
            approvalActivity.Message = ApprovalInfo.Message;
            approvalActivity.TaskTitle = ApprovalInfo.TaskTitle;
        }
        /// <summary>
        /// Handles the ChildInitialized event of the ForEachTarget ReplicatorActivity.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="ReplicatorChildEventArgs"/> instance containing the event data.</param>
        private void ForEachTarget_ChildInitialized(object sender, ReplicatorChildEventArgs e)
        {
            Logger.Instance.WriteMethodEntry(EventIdentifier.DeleteResourcesForEachTargetChildInitialized, "Target: '{0}'.", e.InstanceData);

            try
            {
                // Cast the instance data as a Guid and prepare the delete resource activity
                // by assigning a resource ID
                Guid target = new Guid();
                if (e.InstanceData != null)
                {
                    target = (Guid)((Guid?)e.InstanceData);
                }

                this.Target = target;
            }
            finally
            {
                Logger.Instance.WriteMethodExit(EventIdentifier.DeleteResourcesForEachTargetChildInitialized, "Target: '{0}'.", e.InstanceData);
            }
        }