public void SaveTaskAction() { RestClient.UpdateTask(SelectedTask); for (int i = 0; i < Categories.Count(); i++) { if (Categories[i] == SelectedCategory) { for (int j = 0; j < Categories[i].Tasks.Count(); j++) { if (Categories[i].Tasks[j].Id == SelectedTask.Id) { Categories[i].Tasks[j] = SelectedTask; } else { for (int k = 0; k < Categories[i].Tasks[j].SubTasks.Count(); k++) { if (Categories[i].Tasks[j].SubTasks[k].Id == SelectedTask.Id) { Categories[i].Tasks[j].SubTasks[k] = SelectedTask; } } } } } } SelectedCategory.NotifyProperty(); }
public void ChangeTaskState(int taskId, int newState) { var task = AllTasks.Where(t => t.Id == taskId).First(); var selectedTask = SelectedCategory.Tasks.Where(t => t.Id == taskId).First(); task.State = newState; selectedTask.State = newState; SelectedCategory.NotifyProperty(); RestClient.UpdateTask(task); }
public void AddSubTaskAction(int parentId) { int id = AllTasks.Last().Id + 1; var newTask = new TaskDto { Id = id, Name = "New SubTask", Description = "", State = 3, DeadlineDate = DateTime.Now, ScheduledDate = DateTime.Now, ParentId = SelectedCategory.Id, ParentTaskId = parentId, IsSubTask = true }; //TODO:restclient SelectedCategory.Tasks.Where(t => t.Id == parentId).First().SubTasks.Add(newTask); SelectedCategory.NotifyProperty(); AllTasks.Add(newTask); }
public void AddTaskAction() { int id = AllTasks.Last().Id + 1; var newTask = new TaskDto { Id = id, Name = "New Task", Description = "", State = 3, DeadlineDate = DateTime.Now, ScheduledDate = DateTime.Now, ParentId = SelectedCategory.Id }; RestClient.AddTask(newTask); AllTasks.Add(newTask); SelectedCategory.Tasks.Add(newTask); SelectedCategory.NotifyProperty(); }
public void DeleteTaskAction() { RestClient.DeleteTask(SelectedTask); IsPanelActive = false; AllTasks.Remove(SelectedTask); for (int i = 0; i < Categories.Count(); i++) { if (Categories[i] == SelectedCategory) { for (int j = 0; j < Categories[i].Tasks.Count(); j++) { if (Categories[i].Tasks[j].Id == SelectedTask.Id) { Categories[i].Tasks.RemoveAt(j); } } } } SelectedCategory.NotifyProperty(); }