Exemplo n.º 1
0
 public bool AddTaskNode(HierarchyObject taskRelations, TaskObject taskToAdd, LevelObject levelToAddTo)
 {
     bool added = false;
     if (_allLevels.Count > 0)
     {
         foreach (LevelObject item in _allLevels)
         {
             if (item.UniqueId.Equals(levelToAddTo.UniqueId))
             {
                 bool valid = true;
                 foreach (HierarchyTaskObject items in item.LevelCollection)
                 {
                     if (taskRelations.UniqueId == items.hierarchyObj.UniqueId
                         && taskToAdd.UniqueId == items.taskObj.UniqueId)
                     {
                         valid = false;
                     }
                 }
                 if(valid == true)
                 {
                     HierarchyTaskObject TO = new HierarchyTaskObject(Guid.NewGuid().ToString(), taskRelations.Name+taskToAdd.Name);
                     TO.hierarchyObj = taskRelations;
                     TO.taskObj = taskToAdd;
                     AddToLevel(levelToAddTo, TO);
                     added = true;
                     break;
                 }
             }
         }
     }
     return added;
 }
Exemplo n.º 2
0
        public static void CreateHierachyTaskObject(bool isCategory, TaskObject taskCreated)
        {
            HierarchyObject hierarchyNodeMetaData = new HierarchyObject(Guid.NewGuid().ToString(), "hierarchyObject_", null, taskCreated);

            if (isCategory == true)
            {
                _appDataSource.NodeManager.AddTaskNode(hierarchyNodeMetaData, taskCreated, _appDataSource.NodeManager.GetAllLevels[0]);
            }
            else
            {
                _appDataSource.NodeManager.AddTaskNode(hierarchyNodeMetaData, taskCreated, _appDataSource.NodeManager.GetAllLevels[1]);
            }
        }