public static IList <Task> GetTasks() #endif { var localTasks = new List <Task>(DAL.TaskRepository.GetTasks()); #if Win8 NuTask[] newTasks = await RemoteTaskManager.GetNewTasks(localTasks.ToArray()); #else NuTask[] newTasks = RemoteTaskManager.GetNewTasks(localTasks.ToArray()); #endif if (newTasks.Length > 0) { foreach (NuTask newTask in newTasks) { Task task = new Task(); task.Done = newTask.Completed; task.Name = newTask.Subject; task.Notes = newTask.Body; task.Modified = newTask.LastModified; //task.ID = int.Parse(newTask.ExternalId); NOT HERE! var itemId = DAL.TaskRepository.SaveTask(task); RemoteTaskManager.ChangeExternalId(newTask.ExternalId, task); } localTasks = new List <Task>(DAL.TaskRepository.GetTasks()); } return(localTasks); }
public static int SaveTask(Task item) { item.Modified = DateTime.UtcNow; var itemId = DAL.TaskRepository.SaveTask(item); RemoteTaskManager.SaveTask(item); return(itemId); }
static void wsdl_GetTasksCompleted(object sender, GetTasksCompletedEventArgs e) { Task[] localTasks = (Task[])(e.UserState); NuTask[] newTasks = DoTasksComparison(localTasks, e.Result); if (newTasks.Length > 0) { foreach (NuTask newTask in newTasks) { Task task = new Task(); task.Done = newTask.Completed; task.Name = newTask.Subject; task.Notes = newTask.Body; task.Modified = newTask.LastModified; //task.ID = int.Parse(newTask.ExternalId); NOT HERE! var itemId = DAL.TaskRepository.SaveTask(task); RemoteTaskManager.ChangeExternalId(newTask.ExternalId, task); } } }
public static int DeleteTask(int id) { RemoteTaskManager.DeleteTask(id); return(DAL.TaskRepository.DeleteTask(id)); }