public void UpdateItem(ToDoItem item)
 {
     context.Update(item);
     context.SaveChanges();
 }
Beispiel #2
0
 public void AddItem(ToDoItem item)
 {
     context.Add(item);
     context.SaveChanges();
 }
Beispiel #3
0
 public void DeleteItem(ToDoItem item)
 {
     context.Remove(item);
     context.SaveChanges();
 }
Beispiel #4
0
        public static bool cutPaste(ToDoItem itemToBeCut, ToDoItem parentOfItemToBeCut, ToDoItem pasteParent)
        {
            if (!canBeCutPastedHere(itemToBeCut, pasteParent))
            {
                return(false);
            }

            parentOfItemToBeCut.deleteChild(itemToBeCut);
            pasteParent.addChild(itemToBeCut);
            return(true);
        }
Beispiel #5
0
 public void Create(ToDoItem item)
 {
     db.Items.Add(item);
     db.SaveChanges();
 }
 public void AddItem(ToDoItem item)          //Add an item
 {
     itemContext.Add(item);
     itemContext.SaveChanges();
 }
Beispiel #7
0
 public static bool canBeCutPastedHere(ToDoItem itemToBeCut, ToDoItem pasteParent)
 {
     // check for cyclic dependencies.
     return(itemToBeCut != null && pasteParent != null && !itemToBeCut.containsInTree(pasteParent));
 }
Beispiel #8
0
 public int getChildIndex(ToDoItem child)
 {
     return(children.IndexOf(child));
 }
Beispiel #9
0
 public TreeNode getNodeForToDoItem(ToDoItem item)
 {
     TreeNode[] nodes = treeViewItems.Nodes.Find(item.id, true);
     return(nodes.Length > 0 ? nodes[0] : null);
 }
Beispiel #10
0
 public void addChildNextTo(ToDoItem child, ToDoItem nextTo)
 {
     children.Insert(1 + getChildIndex(nextTo), child);
     setIsModified();
     child.setIsModified();
 }
Beispiel #11
0
 public void addChild(ToDoItem child)
 {
     children.Add(child);
     setIsModified();
     child.setIsModified();
 }
Beispiel #12
0
 public void deleteChild(ToDoItem child)
 {
     children.Remove(child);
     setIsModified();
 }
Beispiel #13
0
 public bool containsInTree(ToDoItem childToLookFor)
 {
     return(this == childToLookFor ||
            children.Find(child => child == childToLookFor || child.containsInTree(childToLookFor)) == childToLookFor);
 }
Beispiel #14
0
 public void AddItem(ToDoItem item)
 {
 }