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); }
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; } }
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()); }
public void addWorkItem(Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem wi) { this.Rows.Add(wi.Id, wi.Type.Name, wi.State.ToString(), wi.Title); }
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>()); }
public QueryResultViewModel(Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem workItem) { this._workItem = workItem; Id = _workItem.Id; Title = _workItem.Title; }
public void WorkItemSaved(Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem workItem) { Log(LogLevel.Information, "Saved work item #{0}", workItem.Id); }
public void SavingWorkItem(Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem workItem) { Log(LogLevel.Verbose, "Saving work item in TFS"); }
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>(); }
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); } }