/// <summary> /// Fills an List of tasks with a full hierarchy. /// </summary> /// <param name="parent">Parent task</param> /// <param name="tasks">List of tasks, already initialized</param> private static void CollectHierarchy(Task parent, List <Task> tasks) { if (tasks != null) { tasks.Add(parent); } foreach (Task child in Todomoo.GetChildrenTasks(parent)) { CollectHierarchy(child, tasks); } }
void BtnSumTimersClick(object sender, EventArgs e) { int timer = 0; foreach (Task t in Todomoo.GetChildrenTasks(task)) { try { timer += t.Timer; } catch { } } try { numTimerS.Value = timer % 60; numTimerM.Value = ((timer - numTimerS.Value) / 60) % 60; numTimerH.Value = (timer - numTimerS.Value - numTimerM.Value * 60) / (60 * 60); } catch { } }
void BtnSumPriceClick(object sender, EventArgs e) { float sum = 0; DateTime last = DateTime.MinValue; foreach (Task t in Todomoo.GetChildrenTasks(task)) { try { sum += t.Price; if (t.Paid > last) { last = t.Paid; } } catch { } } numPrice.Value = (Decimal)sum; if (last != DateTime.MinValue) { dtPaid.Value = last; } }