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


C# Client.WorkItem类代码示例

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


WorkItem类属于Microsoft.TeamFoundation.WorkItemTracking.Client命名空间,在下文中一共展示了WorkItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RefreshWorkItems

        public void RefreshWorkItems(IResultsDocument queryResultsDocument)
        {
            string query = queryResultsDocument.QueryDocument.QueryText;
            Hashtable context = GetTfsQueryParameters(queryResultsDocument);

            var tpc = visualStudioAdapter.GetCurrent();
            var workItemStore = tpc.GetService<WorkItemStore>();

            var workItemQuery = new Query(workItemStore, query, context);
            
            NumericFieldDefinitions = GetNumericFieldDefinitions(workItemQuery);

            if (!NumericFieldDefinitions.Any())
            {
                CurrentWorkItems = new WorkItem[0];
                return;
            }

            WorkItemCollection workItemCollection = workItemStore.GetWorkItems(workItemQuery, NumericFieldDefinitions);

            WorkItem[] workItemsA = new WorkItem[workItemCollection.Count];
            ((ICollection)workItemCollection).CopyTo(workItemsA, 0);

            CurrentWorkItems = workItemsA;

            RefreshTotals((queryResultsDocument.SelectedItemIds ?? new int[0]));
        }
开发者ID:cqse,项目名称:ScrumPowerTools,代码行数:27,代码来源:QueryResultsTotalizerModel.cs

示例2: QueryResultsTotalizerModel

        public QueryResultsTotalizerModel(IVisualStudioAdapter visualStudioAdapter)
        {
            this.visualStudioAdapter = visualStudioAdapter;

            CurrentWorkItems = new WorkItem[0];
            NumericFieldDefinitions = new FieldDefinition[0];
        }
开发者ID:cqse,项目名称:ScrumPowerTools,代码行数:7,代码来源:QueryResultsTotalizerModel.cs

示例3: GetRelatedWorkItemLinks

 private IEnumerable<RelatedLink> GetRelatedWorkItemLinks(WorkItem workItem)
 {
     return workItem.Links.Cast<Link>()
         .Where(link => link.BaseType == BaseLinkType.RelatedLink)
         .Select(link => link as RelatedLink)
         .ToList();
 }
开发者ID:benjambe,项目名称:TeamCityBuildChanges,代码行数:7,代码来源:TfsApi.cs

示例4: createChildWorkItems

        /// <summary>
        /// Copies the child work items from the templat work item, under parentWorkItem.
        /// Currently there is no support for multiple nesting in the template. This will only copy one level deep.
        /// </summary>
        /// <param name="parentWorkItem"></param>
        public void createChildWorkItems(WorkItem parentWorkItem, WorkItem templateWorkItem)
        {
            WorkItemLinkTypeEnd childLinkType =  workItemStore.WorkItemLinkTypes.LinkTypeEnds["Child"];
            WorkItemLinkTypeEnd parentLinkType =  workItemStore.WorkItemLinkTypes.LinkTypeEnds["Parent"];

            foreach(WorkItemLink itemLInk in templateWorkItem.WorkItemLinks) {

                if ((itemLInk.BaseType == BaseLinkType.WorkItemLink) && (itemLInk.LinkTypeEnd == childLinkType)) {
                   WorkItem copyWorkItem = getWorkItem(itemLInk.TargetId);

                    if (!copyWorkItem["State"].Equals("Removed")) {
                        WorkItem newWorkItem = copyWorkItem.Copy();

                        newWorkItem.Title =  newWorkItem.Title;
                        newWorkItem.IterationId = parentWorkItem.IterationId;
                        newWorkItem.Links.Clear();

                        clearHistoryFromWorkItem(newWorkItem);

                        //This history entry is added to the new items to prevent recursion on newly created items.
                        newWorkItem.History = Resources.strings.HISTORYTEXT_CLONED;

                        WorkItemLinkTypeEnd linkTypeEnd = parentLinkType;
                        newWorkItem.Links.Add(new RelatedLink(linkTypeEnd, parentWorkItem.Id));
                        newWorkItem.Save();
                    }
                }
            }
        }
开发者ID:JohnFx,项目名称:ImprovedTFS,代码行数:34,代码来源:TFSHelper.cs

示例5: CreateWorkItem

        /// <summary>
        /// Creates a new work item of a defined type
        /// </summary>
        /// <param name="workItemType">The type name</param>
        /// <param name="title">Default title</param>
        /// <param name="description">Default description</param>
        /// <param name="fieldsAndValues">List of extra propierties and values</param>
        /// <returns></returns>
        public WorkItem CreateWorkItem(string workItemType, string title, string description, Dictionary<string, object> fieldsAndValues)
        {
            WorkItemType wiType = workItemTypeCollection[workItemType];
            WorkItem wi = new WorkItem(wiType) { Title = title, Description = description };

            foreach (KeyValuePair<string, object> fieldAndValue in fieldsAndValues)
            {
                string fieldName = fieldAndValue.Key;
                object value = fieldAndValue.Value;

                if (wi.Fields.Contains(fieldName))
                    wi.Fields[fieldName].Value = value;
                else
                    throw new ApplicationException(string.Format("Field not found {0} in workItemType {1}, failed to save the item", fieldName, workItemType));
            }

            if (wi.IsValid())
            {
                wi.Save();
            }
            else
            {
                ArrayList validationErrors = wi.Validate();
                string errMessage = "Work item cannot be saved...";
                foreach (Field field in validationErrors)
                    errMessage += "Field: " + field.Name + " has status: " + field.Status + "/n";

                throw new ApplicationException(errMessage);
            }

            return wi;
        }
开发者ID:rolandocc,项目名称:TFSAPIWrapper,代码行数:40,代码来源:TFSAPI.cs

示例6: ConfigureAsync

        /// <inheritdoc/>
        public async Task ConfigureAsync(TfsServiceProviderConfiguration configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            if(string.IsNullOrEmpty(configuration.WorkItemType))
            {
                throw new ArgumentNullException(nameof(configuration.WorkItemType));
            }

            this.logger.Debug("Configure of TfsSoapServiceProvider started...");
            var networkCredential = new NetworkCredential(configuration.Username, configuration.Password);
            var tfsClientCredentials = new TfsClientCredentials(new BasicAuthCredential(networkCredential)) { AllowInteractive = false };
            var tfsProjectCollection = new TfsTeamProjectCollection(this.serviceUri, tfsClientCredentials);
            this.workItemType = configuration.WorkItemType;
            tfsProjectCollection.Authenticate();
            tfsProjectCollection.EnsureAuthenticated();
            this.logger.Debug("Authentication successful for {serviceUri}.", this.serviceUri.AbsoluteUri);

            await Task.Run(
                () =>
                    {
                        this.logger.Debug("Fetching workitem for id {parentWorkItemId}.", configuration.ParentWorkItemId);
                        this.workItemStore = new WorkItemStore(tfsProjectCollection);
                        this.parentWorkItem = this.workItemStore.GetWorkItem(configuration.ParentWorkItemId);
                        this.logger.Debug("Found parent work item '{title}'.", this.parentWorkItem.Title);
                    });
            this.logger.Verbose("Tfs service provider configuration complete.");
        }
开发者ID:acesiddhu,项目名称:supa,代码行数:32,代码来源:TfsSoapServiceProvider.cs

示例7: IsIncluded

        public bool IsIncluded(WorkItem item)
        {
            if (ExcludedItemTypes.Any(x => x.Equals(item.Type.Name, StringComparison.InvariantCultureIgnoreCase)))
            {
                return false;
            }

            if (Projects.Any(x => x.ProjectName.Equals(item.Project.Name, StringComparison.InvariantCultureIgnoreCase)))
            {
                if (Projects.First(x => x.ProjectName.Equals(item.Project.Name, StringComparison.InvariantCultureIgnoreCase))
                            .ExcludedItemTypes.Any(x => x.Equals(item.Type.Name, StringComparison.InvariantCultureIgnoreCase)))
                {
                    return false;
                }
            }

            if (Whitelist)
            {
                return WhitelistedProjects.Any(x => x.Equals(item.Project.Name, StringComparison.InvariantCultureIgnoreCase)) &&
                       !BlacklistedProjects.Any(x => x.Equals(item.Project.Name, StringComparison.InvariantCultureIgnoreCase));
            }
            else
            {
                return !BlacklistedProjects.Any(x => x.Equals(item.Project.Name, StringComparison.InvariantCultureIgnoreCase));
            }
        }
开发者ID:DanMannMann,项目名称:Timekeeper,代码行数:26,代码来源:TimekeeperVsExtensionSettings.cs

示例8: Map

		public static List<WorkItemField> Map(WorkItem workItem)
		{
			switch (workItem.Type.Name)
			{
				case Constants.TfsBug:
					{
						return GetMapping(workItem, BugFields);
					}
				case Constants.TfsTask:
					{
						return GetMapping(workItem, TaskFields);
					}
				case Constants.TfsUserStory:
					{
						return GetMapping(workItem, UserStoryFields);
					}
				case Constants.TfsIssue:
					{
						return GetMapping(workItem, IssueFields);
					}
				case Constants.TfsBacklogItem:
					{
						return GetMapping(workItem, BackLogFields);
					}
				case Constants.TfsImpediment:
					{
						return GetMapping(workItem, ImpedimentFields);
					}
				default:
					throw new ArgumentException(string.Format("Invalid Work Item Type: {0}", workItem.Type.Name));
			}
		}
开发者ID:TargetProcess,项目名称:Target-Process-Plugins,代码行数:32,代码来源:WorkItemsUsedFields.cs

示例9: GetReleaseNumber

 private static string GetReleaseNumber(WorkItem workItem, string customReleaseNumberFieldName)
 {
     if (string.IsNullOrEmpty(customReleaseNumberFieldName))
         return workItem.IterationPath.Substring(workItem.IterationPath.LastIndexOf('\\') + 1);
     else
         return workItem.Fields[customReleaseNumberFieldName].Value.ToString().Trim();
 }
开发者ID:mwpnl,项目名称:bmx-tfs2012,代码行数:7,代码来源:Tfs2012Issue.cs

示例10: CopyAttributes

 public bool CopyAttributes(Story pivotalstorySource, WorkItem destinationWorkItem)
 {
     destinationWorkItem.Fields[ConchangoTeamsystemScrumEstimatedeffort].Value = pivotalstorySource.Estimate;
     destinationWorkItem.Fields[ConchangoTeamsystemScrumBusinesspriority].Value = pivotalstorySource.Priority;
     destinationWorkItem.Fields[ConchangoTeamsystemScrumDeliveryorder].Value = pivotalstorySource.Priority;
     return true;
 }
开发者ID:ricred,项目名称:PivotalTFS,代码行数:7,代码来源:Conchango_Template.cs

示例11: ProcessWorkItemRelationships

        /// <summary>
        /// Method for processing work items down to the changesets that are related to them
        /// </summary>
        /// <param name="wi">Work Item to process</param>
        /// <param name="outputFile">File to write the dgml to</param>
        /// <param name="vcs">Version Control Server which contains the changesets</param>
        public void ProcessWorkItemRelationships(WorkItem[] wi, 
                                                 string outputFile, 
                                                 bool hideReverse,
                                                 bool groupbyIteration,
                                                 bool dependencyAnalysis,
                                                 List<TempLinkType> selectedLinks,
                                                 VersionControlServer vcs)
        {
            string projectName = wi[0].Project.Name;

            _workItemStubs = new List<WorkItemStub>();
            _wis = wi[0].Store;
            _vcs = vcs;
            _tms = vcs.TeamProjectCollection.GetService<ITestManagementService>();
            _tmp = _tms.GetTeamProject(projectName);
            _selectedLinks = selectedLinks;

            //Store options
            _hideReverse = hideReverse;
            _groupbyIteration = groupbyIteration;
            _dependencyAnalysis = dependencyAnalysis;

            for (int i = 0; i < wi.Length; i++)
            {
                ProcessWorkItemCS(wi[i]);
            }

            WriteChangesetInfo(outputFile, projectName);
        }
开发者ID:amccool,项目名称:WorkItemVisualization,代码行数:35,代码来源:ProcessDGMLData.cs

示例12: AddWorkItem

 public void AddWorkItem()
 {
     WorkItem newItem = new WorkItem( teamProject.WorkItemTypes["タスク"] );
     newItem.Title = "作業項目の概要です";
     newItem.Description = "作業項目の詳細です";
     newItem.Save();
 }
开发者ID:kaorun55,项目名称:tfs_sandbox,代码行数:7,代码来源:TfsClient.cs

示例13: WorkItemModel

 public WorkItemModel(WorkItem workItem)
 {
     Title = workItem.Title;
     ID = workItem.Id;
     Type = workItem.Type.Name;
     CompletedWork = Type == "Task" && workItem["Completed Work"] != null ? (double)workItem["Completed Work"] : 0;
 }
开发者ID:campbell18,项目名称:TimeSheet,代码行数:7,代码来源:WorkItemModel.cs

示例14: FromWorkItem

        /// <summary>
        /// Fills this instance's fields using the values from the provided <see cref="WorkItem"/>.
        /// This includes the Priority, Reason, Original Estimate, Remaining Work and Completed work fields.
        /// </summary>
        public override void FromWorkItem(WorkItem item)
        {
            base.FromWorkItem(item);

            ResolvedBy = GetFieldValue(item, "Resolved By");

            if (item.Fields.Contains("Priority") && item.Fields["Priority"].Value != null)
                Priority = item.Fields["Priority"].Value.ToString().ToIntOrDefault();

            if (item.Fields.Contains("Reason") && item.Fields["Reason"].Value != null)
                Reason = item.Fields["Reason"].Value.ToString();

            // Estimates
            // Check this field exists. 4.2 Agile doesn't have this field
            if (item.Fields.Contains("Original Estimate") && item.Fields["Original Estimate"].Value != null)
                EstimatedHours = item.Fields["Original Estimate"].Value.ToString().ToDoubleOrDefault();

            if (item.Fields.Contains("Remaining Work") && item.Fields["Remaining Work"].Value != null)
                RemainingHours = item.Fields["Remaining Work"].Value.ToString().ToDoubleOrDefault();

            if (item.Fields.Contains("Completed Work") && item.Fields["Completed Work"].Value != null)
                CompletedHours = item.Fields["Completed Work"].Value.ToString().ToDoubleOrDefault();

            // For updates only
            if (item.Fields.Contains("Original Estimate") && item.Fields["Original Estimate"].Value != null)
                EstimatedHours = item.Fields["Original Estimate"].Value.ToString().ToDoubleOrDefault();
        }
开发者ID:yetanotherchris,项目名称:spruce,代码行数:31,代码来源:TaskSummary.cs

示例15: AddToTFVC

        public bool AddToTFVC(string[] _files, WorkItem _wi, Workspace _ws)
        {
            try
             {
                 _ws.Get();
                 // Now add everything.
                 _ws.PendAdd(_files, false);
                 WorkItemCheckinInfo[] _wici = new WorkItemCheckinInfo[1];

                 _wici[0] = new WorkItemCheckinInfo(_wi, WorkItemCheckinAction.Associate);

                 if (_ws.CheckIn(_ws.GetPendingChanges(), null, null, _wici, null) > 0)
                 {
                     _ws.Delete();
                     return true;

                 }
                 else
                 {
                     return false;
                 }

             }
             catch
             {
                 return false;
             }
        }
开发者ID:hopenbr,项目名称:HopDev,代码行数:28,代码来源:TFVC.cs


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