private void GetSprintReport() { SortableBindingList <Project> projects = (SortableBindingList <Project>)projectBindingSource.DataSource; if (this.checkedListBoxSprintFilter.CheckedItems.Count > 0) { if (checkedListBoxStatus.CheckedItems.Count > 0) { List <Todo> todoList = GetTasksInStatus(); ReportScreen repostScreen = new ReportScreen(todoList, projects); repostScreen.Show(); } else { Dictionary <Sprint, List <Todo> > sprintTodoList = new Dictionary <Sprint, List <Todo> >(); foreach (Object sprint in this.checkedListBoxSprintFilter.CheckedItems) { sprintTodoList.Add((Sprint)sprint, new List <Todo>()); } Project project = (Project)ProjectBindingSource.Current; SortableBindingList <Todo> todos = (SortableBindingList <Todo>)todoBindingSource.DataSource; StringBuilder report = new StringBuilder(); foreach (KeyValuePair <Sprint, List <Todo> > sprint in sprintTodoList) { Dictionary <Status, int> tasksInStatus = new Dictionary <Status, int>(); if (sprint.Key.Kanban != null) { var tasks = from task in sprint.Key.Kanban orderby task.Status select task.TaskPid; if (tasks.Count() > 0) { foreach (Guid todoPid in tasks.ToList()) { var task = from todo in todos where todo.pId == todoPid select todo; if (task.Count() > 0) { Todo todo = (Todo)task.First(); sprint.Value.Add(todo); } } } } } ReportScreen repostScreen = new ReportScreen(sprintTodoList, projects); repostScreen.Show(); } } else { MessageBox.Show("Select Sprint or Sprint Done Tasks", "No Data", MessageBoxButtons.OK, MessageBoxIcon.Hand); } }
private void button1_Click(object sender, EventArgs e) { List <Todo> todoList = new List <Todo>(); foreach (Panel panel in panels) { foreach (Control control in panel.Controls) { if (control.GetType() == typeof(TaskItem)) { TaskItem taskItem = (TaskItem)control; if (taskItem.Checked) { todoList.Add(taskItem.Task); } } } } SortableBindingList <Project> projects = (SortableBindingList <Project>)projectBindingSource.DataSource; ReportScreen repostScreen = new ReportScreen(todoList, projects); repostScreen.Show(); }