protected void Page_Load(object sender, EventArgs e)
        {
            _hintPopup.Options.IsPopup           = true;
            _hintPopupTaskRemove.Options.IsPopup = true;
            _newLinkError.Options.IsPopup        = true;

            SubtasksCount = Task.SubTasks.Count;

            CanEditTask        = ProjectSecurity.CanEdit(Task);
            CanCreateSubtask   = ProjectSecurity.CanCreateSubtask(Task);
            CanCreateTimeSpend = ProjectSecurity.CanCreateTimeSpend(Task);
            CanDeleteTask      = ProjectSecurity.CanDelete(Task);

            InitAttachments();
            InitCommentBlock(commentList, Task);

            var timeList = Page.EngineFactory.TimeTrackingEngine.GetByTask(Task.ID);

            TaskTimeSpend = timeList.Sum(timeSpend => timeSpend.Hours).ToString();
            TaskTimeSpend = TaskTimeSpend.Replace(',', '.');

            var taskCount = Page.EngineFactory.CommentEngine.Count(Task);

            CommentsCountTitle = taskCount != 0 ? string.Format("({0})", taskCount.ToString(CultureInfo.InvariantCulture)) : "";
        }
Exemple #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Utility.RegisterTypeForAjax(typeof(TaskDescriptionView), Page);

            _hintPopup.Options.IsPopup           = true;
            _hintPopupTaskRemove.Options.IsPopup = true;
            _newLinkError.Options.IsPopup        = true;

            IsMobile = MobileDetector.IsRequestMatchesMobile(Context);

            CanReadFiles       = ProjectSecurity.CanReadFiles(Task.Project);
            CanEditTask        = ProjectSecurity.CanEdit(Task);
            CanCreateSubtask   = ProjectSecurity.CanCreateSubtask(Task);
            CanCreateTimeSpend = ProjectSecurity.CanCreateTimeSpend(Task);
            CanDeleteTask      = ProjectSecurity.CanDelete(Task);
            SubtasksCount      = Task.SubTasks.Count;

            if (CanReadFiles)
            {
                InitAttachments();
            }

            InitCommentBlock();

            var timeList = Global.EngineFactory.GetTimeTrackingEngine().GetByTask(Task.ID);

            TaskTimeSpend = timeList.Sum(timeSpend => timeSpend.Hours).ToString();
            TaskTimeSpend = TaskTimeSpend.Replace(',', '.');
        }
Exemple #3
0
        public TaskWrapper(Task task)
        {
            Id          = task.ID;
            Title       = task.Title;
            Description = task.Description;
            Status      = (int)task.Status;

            if (Status > 2)
            {
                Status = 1;
            }

            if (task.Responsibles != null)
            {
                Responsibles = task.Responsibles.Select(EmployeeWraper.Get).OrderBy(r => r.DisplayName).ToList();
            }


            Deadline     = (task.Deadline == DateTime.MinValue ? null : new ApiDateTime(task.Deadline, TimeZoneInfo.Local));
            Priority     = task.Priority;
            ProjectOwner = new SimpleProjectWrapper(task.Project);
            MilestoneId  = task.Milestone;
            Created      = (ApiDateTime)task.CreateOn;
            CreatedBy    = EmployeeWraper.Get(task.CreateBy);
            Updated      = (ApiDateTime)task.LastModifiedOn;
            StartDate    = task.StartDate.Equals(DateTime.MinValue) ? null : (ApiDateTime)task.StartDate;

            if (task.CreateBy != task.LastModifiedBy)
            {
                UpdatedBy = EmployeeWraper.Get(task.LastModifiedBy);
            }

            if (task.SubTasks != null)
            {
                Subtasks = task.SubTasks.Select(x => new SubtaskWrapper(x, task)).ToList();
            }

            Progress = task.Progress;

            if (task.Milestone != 0 && task.MilestoneDesc != null)
            {
                Milestone = new SimpleMilestoneWrapper(task.MilestoneDesc);
            }

            if (task.Links.Any())
            {
                Links = task.Links.Select(r => new TaskLinkWrapper(r));
            }

            CanEdit            = ProjectSecurity.CanEdit(task);
            CanCreateSubtask   = ProjectSecurity.CanCreateSubtask(task);
            CanCreateTimeSpend = ProjectSecurity.CanCreateTimeSpend(task);
            CanDelete          = ProjectSecurity.CanDelete(task);
            CanReadFiles       = ProjectSecurity.CanReadFiles(task.Project);
        }
        public SimpleTaskWrapper(Task task)
        {
            ID          = task.ID;
            Title       = task.Title;
            Description = task.Description;
            Status      = (int)task.Status;

            if (task.Responsibles != null)
            {
                Responsibles = task.Responsibles;
            }

            Deadline     = (task.Deadline == DateTime.MinValue ? null : new ApiDateTime(task.Deadline, TimeZoneInfo.Local));
            Priority     = task.Priority;
            ProjectOwner = task.Project.ID;
            MilestoneId  = task.Milestone;
            Created      = (ApiDateTime)task.CreateOn;
            CreatedBy    = task.CreateBy;
            Updated      = (ApiDateTime)task.LastModifiedOn;
            StartDate    = task.StartDate.Equals(DateTime.MinValue) ? null : (ApiDateTime)task.StartDate;

            if (task.CreateBy != task.LastModifiedBy)
            {
                UpdatedBy = task.LastModifiedBy;
            }

            if (task.SubTasks != null)
            {
                SubtasksCount = task.SubTasks.Count(r => r.Status == TaskStatus.Open); // somehow don't work :(
            }

            Progress    = task.Progress;
            MilestoneId = task.Milestone;

            if (task.Links.Any())
            {
                Links = task.Links.Select(r => new TaskLinkWrapper(r));
            }

            CanEdit            = ProjectSecurity.CanEdit(task);
            CanCreateSubtask   = ProjectSecurity.CanCreateSubtask(task);
            CanCreateTimeSpend = ProjectSecurity.CanCreateTimeSpend(task);
            CanDelete          = ProjectSecurity.CanDelete(task);
        }