Esempio n. 1
0
        public static void CompleteTask(this MapNode node)
        {
            node.Tree.ChangeManager.StartBatch("Complete Task");

            CompletionDateAttribute.SetCompletionDate(node, DateTime.Now);
            TaskStatusAttribute.SetTaskStatus(node, TaskStatus.Complete);

            node.Tree.ChangeManager.EndBatch();
        }
Esempio n. 2
0
 private static void OnAttributeAdded(MapNode node, AttributeChangeEventArgs e)
 {
     if (e.AttributeSpec.IsDueDate())
     {
         if (node.GetTaskStatus() == TaskStatus.None)
         {
             TaskStatusAttribute.SetTaskStatus(node, TaskStatus.Open);
         }
     }
     else if (e.AttributeSpec.IsTaskStatus())
     {
         if (node.GetTaskStatus() == TaskStatus.Complete && !node.CompletionDateExists())
         {
             CompletionDateAttribute.SetCompletionDate(node, DateTime.Now);
         }
     }
 }
Esempio n. 3
0
        public static void AddTask(this MapNode node, DateTime dateTime)
        {
            if (!node.IsTaskPending())
            {
                node.Tree.ChangeManager.StartBatch("Add Task");

                DueDateAttribute.SetDueDate(node, dateTime);
                TaskStatusAttribute.SetTaskStatus(node, TaskStatus.Open);
                CompletionDateAttribute.RemoveCompletionDate(node);

                node.Tree.ChangeManager.EndBatch();

                //node.AttributeBatchUpdate(new MapNode.Attribute[]
                //    {
                //        new MapNode.Attribute(DueDateAttribute.GetOrCreateAttributeSpec(node.Tree), DateHelper.ToString(dateTime)),
                //        new MapNode.Attribute(TaskStatusAttribute.GetOrCreateAttributeSpec(node.Tree), TaskStatus.Open.ToString())
                //    },
                //    new MapTree.AttributeSpec[]
                //    {
                //        CompletionDateAttribute.GetOrCreateAttributeSpec(node.Tree)
                //    });
            }
            else
            {
                node.Tree.ChangeManager.StartBatch("Update Task Due Date");

                if (node.StartDateExists())
                {
                    TimeSpan duration = node.GetDueDate() - node.GetStartDate();
                    node.SetStartDate(dateTime.Subtract(duration));
                }
                DueDateAttribute.SetDueDate(node, dateTime);

                node.Tree.ChangeManager.EndBatch();
            }
        }