コード例 #1
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);
            }
        }
コード例 #2
0
        /// <summary>
        /// Handles the ChildInitialized event of the ForEachPending 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 ForEachPending_ChildInitialized(object sender, ReplicatorChildEventArgs e)
        {
            Logger.Instance.WriteMethodEntry(EventIdentifier.UpdateLookupsForEachPendingChildInitialized, "Resource: '{0}'.", e.InstanceData);

            try
            {
                // Cast the instance data as a Guid and prepare the read resource activity
                // by assigning a resource ID for update and the attributes to be read
                Guid resource = new Guid();
                if (e.InstanceData != null)
                {
                    resource = (Guid)((Guid?)e.InstanceData);
                }

                ReadResourceActivity read = e.Activity as ReadResourceActivity;

                if (read == null)
                {
                    return;
                }

                read.ResourceId          = resource;
                read.SelectionAttributes = this.PendingRequests[resource].Select(parameter => parameter.PropertyName).ToArray();
            }
            finally
            {
                Logger.Instance.WriteMethodExit(EventIdentifier.UpdateLookupsForEachPendingChildInitialized, "Resource: '{0}'.", e.InstanceData);
            }
        }
コード例 #3
0
        /// <summary>
        /// Handles the ChildInitialized event of the ForEachLdap 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 ForEachLdap_ChildInitialized(object sender, ReplicatorChildEventArgs e)
        {
            Logger.Instance.WriteMethodEntry(EventIdentifier.GenerateUniqueValueForEachLdapChildInitialized);

            string stringForResolution = null;

            try
            {
                // Prepare for the execution of the LDAP query by pulling the filter
                // from the definition and assigning it to the resolve lookup string
                // Resolve the [//Value] lookup with the current value before resolution
                Definition          definition    = e.InstanceData as Definition;
                ResolveLookupString resolveFilter = e.Activity as ResolveLookupString;
                if (resolveFilter == null || definition == null)
                {
                    return;
                }

                stringForResolution = ResolveValueFilter(definition.Right, this.resolvedValue);
                resolveFilter.StringForResolution = stringForResolution;
            }
            finally
            {
                Logger.Instance.WriteMethodExit(EventIdentifier.GenerateUniqueValueForEachLdapChildInitialized, "StringForResolution: '{0}'.", stringForResolution);
            }
        }
コード例 #4
0
        /// <summary>
        /// Handles the ChildCompleted event of the ForEachDynamicStringForResolution 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 ForEachDynamicStringForResolution_ChildCompleted(object sender, ReplicatorChildEventArgs e)
        {
            Logger.Instance.WriteMethodEntry(EventIdentifier.UpdateResourcesForEachDynamicStringForResolutionChildCompleted);

            string stringForResolution = e.InstanceData as string;
            string resolved            = null;

            try
            {
                // Using the resolved filter, execute the LDAP query to determine if a conflict exists
                ResolveLookupString resolveDynamicLookupString = e.Activity as ResolveLookupString;
                if (resolveDynamicLookupString == null || string.IsNullOrEmpty(stringForResolution))
                {
                    return;
                }

                resolved = resolveDynamicLookupString.Resolved;

                // Load resolved value expressions to the expression evaluator
                this.ActivityExpressionEvaluator.LookupCache[stringForResolution] = resolved;
            }
            finally
            {
                Logger.Instance.WriteMethodExit(EventIdentifier.UpdateResourcesForEachDynamicStringForResolutionChildCompleted, "StringForResolution: '{0}'. Resolved: '{1}'.", stringForResolution, resolved);
            }
        }
コード例 #5
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.CreateResourceForEachIterationChildCompleted, "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.CreateResourceForEachIterationChildCompleted, "Iteration: '{0}' of '{1}'. Break Iteration '{2}'.", this.iterations, this.ForEachIteration.InitialChildData.Count, this.breakIteration);
            }
        }
コード例 #6
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.DeleteResourcesForEachIterationChildInitialized, "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;
            }
            finally
            {
                Logger.Instance.WriteMethodEntry(EventIdentifier.DeleteResourcesForEachIterationChildInitialized, "Current Iteration Value: '{0}'.", e.InstanceData);
            }
        }
コード例 #7
0
        /// <summary>
        /// Executed as each child activity instance is initialized
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void replicatorActivity1_ChildInitialized(
            object sender, ReplicatorChildEventArgs e)
        {
            //ConsoleMessageActivity cma
            //    = ((SequenceActivity)e.Activity).Activities[0]
            //        as ConsoleMessageActivity;

            //find the activity that needs the input string
            ConsoleMessageActivity cma = e.Activity.GetActivityByName(
                "consoleMessageActivity1", true) as ConsoleMessageActivity;

            //pass the input parameter to the child activity
            if (cma != null)
            {
                cma.Message = e.InstanceData as String;
            }
        }
コード例 #8
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);
            }
        }
コード例 #9
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.ActivityExpressionEvaluator.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);
            }
        }
コード例 #10
0
        /// <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);
            }
        }
コード例 #11
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);
            }
        }
コード例 #12
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);

                // Reset to the original update definitions as ResolveDynamicGrammar updates the working definitions.
                // The If check is really not needed.
                if (this.ResolveDynamicGrammar)
                {
                    DefinitionsConverter updatesConverter = new DefinitionsConverter(this.UpdatesTable);
                    this.updates = updatesConverter.Definitions;
                }
            }
            finally
            {
                Logger.Instance.WriteMethodExit(EventIdentifier.UpdateResourcesForEachIterationChildCompleted, "Iteration: '{0}' of '{1}'. Break Iteration '{2}'.", this.iterations, this.ForEachIteration.InitialChildData.Count, this.breakIteration);
            }
        }
コード例 #13
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.UpdateLookupsForEachRequestChildInitialized, "Resource: '{0}'.", e.InstanceData);

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

                this.CurrentTargetResource    = resource;
                this.CurrentRequestParameters = this.UpdateRequests[resource].ToArray();
            }
            finally
            {
                Logger.Instance.WriteMethodExit(EventIdentifier.UpdateLookupsForEachRequestChildInitialized, "Resource: '{0}'.", e.InstanceData);
            }
        }
コード例 #14
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.ActivityExpressionEvaluator.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.ActivityExpressionEvaluator.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);
            }
        }
コード例 #15
0
        /// <summary>
        /// Handles the ChildCompleted event of the ForEachLdap 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 ForEachLdap_ChildCompleted(object sender, ReplicatorChildEventArgs e)
        {
            Logger.Instance.WriteMethodEntry(EventIdentifier.GenerateUniqueValueForEachLdapChildCompleted);

            try
            {
                // Using the resolved filter, execute the LDAP query to determine if a conflict exists
                Definition          definition    = e.InstanceData as Definition;
                ResolveLookupString resolveFilter = e.Activity as ResolveLookupString;
                if (resolveFilter == null || definition == null)
                {
                    return;
                }

                if (ConflictExistsInLdap(definition.Left, resolveFilter.Resolved))
                {
                    this.ldapConflict = true;
                }
            }
            finally
            {
                Logger.Instance.WriteMethodExit(EventIdentifier.GenerateUniqueValueForEachLdapChildCompleted, "LDAP Conflict: '{0}'.", this.ldapConflict);
            }
        }
コード例 #16
0
 private void SendingEmailsReplicator_ChildCompleted(object sender, ReplicatorChildEventArgs e)
 {
 }
コード例 #17
0
        /// <summary>
        /// Handles the ChildInitialized event of the ForEachDynamicStringForResolution 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 ForEachDynamicStringForResolution_ChildInitialized(object sender, ReplicatorChildEventArgs e)
        {
            Logger.Instance.WriteMethodEntry(EventIdentifier.UpdateResourcesForEachDynamicStringForResolutionChildInitialized);

            string stringForResolution = e.InstanceData as string;

            try
            {
                ResolveLookupString resolveDynamicLookupString = e.Activity as ResolveLookupString;
                if (resolveDynamicLookupString == null || string.IsNullOrEmpty(stringForResolution))
                {
                    return;
                }

                resolveDynamicLookupString.StringForResolution = stringForResolution;
            }
            finally
            {
                Logger.Instance.WriteMethodExit(EventIdentifier.UpdateResourcesForEachDynamicStringForResolutionChildInitialized, "StringForResolution: '{0}'.", stringForResolution);
            }
        }
コード例 #18
0
 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;
 }
コード例 #19
0
 private void replicateTasks_ChildInitialized(object sender, ReplicatorChildEventArgs e)
 {
 }
コード例 #20
0
        /// <summary>
        /// Handles the ChildCompleted event of the ForEachPending 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 ForEachPending_ChildCompleted(object sender, ReplicatorChildEventArgs e)
        {
            Logger.Instance.WriteMethodEntry(EventIdentifier.UpdateLookupsForEachPendingChildCompleted, "Resource: '{0}'.", e.InstanceData);

            try
            {
                Guid resource = new Guid();
                if (e.InstanceData != null)
                {
                    resource = (Guid)((Guid?)e.InstanceData);
                }

                ReadResourceActivity read = e.Activity as ReadResourceActivity;
                if (read == null || read.Resource == null)
                {
                    return;
                }

                List <UpdateRequestParameter> changes = new List <UpdateRequestParameter>();
                foreach (UpdateRequestParameter parameter in this.PendingRequests[resource])
                {
                    // Read the current value of the attribute on the target resource
                    object currentValue = read.Resource[parameter.PropertyName];
                    if (currentValue != null)
                    {
                        // FIM inconsistently returns reference values as either UniqueIdentifiers or Guids
                        // To prevent repetitive checks, convert all UniqueIdentifiers to Guids,
                        // and any List<UniqueIdentifier> to List<Guid>
                        if (currentValue.GetType() == typeof(UniqueIdentifier))
                        {
                            currentValue = ((UniqueIdentifier)currentValue).GetGuid();
                        }
                        else if (currentValue.GetType() == typeof(List <UniqueIdentifier>))
                        {
                            List <Guid> guidList = (from id in (List <UniqueIdentifier>) currentValue select id.GetGuid()).ToList();
                            currentValue = guidList;
                        }
                    }

                    // Determine if the request represents a change based on type
                    bool change = false;
                    if (parameter.Mode == UpdateMode.Modify)
                    {
                        if (parameter.Value == null)
                        {
                            // If the new value is null, only submit the request parameter if the current value is not null
                            change = currentValue != null;
                        }
                        else if (parameter.Value.GetType().IsGenericType&& parameter.Value.GetType().GetGenericTypeDefinition() == typeof(List <>))
                        {
                            // If the new value is multi-valued, assume we are writing to a multi-valued attribute
                            // When the current value is null, simply add all new values
                            if (currentValue == null)
                            {
                                changes.AddRange(from object o in (IEnumerable)parameter.Value select new UpdateRequestParameter(parameter.PropertyName, UpdateMode.Insert, o));
                            }
                            else
                            {
                                if (!(currentValue is IEnumerable))
                                {
                                    currentValue = new object[] { currentValue };
                                }

                                // Identify all values that exist in the new list but not in the current list
                                // and submit them as insert request parameters
                                changes.AddRange(from object o in (IEnumerable)parameter.Value let contains = ((IEnumerable)currentValue).Cast <object>().Contains(o) where !contains select new UpdateRequestParameter(parameter.PropertyName, UpdateMode.Insert, o));

                                // Identify all values that exist in the current list but not in the new list
                                // and submit them as remove request parameters
                                changes.AddRange(from object o in (IEnumerable)currentValue let contains = ((IEnumerable)parameter.Value).Cast <object>().Contains(o) where !contains select new UpdateRequestParameter(parameter.PropertyName, UpdateMode.Remove, o));
                            }
                        }
                        else
                        {
                            // If the new value is not null and is single-valued,
                            // determine if it represents a change to the existing attribute value
                            if (currentValue == null)
                            {
                                change = true;
                            }
                            else
                            {
                                change = !currentValue.Equals(parameter.Value);
                            }
                        }
                    }
                    else
                    {
                        // Check if the insert or remove operation will result in a change
                        // based on the values currently in the target attribute
                        if (currentValue == null)
                        {
                            change = parameter.Mode == UpdateMode.Insert;
                        }
                        else if (parameter.Value != null && currentValue.GetType().IsGenericType&& currentValue.GetType().GetGenericTypeDefinition() == typeof(List <>))
                        {
                            bool contains = ((IEnumerable)currentValue).Cast <object>().Any(o => o.Equals(parameter.Value));

                            switch (parameter.Mode)
                            {
                            case UpdateMode.Insert:
                                change = !contains;
                                break;

                            case UpdateMode.Remove:
                                change = contains;
                                break;
                            }
                        }
                        else
                        {
                            // Current value is not null and is not multivalued or we are trying to insert or remove a null value
                            // The second possibility should have been caught earlier, while the second indicates that the calling activity has been misconfigured
                            // Let the request through so the FIM Service can throw an error if appropriate
                            change = true;
                        }
                    }

                    // If the request parameter will result in a change, add it to the change list
                    // Note that manipulation of multi-valued attributes via modify (overwrite) will have been
                    // addressed via direct insertion of request parameters to the changes collection
                    // In that scenario, change will always be false to prevent inclusion of the original request parameter
                    if (change)
                    {
                        changes.Add(parameter);
                    }
                }

                // If we have changes, add the request to the list that will be submitted
                if (changes.Count > 0)
                {
                    this.UpdateRequests.Add(resource, changes);
                }
            }
            finally
            {
                Logger.Instance.WriteMethodExit(EventIdentifier.UpdateLookupsForEachPendingChildCompleted, "Resource: '{0}'.", e.InstanceData);
            }
        }
コード例 #21
0
 private void replicateTasks_ChildCompleted(object sender, ReplicatorChildEventArgs e)
 {
 }
コード例 #22
0
        private void SendingEmailsReplicator_ChildInitialized(object sender, ReplicatorChildEventArgs e)
        {
            MailData _md = (MailData)e.InstanceData;

            try
            {
                using (EntitiesDataContext EDC = new EntitiesDataContext(_md.URL)
                {
                    ObjectTrackingEnabled = false
                })
                {
                    Shipping        _sp    = Element.GetAtIndex <Shipping>(EDC.Shipping, _md.ShippmentID.ToString());
                    IEmailGrnerator _msg   = default(IEmailGrnerator);
                    string          _cause = default(string);
                    switch (_md.EmailType)
                    {
                    case EmailType.Delayed:
                        _msg = new DelayedShippingVendorTemplate()
                        {
                            TruckTitle = _sp.TruckTitle.Title(),
                        };
                        _cause = "ShipmentDelayed".GetLocalizedString();
                        break;

                    case EmailType.RequestData:
                        switch (_md.Role)
                        {
                        case ExternalRole.Vendor:
                        case ExternalRole.Forwarder:
                            _msg = new SupplementData2hVendorTemplate();
                            break;

                        case ExternalRole.Escort:
                            _msg = new SupplementData2hEscortTemplate();
                            break;

                        default:
                            break;
                        }
                        _cause = "DataRequestShipment".GetLocalizedString();
                        break;

                    case EmailType.Canceled:
                        _msg   = new CanceledShippingVendorTemplate();
                        _cause = "ShipmentCanceled".GetLocalizedString();
                        break;
                    } //switch (_md.EmailType)
                    switch (_md.Role)
                    {
                    case ExternalRole.Vendor:
                    case ExternalRole.Forwarder:
                        _msg.PartnerTitle = _sp.PartnerTitle.Title();
                        m_CarrierNotificationSendEmail_To = _sp.PartnerTitle != null?_sp.PartnerTitle.EmailAddress.UnknownIfEmpty() : CommonDefinition.UnknownEmail;

                        break;

                    case ExternalRole.Escort:
                        _msg.PartnerTitle = _sp.Shipping2PartnerTitle.Title();
                        m_CarrierNotificationSendEmail_To = _sp.Shipping2PartnerTitle != null?_sp.Shipping2PartnerTitle.EmailAddress.UnknownIfEmpty() : CommonDefinition.UnknownEmail;

                        break;

                    default:
                        break;
                    } //switch (_md.Role)
                    _msg.ShippingTitle = _sp.Title();
                    _msg.StartTime     = _sp.StartTime.Value;
                    _msg.Subject       = _sp.Title().Insert(0, _cause);
                    ShepherdRole _ccRole = _sp.IsOutbound.Value ? ShepherdRole.OutboundOwner : ShepherdRole.InboundOwner;
                    string       _cc     = DistributionList.GetEmail(_ccRole, EDC);
                    m_CarrierNotificationSendEmail_Subject1 = _sp.Title().Insert(0, _cause);
                    m_CarrierNotificationSendEmail_CC       = _cc;
                    m_CarrierNotificationSendEmail_From     = _cc;
                    m_CarrierNotificationSendEmail_Body     = _msg.TransformText();
                } //using
            }
            catch (Exception ex)
            {
                ReportException("SendingEmailsReplicator_ChildInitialized", ex);
            }
        }