示例#1
0
        public int ParseTask(Innovator inn, ref List <WbsElement> output, List <Task> tasks, int taskIndex, string parentID)
        {
            var task = tasks[taskIndex];

            if (task.Summary)
            {
                throw new Exception("ParseTask Invalid param: Is a summary task");
            }

            var wbs = new WbsActivityElement
            {
                ArasID       = inn.getNewID(),
                Name         = task.Name,
                ParentMppID  = parentID,
                OrigMppIndex = task.ID.intValue(),
                Description  = task.Notes,
                //WorkEst = task.Milestone ? 0 : Math.Round(task.Work.Duration / 60, 0),
                WorkEst            = task.Milestone ? 0 : Math.Round(task.Work.Duration, 0),
                DateStart          = task.Milestone ? task.Finish.ToDateTime() : task.Start.ToDateTime(),
                DateDueTarget      = task.Finish.ToDateTime(),
                ExpectedDuration   = task.Milestone ? 0 : Math.Round(task.Duration.Duration, 0),
                PercentComplete    = task.PercentageComplete.ToNullableDecimal() != null ? (decimal)task.PercentageComplete.ToNullableDecimal() : 0,
                IsMilestone        = task.Milestone,
                IsSummaryMilestone = false
            };

            // dependencies can be forward so we have to resolve them in another iteration

            output.Add(wbs);
            //_backgroundWorker.ReportProgress(taskIndex + 1);
            return(taskIndex + 1);
        }
示例#2
0
        // note this is recursive and can skip ahead on the index value returned
        public int ParseSummaryTasks(Innovator inn, ref List <WbsElement> output, List <Task> tasks, int taskIndexIn, string parentID)
        {
            var taskIndex = taskIndexIn;
            var task      = tasks[taskIndex];

            if (!task.Summary)
            {
                throw new Exception("ParseSummaryTask Invalid param: Not a summary task");
            }

            var wbse = new WbsElement
            {
                ArasID       = inn.getNewID(),
                Name         = task.Name,
                ParentMppID  = parentID,
                OrigMppIndex = task.ID.intValue()
            };

            output.Add(wbse);

            ++taskIndex;

            foreach (Task child in task.ChildTasks.ToIEnumerable())
            {
                taskIndex = ParseTasks(inn, ref output, tasks, taskIndex, wbse.ArasID);
                //_backgroundWorker.ReportProgress(taskIndex);
            }

            // add a milestone to mark the end of this summary task
            var wbsMilestone = new WbsActivityElement
            {
                ArasID             = inn.getNewID(),
                Name               = task.Name + " completed",
                ParentMppID        = wbse.ArasID,
                OrigMppIndex       = task.ID.intValue(),
                Description        = task.Notes,
                WorkEst            = 0,
                DateStart          = task.Finish.ToDateTime(),
                DateDueTarget      = task.Finish.ToDateTime(),
                ExpectedDuration   = 0,
                PercentComplete    = 0,
                IsMilestone        = true,
                IsSummaryMilestone = true
            };

            wbse.SummaryMilestoneID = wbsMilestone.ArasID;
            output.Add(wbsMilestone);

            //_backgroundWorker.ReportProgress(taskIndex);
            return(taskIndex);
        }