Exemple #1
0
        public async static Task <IQueryable <AzureWorkItem> > GetWorkItems(AzureDevOpsConnectionInfo connInfo, WorkItemTrackingHttpClient witClient, string whereCond)
        {
            var q = new Wiql()
            {
                Query = $"SELECT [System.Id] FROM WorkItems WHERE {whereCond}"
            };
            var result = await witClient.QueryByWiqlAsync(q);

            var wait = await Task.WhenAll(result.WorkItems.Select(x => GetWorkItem(connInfo, witClient, x.Id)));

            return(wait.AsQueryable());
        }
Exemple #2
0
 public AzureWorkItemProfile(AzureDevOpsConnectionInfo connectionInfo)
 {
     CreateMap <WorkItem, AzureWorkItem>()
     .ForMember(dest => dest.Id, opt => opt.MapFrom(src => (int)src.Id))
     .ForMember(dest => dest.Title, opt => opt.MapFrom(src => (string)src.Fields["System.Title"]))
     .ForMember(dest => dest.ItemType, opt => opt.MapFrom(src => (string)src.Fields["System.WorkItemType"]))
     .ForMember(dest => dest.State, opt => opt.MapFrom(src => (string)src.Fields["System.State"]))
     .ForMember(dest => dest.IterationPath, opt => opt.MapFrom(src => (string)src.Fields["System.IterationPath"]))
     .ForMember(dest => dest.AssignedTo, opt => opt.MapFrom(src => src.Fields.ContainsKey("System.AssignedTo") ? (string)src.Fields["System.AssignedTo"] : string.Empty))
     .ForMember(dest => dest.Blocked, opt => opt.MapFrom(src => src.Fields.ContainsKey("Microsoft.VSTS.CMMI.Blocked") ? (string)src.Fields["Microsoft.VSTS.CMMI.Blocked"] : string.Empty))
     .ForMember(dest => dest.CreatedDate, opt => opt.MapFrom(src => src.Fields.ContainsKey("System.CreatedDate") ? (DateTime)src.Fields["System.CreatedDate"] : DateTime.MinValue))
     .ForMember(dest => dest.ClosedDate, opt => opt.MapFrom(src => src.Fields.ContainsKey("Microsoft.VSTS.Common.ClosedDate") ? (DateTime)src.Fields["Microsoft.VSTS.Common.ClosedDate"] : DateTime.MinValue))
     .ForMember(dest => dest.BacklogPriority, opt => opt.MapFrom(src => src.Fields.ContainsKey("Microsoft.VSTS.Common.BacklogPriority") ? (double)src.Fields["Microsoft.VSTS.Common.BacklogPriority"] : double.MaxValue))
     .ForMember(dest => dest.Elapsed, opt => opt.Ignore())
     .ForMember(dest => dest.AssignedOn, opt => opt.Ignore())
     .ForMember(dest => dest.Children, opt => opt.Ignore())
     .ForMember(dest => dest.Parent, opt => opt.Ignore())
     .ForCtorParam("conn", opt => opt.MapFrom(x => connectionInfo));
 }
Exemple #3
0
        public async static Task <AzureWorkItem> GetWorkItem(AzureDevOpsConnectionInfo connInfo, WorkItemTrackingHttpClient witClient, int id)
        {
            var workItem = await witClient.GetWorkItemAsync(id, expand : WorkItemExpand.All);

            var azureWit  = workItem.Map(connInfo);
            var tasks     = workItem.Relations.Where(t => t.Rel == "System.LinkTypes.Hierarchy-Forward").Select(x => GetWorkItem(connInfo, witClient, x.GetItemId()));
            var parentRel = workItem.Relations.FirstOrDefault(t => t.Rel == "System.LinkTypes.Hierarchy-Reverse");

            /*if (parentRel != null)
             * {
             *  azureWit.Parent = await GetWorkItem(connInfo, witClient, parentRel.GetItemId());
             * }*/
            var histories = await witClient.GetRevisionsAsync(id);

            var history = histories.Where(h => h.Fields.ContainsKey("System.AssignedTo")).OrderByDescending(h => h.Fields["System.ChangedDate"]).FirstOrDefault();

            azureWit.AssignedOn = history != null ? (DateTime)history.Fields["System.ChangedDate"] : DateTime.MinValue;
            azureWit.Children   = (await Task.WhenAll(tasks)).OrderBy(x => x.BacklogPriority).ToList();
            return(azureWit);
        }
Exemple #4
0
        public async static Task <IEnumerable <AzureProject> > GetProjects(AzureDevOpsConnectionInfo connInfo, ProjectHttpClient witClient)
        {
            var items = await witClient.GetProjects();

            return(items.Select(x => x.Map()));
        }
Exemple #5
0
 public ConnectionDialog(IConnectionInfo cxInfo)
 {
     _connInfo   = new AzureDevOpsConnectionInfo(cxInfo);
     DataContext = _connInfo;
     InitializeComponent();
 }
Exemple #6
0
 public AzureWorkItem(AzureDevOpsConnectionInfo conn)
 {
     ConnectionInfo = conn;
     Children       = new List <AzureWorkItem>();
 }
Exemple #7
0
 public AzureWorkItemQueryProvider(AzureDevOpsConnectionInfo connInfo, WorkItemTrackingHttpClient _witClient)
 {
     witClient      = _witClient;
     ConnectionInfo = connInfo;
     Expression     = Expression.Constant(this);
 }