Beispiel #1
0
        internal TaskDetail(ApiModels.TaskDataApi taskDataApi, ApiModels.JobDataApi jobDataApi)
        {
            this.TaskID                  = taskDataApi.TaskID;
            this.TaskNumber              = taskDataApi.TaskNumber;
            this.TaskTitle               = taskDataApi.TaskTitle;
            this.JobID                   = taskDataApi.JobID;
            this.JobNumber               = jobDataApi.JobNumber;
            this.JobTitle                = jobDataApi.JobTitle;
            this.Owner                   = new Owner(taskDataApi.Owner.UserID, taskDataApi.Owner.UserLogin, taskDataApi.Owner.UserHashCode);
            this.MemberListString        = taskDataApi.MemberListString;
            this.ClientNickname          = jobDataApi.Client.ClientNickName;
            this.RowVersion              = taskDataApi.RowVersion;
            this.DueDate                 = Utils.Parser.ToDateTimeFromTaskrowDate(taskDataApi.DueDate);
            this.EffortEstimationMinutes = taskDataApi.EffortEstimation;
            this.Closed                  = taskDataApi.Closed;

            int ownerUserID    = 0;
            int pipelineStepID = 0;

            ApiModels.TaskItemApi taskItemApi;
            this.TaskItems = new List <TaskItem>();

            if (taskDataApi.NewTaskItems != null)
            {
                for (int i = 0; i < taskDataApi.NewTaskItems.Count; i++)
                {
                    taskItemApi = taskDataApi.NewTaskItems[i];

                    if (i == 0)
                    {
                        ownerUserID    = taskItemApi.NewOwnerUserID.GetValueOrDefault();
                        pipelineStepID = taskItemApi.PipelineStepID.GetValueOrDefault();
                    }

                    bool ownerChanged = (taskItemApi.NewOwnerUserID.GetValueOrDefault() != 0 && ownerUserID != taskItemApi.NewOwnerUserID && taskItemApi.NewOwnerUserID.GetValueOrDefault() != 0);
                    if (ownerChanged)
                    {
                        ownerUserID = taskItemApi.NewOwnerUserID.GetValueOrDefault();
                    }

                    bool pipelineChanged = (taskItemApi.PipelineStepID != 0 && pipelineStepID != taskItemApi.PipelineStepID);
                    if (pipelineChanged)
                    {
                        pipelineStepID = taskItemApi.PipelineStepID.GetValueOrDefault();
                    }

                    this.TaskItems.Add(new TaskItem(taskItemApi, ownerChanged, pipelineChanged));
                }
            }

            if (taskDataApi.Tags != null)
            {
                this.Tags = taskDataApi.Tags.Select(a => new TaskTag(a)).ToList();
            }

            if (taskDataApi.Subtasks != null)
            {
                this.SubTasks = taskDataApi.Subtasks.Select(a => new SubTask(a, jobDataApi)).ToList();
            }
        }
Beispiel #2
0
        internal SubTask(ApiModels.SubTaskApi subTaskApi, ApiModels.JobDataApi jobDataApi)
        {
            this.SubTaskID   = subTaskApi.SubTaskID;
            this.TaskID      = subTaskApi.TaskID;
            this.ChildTaskID = subTaskApi.ChildTaskID;
            this.Title       = subTaskApi.Title;

            if (subTaskApi.ChildTask != null)
            {
                this.ChildTask = new TaskDetail(subTaskApi.ChildTask, jobDataApi);
            }
        }