Example #1
0
        // Remove a to-do task item from the database and collections.
        public void DeleteToDoItem(ToDoItem toDoForDelete)
        {
            // Remove the to-do item from the data context.
            toDoDBContext.Items.DeleteOnSubmit(toDoForDelete);

            // Save changes to the database.
            toDoDBContext.SubmitChanges();

            if (TodayToDoItems.Contains(toDoForDelete))
            {
                TodayToDoItems.Remove(toDoForDelete);
            }
            else if (TomorrowToDoItems.Contains(toDoForDelete))
            {
                TomorrowToDoItems.Remove(toDoForDelete);
            }
            else if (LaterToDoItems.Contains(toDoForDelete))
            {
                LaterToDoItems.Remove(toDoForDelete);
            }
        }
Example #2
0
        public void ChangeCompletedStatus(ToDoItem item, bool completed)
        {
            toDoDBContext.SubmitChanges();

            if (item == null)
            {
                return;
            }
            if (TodayToDoItems.Contains(item))
            {
                TodayToDoItems.Remove(item);
            }
            else if (TomorrowToDoItems.Contains(item))
            {
                TomorrowToDoItems.Remove(item);
            }
            else if (LaterToDoItems.Contains(item))
            {
                LaterToDoItems.Remove(item);
            }
            CompletedToDoItems.Insert(0, item);
        }