Exemple #1
0
        public static void CreateProxyItem(SprintSearchCollection SprintRefID, HPMUniqueID ProjectID, HPMUniqueID masterRefID)
        {
            HPMTaskCreateUnifiedReference parent = new HPMTaskCreateUnifiedReference();

            parent.m_bLocalID = false;
            parent.m_RefID    = SprintRefID.childID;

            HPMTaskCreateUnifiedReference prevTaskID = new HPMTaskCreateUnifiedReference();

            prevTaskID.m_bLocalID = false;
            prevTaskID.m_RefID    = SprintRefID.childID;

            HPMTaskCreateUnified ProxyTaskCreate = new HPMTaskCreateUnified();

            ProxyTaskCreate.m_Tasks                                    = new HPMTaskCreateUnifiedEntry[1];
            ProxyTaskCreate.m_Tasks[0]                                 = new HPMTaskCreateUnifiedEntry();
            ProxyTaskCreate.m_Tasks[0].m_bIsProxy                      = true;
            ProxyTaskCreate.m_Tasks[0].m_LocalID                       = 0;
            ProxyTaskCreate.m_Tasks[0].m_TaskType                      = EHPMTaskType.Planned;
            ProxyTaskCreate.m_Tasks[0].m_TaskLockedType                = EHPMTaskLockedType.BacklogItem;
            ProxyTaskCreate.m_Tasks[0].m_ParentRefIDs                  = new HPMTaskCreateUnifiedReference[1];
            ProxyTaskCreate.m_Tasks[0].m_ParentRefIDs[0]               = parent;
            ProxyTaskCreate.m_Tasks[0].m_PreviousWorkPrioRefID         = new HPMTaskCreateUnifiedReference();
            ProxyTaskCreate.m_Tasks[0].m_PreviousWorkPrioRefID.m_RefID = -2;
            ProxyTaskCreate.m_Tasks[0].m_Proxy_ReferToRefTaskID        = masterRefID;

            prevTaskID.m_bLocalID = true;
            prevTaskID.m_RefID    = 0;

            HPMChangeCallbackData_TaskCreateUnified proxyResult = SessionManager.Session.TaskCreateUnifiedBlock(ProjectID, ProxyTaskCreate);
        }
Exemple #2
0
        //public static Task CreateTask(Task parent, HPMUniqueID ProjectID, string status, HPMUniqueID sprintID)
        public static Task CreateTask(Task parentTask, HPMUniqueID ProjectID, string newTaskName, SprintSearchCollection sprintSearchResult)
        {
            Task newTask = null;

            try
            {
                HPMUniqueID backlogProjectID = SessionManager.Session.ProjectOpenBacklogProject(ProjectID);

                HPMTaskCreateUnifiedReference parentRefId = new HPMTaskCreateUnifiedReference();
                parentRefId.m_RefID    = parentTask.UniqueID;
                parentRefId.m_bLocalID = false;

                HPMTaskCreateUnified createData = new HPMTaskCreateUnified();
                createData.m_Tasks                                    = new HPMTaskCreateUnifiedEntry[1];
                createData.m_Tasks[0]                                 = new HPMTaskCreateUnifiedEntry();
                createData.m_Tasks[0].m_bIsProxy                      = false;
                createData.m_Tasks[0].m_LocalID                       = 0;
                createData.m_Tasks[0].m_ParentRefIDs                  = new HPMTaskCreateUnifiedReference[1];
                createData.m_Tasks[0].m_ParentRefIDs[0]               = parentRefId;
                createData.m_Tasks[0].m_PreviousRefID                 = new HPMTaskCreateUnifiedReference();
                createData.m_Tasks[0].m_PreviousRefID.m_RefID         = -1;
                createData.m_Tasks[0].m_PreviousWorkPrioRefID         = new HPMTaskCreateUnifiedReference();
                createData.m_Tasks[0].m_PreviousWorkPrioRefID.m_RefID = -2;
                createData.m_Tasks[0].m_TaskLockedType                = EHPMTaskLockedType.BacklogItem;
                createData.m_Tasks[0].m_TaskType                      = EHPMTaskType.Planned;
                HPMChangeCallbackData_TaskCreateUnified result = SessionManager.Session.TaskCreateUnifiedBlock(backlogProjectID, createData);
                SessionManager.Session.TaskSetFullyCreated(SessionManager.Session.TaskRefGetTask(result.m_Tasks[0].m_TaskRefID));
                newTask = Task.GetTask(result.m_Tasks[0].m_TaskRefID);
                HPMUniqueID masterRefID = newTask.UniqueID;
                newTask.Name = newTaskName;
                if (sprintSearchResult.childID != null)
                {
                    CreateProxyItem(sprintSearchResult, ProjectID, masterRefID);
                }
            }
            catch (Exception)
            {
                if (newTask != null)
                {
                    SessionManager.Session.TaskDelete(newTask.UniqueTaskID);
                }
            }

            return(newTask);
        }
        private void CloneChildTasks(HansoftItem sourceParent, HansoftItem targetParent, ProjectView targetProject, HPMProjectCustomColumns customColumns)
        {
            Task newTask = null;
            foreach (Task task in sourceParent.Children)
            {
                HPMTaskCreateUnifiedReference prevRefID = new HPMTaskCreateUnifiedReference();
                if (newTask == null)
                    prevRefID.m_RefID = -1;
                else
                    prevRefID.m_RefID = newTask.UniqueTaskID;
                prevRefID.m_bLocalID = false;

                HPMTaskCreateUnifiedReference prevWorkPrioRefID = new HPMTaskCreateUnifiedReference();
                prevWorkPrioRefID.m_RefID = -2;
                prevWorkPrioRefID.m_bLocalID = false;

                HPMTaskCreateUnifiedReference[] parentRefIds = new HPMTaskCreateUnifiedReference[1];
                parentRefIds[0] = new HPMTaskCreateUnifiedReference();
                parentRefIds[0].m_RefID = targetParent.Id; // This should be a taskref, which it should be
                parentRefIds[0].m_bLocalID = false;

                HPMTaskCreateUnified createTaskData = new HPMTaskCreateUnified();
                createTaskData.m_Tasks = new HPMTaskCreateUnifiedEntry[1];
                createTaskData.m_Tasks[0] = new HPMTaskCreateUnifiedEntry();
                createTaskData.m_Tasks[0].m_bIsProxy = false;
                createTaskData.m_Tasks[0].m_LocalID = -1;
                createTaskData.m_Tasks[0].m_ParentRefIDs = parentRefIds;
                createTaskData.m_Tasks[0].m_PreviousRefID = prevRefID;
                createTaskData.m_Tasks[0].m_PreviousWorkPrioRefID = prevWorkPrioRefID;
                createTaskData.m_Tasks[0].m_NonProxy_ReuseID = 0;
                createTaskData.m_Tasks[0].m_TaskLockedType = Session.TaskGetLockedType(task.UniqueTaskID);
                createTaskData.m_Tasks[0].m_TaskType = Session.TaskGetType(task.UniqueTaskID);

                HPMChangeCallbackData_TaskCreateUnified createdData = Session.TaskCreateUnifiedBlock(targetProject.UniqueID, createTaskData);
                if (createdData.m_Tasks.Length == 1)
                {
                    newTask = Task.GetTask(createdData.m_Tasks[0].m_TaskRefID);
                    newTask.Category = task.Category;
                    newTask.Confidence = task.Confidence;
                    newTask.DetailedDescription = task.DetailedDescription;
                    newTask.EstimatedDays = task.EstimatedDays;
                    newTask.Hyperlink = task.Hyperlink;
                    newTask.Name = task.Name;
                    newTask.Points = task.Points;
                    newTask.Priority = task.Priority;
                    newTask.Risk = task.Risk;
                    newTask.Severity = task.Severity;
                    newTask.Status = task.Status;
                    newTask.WorkRemaining = task.WorkRemaining;
                    Session.TaskSetFullyCreated(newTask.UniqueTaskID);
                    foreach (HPMProjectCustomColumnsColumn column in customColumns.m_ShowingColumns)
                        newTask.SetCustomColumnValue(column.m_Name, task.GetCustomColumnValue(column.m_Name));
                    CloneChildTasks(task, newTask, targetProject, customColumns);
                }
            }
        }
        private void CloneChildTasks(HansoftItem sourceParent, HansoftItem targetParent, ProjectView targetProject, HPMProjectCustomColumns customColumns)
        {
            Task newTask = null;

            foreach (Task task in sourceParent.Children)
            {
                HPMTaskCreateUnifiedReference prevRefID = new HPMTaskCreateUnifiedReference();
                if (newTask == null)
                {
                    prevRefID.m_RefID = -1;
                }
                else
                {
                    prevRefID.m_RefID = newTask.UniqueTaskID;
                }
                prevRefID.m_bLocalID = false;

                HPMTaskCreateUnifiedReference prevWorkPrioRefID = new HPMTaskCreateUnifiedReference();
                prevWorkPrioRefID.m_RefID    = -2;
                prevWorkPrioRefID.m_bLocalID = false;

                HPMTaskCreateUnifiedReference[] parentRefIds = new HPMTaskCreateUnifiedReference[1];
                parentRefIds[0]            = new HPMTaskCreateUnifiedReference();
                parentRefIds[0].m_RefID    = targetParent.Id; // This should be a taskref, which it should be
                parentRefIds[0].m_bLocalID = false;

                HPMTaskCreateUnified createTaskData = new HPMTaskCreateUnified();
                createTaskData.m_Tasks                            = new HPMTaskCreateUnifiedEntry[1];
                createTaskData.m_Tasks[0]                         = new HPMTaskCreateUnifiedEntry();
                createTaskData.m_Tasks[0].m_bIsProxy              = false;
                createTaskData.m_Tasks[0].m_LocalID               = -1;
                createTaskData.m_Tasks[0].m_ParentRefIDs          = parentRefIds;
                createTaskData.m_Tasks[0].m_PreviousRefID         = prevRefID;
                createTaskData.m_Tasks[0].m_PreviousWorkPrioRefID = prevWorkPrioRefID;
                createTaskData.m_Tasks[0].m_NonProxy_ReuseID      = 0;
                createTaskData.m_Tasks[0].m_TaskLockedType        = Session.TaskGetLockedType(task.UniqueTaskID);
                createTaskData.m_Tasks[0].m_TaskType              = Session.TaskGetType(task.UniqueTaskID);


                HPMChangeCallbackData_TaskCreateUnified createdData = Session.TaskCreateUnifiedBlock(targetProject.UniqueID, createTaskData);
                if (createdData.m_Tasks.Length == 1)
                {
                    newTask                     = Task.GetTask(createdData.m_Tasks[0].m_TaskRefID);
                    newTask.Category            = task.Category;
                    newTask.Confidence          = task.Confidence;
                    newTask.DetailedDescription = task.DetailedDescription;
                    newTask.EstimatedDays       = task.EstimatedDays;
                    newTask.Hyperlink           = task.Hyperlink;
                    newTask.Name                = task.Name;
                    newTask.Points              = task.Points;
                    newTask.Priority            = task.Priority;
                    newTask.Risk                = task.Risk;
                    newTask.Severity            = task.Severity;
                    newTask.Status              = task.Status;
                    newTask.WorkRemaining       = task.WorkRemaining;
                    Session.TaskSetFullyCreated(newTask.UniqueTaskID);
                    foreach (HPMProjectCustomColumnsColumn column in customColumns.m_ShowingColumns)
                    {
                        newTask.SetCustomColumnValue(column.m_Name, task.GetCustomColumnValue(column.m_Name));
                    }
                    CloneChildTasks(task, newTask, targetProject, customColumns);
                }
            }
        }
        private void CreateTask(string project)
        {
            DataTable dt = GetDataSource(project);
            if (dt != null)
            {
                try
                {
                    HPMUniqueID projectid = new HPMUniqueID(Convert.ToInt32(project));
                    HPMTaskCreateUnified taskCreate = new HPMTaskCreateUnified();
                    Array.Resize(ref taskCreate.m_Tasks, 1);

                    taskCreate.m_Tasks[0] = new HPMTaskCreateUnifiedEntry();
                    // Set previous to -1 to make it the top task.
                    HPMTaskCreateUnifiedReference PrevRefID = new HPMTaskCreateUnifiedReference();
                    PrevRefID.m_RefID = -1;
                    HPMTaskCreateUnifiedReference PrevWorkPrioRefID = new HPMTaskCreateUnifiedReference();
                    PrevWorkPrioRefID.m_RefID = -1;

                    taskCreate.m_Tasks[0].m_LocalID = 0xfab;
                    taskCreate.m_Tasks[0].m_bIsProxy = false;
                    taskCreate.m_Tasks[0].m_TaskType = EHPMTaskType.Planned;
                    taskCreate.m_Tasks[0].m_TaskLockedType = EHPMTaskLockedType.QABug;

                    taskCreate.m_Tasks[0].m_NonProxy_ReuseID = 0;
                    taskCreate.m_Tasks[0].m_NonProxy_WorkflowID = 0xffffffff;

                    taskCreate.m_Tasks[0].m_PreviousRefID = PrevRefID;

                    taskCreate.m_Tasks[0].m_PreviousWorkPrioRefID = PrevWorkPrioRefID;

                    m_VirtSession.ResourceImpersonate(m_ResourceID, EHPMDataHistoryClientOrigin.CustomSDK, m_UpdatedFromWeb);
                    HPMChangeCallbackData_TaskCreateUnified TaskCreateReturn = m_VirtSession.TaskCreateUnifiedBlock(projectid, taskCreate);

                    if (TaskCreateReturn.m_Tasks.Length == 1)
                    {
                        // The returned is a task ref in the project container. We need the task id not the reference id.
                        HPMUniqueID taskrefid = TaskCreateReturn.m_Tasks[0].m_TaskRefID;
                        HPMUniqueID taskid = m_VirtSession.TaskRefGetTask(taskrefid);


                        m_VirtSession.TaskSetOriginallyCreatedBy(taskid, m_ResourceID);
                        // When we set fully created the task becomes visible to users.
                        m_VirtSession.TaskSetFullyCreated(taskid);

                        // set the first workflow status
                        HPMProjectWorkflowSettings settings = m_VirtSession.ProjectWorkflowGetSettings(projectid, 0);
                        foreach (HPMProjectWorkflowObject workflow in settings.m_WorkflowObjects)
                        {
                            if (workflow.m_ObjectType == EHPMProjectWorkflowObjectType.EntryStatus)
                            {
                                HPMWorkflowProgressionStructure progessTo = m_VirtSession.ProjectUtilGetWorkflowProgression(projectid, 0, m_ResourceID, workflow.m_ObjectID);
                                if (progessTo.m_ProgressionStates.Length > 0)
                                {
                                    if (CanProgressToNewStatus(taskid, m_ResourceID, projectid, (int)progessTo.m_ProgressionStates[0].m_StatusID))
                                        m_VirtSession.TaskSetWorkflowStatus(taskid, (int)progessTo.m_ProgressionStates[0].m_StatusID, EHPMTaskSetStatusFlag.DoAutoAssignments | EHPMTaskSetStatusFlag.DoAutoCompletion);
                                }
                                break;
                            }
                        }
                        AddTask(taskrefid, projectid, project, dt, true);
                        GridView gView = GetGridView(project);

                        gView.PageIndex = gView.PageCount;
                        int taskOnPageIndex = (dt.Rows.Count - 1) % gView.PageSize;
                        if (taskOnPageIndex == 0)
                            gView.PageIndex++;
                        gView.SelectedIndex = taskOnPageIndex;
                        gView.EditIndex = taskOnPageIndex;
                        ShowNoItemSelectedText(project, false, "Editing " + Convert.ToString(taskid.m_ID));
                        MultilineTabsReadOnly(false, project);
                        SetDataSource(dt, project);
                        BindGrid(project, dt);
                    }
                }
                catch (HPMSdkException error)
                {
                    SetErrorMessage("Could not create task.", error.ErrorAsStr());
                }
                catch (HPMSdkManagedException error)
                {
                    SetErrorMessage("Could not create task.", error.ErrorAsStr());
                }
                finally
                {
                    m_VirtSession.ResourceImpersonate(m_NoUserID, EHPMDataHistoryClientOrigin.CustomSDK, m_NoMessage);
                }

            }

        }
        public static void CreateProxyItem(SprintSearchCollection SprintRefID, HPMUniqueID ProjectID, HPMUniqueID masterRefID)
        {
            HPMTaskCreateUnifiedReference parent = new HPMTaskCreateUnifiedReference();
            parent.m_bLocalID = false;
            parent.m_RefID = SprintRefID.childID;

            HPMTaskCreateUnifiedReference prevTaskID = new HPMTaskCreateUnifiedReference();
            prevTaskID.m_bLocalID = false;
            prevTaskID.m_RefID = SprintRefID.childID;

            HPMTaskCreateUnified ProxyTaskCreate = new HPMTaskCreateUnified();
            ProxyTaskCreate.m_Tasks = new HPMTaskCreateUnifiedEntry[1];
            ProxyTaskCreate.m_Tasks[0] = new HPMTaskCreateUnifiedEntry();
            ProxyTaskCreate.m_Tasks[0].m_bIsProxy = true;
            ProxyTaskCreate.m_Tasks[0].m_LocalID = 0;
            ProxyTaskCreate.m_Tasks[0].m_TaskType = EHPMTaskType.Planned;
            ProxyTaskCreate.m_Tasks[0].m_TaskLockedType = EHPMTaskLockedType.BacklogItem;
            ProxyTaskCreate.m_Tasks[0].m_ParentRefIDs = new HPMTaskCreateUnifiedReference[1];
            ProxyTaskCreate.m_Tasks[0].m_ParentRefIDs[0] = parent;
            ProxyTaskCreate.m_Tasks[0].m_PreviousWorkPrioRefID = new HPMTaskCreateUnifiedReference();
            ProxyTaskCreate.m_Tasks[0].m_PreviousWorkPrioRefID.m_RefID = -2;
            ProxyTaskCreate.m_Tasks[0].m_Proxy_ReferToRefTaskID = masterRefID;

            prevTaskID.m_bLocalID = true;
            prevTaskID.m_RefID = 0;

            HPMChangeCallbackData_TaskCreateUnified proxyResult = SessionManager.Session.TaskCreateUnifiedBlock(ProjectID, ProxyTaskCreate);
        }
        //public static Task CreateTask(Task parent, HPMUniqueID ProjectID, string status, HPMUniqueID sprintID)
        public static Task CreateTask(Task parentTask, HPMUniqueID ProjectID, string newTaskName, SprintSearchCollection sprintSearchResult)
        {
            Task newTask = null;
            try
            {
                HPMUniqueID backlogProjectID = SessionManager.Session.ProjectOpenBacklogProject(ProjectID);

                HPMTaskCreateUnifiedReference parentRefId = new HPMTaskCreateUnifiedReference();
                parentRefId.m_RefID = parentTask.UniqueID;
                parentRefId.m_bLocalID = false;

                HPMTaskCreateUnified createData = new HPMTaskCreateUnified();
                createData.m_Tasks = new HPMTaskCreateUnifiedEntry[1];
                createData.m_Tasks[0] = new HPMTaskCreateUnifiedEntry();
                createData.m_Tasks[0].m_bIsProxy = false;
                createData.m_Tasks[0].m_LocalID = 0;
                createData.m_Tasks[0].m_ParentRefIDs = new HPMTaskCreateUnifiedReference[1];
                createData.m_Tasks[0].m_ParentRefIDs[0] = parentRefId;
                createData.m_Tasks[0].m_PreviousRefID = new HPMTaskCreateUnifiedReference();
                createData.m_Tasks[0].m_PreviousRefID.m_RefID = -1;
                createData.m_Tasks[0].m_PreviousWorkPrioRefID = new HPMTaskCreateUnifiedReference();
                createData.m_Tasks[0].m_PreviousWorkPrioRefID.m_RefID = -2;
                createData.m_Tasks[0].m_TaskLockedType = EHPMTaskLockedType.BacklogItem;
                createData.m_Tasks[0].m_TaskType = EHPMTaskType.Planned;
                HPMChangeCallbackData_TaskCreateUnified result = SessionManager.Session.TaskCreateUnifiedBlock(backlogProjectID, createData);
                SessionManager.Session.TaskSetFullyCreated(SessionManager.Session.TaskRefGetTask(result.m_Tasks[0].m_TaskRefID));
                newTask = Task.GetTask(result.m_Tasks[0].m_TaskRefID);
                HPMUniqueID masterRefID = newTask.UniqueID;
                newTask.Name = newTaskName;
                if (sprintSearchResult.childID != null)
                {
                    CreateProxyItem(sprintSearchResult, ProjectID, masterRefID);
                }
            }
            catch (Exception)
            {
                if (newTask != null)
                {
                    SessionManager.Session.TaskDelete(newTask.UniqueTaskID);
                }
            }

            return newTask;
        }
Exemple #8
0
        void Update()
        {
            if (InitConnection())
            {
                try
                {
                    if (m_bBrokenConnection)
                    {
                        DestroyConnection();
                    }
                    else
                    {
                        // Check our stuff
                        HPMUInt64 CurrentTime = GetTimeSince1970();
                        if (CurrentTime > m_NextUpdate)
                        {
                            // Find administrator resource

                            HPMResourceEnum Resources = m_Session.ResourceEnum();

                            HPMUniqueID AdminResourceUID = -1;
                            string      ResourceToFind   = "Administrator";
                            for (HPMUInt32 i = 0; i < Resources.m_Resources.Length && !AdminResourceUID.IsValid(); ++i)
                            {
                                HPMUniqueID           ResourceUID  = Resources.m_Resources[i];
                                HPMResourceProperties ResourceInfo = m_Session.ResourceGetProperties(ResourceUID);;

                                if (ResourceInfo.m_Name == ResourceToFind)
                                {
                                    AdminResourceUID = ResourceUID;
                                }
                            }

                            if (AdminResourceUID.IsValid())
                            {
                                // Enumerate projects
                                HPMProjectEnum Projects = m_Session.ProjectEnum();
                                // Loop through projects
                                for (HPMUInt32 i = 0; i < Projects.m_Projects.Length; ++i)
                                {
                                    // Enumerate tasks
                                    HPMUniqueID          ProjectUID  = Projects.m_Projects[i];
                                    HPMTaskEnum          Tasks       = m_Session.TaskEnum(ProjectUID);
                                    HPMProjectProperties ProjectProp = m_Session.ProjectGetProperties(ProjectUID);

                                    HPMUniqueID OurTaskID   = -1;
                                    string      OurTaskDesc = "HPM SDK Simple Sample Task";
                                    for (HPMUInt32 j = 0; j < Tasks.m_Tasks.Length && !OurTaskID.IsValid(); ++j)
                                    {
                                        string Description = m_Session.TaskGetDescription(Tasks.m_Tasks[j]);
                                        if (Description == OurTaskDesc)
                                        {
                                            OurTaskID = Tasks.m_Tasks[j];
                                        }
                                    }

                                    // Impersonate resource so it looks like this resource made the changes.
                                    // The string in the third argument will be shown in the "Change originates from" column in the change history
                                    m_Session.ResourceImpersonate(AdminResourceUID, EHPMDataHistoryClientOrigin.CustomSDK, m_Session.LocalizationCreateUntranslatedStringFromString("Task updated from Sample_SimpleManaged"));

                                    if (!OurTaskID.IsValid())
                                    {
                                        // No old task was found, create a new one
                                        HPMTaskCreateUnified CreateData = new HPMTaskCreateUnified();
                                        Array.Resize(ref CreateData.m_Tasks, 1);
                                        CreateData.m_Tasks[0] = new HPMTaskCreateUnifiedEntry();

                                        // Set previous to -1 to make it the top task.
                                        HPMTaskCreateUnifiedReference PrevRefID = new HPMTaskCreateUnifiedReference();
                                        PrevRefID.m_RefID = -1;
                                        HPMTaskCreateUnifiedReference PrevWorkPrioRefID = new HPMTaskCreateUnifiedReference();
                                        PrevWorkPrioRefID.m_RefID = -2;

                                        CreateData.m_Tasks[0].m_LocalID               = 1;
                                        CreateData.m_Tasks[0].m_PreviousRefID         = PrevRefID;
                                        CreateData.m_Tasks[0].m_PreviousWorkPrioRefID = PrevWorkPrioRefID;

                                        HPMChangeCallbackData_TaskCreateUnified TaskCreateReturn = m_Session.TaskCreateUnifiedBlock(ProjectUID, CreateData);

                                        if (TaskCreateReturn.m_Tasks.Length == 1)
                                        {
                                            // The returned is a task ref in the project container. We need the task id not the reference id.
                                            HPMUniqueID OurTaskRefID = TaskCreateReturn.m_Tasks[0].m_TaskRefID;
                                            OurTaskID = m_Session.TaskRefGetTask(OurTaskRefID);
                                            m_Session.TaskSetDescription(OurTaskID, OurTaskDesc);
                                            // When we set fully created the task becomes visible to users.
                                            m_Session.TaskSetFullyCreated(OurTaskID);
                                            Console.Write("Successfully created task for project: " + ProjectProp.m_Name + "\r\n");
                                        }
                                        else
                                        {
                                            Console.Write("The wrong number of tasks were created, aborting\r\n");
                                        }
                                    }

                                    if (OurTaskID.IsValid())
                                    {
                                        // Set to todays date
                                        HPMTaskTimeZones Zones = new HPMTaskTimeZones();
                                        Array.Resize(ref Zones.m_Zones, 1);
                                        Zones.m_Zones[0]         = new HPMTaskTimeZonesZone();
                                        Zones.m_Zones[0].m_Start = (CurrentTime / (((HPMUInt64)(60 * 60 * 24)) * 1000000)) * (((HPMUInt64)(60 * 60 * 24)) * 1000000); // We must align the time on whole days
                                        Zones.m_Zones[0].m_End   = Zones.m_Zones[0].m_Start;                                                                          // When the end is the same as the start the task is one day long.
                                        m_Session.TaskSetTimeZones(OurTaskID, Zones, false);
                                        Console.Write("Successfully updated task for project: " + ProjectProp.m_Name + "\r\n");
                                    }
                                }
                            }
                            else
                            {
                                Console.Write("No administrator user was found, aborting.\r\n");
                            }

#if (DEBUG)
                            m_NextUpdate = CurrentTime + 10000000;  // Check every 10 seconds
#else
                            m_NextUpdate = CurrentTime + 120000000; // Check every 120 seconds
#endif
                        }
                    }
                }
                catch (HPMSdkException _Error)
                {
                    Console.Write("Exception in processing loop: " + _Error.ErrorAsStr() + "\r\n");
                }
                catch (HPMSdkManagedException _Error)
                {
                    Console.Write("Exception in processing loop: " + _Error.ErrorAsStr() + "\r\n");
                }
            }
        }