예제 #1
0
        private static RecipientTrackingEvent[] GetRecipientEventsForSummaryReport(IConfigurationSession configurationSession, IRecipientSession recipientSession, MultiValuedProperty <CultureInfo> userLanguages, bool returnHelpDeskMessages, bool trackingAsSender, RecipientTrackingEvent[] internalRecipientTrackingEvents)
        {
            Dictionary <string, RecipientTrackingEvent> dictionary = new Dictionary <string, RecipientTrackingEvent>(StringComparer.OrdinalIgnoreCase);

            for (int i = 0; i < internalRecipientTrackingEvents.Length; i++)
            {
                if (!MessageTrackingReport.ShouldHideEvent(true, internalRecipientTrackingEvents[i], returnHelpDeskMessages, trackingAsSender))
                {
                    RecipientTrackingEvent recipientTrackingEvent = RecipientTrackingEvent.Create(true, configurationSession, userLanguages, returnHelpDeskMessages, internalRecipientTrackingEvents[i]);
                    if (recipientTrackingEvent == null)
                    {
                        ExTraceGlobals.TaskTracer.TraceDebug <string, SmtpAddress>(0L, "Event: {0} not translateable for end-user for recipient: {1}, substituting with generic pending event", Names <EventDescription> .Map[(int)internalRecipientTrackingEvents[i].EventDescription], internalRecipientTrackingEvents[i].RecipientAddress);
                        RecipientTrackingEvent internalRecipientTrackingEvent = new RecipientTrackingEvent(null, internalRecipientTrackingEvents[i].RecipientAddress, internalRecipientTrackingEvents[i].RecipientDisplayName, DeliveryStatus.Pending, EventType.Pending, EventDescription.Pending, null, internalRecipientTrackingEvents[i].Server, internalRecipientTrackingEvents[i].Date, internalRecipientTrackingEvents[i].InternalMessageId, null, internalRecipientTrackingEvents[i].HiddenRecipient, new bool?(internalRecipientTrackingEvents[i].BccRecipient), internalRecipientTrackingEvents[i].RootAddress, null, null);
                        recipientTrackingEvent = RecipientTrackingEvent.Create(true, configurationSession, userLanguages, returnHelpDeskMessages, internalRecipientTrackingEvent);
                        if (recipientTrackingEvent == null)
                        {
                            throw new InvalidOperationException("Generic pending event should always be creatable");
                        }
                    }
                    RecipientTrackingEvent recipientTrackingEvent2;
                    if (!dictionary.TryGetValue(recipientTrackingEvent.RecipientAddress.ToString(), out recipientTrackingEvent2) || recipientTrackingEvent2.Status != _DeliveryStatus.Delivered)
                    {
                        dictionary[recipientTrackingEvent.RecipientAddress.ToString()] = recipientTrackingEvent;
                    }
                }
            }
            if (dictionary.Count == 0)
            {
                return(null);
            }
            return(dictionary.Values.ToArray <RecipientTrackingEvent>());
        }
예제 #2
0
        private static RecipientTrackingEvent[] GetRecipientEventsForRecipientPathReport(IConfigurationSession configurationSession, IRecipientSession recipientSession, MultiValuedProperty <CultureInfo> userLanguages, bool returnHelpDeskMessages, bool trackingAsSender, RecipientTrackingEvent[] internalRecipientTrackingEvents, bool isCompleteReport)
        {
            List <RecipientTrackingEvent> list = new List <RecipientTrackingEvent>(internalRecipientTrackingEvents.Length);
            RecipientTrackingEvent        recipientTrackingEvent = null;

            if (isCompleteReport)
            {
                recipientTrackingEvent = RecipientTrackingEvent.GetExplanatoryMessage(internalRecipientTrackingEvents);
            }
            bool flag = false;

            for (int i = 0; i < internalRecipientTrackingEvents.Length; i++)
            {
                bool flag2 = i == internalRecipientTrackingEvents.Length - 1;
                if (!MessageTrackingReport.ShouldHideEvent(flag2, internalRecipientTrackingEvents[i], returnHelpDeskMessages, trackingAsSender) && (!flag || internalRecipientTrackingEvents[i].EventDescription != EventDescription.FailedGeneral) && (internalRecipientTrackingEvents[i].EventDescription != EventDescription.TransferredToForeignOrg || flag2) && (internalRecipientTrackingEvents[i].EventDescription != EventDescription.FailedTransportRules || returnHelpDeskMessages || (!flag && (i + 1 >= internalRecipientTrackingEvents.Length || (internalRecipientTrackingEvents[i + 1].EventDescription != EventDescription.FailedTransportRules && internalRecipientTrackingEvents[i + 1].EventDescription != EventDescription.FailedGeneral)))))
                {
                    RecipientTrackingEvent recipientTrackingEvent2 = RecipientTrackingEvent.Create(flag2, configurationSession, userLanguages, returnHelpDeskMessages, internalRecipientTrackingEvents[i]);
                    if (recipientTrackingEvent2 != null)
                    {
                        if (internalRecipientTrackingEvents[i].EventDescription == EventDescription.FailedTransportRules || internalRecipientTrackingEvents[i].EventDescription == EventDescription.FailedGeneral)
                        {
                            flag = true;
                        }
                        list.Add(recipientTrackingEvent2);
                    }
                    else
                    {
                        ExTraceGlobals.TaskTracer.TraceDebug <string, SmtpAddress>(0L, "Event: {0} for recipient {1} not translateable for end-user. It will be dropped", Names <EventDescription> .Map[(int)internalRecipientTrackingEvents[i].EventDescription], internalRecipientTrackingEvents[i].RecipientAddress);
                    }
                }
            }
            if (list.Count == 0)
            {
                return(null);
            }
            if (recipientTrackingEvent != null)
            {
                list.Add(recipientTrackingEvent);
            }
            return(list.ToArray());
        }