public void AddWorkItemLink(IWorkItemExposed destination, string linkTypeName) { var destLinkType = this.workItem.Store.WorkItemLinkTypes .FirstOrDefault(t => t.ForwardEnd.Name == linkTypeName) .ForwardEnd; var relationship = new WorkItemLink(destLinkType, this.Id, destination.Id); // check it does not exist already if (!this.workItem.WorkItemLinks.Contains(relationship)) { this.Logger.AddingWorkItemLink(this.Id, destLinkType, destination.Id); this.workItem.WorkItemLinks.Add(relationship); } else { this.Logger.WorkItemLinkAlreadyExists(this.Id, destLinkType, destination.Id); } }
public void AddWorkItemLink(IWorkItemExposed destination, string linkTypeName) { // HACK: should use the code in wrapper... var relationship = new WorkItemLinkMock(linkTypeName, destination.Id, this.Store); // check it does not exist already if (!this.workItemLinks.Contains(relationship)) { this.workItemLinks.Add(relationship); this.IsDirty = true; } }
/// <summary> /// Used to convert a field to a number. If anything goes wrong then the default value is returned. /// </summary> /// <param name="self">The work item to get the field data from</param> /// <param name="fieldName">The name of the field to be retrieved</param> /// <param name="defaultValue">Value to be returned if something goes wrong.</param> /// <returns></returns> public static TType GetField <TType>(this IWorkItemExposed self, string fieldName, TType defaultValue) { try { TType convertedValue = (TType)self[fieldName]; return(convertedValue); } catch (Exception) { return(defaultValue); } }
internal void AddWorkItemLink(IWorkItemExposed destination, string linkTypeName, IEnumerable <WorkItemLinkType> availableLinkTypes) { WorkItemLinkType workItemLinkType = availableLinkTypes .FirstOrDefault( t => new string[] { t.ForwardEnd.ImmutableName, t.ForwardEnd.Name, t.ReverseEnd.ImmutableName, t.ReverseEnd.Name } .Contains(linkTypeName, StringComparer.OrdinalIgnoreCase)); if (workItemLinkType == null) { throw new ArgumentOutOfRangeException(nameof(linkTypeName)); } WorkItemLinkTypeEnd destLinkType; #pragma warning disable S3240 if ( new string[] { workItemLinkType.ForwardEnd.ImmutableName, workItemLinkType.ForwardEnd.Name } .Contains(linkTypeName, StringComparer.OrdinalIgnoreCase)) { destLinkType = workItemLinkType.ForwardEnd; } else { destLinkType = workItemLinkType.ReverseEnd; } #pragma warning restore S3240 var relationship = new WorkItemLink(destLinkType, this.Id, destination.Id); // check it does not exist already if (!this.workItem.WorkItemLinks.Contains(relationship)) { this.Logger.AddingWorkItemLink(this.Id, destLinkType, destination.Id); this.workItem.WorkItemLinks.Add(relationship); } else { this.Logger.WorkItemLinkAlreadyExists(this.Id, destLinkType, destination.Id); } }
public IWorkItem MakeNewWorkItem(IWorkItemExposed inSameProjectAs, string workItemTypeName) { return(this.MakeNewWorkItem((IWorkItem)inSameProjectAs, workItemTypeName)); }
public void AddWorkItemLink(IWorkItemExposed destination, string linkTypeName) { IEnumerable <WorkItemLinkType> availableLinkTypes = this.workItem.Store.WorkItemLinkTypes; this.AddWorkItemLink(destination, linkTypeName, availableLinkTypes); }
internal void AddWorkItemLink(IWorkItemExposed destination, string linkTypeName, IEnumerable<WorkItemLinkType> availableLinkTypes) { WorkItemLinkType workItemLinkType = availableLinkTypes .FirstOrDefault( t => new string[] { t.ForwardEnd.ImmutableName, t.ForwardEnd.Name, t.ReverseEnd.ImmutableName, t.ReverseEnd.Name } .Contains(linkTypeName, StringComparer.OrdinalIgnoreCase)); if (workItemLinkType == null) { throw new ArgumentOutOfRangeException(nameof(linkTypeName)); } WorkItemLinkTypeEnd destLinkType; #pragma warning disable S3240 if ( new string[] { workItemLinkType.ForwardEnd.ImmutableName, workItemLinkType.ForwardEnd.Name } .Contains(linkTypeName, StringComparer.OrdinalIgnoreCase)) { destLinkType = workItemLinkType.ForwardEnd; } else { destLinkType = workItemLinkType.ReverseEnd; } #pragma warning restore S3240 var relationship = new WorkItemLink(destLinkType, this.Id, destination.Id); // check it does not exist already if (!this.workItem.WorkItemLinks.Contains(relationship)) { this.Logger.AddingWorkItemLink(this.Id, destLinkType, destination.Id); this.workItem.WorkItemLinks.Add(relationship); } else { this.Logger.WorkItemLinkAlreadyExists(this.Id, destLinkType, destination.Id); } }
public void AddWorkItemLink(IWorkItemExposed destination, string linkTypeName) { IEnumerable<WorkItemLinkType> availableLinkTypes = this.workItem.Store.WorkItemLinkTypes; this.AddWorkItemLink(destination, linkTypeName, availableLinkTypes); }
public IWorkItemExposed MakeNewWorkItem(IWorkItemExposed inSameProjectAs, string workItemTypeName) { string projectName = inSameProjectAs.Fields["System.TeamProject"].ToString(); return(MakeNewWorkItem(projectName, workItemTypeName)); }
public static FluentQuery FollowingLinks(this IWorkItemExposed wi, string linkType) { return(new FluentQuery(wi).FollowingLinks(linkType)); }
public static FluentQuery AtMost(this IWorkItemExposed wi, int levels) { return(new FluentQuery(wi).AtMost(levels)); }
// fluent API for GetRelatives public static FluentQuery WhereTypeIs(this IWorkItemExposed wi, string workItemType) { return(new FluentQuery(wi).WhereTypeIs(workItemType)); }
public static bool HasChildren(this IWorkItemExposed self) { return(self.HasRelation(WorkItemImplementationBase.ChildRelationship)); }
public static bool HasParent(this IWorkItemExposed self) { return(self.HasRelation(WorkItemImplementationBase.ParentRelationship)); }