/// <summary> /// Handles the ExecuteCode event of the ReadFoundResource CodeActivity. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void ReadFoundResource_ExecuteCode(object sender, EventArgs e) { Logger.Instance.WriteMethodEntry(EventIdentifier.FindResourcesReadFoundResourceExecuteCode, "XPathFilter: '{0}'. ResolvedFilter: '{1}'.", this.XPathFilter, this.ResolvedFilter); try { // This method is called for each result returned by the enumerate resources activity // Cast the returned object as a resource and retrieve the Guid ResourceType resource = EnumerateResourcesActivity.GetCurrentIterationItem((CodeActivity)sender) as ResourceType; if (resource == null) { Logger.Instance.WriteVerbose(EventIdentifier.FindResourcesReadFoundResourceExecuteCode, "No resource found matching XPath filter '{0}'. ResolvedFilter: '{1}'.", this.XPathFilter, this.ResolvedFilter); return; } Guid identifier; resource.ObjectID.TryGetGuid(out identifier); // If the resource is not the workflow target, or if the activity is not configured // to exclude the workflow target from the result set, add the resource and associated Guid // to the lists which will be returned by the activity if (identifier == Guid.Empty || (identifier == this.workflowTarget && this.ExcludeWorkflowTarget)) { Logger.Instance.WriteVerbose(EventIdentifier.FindResourcesReadFoundResourceExecuteCode, "The resource is the workflow target and the activity is configured to exclude workflow target from the found resources result set."); return; } this.FoundResources.Add(resource); this.FoundIds.Add(identifier); Logger.Instance.WriteVerbose(EventIdentifier.FindResourcesReadFoundResourceExecuteCode, "The resource '{0}' of type '{1}' is added to the found resources collection.", resource.ObjectID, resource.ObjectType); } finally { Logger.Instance.WriteMethodExit(EventIdentifier.FindResourcesReadFoundResourceExecuteCode, "XPathFilter: '{0}'. ResolvedFilter: '{1}'.", this.XPathFilter, this.ResolvedFilter); } }
private void IterateEnumManager_ExecuteCode(object sender, EventArgs e) { ResourceType managerResource = EnumerateResourcesActivity.GetCurrentIterationItem((CodeActivity)sender) as ResourceType; _managerGUID = managerResource.ObjectID.GetGuid(); }
private void Iterate_Enum_ExecuteCode(object sender, EventArgs e) { ResourceType costCenterResource = EnumerateResourcesActivity.GetCurrentIterationItem((CodeActivity)sender) as ResourceType; _costCenter = costCenterResource.ObjectID.GetGuid(); }