Exemple #1
0
        public List <Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem> GetChildTasks(List <string> WorkItemIds)
        {
            List <Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem> WorkItems = null;
            string   burnQuery = "";
            TFSQuery query     = new TFSQuery {
                QueryString = burnQuery
            };

            query.Context.Add("project", "KTA");
            return(WorkItems);
        }
Exemple #2
0
 public Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemCollection GetListOfWorkItems(TFSQuery query)
 {
     Validate();
     Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemCollection workItems = workItemStore.Query(query.QueryString);
     return(workItems);
 }
        public QueryResult Execute(WorkItemStore workItemStore, TFSQuery tfsQuery, Duration durationFilter, bool dayPrecision)
        {
            var queryResults = new QueryResult();
            // get the query
            var queryDefinition = new QueryDefinition(Guid.NewGuid().ToString(), tfsQuery.QueryString);
            var query           = new Query(workItemStore, tfsQuery.QueryString, tfsQuery.Context, dayPrecision);

            if (queryDefinition.QueryType == QueryType.OneHop || queryDefinition.QueryType == QueryType.Tree)
            {
                var workItemLinks = query.RunLinkQuery();

                int[] ids = (from WorkItemLinkInfo info in workItemLinks
                             select info.TargetId).ToArray();

                //
                // Next we want to create a new query that will retrieve all the column values from the original query, for
                // each of the work item IDs returned by the original query.
                //
                var detailsWiql = new StringBuilder();
                detailsWiql.AppendLine("SELECT");
                bool first = true;

                foreach (FieldDefinition field in query.DisplayFieldList)
                {
                    detailsWiql.Append(" ");
                    if (!first)
                    {
                        detailsWiql.Append(",");
                    }
                    detailsWiql.AppendLine("[" + field.ReferenceName + "]");
                    first = false;
                }

                detailsWiql.AppendLine("FROM WorkItems");

                //
                // Get the work item details
                //

                int[] uniqueIds = ids.Distinct().ToArray();

                var flatQuery = new Query(workItemStore, detailsWiql.ToString(), uniqueIds);
                Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemCollection flatQueryList = flatQuery.RunQuery();

                //When query returns details, timestamps are converted to client zone. Use Client timestamp to further filter data
                queryResults.Result = FilterOutItemsNotNeeded(WalkLinks(flatQueryList, workItemLinks, null), durationFilter);
            }
            else
            {
                var workItems = query.RunQuery();
                var result    = new List <WorkItemNode>();
                foreach (Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem workItem in workItems)
                {
                    result.Add(new WorkItemNode
                    {
                        Item     = workItem,
                        Children = new List <WorkItemNode>()
                    });
                }
                queryResults.Result = result;
            }

            return(queryResults);
        }
Exemple #4
0
 public QueryResult Execute(TFSQuery query, Duration durationFilter, bool dayPrecision)
 {
     Validate();
     return(executor.Execute(workItemStore, query, durationFilter, dayPrecision));
 }