public MessageWrapper(ProjectApiBase projectApiBase, Message message)
        {
            Id = message.ID;
            if (message.Project != null)
            {
                ProjectOwner = new SimpleProjectWrapper(message.Project);
            }
            Title   = message.Title;
            Text    = message.Description;
            Created = (ApiDateTime)message.CreateOn;
            Updated = (ApiDateTime)message.LastModifiedOn;

            if (projectApiBase.Context.GetRequestValue("simple") != null)
            {
                CreatedById = message.CreateBy;
                UpdatedById = message.LastModifiedBy;
            }
            else
            {
                CreatedBy = projectApiBase.GetEmployeeWraper(message.CreateBy);
                if (message.CreateBy != message.LastModifiedBy)
                {
                    UpdatedBy = projectApiBase.GetEmployeeWraper(message.LastModifiedBy);
                }
            }

            CanEdit          = projectApiBase.ProjectSecurity.CanEdit(message);
            CommentsCount    = message.CommentsCount;
            Status           = (int)message.Status;
            CanCreateComment = projectApiBase.ProjectSecurity.CanCreateComment(message);
        }
示例#2
0
        public ProjectWrapperFull(ProjectApiBase projectApiBase, Project project, object filesRoot = null, bool isFollow = false, IEnumerable <string> tags = null)
        {
            Id          = project.ID;
            Title       = project.Title;
            Description = project.Description;
            Status      = (int)project.Status;
            if (projectApiBase.Context.GetRequestValue("simple") != null)
            {
                ResponsibleId = project.Responsible;
                CreatedById   = project.CreateBy;
                UpdatedById   = project.LastModifiedBy;
            }
            else
            {
                Responsible = projectApiBase.GetEmployeeWraperFull(project.Responsible);
                CreatedBy   = projectApiBase.GetEmployeeWraper(project.CreateBy);
                if (project.CreateBy != project.LastModifiedBy)
                {
                    UpdatedBy = projectApiBase.GetEmployeeWraper(project.LastModifiedBy);
                }
            }

            Created = (ApiDateTime)project.CreateOn;
            Updated = (ApiDateTime)project.LastModifiedOn;


            if (project.Security == null)
            {
                projectApiBase.ProjectSecurity.GetProjectSecurityInfo(project);
            }
            Security      = project.Security;
            CanEdit       = Security.CanEdit;
            CanDelete     = Security.CanDelete;
            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;
            Tags = tags;
        }
示例#3
0
 public ParticipantFullWrapper(ProjectApiBase projectApiBase, ParticipantFull participant)
 {
     Project     = projectApiBase.ProjectWrapperSelector(participant.Project);
     Participant = projectApiBase.GetEmployeeWraper(participant.ID);
     Created     = participant.Created;
     Updated     = participant.Updated;
     Removed     = participant.Removed;
 }
示例#4
0
 public CommentWrapper(ProjectApiBase projectApiBase, Comment comment, ProjectEntity entity)
 {
     Id        = comment.OldGuidId;
     ParentId  = comment.Parent;
     Text      = comment.Content;
     Created   = Updated = (ApiDateTime)comment.CreateOn;
     CreatedBy = projectApiBase.GetEmployeeWraper(comment.CreateBy);
     Inactive  = comment.Inactive;
     CanEdit   = ProjectSecurity.CanEditComment(entity, comment);
 }
示例#5
0
 public ProjectWrapper(ProjectApiBase projectApiBase, Project project)
 {
     Id          = project.ID;
     Title       = project.Title;
     Description = project.Description;
     Responsible = projectApiBase.GetEmployeeWraper(project.Responsible);
     Status      = (int)project.Status;
     CanEdit     = ProjectSecurity.CanEdit(project);
     IsPrivate   = project.Private;
 }
        public SubtaskWrapper(ProjectApiBase projectApiBase, Subtask subtask, Task task)
        {
            Id     = subtask.ID;
            Title  = subtask.Title;
            Status = (int)subtask.Status;
            if (subtask.Responsible != Guid.Empty)
            {
                Responsible = projectApiBase.GetEmployeeWraper(subtask.Responsible);
            }
            Created   = (ApiDateTime)subtask.CreateOn;
            CreatedBy = projectApiBase.GetEmployeeWraper(subtask.CreateBy);
            Updated   = (ApiDateTime)subtask.LastModifiedOn;
            if (subtask.CreateBy != subtask.LastModifiedBy)
            {
                UpdatedBy = projectApiBase.GetEmployeeWraper(subtask.LastModifiedBy);
            }
            CanEdit = projectApiBase.ProjectSecurity.CanEdit(task, subtask);

            TaskId = task.ID;
        }
示例#7
0
        public TimeWrapper(ProjectApiBase projectApiBase, TimeSpend timeSpend)
        {
            Date                 = (ApiDateTime)timeSpend.Date;
            Hours                = timeSpend.Hours;
            Id                   = timeSpend.ID;
            Note                 = timeSpend.Note;
            CreatedBy            = projectApiBase.GetEmployeeWraper(timeSpend.CreateBy);
            RelatedProject       = timeSpend.Task.Project.ID;
            RelatedTask          = timeSpend.Task.ID;
            RelatedTaskTitle     = timeSpend.Task.Title;
            CanEdit              = projectApiBase.ProjectSecurity.CanEdit(timeSpend);
            PaymentStatus        = timeSpend.PaymentStatus;
            StatusChanged        = (ApiDateTime)timeSpend.StatusChangedOn;
            CanEditPaymentStatus = projectApiBase.ProjectSecurity.CanEditPaymentStatus(timeSpend);
            Task                 = new TaskWrapper(projectApiBase, timeSpend.Task);
            CreateOn             = (ApiDateTime)timeSpend.CreateOn;

            if (timeSpend.CreateBy != timeSpend.Person)
            {
                Person = projectApiBase.GetEmployeeWraper(timeSpend.Person);
            }
        }
        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         = projectApiBase.ProjectSecurity.CanEdit(milestone);
            CanDelete       = projectApiBase.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);
                }
            }
        }
示例#9
0
        public TaskWrapper(ProjectApiBase projectApiBase, Task task)
        {
            Id          = task.ID;
            Title       = task.Title;
            Description = task.Description;
            Status      = (int)task.Status;

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


            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;
            Updated      = (ApiDateTime)task.LastModifiedOn;
            StartDate    = task.StartDate.Equals(DateTime.MinValue) ? null : (ApiDateTime)task.StartDate;

            if (task.SubTasks != null)
            {
                Subtasks = task.SubTasks.Select(x => new SubtaskWrapper(projectApiBase, 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));
            }

            if (task.Security == null)
            {
                ProjectSecurity.GetTaskSecurityInfo(task);
            }

            if (projectApiBase.Context.GetRequestValue("simple") != null)
            {
                CreatedById = task.CreateBy;
                UpdatedById = task.LastModifiedBy;
                if (task.Responsibles != null)
                {
                    ResponsibleIds = task.Responsibles;
                }
            }
            else
            {
                CreatedBy = projectApiBase.GetEmployeeWraper(task.CreateBy);
                if (task.CreateBy != task.LastModifiedBy)
                {
                    UpdatedBy = projectApiBase.GetEmployeeWraper(task.LastModifiedBy);
                }
                if (task.Responsibles != null)
                {
                    Responsibles = task.Responsibles.Select(projectApiBase.GetEmployeeWraper).OrderBy(r => r.DisplayName).ToList();
                }
            }

            CanEdit            = task.Security.CanEdit;
            CanCreateSubtask   = task.Security.CanCreateSubtask;
            CanCreateTimeSpend = task.Security.CanCreateTimeSpend;
            CanDelete          = task.Security.CanDelete;
            CanReadFiles       = task.Security.CanReadFiles;
        }