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)) : ""; }
public MilestoneWrapper(Milestone milestone) { Id = milestone.ID; ProjectOwner = new SimpleProjectWrapper(milestone.Project); Title = milestone.Title; Description = milestone.Description; Created = (ApiDateTime)milestone.CreateOn; CreatedBy = EmployeeWraper.Get(milestone.CreateBy); Updated = (ApiDateTime)milestone.LastModifiedOn; if (milestone.CreateBy != milestone.LastModifiedBy) { UpdatedBy = EmployeeWraper.Get(milestone.LastModifiedBy); } if (!milestone.Responsible.Equals(Guid.Empty)) { Responsible = EmployeeWraper.Get(milestone.Responsible); } Status = (int)milestone.Status; Deadline = new ApiDateTime(milestone.DeadLine, TimeZoneInfo.Local); IsKey = milestone.IsKey; IsNotify = milestone.IsNotify; CanEdit = ProjectSecurity.CanEdit(milestone); CanDelete = ProjectSecurity.CanDelete(milestone); ActiveTaskCount = milestone.ActiveTaskCount; ClosedTaskCount = milestone.ClosedTaskCount; }
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(',', '.'); }
public ProjectWrapperFull(Project project, object filesRoot, bool isFollow) { Id = project.ID; Title = project.Title; Description = project.Description; Status = (int)project.Status; Responsible = new EmployeeWraperFull(CoreContext.UserManager.GetUsers(project.Responsible)); Created = (ApiDateTime)project.CreateOn; CreatedBy = EmployeeWraper.Get(project.CreateBy); Updated = (ApiDateTime)project.LastModifiedOn; if (project.CreateBy != project.LastModifiedBy) { UpdatedBy = EmployeeWraper.Get(project.LastModifiedBy); } Security = new ProjectSecurityInfo(project); CanEdit = ProjectSecurity.CanEdit(project); CanDelete = ProjectSecurity.CanDelete(project); ProjectFolder = filesRoot; IsPrivate = project.Private; TaskCount = project.TaskCount; TaskCountTotal = project.TaskCountTotal; MilestoneCount = project.MilestoneCount; DiscussionCount = project.DiscussionCount; TimeTrackingTotal = project.TimeTrackingTotal ?? ""; DocumentsCount = project.DocumentsCount; ParticipantCount = project.ParticipantCount; IsFollow = isFollow; }
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); }
protected void Page_Load(object sender, EventArgs e) { _hintPopup.Options.IsPopup = true; _projectDescriptionPopup.Options.IsPopup = true; CanEditProject = ProjectSecurity.CanEdit(Project); CanDeleteProject = ProjectSecurity.CanDelete(Project); ProjectLeaderName = Global.EngineFactory.GetParticipantEngine().GetByID(Project.Responsible).UserInfo.DisplayUserName(); IsInTeam = Global.EngineFactory.GetProjectEngine().IsInTeam(Project.ID, Page.Participant.ID); InConcreteProjectModule = RequestContext.IsInConcreteProjectModule; }
public TaskWrapper DeleteTask(int taskid) { var taskEngine = EngineFactory.GetTaskEngine(); var task = taskEngine.GetByID(taskid).NotFoundIfNull(); if (!ProjectSecurity.CanDelete(task)) { throw ProjectSecurity.CreateSecurityException(); } taskEngine.Delete(task); return(new TaskWrapper(task)); }
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); }
public MilestoneWrapper(ProjectApiBase projectApiBase, Milestone milestone) { Id = milestone.ID; ProjectOwner = new SimpleProjectWrapper(milestone.Project); Title = milestone.Title; Description = milestone.Description; Created = (ApiDateTime)milestone.CreateOn; Updated = (ApiDateTime)milestone.LastModifiedOn; Status = (int)milestone.Status; Deadline = new ApiDateTime(milestone.DeadLine, TimeZoneInfo.Local); IsKey = milestone.IsKey; IsNotify = milestone.IsNotify; CanEdit = ProjectSecurity.CanEdit(milestone); CanDelete = ProjectSecurity.CanDelete(milestone); ActiveTaskCount = milestone.ActiveTaskCount; ClosedTaskCount = milestone.ClosedTaskCount; if (projectApiBase.Context.GetRequestValue("simple") != null) { CreatedById = milestone.CreateBy; UpdatedById = milestone.LastModifiedBy; if (!milestone.Responsible.Equals(Guid.Empty)) { ResponsibleId = milestone.Responsible; } } else { CreatedBy = projectApiBase.GetEmployeeWraper(milestone.CreateBy); if (milestone.CreateBy != milestone.LastModifiedBy) { UpdatedBy = projectApiBase.GetEmployeeWraper(milestone.LastModifiedBy); } if (!milestone.Responsible.Equals(Guid.Empty)) { Responsible = projectApiBase.GetEmployeeWraper(milestone.Responsible); } } }