コード例 #1
0
        /// <summary>
        /// Retrieves a <see cref="WorkItemSummary"/> for the given ID.
        /// </summary>
        public WorkItemSummary ItemById(int id)
        {
            WorkItem item = UserContext.Current.WorkItemStore.GetWorkItem(id);

            WorkItemSummary summary = WorkItemSummaryFactory.GetForType(item.Type);

            summary.FromWorkItem(item);
            summary.PopulateAllowedValues(item);
            summary.IsNew = false;

            return(summary);
        }
コード例 #2
0
        /// <summary>
        /// Converts a <see cref="WorkItemCollection"/> to an <see cref="IEnuermable`WorkItemSummary"/>
        /// </summary>
        /// <param name="collection"></param>
        /// <returns></returns>
        public static IEnumerable <WorkItemSummary> ToSummaries(this WorkItemCollection collection)
        {
            List <WorkItemSummary> list = new List <WorkItemSummary>();

            foreach (WorkItem item in collection)
            {
                WorkItemSummary summary = WorkItemSummaryFactory.GetForType(item.Type);
                summary.FromWorkItem(item);
                list.Add(summary);
            }

            return(list);
        }