Exemple #1
0
        private static void FindRecursive(WorkItem item, TfsTeamProjectCollection tpc, string project, IDictionary <int, WorkItem> dict)
        {
            if (item == null || item.WorkItemLinks == null)
            {
                return;
            }

            var tempValues = new List <WorkItem>();

            var workItemIds = item.WorkItemLinks
                              .OfType <WorkItemLink>()
                              .Select(x => x.TargetId);

            foreach (var id in workItemIds)
            {
                if (dict.ContainsKey(id))
                {
                    continue;
                }

                var value = GetWorkItem(tpc, project, id);
                tempValues.Add(value);
                dict.Add(id, value);
            }

            foreach (var value in tempValues)
            {
                FindRecursive(value, tpc, project, dict);
            }
        }
        public ChildItemCollection GetChildTasksDetails(string tfsUrlPath, string projectName, string parentId)
        {
            this.Connect(tfsUrlPath, projectName);
            QueryResult result = server.Execute(QueryStore.GetChildTasksQuery(parentId), null, false);

            Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem workItem = server.GetWorkItem(Convert.ToInt32(parentId));
            ChildItemCollection ChildItemCollection = reportEngine.CompileChildTasks(result, tfsUrlPath, projectName, workItem);

            return(ChildItemCollection);
        }
Exemple #3
0
        public WorkItemDto GetWorkItemById(int taskId, int serverId, string userId)
        {
            TeamServer     server         = null;
            UserServerInfo userServerInfo = null;

            try
            {
                using (TeamServerRepository teamServerRepository = new TeamServerRepository())
                {
                    server = teamServerRepository.GetById(serverId);
                    if (server == null)
                    {
                        throw new Exception(string.Format("Invalid Server Id : {0}", serverId));
                    }
                }
                UserInfo userInfo = null;
                using (UserInfoRepository userInfoRepository = new UserInfoRepository())
                {
                    userInfo = userInfoRepository.Find(x => x.UserId != null && x.UserId.ToUpper() == userId.ToUpper());
                    if (userInfo == null)
                    {
                        throw new Exception(string.Format("User with ID {0} Not Found", userId));
                    }
                }

                using (UserServerInfoRepository userServerInfoRepository = new UserServerInfoRepository())
                {
                    userServerInfo = userServerInfoRepository.FindLocal(x => x.UserId != null && x.UserId.ToUpper() == userId.ToUpper() &&
                                                                        x.TfsId == serverId);
                    if (userServerInfo == null)
                    {
                        throw new Exception(string.Format("User : {0} is not registered with server id : {1}", userId, serverId));
                    }
                    string   credentialHash = userServerInfo.CredentialHash;
                    string   url            = server.Url;
                    WorkItem workItem       = _teamServerManagementService.GetWorkItemById(taskId, url, credentialHash);
                    if (workItem != null)
                    {
                        return(workItem.ToDto(serverId));
                    }
                }
                return(null);
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                throw;
            }
        }
Exemple #4
0
        public void InvalidWorkItem(Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem workItem)
        {
            var buf = new StringBuilder();

            foreach (Microsoft.TeamFoundation.WorkItemTracking.Client.Field f in workItem.Fields)
            {
                if (!f.IsValid)
                {
                    buf.AppendLine();
                    buf.AppendFormat("File {0} [{1}] has invalid value '{2}'",
                                     f.Name, f.ReferenceName, f.Value);
                }
            }
            Log(LogLevel.Error, "Work item has validation errors:{0}", buf.ToString());
        }
Exemple #5
0
 public void addWorkItem(Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem wi)
 {
     this.Rows.Add(wi.Id, wi.Type.Name, wi.State.ToString(), wi.Title);
 }
Exemple #6
0
        private IEnumerable <IChangeset> GetAssociatedChangesets(VersionControlServer vcs, WorkItem workItem)
        {
            if (workItem != null)
            {
                return(workItem.Links.OfType <ExternalLink>()
                       .Where(x => String.Equals(LinkingUtilities.DecodeUri(x.LinkedArtifactUri).ArtifactType, "Changeset", StringComparison.Ordinal))
                       .Select(x => vcs.ArtifactProvider.GetChangeset(new Uri(x.LinkedArtifactUri)))
                       .Select(_ChangesetFactory.Create)
                       .OrderBy(x => x)
                       .AsReadOnly());
            }

            return(Enumerable.Empty <IChangeset>());
        }
Exemple #7
0
 public QueryResultViewModel(Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem workItem)
 {
     this._workItem = workItem;
     Id             = _workItem.Id;
     Title          = _workItem.Title;
 }
Exemple #8
0
 public void WorkItemSaved(Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem workItem)
 {
     Log(LogLevel.Information, "Saved work item #{0}", workItem.Id);
 }
Exemple #9
0
 public void SavingWorkItem(Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem workItem)
 {
     Log(LogLevel.Verbose, "Saving work item in TFS");
 }
Exemple #10
0
        private IEnumerable<IChangeset> GetAssociatedChangesets(VersionControlServer vcs, WorkItem workItem)
        {
            if (workItem != null)
            {
                return workItem.Links.OfType<ExternalLink>()
                                     .Where(x => String.Equals(LinkingUtilities.DecodeUri(x.LinkedArtifactUri).ArtifactType, "Changeset", StringComparison.Ordinal))
                                     .Select(x => vcs.ArtifactProvider.GetChangeset(new Uri(x.LinkedArtifactUri)))
                                     .Select(_ChangesetFactory.Create)
                                     .OrderBy(x => x)
                                     .AsReadOnly();
            }

            return Enumerable.Empty<IChangeset>();
        }
Exemple #11
0
        private static void FindRecursive(WorkItem item, TfsTeamProjectCollection tpc, string project, IDictionary<int, WorkItem> dict)
        {
            if (item == null || item.WorkItemLinks == null)
                return;

            var tempValues = new List<WorkItem>();

            var workItemIds = item.WorkItemLinks
                                  .OfType<WorkItemLink>()
                                  .Select(x => x.TargetId);

            foreach (var id in workItemIds)
            {
                if (dict.ContainsKey(id)) continue;

                var value = GetWorkItem(tpc, project, id);
                tempValues.Add(value);
                dict.Add(id, value);
            }

            foreach (var value in tempValues)
            {
                FindRecursive(value, tpc, project, dict);
            }
        }