Esempio n. 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 "all" observable collection.
            AllToDoItems.Remove(toDoForDelete);

            // Remove the to-do item from the data context.
            toDoDB.Items.DeleteOnSubmit(toDoForDelete);

            // Remove the to-do item from the appropriate category.

            if (toDoForDelete.Category.Id == 1)
            {
                HomeToDoItems.Remove(toDoForDelete);
            }
            else if (toDoForDelete.Category.Id == 2)
            {
                WorkToDoItems.Remove(toDoForDelete);
            }
            else
            {
                HobbiesToDoItems.Remove(toDoForDelete);
            }



            // Save changes to the database.
            toDoDB.SubmitChanges();
        }
Esempio n. 2
0
        // Add a to-do item to the database and collections.
        public void AddToDoItem(ToDoItem newToDoItem)
        {
            // Add a to-do item to the data context.
            toDoDB.Items.InsertOnSubmit(newToDoItem);

            // Save changes to the database.


            // Add a to-do item to the "all" observable collection.
            //AllToDoItems.Add(newToDoItem);

            // Add a to-do item to the appropriate filtered collection.


            if (newToDoItem.Category.Id == 1)
            {
                HomeToDoItems.Add(newToDoItem);
            }
            else if (newToDoItem.Category.Id == 2)
            {
                WorkToDoItems.Add(newToDoItem);
            }
            else if (newToDoItem.Category.Id == 3)
            {
                HobbiesToDoItems.Add(newToDoItem);
            }

            toDoDB.SubmitChanges();
        }
Esempio n. 3
0
        // Add a to-do item to the database and collections.
        public void AddToDoItem(ToDoItem newToDoItem)
        {
            // Add a to-do item to the data context.
            toDoDB.Items.InsertOnSubmit(newToDoItem);

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

            // Add a to-do item to the "all" observable collection.
            AllToDoItems.Add(newToDoItem);

            // Add a to-do item to the appropriate filtered collection.
            switch (newToDoItem.Category.Name)
            {
            case "Home":
                HomeToDoItems.Add(newToDoItem);
                break;

            case "Work":
                WorkToDoItems.Add(newToDoItem);
                break;

            case "Hobbies":
                HobbiesToDoItems.Add(newToDoItem);
                break;

            default:
                break;
            }
        }
Esempio n. 4
0
        // Remove a to-do task item from the database and collections.
        public void DeleteToDoItem(ToDoItem toDoForDelete)
        {
            // Remove the to-do item from the "all" observable collection.
            AllToDoItems.Remove(toDoForDelete);

            // Remove the to-do item from the data context.
            toDoDB.Items.DeleteOnSubmit(toDoForDelete);

            // Remove the to-do item from the appropriate category.
            switch (toDoForDelete.Category.Name)
            {
            case "Home":
                HomeToDoItems.Remove(toDoForDelete);
                break;

            case "Work":
                WorkToDoItems.Remove(toDoForDelete);
                break;

            case "Hobbies":
                HobbiesToDoItems.Remove(toDoForDelete);
                break;

            default:
                break;
            }

            // Save changes to the database.
            toDoDB.SubmitChanges();
        }
Esempio n. 5
0
        public void AddToDoItem(ToDoItem newToDoItem)
        {
            toDoDb.Items.InsertOnSubmit(newToDoItem);

            toDoDb.SubmitChanges();

            AllToDoItems.Add(newToDoItem);

            switch (newToDoItem.Category.Name)
            {
            case "Home":
                HomeToDoItems.Add(newToDoItem);
                break;

            case "Work":
                WorkToDoItems.Add(newToDoItem);
                break;

            case "Hobbies":
                HobbiesToDoItems.Add(newToDoItem);
                break;

            default:
                break;
            }
        }