private ConversationCreatorSidCalculator.MessageType CalculateMessageTypeOnSave(ConversationIndex.FixupStage fixupStage)
 {
     if (ConversationIndex.CheckStageValue(fixupStage, ConversationIndex.FixupStage.Error))
     {
         return(ConversationCreatorSidCalculator.MessageType.Unknown);
     }
     if (ConversationIndex.IsFixUpCreatingNewConversation(fixupStage))
     {
         return(ConversationCreatorSidCalculator.MessageType.RootMessage);
     }
     return(ConversationCreatorSidCalculator.MessageType.NonRootMessage);
 }
 private static ConversationCreatorHelper.MessageDeliveryScenario CalculateConversationDeliveryScenario(ConversationCreatorHelper.ConversationCreatorDefinitionData definitionData, ICorePropertyBag itemPropertyBag, ConversationIndex.FixupStage fixupStage)
 {
     if (ConversationIndex.CheckStageValue(fixupStage, ConversationIndex.FixupStage.Error))
     {
         return(ConversationCreatorHelper.MessageDeliveryScenario.Unknown);
     }
     if (ConversationIndex.IsFixUpCreatingNewConversation(fixupStage))
     {
         return(ConversationCreatorHelper.MessageDeliveryScenario.DeliveringRootMessage);
     }
     if (definitionData.Conversation.RootMessageId == null)
     {
         ExTraceGlobals.StorageTracer.TraceDebug <string, string>(0L, "ConversationCreatorHelper::CalculateConversationDeliveryScenario : On some corner cases, the conversation is loaded without nodes and then root node is null. MessageClassConversationID:{0} FixupStage:{1}", definitionData.Conversation.ConversationId.ToString(), fixupStage.ToString());
         return(ConversationCreatorHelper.MessageDeliveryScenario.DeliveringRootMessage);
     }
     if (ConversationIndex.IsFixupAddingOutOfOrderMessageToConversation(fixupStage) && ConversationCreatorHelper.IsRootMessage(definitionData.Conversation, itemPropertyBag))
     {
         return(ConversationCreatorHelper.MessageDeliveryScenario.DeliveringOutOfOrderRootMessage);
     }
     return(ConversationCreatorHelper.MessageDeliveryScenario.Unknown);
 }
        private ConversationCreatorSidCalculator.MessageType CalculateMessageTypeOnDelivery(ConversationIndex conversationIndex, ICorePropertyBag itemBag, ConversationIndex.FixupStage fixupStage)
        {
            if (ConversationIndex.CheckStageValue(fixupStage, ConversationIndex.FixupStage.Error))
            {
                return(ConversationCreatorSidCalculator.MessageType.Unknown);
            }
            if (ConversationIndex.IsFixUpCreatingNewConversation(fixupStage))
            {
                return(ConversationCreatorSidCalculator.MessageType.RootMessage);
            }
            IConversation conversation = this.LoadConversation(conversationIndex);

            if (conversation.RootMessageNode == null)
            {
                ExTraceGlobals.StorageTracer.TraceDebug <string, string>(0L, "ConversationCreatorHelper::CalculateConversationDeliveryScenario : On some corner cases, the conversation is loaded without nodes and then root node is null. MessageClassConversationID:{0} FixupStage:{1}", this.LoadConversation(conversationIndex).ConversationId.ToString(), fixupStage.ToString());
                return(ConversationCreatorSidCalculator.MessageType.RootMessage);
            }
            if (ConversationIndex.IsFixupAddingOutOfOrderMessageToConversation(fixupStage) && this.IsRootMessage(conversation, itemBag))
            {
                return(ConversationCreatorSidCalculator.MessageType.OutOfOrderRootMessage);
            }
            return(ConversationCreatorSidCalculator.MessageType.NonRootMessage);
        }