public void CreatLink(Dictionary <string, int> child) { foreach (WorkItem item in SearchResult) { String pattern = @"UC-\d+"; Match match = Regex.Match(item.Description, pattern, RegexOptions.IgnoreCase); if (match.Value != "") { if (child.ContainsKey(match.Value)) { base.Link(item.Id, child[match.Value], "Shared Steps"); } else { String tempQuery = String.Format("SELECT [System.ID] FROM WorkItems WHERE [System.TeamProject] = '{0}' AND [System.Title] CONTAINS '{1}'", RecentProject.Name, match.Value); WorkItemCollection eItems = ItemStore.Query(tempQuery); foreach (WorkItem eItem in eItems) { if (UC(eItem.Title) == match.Value) { base.Link(item.Id, eItem.Id, "Shared Steps"); } } } } } }
public override bool Operate() { try { SearchResult = ItemStore.Query(CorrectQuery()); Dictionary <string, int> idWithTitle = IDWithTitle(SearchResult); CreatLink(idWithTitle); } catch { return(false); } return(true); }