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);
        }
Exemplo n.º 2
0
 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;
 }
Exemplo n.º 3
0
        public TaskWrapper(Task task)
        {
            if (task.SubTasks != null)
                Subtasks = task.SubTasks.Select(x => new SubtaskWrapper(x, task)).ToList();

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

            if (task.Responsible!=Guid.Empty)
                Responsible = EmployeeWraper.Get(task.Responsible);

            Id = task.ID;

            Updated = (ApiDateTime)task.LastModifiedOn;
            Created = (ApiDateTime)task.CreateOn;
            Deadline = (task.Deadline == DateTime.MinValue ? null : (ApiDateTime)task.Deadline);
            Priority = task.Priority;
            
            Title = task.Title;
            Status = (int)task.Status;
            Description = task.Description;
            MilestoneId = task.Milestone;
            ProjectOwner = new SimpleProjectWrapper(task.Project);
            CanEdit = ProjectSecurity.CanEdit(task);
            CanWork = ProjectSecurity.CanWork(task);

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

            if (task.Responsibles != null)
                Responsibles = task.Responsibles.Select(x => EmployeeWraper.Get(x)).ToList();
        }
 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;
 }
Exemplo n.º 5
0
 public static SearchWrapper GetSample()
 {
     return(new SearchWrapper()
     {
         ProjectOwner = SimpleProjectWrapper.GetSample(),
         Items = new SearchItemWrapper[] { SearchItemWrapper.GetSample(), SearchItemWrapper.GetSample(), SearchItemWrapper.GetSample() }
     });
 }
Exemplo n.º 6
0
 public SearchWrapper(SearchGroup searchGroup)
 {
     if (searchGroup.Items != null)
     {
         Items = searchGroup.Items.Select(x => new SearchItemWrapper(x)).ToArray();
     }
     ProjectOwner = new SimpleProjectWrapper(searchGroup.ProjectID, searchGroup.ProjectTitle);
 }
Exemplo n.º 7
0
 public SearchWrapper(SearchGroup searchGroup)
 {
     if (searchGroup.Items != null)
     {
         Items = searchGroup.Items.Select(x => new SearchItemWrapper(x)).ToArray();
     }
     ProjectOwner = new SimpleProjectWrapper(searchGroup.ProjectID, searchGroup.ProjectTitle);
 }
Exemplo n.º 8
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);
        }
Exemplo n.º 9
0
 public static MessageWrapper GetSample()
 {
     return(new MessageWrapper()
     {
         Created = (ApiDateTime)DateTime.Now,
         CreatedBy = EmployeeWraper.GetSample(),
         Id = 10,
         Title = "Sample Title",
         Updated = (ApiDateTime)DateTime.Now,
         UpdatedBy = EmployeeWraper.GetSample(),
         ProjectOwner = SimpleProjectWrapper.GetSample(),
         Text = "Hello, this is sample message",
         CommentsCount = 5
     });
 }
 public static MessageWrapper GetSample()
 {
     return(new MessageWrapper
     {
         Id = 10,
         ProjectOwner = SimpleProjectWrapper.GetSample(),
         Title = "Sample Title",
         Text = "Hello, this is sample message",
         Created = ApiDateTime.GetSample(),
         CreatedBy = EmployeeWraper.GetSample(),
         Updated = ApiDateTime.GetSample(),
         UpdatedBy = EmployeeWraper.GetSample(),
         CanEdit = true,
         CommentsCount = 5
     });
 }
Exemplo n.º 11
0
 public MessageWrapper(Message message)
 {
     Created = (ApiDateTime)message.CreateOn;
     CreatedBy = EmployeeWraper.Get(message.CreateBy);
     Updated = (ApiDateTime)message.LastModifiedOn;
     if (message.CreateBy != message.LastModifiedBy)
         UpdatedBy = EmployeeWraper.Get(message.LastModifiedBy);
     Id = message.ID;
     Text = message.Content;
     Title = message.Title;
     if (message.Project != null)
     {
         ProjectOwner = new SimpleProjectWrapper(message.Project);
     }
     CanEdit = ProjectSecurity.CanEdit(message);
     CommentsCount = message.CommentsCount;
 }
Exemplo n.º 12
0
 public static TaskWrapper GetSample()
 {
     return(new TaskWrapper()
     {
         Created = (ApiDateTime)DateTime.Now,
         CreatedBy = EmployeeWraper.GetSample(),
         Id = 10,
         Title = "Sample Title",
         Updated = (ApiDateTime)DateTime.Now,
         UpdatedBy = EmployeeWraper.GetSample(),
         Description = "Sample description",
         Responsible = EmployeeWraper.GetSample(),
         Status = (int)MilestoneStatus.Open,
         Deadline = (ApiDateTime)DateTime.Now,
         MilestoneId = 123,
         Priority = TaskPriority.High,
         ProjectOwner = SimpleProjectWrapper.GetSample()
     });
 }
Exemplo n.º 13
0
 public MessageWrapper(Message message)
 {
     Id = message.ID;
     if (message.Project != null)
     {
         ProjectOwner = new SimpleProjectWrapper(message.Project);
     }
     Title = message.Title;
     Text = message.Content;
     Created = (ApiDateTime)message.CreateOn;
     CreatedBy = new EmployeeWraperFull(CoreContext.UserManager.GetUsers(message.CreateBy));
     Updated = (ApiDateTime)message.LastModifiedOn;
     if (message.CreateBy != message.LastModifiedBy)
     {
         UpdatedBy = EmployeeWraper.Get(message.LastModifiedBy);
     }
     CanEdit = ProjectSecurity.CanEdit(message);
     CommentsCount = message.CommentsCount;
 }
Exemplo n.º 14
0
 public MessageWrapper(Message message)
 {
     Created   = (ApiDateTime)message.CreateOn;
     CreatedBy = EmployeeWraper.Get(message.CreateBy);
     Updated   = (ApiDateTime)message.LastModifiedOn;
     if (message.CreateBy != message.LastModifiedBy)
     {
         UpdatedBy = EmployeeWraper.Get(message.LastModifiedBy);
     }
     Id    = message.ID;
     Text  = message.Content;
     Title = message.Title;
     if (message.Project != null)
     {
         ProjectOwner = new SimpleProjectWrapper(message.Project);
     }
     CanEdit       = ProjectSecurity.CanEdit(message);
     CommentsCount = message.CommentsCount;
 }
Exemplo n.º 15
0
        public TaskWrapper(Task task)
        {
            if (task.SubTasks != null)
            {
                Subtasks = task.SubTasks.Select(x => new SubtaskWrapper(x, task)).ToList();
            }

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

            if (task.Responsible != Guid.Empty)
            {
                Responsible = EmployeeWraper.Get(task.Responsible);
            }

            Id = task.ID;

            Updated  = (ApiDateTime)task.LastModifiedOn;
            Created  = (ApiDateTime)task.CreateOn;
            Deadline = (task.Deadline == DateTime.MinValue ? null : (ApiDateTime)task.Deadline);
            Priority = task.Priority;

            Title        = task.Title;
            Status       = (int)task.Status;
            Description  = task.Description;
            MilestoneId  = task.Milestone;
            ProjectOwner = new SimpleProjectWrapper(task.Project);
            CanEdit      = ProjectSecurity.CanEdit(task);
            CanWork      = ProjectSecurity.CanWork(task);

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

            if (task.Responsibles != null)
            {
                Responsibles = task.Responsibles.Select(x => EmployeeWraper.Get(x)).ToList();
            }
        }
Exemplo n.º 16
0
 public static TaskWrapper GetSample()
 {
     return new TaskWrapper
         {
             Id = 10,
             Title = "Sample Title",
             Description = "Sample description",
             Deadline = ApiDateTime.GetSample(),
             Priority = TaskPriority.High,
             Status = (int)MilestoneStatus.Open,
             Responsible = EmployeeWraper.GetSample(),
             ProjectOwner = SimpleProjectWrapper.GetSample(),
             MilestoneId = 123,
             Created = ApiDateTime.GetSample(),
             CreatedBy = EmployeeWraper.GetSample(),
             Updated = ApiDateTime.GetSample(),
             UpdatedBy = EmployeeWraper.GetSample(),
             StartDate = ApiDateTime.GetSample()
         };
 }
Exemplo n.º 17
0
 public MessageWrapper(Message message)
 {
     Id = message.ID;
     if (message.Project != null)
     {
         ProjectOwner = new SimpleProjectWrapper(message.Project);
     }
     Title     = message.Title;
     Text      = message.Description;
     Created   = (ApiDateTime)message.CreateOn;
     CreatedBy = new EmployeeWraperFull(CoreContext.UserManager.GetUsers(message.CreateBy));
     Updated   = (ApiDateTime)message.LastModifiedOn;
     if (message.CreateBy != message.LastModifiedBy)
     {
         UpdatedBy = EmployeeWraper.Get(message.LastModifiedBy);
     }
     CanEdit       = ProjectSecurity.CanEdit(message);
     CommentsCount = message.CommentsCount;
     Status        = message.Status;
 }
Exemplo n.º 18
0
        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);
                }
            }
        }
Exemplo n.º 19
0
 public static MilestoneWrapper GetSample()
 {
     return(new MilestoneWrapper
     {
         Id = 10,
         ProjectOwner = SimpleProjectWrapper.GetSample(),
         Title = "Sample Title",
         Description = "Sample description",
         Created = ApiDateTime.GetSample(),
         CreatedBy = EmployeeWraper.GetSample(),
         Updated = ApiDateTime.GetSample(),
         UpdatedBy = EmployeeWraper.GetSample(),
         Responsible = EmployeeWraper.GetSample(),
         Status = (int)MilestoneStatus.Open,
         Deadline = ApiDateTime.GetSample(),
         IsKey = false,
         IsNotify = false,
         CanEdit = true,
         ActiveTaskCount = 15,
         ClosedTaskCount = 5
     });
 }
Exemplo n.º 20
0
        public TaskWrapper(Task task)
        {
            Id = task.ID;
            Title = task.Title;
            Description = task.Description;
            Status = (int)task.Status;

            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);
        }
Exemplo n.º 21
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;
        }