예제 #1
41
        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);
            }
        }
예제 #2
0
        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;
            }
        }
예제 #3
0
 /// <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);
     }
 }
예제 #4
0
        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);
            }
        }
예제 #5
0
        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);
            }
        }
예제 #6
0
 public IWorkItem MakeNewWorkItem(IWorkItemExposed inSameProjectAs, string workItemTypeName)
 {
     return(this.MakeNewWorkItem((IWorkItem)inSameProjectAs, workItemTypeName));
 }
예제 #7
0
        public void AddWorkItemLink(IWorkItemExposed destination, string linkTypeName)
        {
            IEnumerable <WorkItemLinkType> availableLinkTypes = this.workItem.Store.WorkItemLinkTypes;

            this.AddWorkItemLink(destination, linkTypeName, availableLinkTypes);
        }
예제 #8
0
        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);
            }
        }
예제 #9
0
 public void AddWorkItemLink(IWorkItemExposed destination, string linkTypeName)
 {
     IEnumerable<WorkItemLinkType> availableLinkTypes = this.workItem.Store.WorkItemLinkTypes;
     this.AddWorkItemLink(destination, linkTypeName, availableLinkTypes);
 }
예제 #10
0
        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;
            }
        }
예제 #11
0
        public IWorkItemExposed MakeNewWorkItem(IWorkItemExposed inSameProjectAs, string workItemTypeName)
        {
            string projectName = inSameProjectAs.Fields["System.TeamProject"].ToString();

            return(MakeNewWorkItem(projectName, workItemTypeName));
        }
예제 #12
0
 public static FluentQuery FollowingLinks(this IWorkItemExposed wi, string linkType)
 {
     return(new FluentQuery(wi).FollowingLinks(linkType));
 }
예제 #13
0
 public static FluentQuery AtMost(this IWorkItemExposed wi, int levels)
 {
     return(new FluentQuery(wi).AtMost(levels));
 }
예제 #14
0
 // fluent API for GetRelatives
 public static FluentQuery WhereTypeIs(this IWorkItemExposed wi, string workItemType)
 {
     return(new FluentQuery(wi).WhereTypeIs(workItemType));
 }
예제 #15
0
 public static bool HasChildren(this IWorkItemExposed self)
 {
     return(self.HasRelation(WorkItemImplementationBase.ChildRelationship));
 }
예제 #16
0
 public static bool HasParent(this IWorkItemExposed self)
 {
     return(self.HasRelation(WorkItemImplementationBase.ParentRelationship));
 }