コード例 #1
0
        /// <summary>
        /// Creates the ProgramFeatureSummary and updates the points value based on the linked values.
        /// </summary>
        /// <param name="current_task"></param>
        /// <param name="updateTaskStatus">If set to true the points for the master item will be update with the aggregated points from the linked items.</param>
        /// <returns>A ASCI art table with containing a summary of what needs to be done.</returns>
        public static string ProgramFeatureSummary(Task current_task, bool updateTaskStatus)
        {
            Dictionary <string, TeamCollection> teamCollection = new Dictionary <string, TeamCollection>();
            Dictionary <string, TaskCollection> taskGroup      = new Dictionary <string, TaskCollection>();

            taskGroup.Add("In progress", new TaskCollection("In progress", 0, 0));
            taskGroup.Add("Completed", new TaskCollection("Completed", 0, 0));
            taskGroup.Add("Blocked", new TaskCollection("Blocked", 0, 0));
            taskGroup.Add("Not done", new TaskCollection("Not done", 0, 0));
            taskGroup.Add("To be deleted", new TaskCollection("To be deleted", 0, 0));
            StringBuilder sb = new StringBuilder();

            foreach (Task task in current_task.LinkedTasks)
            {
                string team = task.Project.Name;
                if (team.ToLower().StartsWith("team - "))
                {
                    if (!teamCollection.ContainsKey(team))
                    {
                        TeamCollection collection = new TeamCollection(taskGroup);
                        collection.team = team;
                        teamCollection.Add(team, collection);
                    }
                    teamCollection[team].addTask(task);
                }
            }


            if (teamCollection.Count > 0)
            {
                string format = "<CODE>{0,-20} │ {1,-11} │ {2, -6} │ {3, -8}│ {4, -15}</CODE>";
                sb.Append(string.Format(format, new object[] { "Name", "Status", "Points", "Stories", "Planned sprint" }));
                sb.Append("\n<CODE>─────────────────────┼─────────────┼────────┼─────────┼───────────────────</CODE>\n");
                foreach (KeyValuePair <string, TeamCollection> pair in teamCollection)
                {
                    sb.Append(pair.Value.FormatString(format) + "\n");
                }

                if (hasParentHeader(current_task.Parent, "Development"))
                {
                    foreach (KeyValuePair <string, TaskCollection> taskPair in taskGroup)
                    {
                        createNewTask(current_task, taskPair.Value);
                    }
                }

                try
                {
                    CustomColumnValue v = current_task.GetCustomColumnValue("Team");
                    // Intead of creating the list I jut simply get the existing list and clear it
                    IList selectedTeams = v.ToStringList();
                    selectedTeams.Clear();
                    foreach (KeyValuePair <string, TeamCollection> pair in teamCollection)
                    {
                        string name = pair.Key.Substring(7);
                        if (!selectedTeams.Contains(name))
                        {
                            selectedTeams.Add(name);
                        }
                    }
                    CustomColumnValue.FromStringList(current_task, current_task.ProjectView.GetCustomColumn("Team"), selectedTeams);
                    CustomColumnValue newValue = CustomColumnValue.FromStringList(current_task, current_task.ProjectView.GetCustomColumn("Team"), selectedTeams);
                    current_task.SetCustomColumnValue("Team", newValue);
                }
                catch (Exception)
                {
                }
            }

            return(sb.ToString());
        }
コード例 #2
0
        /// <summary>
        /// Creates the ProgramFeatureSummary and updates the points value based on the linked values.
        /// </summary>
        /// <param name="current_task"></param>
        /// <param name="updateTaskStatus">If set to true the points for the master item will be update with the aggregated points from the linked items.</param>
        /// <returns>A ASCI art table with containing a summary of what needs to be done.</returns>
        public static string ProgramFeatureSummary(Task current_task, bool updateTaskStatus)
        {
            Dictionary<string, TeamCollection> teamCollection = new Dictionary<string, TeamCollection>();
            Dictionary<string, TaskCollection> taskGroup = new Dictionary<string, TaskCollection>();
            taskGroup.Add("In progress", new TaskCollection("In progress", 0, 0));
            taskGroup.Add("Completed", new TaskCollection("Completed", 0, 0));
            taskGroup.Add("Blocked", new TaskCollection("Blocked", 0, 0));
            taskGroup.Add("Not done", new TaskCollection("Not done", 0, 0));
            taskGroup.Add("To be deleted", new TaskCollection("To be deleted", 0, 0));
            StringBuilder sb = new StringBuilder();
            foreach (Task task in current_task.LinkedTasks)
            {
                string team = task.Project.Name;
                if (team.ToLower().StartsWith("team - "))
                {
                    if (!teamCollection.ContainsKey(team))
                    {
                        TeamCollection collection = new TeamCollection(taskGroup);
                        collection.team = team;
                        teamCollection.Add(team, collection);
                    }
                    teamCollection[team].addTask(task);
                }
            }

            if (teamCollection.Count > 0)
            {
                string format = "<CODE>{0,-20} │ {1,-11} │ {2, -6} │ {3, -8}│ {4, -15}</CODE>";
                sb.Append(string.Format(format, new object[] { "Name", "Status", "Points", "Stories", "Planned sprint" }));
                sb.Append("\n<CODE>─────────────────────┼─────────────┼────────┼─────────┼───────────────────</CODE>\n");
                foreach (KeyValuePair<string, TeamCollection> pair in teamCollection)
                {
                    sb.Append(pair.Value.FormatString(format) + "\n");
                }

                if (hasParentHeader(current_task.Parent, "Development"))
                {
                    foreach (KeyValuePair<string, TaskCollection> taskPair in taskGroup)
                    {
                        createNewTask(current_task, taskPair.Value);
                    }
                }

                try
                {
                    CustomColumnValue v = current_task.GetCustomColumnValue("Team");
                    // Intead of creating the list I jut simply get the existing list and clear it
                    IList selectedTeams = v.ToStringList();
                    selectedTeams.Clear();
                    foreach (KeyValuePair<string, TeamCollection> pair in teamCollection)
                    {
                        string name = pair.Key.Substring(7);
                        if (!selectedTeams.Contains(name))
                        {
                            selectedTeams.Add(name);
                        }
                    }
                    CustomColumnValue.FromStringList(current_task, current_task.ProjectView.GetCustomColumn("Team"), selectedTeams);
                    CustomColumnValue newValue = CustomColumnValue.FromStringList(current_task, current_task.ProjectView.GetCustomColumn("Team"), selectedTeams);
                    current_task.SetCustomColumnValue("Team", newValue);
                }
                catch (Exception)
                {

                }
            }

            return sb.ToString();
        }