private ParticipantTable LoadReplyAllParticipantsPerTypeImpl(IConversationTree conversationTree, ICollection <IConversationTreeNode> nodes, SmartPropertyDefinition propertyDefinition)
        {
            ParticipantTable participantTable = this.LoadParticipantsPerType(new ConversationDataExtractor.ParticipantPerTypeLoaderDelegate(this.LoadReplyAllParticipantField), conversationTree, nodes, propertyDefinition);

            participantTable[RecipientItemType.Cc].ExceptWith(participantTable[RecipientItemType.To]);
            return(participantTable);
        }
        private bool CanExtractItemPart(IConversationTree conversationTree, IStorePropertyBag propertyBag, out ParticipantTable recipientTable, out List <Participant> replyToParticipants)
        {
            IConversationTreeNode treeNode = null;
            StoreObjectId         objectId = ((VersionedId)propertyBag.TryGetProperty(ItemSchema.Id)).ObjectId;

            recipientTable      = null;
            replyToParticipants = null;
            if (!conversationTree.TryGetConversationTreeNode(objectId, out treeNode))
            {
                throw new ArgumentException("No ConversationTreeNode can be found for the passed StorePropertyBag");
            }
            if (this.itemParts.ContainsKey(objectId))
            {
                return(true);
            }
            if (this.OnBeforeItemLoad != null)
            {
                LoadItemEventArgs loadItemEventArgs = new LoadItemEventArgs(treeNode, propertyBag);
                this.OnBeforeItemLoad(this, loadItemEventArgs);
                if (loadItemEventArgs.MessagePropertyDefinitions != null)
                {
                    foreach (PropertyDefinition propertyDefinition in loadItemEventArgs.MessagePropertyDefinitions)
                    {
                        ICollection <PropertyDefinition> requiredPropertyDefinitionsWhenReading = propertyDefinition.RequiredPropertyDefinitionsWhenReading;
                        foreach (PropertyDefinition propertyDefinition2 in requiredPropertyDefinitionsWhenReading)
                        {
                            if (!conversationTree.IsPropertyLoaded(propertyDefinition2) && !ConversationDataExtractor.nonNativePropertiesCanBeExtracted.Contains(propertyDefinition2) && !ConversationDataExtractor.BodyPropertiesCanBeExtracted.Contains(propertyDefinition2))
                            {
                                this.optimizationInfo.UpdateItemExtraPropertiesNeeded(objectId);
                                return(false);
                            }
                        }
                    }
                }
            }
            if (true.Equals(propertyBag.TryGetProperty(StoreObjectSchema.IsRestricted)))
            {
                this.optimizationInfo.UpdateItemIrmProtected(objectId);
                return(false);
            }
            if (true.Equals(propertyBag.TryGetProperty(InternalSchema.MapiHasAttachment)))
            {
                if (true.Equals(propertyBag.TryGetProperty(ItemSchema.HasAttachment)))
                {
                    this.optimizationInfo.UpdateItemAttachmentPresent(objectId);
                }
                this.optimizationInfo.UpdateItemMapiAttachmentPresent(objectId);
                return(false);
            }
            recipientTable      = new ParticipantTable();
            replyToParticipants = new List <Participant>();
            if (!this.TryExtractRecipients(propertyBag, recipientTable, replyToParticipants))
            {
                this.optimizationInfo.UpdateItemParticipantNotFound(objectId);
                return(false);
            }
            return(true);
        }
        private ParticipantSet LoadReplyAllParticipantsImpl(IConversationTree conversationTree, ICollection <IConversationTreeNode> nodes, SmartPropertyDefinition propertyDefinition)
        {
            ParticipantSet   participantSet   = new ParticipantSet();
            ParticipantTable participantTable = this.LoadReplyAllParticipantsPerTypeImpl(conversationTree, nodes, propertyDefinition);

            participantSet.UnionWith(participantTable[RecipientItemType.To]);
            participantSet.UnionWith(participantTable[RecipientItemType.Cc]);
            return(participantSet);
        }
Exemplo n.º 4
0
        private ParticipantTable CalculateReplyAllParticipants()
        {
            IParticipant valueOrDefault  = base.StorePropertyBag.GetValueOrDefault <IParticipant>(ItemSchema.From, null);
            IParticipant valueOrDefault2 = base.StorePropertyBag.GetValueOrDefault <IParticipant>(ItemSchema.Sender, null);
            IDictionary <RecipientItemType, HashSet <IParticipant> > dictionary = ReplyAllParticipantsRepresentationProperty <IParticipant> .BuildReplyAllRecipients <IParticipant>(valueOrDefault2, valueOrDefault, this.ReplyToParticipants, base.Recipients.ToDictionary(), ParticipantComparer.EmailAddress);

            ParticipantTable participantTable = new ParticipantTable();

            foreach (KeyValuePair <RecipientItemType, HashSet <IParticipant> > keyValuePair in dictionary)
            {
                participantTable.Add(keyValuePair.Key, keyValuePair.Value);
            }
            return(participantTable);
        }
Exemplo n.º 5
0
        public async Task SaveOrUpdateParticipantAsync(ParticipantDto participant)
        {
            var table = await GetTable("EventData");

            var existingEntry = await GetParticipantAsync(participant.EventCode, participant.ParticipantCode);

            var etag = existingEntry == null ? null : "*";

            var participantTable = new ParticipantTable
            {
                RowKey       = participant.EventCode,
                PartitionKey = participant.ParticipantCode,
                ETag         = etag
            };

            MapParticipantDtoToParticipantTable(participant, participantTable);

            var insertOperation = TableOperation.InsertOrReplace(participantTable);
            await table.ExecuteAsync(insertOperation);
        }
        private ParticipantTable LoadParticipantsPerType(ConversationDataExtractor.ParticipantPerTypeLoaderDelegate loaderDelegate, IConversationTree conversationTree, IEnumerable <IConversationTreeNode> nodes, SmartPropertyDefinition propertyDefinition)
        {
            ParticipantTable participantTable = new ParticipantTable();

            foreach (IConversationTreeNode conversationTreeNode in nodes)
            {
                if (conversationTreeNode.HasData)
                {
                    foreach (IStorePropertyBag propertyBag in conversationTreeNode.StorePropertyBags)
                    {
                        IDictionary <RecipientItemType, ParticipantSet> dictionary = loaderDelegate(conversationTree, propertyBag, propertyDefinition);
                        foreach (KeyValuePair <RecipientItemType, ParticipantSet> keyValuePair in dictionary)
                        {
                            participantTable[keyValuePair.Key].UnionWith(keyValuePair.Value);
                        }
                    }
                }
            }
            return(participantTable);
        }
        private bool TryGetParticipantsFromReplyAllParticipantsProperty(IStorePropertyBag propertyBag, SmartPropertyDefinition propertyDefinition, out ParticipantTable participantTable)
        {
            participantTable = new ParticipantTable();
            object obj = propertyBag.TryGetProperty(propertyDefinition);

            if (PropertyError.IsPropertyError(obj))
            {
                return(false);
            }
            IDictionary <RecipientItemType, HashSet <string> > dictionary = (IDictionary <RecipientItemType, HashSet <string> >)obj;

            foreach (KeyValuePair <RecipientItemType, HashSet <string> > keyValuePair in dictionary)
            {
                IList <Participant> participants = new List <Participant>();
                if (!this.TryResolveParticipants(keyValuePair.Value, participants))
                {
                    return(false);
                }
                participantTable.Add(keyValuePair.Key, participants);
            }
            return(true);
        }
        private bool TryExtractRecipients(IStorePropertyBag propertyBag, ParticipantTable recipientTable, IList <Participant> replyToParticipants)
        {
            IList <Participant> list = new List <Participant>();

            if (!this.TryGetParticipantsFromDisplayNameProperty(propertyBag, ItemSchema.DisplayTo, list))
            {
                return(false);
            }
            recipientTable.Add(RecipientItemType.To, list.ToArray <Participant>());
            list.Clear();
            if (!this.TryGetParticipantsFromDisplayNameProperty(propertyBag, ItemSchema.DisplayCc, list))
            {
                return(false);
            }
            recipientTable.Add(RecipientItemType.Cc, list.ToArray <Participant>());
            list.Clear();
            if (!this.TryGetParticipantsFromDisplayNameProperty(propertyBag, ItemSchema.DisplayBcc, list))
            {
                return(false);
            }
            recipientTable.Add(RecipientItemType.Bcc, list.ToArray <Participant>());
            return(this.TryGetParticipantsFromDisplayNameProperty(propertyBag, MessageItemSchema.ReplyToNames, replyToParticipants));
        }
Exemplo n.º 9
0
 internal ItemPart(StoreObjectId itemId, string subject, FragmentInfo uniqueBodyFragment, FragmentInfo disclaimerFragment, ParticipantTable recipients, IList <Participant> replyToParticipants, IStorePropertyBag storePropertyBag, PropertyDefinition[] loadedProperties) : this(loadedProperties)
 {
     this.itemId             = itemId;
     this.subject            = subject;
     this.storePropertyBag   = storePropertyBag;
     this.uniqueBodyFragment = uniqueBodyFragment;
     this.disclaimerFragment = disclaimerFragment;
     this.recipients         = recipients;
     this.replyToParticipants.AddRange(replyToParticipants);
 }
Exemplo n.º 10
0
 private void MapParticipantTableToParticipantDto(ParticipantTable table, ParticipantDto dto)
 {
     // TODO: MAP PARTICIPANT TABLE OBJECT TO THE PARTICIPANT DTO OBJECT
 }
Exemplo n.º 11
0
 public ItemPart Create(StoreObjectId itemId, IStorePropertyBag propertyBagFromTree, FragmentInfo uniqueBodyFragment, FragmentInfo disclaimerFragment, ParticipantTable recipients, IList <Participant> replyToParticipants)
 {
     return(new ItemPart(itemId, (propertyBagFromTree.TryGetProperty(ItemSchema.Subject) as string) ?? string.Empty, uniqueBodyFragment, disclaimerFragment, recipients, replyToParticipants, propertyBagFromTree, this.queriedPropertyDefinitions));
 }