当前位置: 首页>>代码示例>>C#>>正文


C# WorkItemStore.Query方法代码示例

本文整理汇总了C#中Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore.Query方法的典型用法代码示例。如果您正苦于以下问题:C# WorkItemStore.Query方法的具体用法?C# WorkItemStore.Query怎么用?C# WorkItemStore.Query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore的用法示例。


在下文中一共展示了WorkItemStore.Query方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WorkItemTimeCollection

        /// <summary>
        /// Search all work items
        /// </summary>
        /// <param name="store"></param>
        /// <param name="iterationPath"></param>
        /// <param name="startDate"></param>
        /// <param name="endDate"></param>
        public WorkItemTimeCollection(WorkItemStore store, string iterationPath, DateTime startDate, DateTime endDate)
        {
            this.IterationPath = iterationPath;
            this.Data = new ObservableCollection<WorkItemTime>();

            // Sets a list of dates to compute
            _trackDates.Add(startDate.Date);
            for (DateTime date = startDate.Date; date <= endDate.Date; date = date.AddDays(1))
            {
                _trackDates.Add(date.AddHours(23).AddMinutes(59));
            }

            // Gets all work items for each dates
            foreach (DateTime asOfDate in _trackDates)
            {
                // Execute the query
                var wiCollection = store.Query(this.GetQueryString(asOfDate));

                // Iterate through all work items
                foreach (WorkItem wi in wiCollection)
                {
                    WorkItemTime time = new WorkItemTime(asOfDate, wi);
                    this.Data.Add(time);
                }
            }
        }
开发者ID:dvoituron,项目名称:TfsHistorical,代码行数:33,代码来源:WorkItemTimeCollection.cs

示例2: GetWorkItem

 private static WorkItem GetWorkItem(WorkItemStore workItemStore, string workItemType, int workItemId)
 {
     var queryResults = workItemStore.Query(string.Format(@"
         Select [State], [Title]
         From WorkItems
         Where [Work Item Type] = '{0}' And Id = {1}
         Order By [State] Asc, [Changed Date] Desc", workItemType, workItemId));
     return queryResults.Count == 0 ? null : queryResults[0];
 }
开发者ID:JeffreyVest,项目名称:TfsPbiReader,代码行数:9,代码来源:Program.cs

示例3: Get

        public IEnumerable<FeatureEntity> Get(string project, string rootQuery, string query)
        {
            if (string.IsNullOrEmpty(project)) throw new NullReferenceException("project");
            if (string.IsNullOrEmpty(rootQuery)) throw new NullReferenceException("rootQuery");
            if (string.IsNullOrEmpty(query)) throw new NullReferenceException("query");

            var tpc = new TfsTeamProjectCollection(new Uri(TfsUrl));
            var workItemStore = new WorkItemStore(tpc);

            var queryRoot = workItemStore.Projects[project].QueryHierarchy;
            var folder = (QueryFolder)queryRoot[rootQuery];

            QueryDefinition queryDef = null;
            foreach (var q in query.Split('/'))
            {
                queryDef = (QueryDefinition)folder[q];
            }

            if (queryDef == null)
            {
                throw new Exception(string.Format("Query {0} was not found on the root {1}", query, rootQuery));
            }

            var queryResults = workItemStore.Query(queryDef.QueryText);

            var result = new List<FeatureEntity>();

            foreach (WorkItem wi in queryResults)
            {
                try
                {
                    var targetDate = (DateTime)wi["Target Date"];
                    var targetEndDate = (DateTime)wi["Target End Date"];

                    result.Add(new FeatureEntity
                    {
                        Start = targetDate,
                        End = targetEndDate,
                        Group = wi["Group"].ToString(),
                        Title = wi.Title,
                        Url = string.Format("{0}/{1}/_workitems#_a=edit&id={2}", TfsUrl, project, wi.Id),
                        Risk = wi["Risk"] as string,
                        Tags = wi.Tags,
                        Priority = wi["Priority"].ToString(),
                        Requestor = wi["Requestor"].ToString(),
                        WIId = wi.Id,
                        ChildUSCount = GetAtivatedChildUsCount(workItemStore, wi),
                        Status = wi["Status"].ToString()
                    });
                }
                catch (Exception ex)
                {
                }
            }

            return result;
        }
开发者ID:soft-nt,项目名称:TFSRoadmap,代码行数:57,代码来源:TfsRoadmapProvider.cs

示例4: btnMicrosoftTeamFoundationWorkItemTrackingClientWorkItem_Click

 private void btnMicrosoftTeamFoundationWorkItemTrackingClientWorkItem_Click(object sender, EventArgs e)
 {
     var tfs = new TfsTeamProjectCollection(new Uri(string.Format("http://{0}:8080/tfs", Environment.MachineName)), new TfsClientCredentials(new WindowsCredential(true), true));
     var store = new WorkItemStore(tfs);
     var workItemList = new List<WorkItem>(store.Query("SELECT Id, Title, [Work Item Type] FROM WorkItems").Cast<WorkItem>());
     if (workItemList.Count > 0)
     {
         workItemList[0].PartialOpen();
         workItemList[0].Title = string.Format("changed the title to show the date - {0}", DateTime.Now.ToString("dd MMM yyyy"));
         workItemList[0].Description = "bob is the description";
     }
     Debugger.Break();
 }
开发者ID:Gordon-Beeming,项目名称:DotNet-Pretty,代码行数:13,代码来源:frmMain.cs

示例5: Main

        static void Main(string[] args)
        {
            var tpc = new TfsTeamProjectCollection(new Uri("http://exptfs:8080/tfs/geneva"));
            var workItemStore = new WorkItemStore(tpc);

            var queryRoot = workItemStore.Projects["PSG Dashboard"].QueryHierarchy;
            var folder = (QueryFolder)queryRoot["Shared Queries"];
            var queryDef = (QueryDefinition)folder["All Active Features"];

            var queryResults = workItemStore.Query(queryDef.QueryText);

            foreach (WorkItem q in queryResults)
            {
                Console.WriteLine(q.Tags);
            }
        }
开发者ID:soft-nt,项目名称:TFSRoadmap,代码行数:16,代码来源:Program.cs

示例6: GetWorkItemsFromLinkQuery

        private static WorkItemCollection GetWorkItemsFromLinkQuery(WorkItemStore store, Query workItemQuery,
                                                                    IEnumerable<FieldDefinition> fieldDefinitions)
        {
            var workItemInfo = workItemQuery.RunLinkQuery();

            var allWorkItemIds = workItemInfo.Select(wi => wi.TargetId).Distinct().ToArray();

            if (fieldDefinitions == null)
            {
                return store.Query(allWorkItemIds, "SELECT * FROM WorkItems");
            }
            else
            {
                IEnumerable<string> numericFieldDefinitionNames =
                    fieldDefinitions.Select(fd => "[" + fd.ReferenceName + "]");
                string select = "SELECT " + string.Join(", ", numericFieldDefinitionNames) + " FROM WorkItems";

                var actualWorkItemQuery = new Query(store, select, allWorkItemIds);

                return actualWorkItemQuery.RunQuery();
            }
        }
开发者ID:cqse,项目名称:ScrumPowerTools,代码行数:22,代码来源:WorkItemStoreExtensions.cs

示例7: getFeatureProductBacklogMapping

        private static Dictionary<int, List<WorkItem>> getFeatureProductBacklogMapping(WorkItemStore query, List<int> relatedLinkIds)
        {
            Dictionary<int, List<WorkItem>> featureProductBacklogMapping = new Dictionary<int, List<WorkItem>>();

            var wiqlBacklogs =
                "SELECT [System.Id], [System.Title] FROM WorkItems WHERE [System.Id] IN ({0}) AND [System.WorkItemType] = '產品待處理項目'";
            var queryBacklogs = query.Query(String.Format(wiqlBacklogs, String.Join(",", relatedLinkIds.ToArray())));

            var backlogList = queryBacklogs.Cast<WorkItem>().ToList();
            foreach (var productBacklog in backlogList)
            {
                foreach (
                    var linkId in
                        productBacklog.Links.OfType<RelatedLink>().Select(relatedLink => relatedLink.RelatedWorkItemId))
                {
                    if (!featureProductBacklogMapping.ContainsKey(linkId))
                    {
                        featureProductBacklogMapping.Add(linkId, new List<WorkItem>());
                    }
                    featureProductBacklogMapping[linkId].Add(productBacklog);
                }
            }
            return featureProductBacklogMapping;
        }
开发者ID:wellwind,项目名称:GetTfsPersonalWorks,代码行数:24,代码来源:frmMain.cs

示例8: GetWorkItemCollection

        /// <summary>
        /// Gets a work item collection.
        /// </summary>
        /// <param name="wiqlQueryFormat">The WIQL query format string</param>
        /// <param name="args">The arguments for the format string</param>
        private WorkItemCollection GetWorkItemCollection(WorkItemStore store, string wiqlQueryFormat, params object[] args)
        {
            var wiql = string.Format(wiqlQueryFormat, args);

            return store.Query(wiql);
        }
开发者ID:mwpnl,项目名称:bmx-tfs2012,代码行数:11,代码来源:Tfs2012IssueTrackingProvider.cs

示例9: GetWorkItemByID

        /// <summary>
        /// Gets the work item by its ID.
        /// </summary>
        /// <param name="workItemID">The work item ID.</param>
        private WorkItem GetWorkItemByID(WorkItemStore store, string workItemID)
        {
            var wiql = String.Format(@"SELECT [System.ID], 
                                [System.Title], 
                                [System.Description], 
                                [System.State] 
                                {0} 
                            FROM WorkItems 
                            WHERE [System.ID] = '{1}'",
                            String.IsNullOrEmpty(this.CustomReleaseNumberFieldName)
                             ? ""
                             : ", [" + this.CustomReleaseNumberFieldName + "]",
                            workItemID);
            var workItemCollection = store.Query(wiql);

            if (workItemCollection.Count == 0) throw new Exception("There is no work item with the ID: " + workItemID);
            if (workItemCollection.Count > 1) throw new Exception("There are multiple issues with the same ID: " + workItemID);

            return workItemCollection[0];
        }
开发者ID:mwpnl,项目名称:bmx-tfs2012,代码行数:24,代码来源:Tfs2012IssueTrackingProvider.cs

示例10: Query4BBI

        private WorkItemCollection Query4BBI(WorkItemStore _wis, string _teamProject, string _buildNumber)
        {
            StringBuilder _wiql = new StringBuilder();
            _wiql.AppendLine("SELECT [System.ID], [System.Title]")
                 .AppendLine("FROM WORKITEMS")
                 .AppendLine("WHERE ([HIC.Build.Number] == '" + _buildNumber + "'")
                 .AppendLine("OR")
                 .AppendLine("[System.Title] == '" + _buildNumber + "')")
                 .AppendLine("AND")
                 .AppendLine("[System.TeamProject] == '" + _teamProject + "'")
                 .AppendLine("AND")
                 .AppendLine("[System.WorkItemType] == 'Build Backlog Item'");

            return (_wis.Query(_wiql.ToString()));
        }
开发者ID:hopenbr,项目名称:HopDev,代码行数:15,代码来源:TFWI.DBI.cs

示例11: getProductBacklogTaskMapping

        private Dictionary<int, List<WorkItem>> getProductBacklogTaskMapping(WorkItemStore query)
        {
            var productBacklogTaskMapping = new Dictionary<int, List<WorkItem>>();

            var wiqlTasks =
                "SELECT [System.Id], [System.Title] FROM WorkItems WHERE [System.WorkItemType] = '工作' AND [System.State] = '完成' AND [Microsoft.VSTS.Common.StateChangeDate] >= @today - 30";
            var queryTasks = query.Query(String.Format(wiqlTasks, howManyDays));

            var taskList = queryTasks.Cast<WorkItem>().ToList();
            convertTaskListIntoBacklogTaskMapping(taskList, productBacklogTaskMapping);

            return productBacklogTaskMapping;
        }
开发者ID:wellwind,项目名称:GetTfsPersonalWorks,代码行数:13,代码来源:frmMain.cs

示例12: getFeatures

 private static List<WorkItem> getFeatures(WorkItemStore query, Dictionary<int, List<WorkItem>> featureProductBacklogMapping)
 {
     List<WorkItem> features = new List<WorkItem>();
     var wiqlFeatures =
         "SELECT [System.Id], [System.Title] FROM WorkItems WHERE [System.Id] IN ({0}) AND [System.WorkItemType] = '特殊功能'";
     var queryFeatures =
         query.Query(String.Format(wiqlFeatures, String.Join(",", featureProductBacklogMapping.Keys.ToArray())));
     features = queryFeatures.Cast<WorkItem>().ToList();
     return features;
 }
开发者ID:wellwind,项目名称:GetTfsPersonalWorks,代码行数:10,代码来源:frmMain.cs

示例13: GetWorkItemListById

        public static List<WorkItem> GetWorkItemListById(string idList)
        {

            _workItemStore = GetWorkItemStore;
            WorkItemCollection workItemCollection = _workItemStore.Query(
                "SELECT * FROM WorkItems WHERE [System.TeamProject] = 'LEAP'");

            var _workItemList = new List<WorkItem>();

            foreach(WorkItem wi in workItemCollection)
            {
                _workItemList.Add(wi);
            }
            return _workItemList;
        }
开发者ID:dwhudson,项目名称:TFS_Work_Intake_Interface,代码行数:15,代码来源:ConnectionAndInformation.cs

示例14: Main

        static void Main(string[] args)
        {
            var options = new Options();
            if (!CommandLine.Parser.Default.ParseArguments(args, options))

            {
                Console.WriteLine(options.GetUsage());

                return;
            }

            // Connect to the desired Team Foundation Server
            TfsTeamProjectCollection tfsServer = new TfsTeamProjectCollection(new Uri(options.ServerNameUrl));

            // Authenticate with the Team Foundation Server
            tfsServer.Authenticate();

            // Get a reference to a Work Item Store
            var workItemStore = new WorkItemStore(tfsServer);

            var project = GetProjectByName(workItemStore, options.ProjectName);

            if (project == null)
            {
                Console.WriteLine($"Could not find project '{options.ProjectName}'");
                return;
            }

            var query = GetWorkItemQueryByName(workItemStore, project, options.QueryPath);

            if (query == null)
            {
                Console.WriteLine($"Could not find query '{options.QueryPath}' in project '{options.ProjectName}'");
                return;
            }

            var queryText = query.QueryText.Replace("@project", $"'{project.Name}'");

            Console.WriteLine($"Executing query '{options.QueryPath}' with text '{queryText}'");

            var count = workItemStore.QueryCount(queryText);

            Console.WriteLine($"Exporting {count} work items");

            var workItems = workItemStore.Query(queryText);

            foreach (WorkItem workItem in workItems)
            {
                StoreAttachments(workItem, options.OutputPath);
            }
        }
开发者ID:bwegman,项目名称:TFSDownloadAttachments,代码行数:51,代码来源:Program.cs

示例15: GetIDClause

        private string GetIDClause(WorkItemStore store)
        {
            if (!string.IsNullOrEmpty(RequirementsQuery))
            {
                var query = FindQueryRecursive(store.Projects[ProjectName].QueryHierarchy);
                if (query == null)
                {
                    throw new ApplicationException(string.Format("Could not find query [{0}]", RequirementsQuery));
                }
                if (query.QueryType != QueryType.List)
                {
                    throw new ApplicationException(string.Format("Query [{0}] is not a flat-list query - only flat-list queries are supported", RequirementsQuery));
                }

                var reqs = store.Query(query.QueryText, new Dictionary<string, object> { { "project", ProjectName } } );
                var ids = reqs.Cast<WorkItem>().Select(w => w.Id.ToString()).Aggregate("", (w, s) => s + "," + w);
                ids = ids.Substring(0, ids.Length - 1);

                return string.Format("Source.[System.ID] IN ({0}) AND", ids);
            }
            return "";
        }
开发者ID:colindembovsky,项目名称:TFSReqMatrix,代码行数:22,代码来源:RequirementMatrixGenerator.cs


注:本文中的Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore.Query方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。