示例#1
0
 /// <summary>
 /// Check whether this task is tagged to a release.
 /// </summary>
 /// <param name="release">The release.</param>
 /// <returns>true if this task is tagged to the release, false otherwise.</returns>
 public bool IsTaggedToRelease(Release release)
 {
     HPMTaskLinkedToMilestones relIDs = Session.TaskGetLinkedToMilestones(UniqueTaskID);
     foreach (HPMUniqueID relID in relIDs.m_Milestones)
     {
         if (relID.m_ID == release.UniqueID.m_ID)
             return true;
     }
     return false;
 }
 private static void ProcessExternalDependencies(Release milestone)
 {
     var program = milestone.Project.Name;
     var linkedItems = milestone.LinkedTasks.Where(t => IsTeamProject(t));
     var value = linkedItems.Any(t => !ProgramTeamsConfig.IsTeamInProgram(program, TeamName(t))) ? ExternalDependencies(milestone) : "";
     foreach (Task feature in milestone.ProductBacklogItems)
     {
         bool clearValue = true;
         if (value == "")
         {
             foreach (var otherMilestone in feature.TaggedToReleases.Where(t => t.Name != milestone.Name))
             {
                 if (ExternalDependencies(otherMilestone) != "")
                 {
                     clearValue = false;
                     break;
                 }
             }
         }
         if (value != "" || (value == "" && clearValue))
             feature.SetCustomColumnValue(EXTERNAL_DEPENDENCIES, value);
     }
 }
        private static string ExternalDependencies(Release milestone)
        {
            var program = milestone.Project.Name;
            var allDependencies = new HashSet<string>();
            var dependencies = milestone.LinkedTasks
                .Where(t => IsTeamProject(t) && !ProgramTeamsConfig.IsTeamInProgram(program, TeamName(t)))
                .GroupBy(t => TeamName(t), t => t.AggregatedStatus, (key, s) => new { TeamName = key, AggregatedStatuses = s });

            if (dependencies.Count() > 0)
            {
                var col = milestone.Color;
                milestone.Color = HANSOFT_RED;
                foreach (var dependency in dependencies)
                    allDependencies.Add(string.Format("{0} ({1})", dependency.TeamName, CalcAggregatedStatus(dependency.AggregatedStatuses)));
            }

            var externalDependencies = allDependencies.Count() == 0 ? "" : allDependencies.OrderBy(t => t).Aggregate((current, next) => current + ", " + next);
            return externalDependencies;
        }
 private void ProcessRelease(Release release)
 {
     var name = release.Name;
     List<DateTime> dates = new List<DateTime>();
     foreach (ProductBacklogItem item in release.ProductBacklogItems)
     {
         foreach (Release linkedRelease in item.LinkedTasks.Where(t => t is Release && IsTeamProject(t)))
         {
             dates.Add(linkedRelease.Date);
         }
     }
     if (dates.Count == 0)
         return;
     DateTime maxDate = dates.Max();
     if (maxDate != release.Date)
         release.Date = maxDate;
 }