public static int? GetWorkItemIdFromConversationId()

in Mail2Bug/WorkItemManagement/MessageToWorkItemMapper.cs [105:128]


        public static int? GetWorkItemIdFromConversationId(string conversationId, SortedList<string, int> bugs, bool useConversationGuidOnly)
        {
            Logger.DebugFormat("GetWorkItemIdFromConversationId {0}", conversationId);
            foreach (var bugConversationId in bugs.Keys)
            {
                if (bugConversationId.Trim() == String.Empty)
                {
                    Logger.DebugFormat("Bug with empty conversation ID found in cache");
                    continue;
                }

                // If we are using only the ConversationGuid, look for an exact match.
                // Otherwise, do a StartsWith match, as we used to do.
                if ((!useConversationGuidOnly && conversationId.StartsWith(bugConversationId)) 
                     || conversationId.Equals(bugConversationId))
                {
                    Logger.DebugFormat("Matched conversation {0} against bug with conversation id {1}", conversationId, bugConversationId);
                    return bugs[bugConversationId];
                }

            }

            return null;
        }