示例#1
0
        protected override void PageLoad()
        {
            var action = UrlParameters.ActionType;

            var discussionId = UrlParameters.EntityID;

            if (discussionId >= 0)
            {
                var discussion = EngineFactory.MessageEngine.GetByID(discussionId);

                if (action.HasValue && action.Value == UrlAction.Edit)
                {
                    if (ProjectSecurity.CanEdit(discussion))
                    {
                        LoadDiscussionActionControl(discussion);
                    }
                    else
                    {
                        Response.Redirect("messages.aspx", true);
                    }
                }
                else
                {
                    if (discussion != null && (!ProjectSecurity.CanRead(discussion.Project) ||
                                               discussion.Project.ID != Project.ID))
                    {
                        RedirectNotFound(string.Format("messages.aspx?prjID={0}", Project.ID));
                    }
                }

                if (discussion != null)
                {
                    Title = HeaderStringHelper.GetPageTitle(discussion.Title);
                }
            }
            else
            {
                if (action.HasValue && action.Value == UrlAction.Add)
                {
                    if (!RequestContext.IsInConcreteProject || ProjectSecurity.CanCreate <Message>(RequestContext.GetCurrentProject(false)))
                    {
                        LoadDiscussionActionControl(null);

                        Title = HeaderStringHelper.GetPageTitle(MessageResource.CreateMessage);
                    }
                    else
                    {
                        Response.Redirect("messages.aspx", true);
                    }
                }
            }
        }
示例#2
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);
            CanReadFiles       = ProjectSecurity.CanReadFiles(task.Project);
        }
示例#3
0
 public SubtaskWrapper(Subtask subtask, Task task)
 {
     Id     = subtask.ID;
     Title  = subtask.Title;
     Status = (int)subtask.Status;
     if (subtask.Responsible != Guid.Empty)
     {
         Responsible = EmployeeWraper.Get(subtask.Responsible);
     }
     Created   = (ApiDateTime)subtask.CreateOn;
     CreatedBy = EmployeeWraper.Get(subtask.CreateBy);
     Updated   = (ApiDateTime)subtask.LastModifiedOn;
     if (subtask.CreateBy != subtask.LastModifiedBy)
     {
         UpdatedBy = EmployeeWraper.Get(subtask.LastModifiedBy);
     }
     CanEdit = ProjectSecurity.CanEdit(task, subtask);
 }
        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);
        }
示例#5
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;
 }
示例#6
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();
            }
        }
示例#7
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;
 }
示例#8
0
        public TimeWrapper(TimeSpend timeSpend)
        {
            Date                 = (ApiDateTime)timeSpend.Date;
            Hours                = timeSpend.Hours;
            Id                   = timeSpend.ID;
            Note                 = timeSpend.Note;
            CreatedBy            = EmployeeWraper.Get(timeSpend.CreateBy);
            RelatedProject       = timeSpend.Task.Project.ID;
            RelatedTask          = timeSpend.Task.ID;
            RelatedTaskTitle     = timeSpend.Task.Title;
            CanEdit              = ProjectSecurity.CanEdit(timeSpend);
            PaymentStatus        = timeSpend.PaymentStatus;
            StatusChanged        = (ApiDateTime)timeSpend.StatusChangedOn;
            CanEditPaymentStatus = ProjectSecurity.CanEditPaymentStatus(timeSpend);


            if (timeSpend.CreateBy != timeSpend.Person)
            {
                Person = EmployeeWraper.Get(timeSpend.Person);
            }
        }
示例#9
0
 public ProjectWrapperFull(Project project, object filesRoot)
 {
     Id          = project.ID;
     Title       = project.Title;
     Description = project.Description;
     Status      = (int)project.Status;
     Responsible = EmployeeWraper.Get(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);
     ProjectFolder    = filesRoot;
     IsPrivate        = project.Private;
     TaskCount        = project.TaskCount;
     MilestoneCount   = project.MilestoneCount;
     ParticipantCount = project.ParticipantCount;
 }
示例#10
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         = 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);
                }
            }
        }
示例#11
0
        protected override void PageLoad()
        {
            Utility.RegisterTypeForAjax(typeof(CommonControlsConfigurer), Page);

            var messageEngine = Global.EngineFactory.GetMessageEngine();

            CanCreate = RequestContext.CanCreateDiscussion(true);

            int discussionId;

            if (int.TryParse(UrlParameters.EntityID, out discussionId))
            {
                Discussion = messageEngine.GetByID(discussionId);

                if (string.Compare(UrlParameters.ActionType, "edit", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    if (ProjectSecurity.CanEdit(Discussion))
                    {
                        LoadDiscussionActionControl(Discussion);
                    }
                    else
                    {
                        Response.Redirect("messages.aspx", true);
                    }

                    Title = HeaderStringHelper.GetPageTitle(Discussion.Title);
                }
                else if (Discussion != null && ProjectSecurity.CanRead(Discussion.Project) && Discussion.Project.ID == Project.ID)
                {
                    LoadDiscussionDetailsControl(Discussion);

                    IsSubcribed  = messageEngine.IsSubscribed(Discussion);
                    EssenceTitle = Discussion.Title;

                    Title = HeaderStringHelper.GetPageTitle(Discussion.Title);
                }
                else
                {
                    RedirectNotFound(string.Format("messages.aspx?prjID={0}", Project.ID));
                }
            }
            else
            {
                if (string.Compare(UrlParameters.ActionType, "add", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    if (CanCreate)
                    {
                        LoadDiscussionActionControl(null);

                        Title = HeaderStringHelper.GetPageTitle(MessageResource.CreateMessage);
                    }
                    else
                    {
                        Response.Redirect("messages.aspx", true);
                    }
                }
                else
                {
                    contentHolder.Controls.Add(LoadControl(CommonList.Location));
                    loaderHolder.Controls.Add(LoadControl(LoaderPage.Location));
                }
            }
        }
示例#12
0
 public override bool CanEdit()
 {
     return(ProjectSecurity.CanEdit(this));
 }
示例#13
0
        protected override void PageLoad()
        {
            var action = UrlParameters.ActionType;

            CanCreate = RequestContext.CanCreateDiscussion(true);

            var discussionId = UrlParameters.EntityID;

            if (discussionId >= 0)
            {
                var discussion = EngineFactory.MessageEngine.GetByID(discussionId);

                if (action.HasValue && action.Value == UrlAction.Edit)
                {
                    if (ProjectSecurity.CanEdit(discussion))
                    {
                        LoadDiscussionActionControl(discussion);
                    }
                    else
                    {
                        Response.Redirect("messages.aspx", true);
                    }

                    Title = HeaderStringHelper.GetPageTitle(discussion.Title);
                }
                else if (discussion != null && ProjectSecurity.CanRead(discussion.Project) && discussion.Project.ID == Project.ID)
                {
                    LoadDiscussionDetailsControl(discussion);

                    IsSubcribed  = EngineFactory.MessageEngine.IsSubscribed(discussion);
                    EssenceTitle = discussion.Title;

                    Title = HeaderStringHelper.GetPageTitle(discussion.Title);
                }
                else
                {
                    RedirectNotFound(string.Format("messages.aspx?prjID={0}", Project.ID));
                }
            }
            else
            {
                if (action.HasValue && action.Value == UrlAction.Add)
                {
                    if (CanCreate)
                    {
                        LoadDiscussionActionControl(null);

                        Title = HeaderStringHelper.GetPageTitle(MessageResource.CreateMessage);
                    }
                    else
                    {
                        Response.Redirect("messages.aspx", true);
                    }
                }
                else
                {
                    contentHolder.Controls.Add(LoadControl(CommonList.Location));
                    loaderHolder.Controls.Add(LoadControl(LoaderPage.Location));
                }
            }
        }
 protected bool CanEditProject()
 {
     return(ProjectSecurity.CanEdit(ProjectFat.Project));
 }
示例#15
0
        protected override void PageLoad()
        {
            Project = RequestContext.GetCurrentProject(false);

            if (RequestContext.IsInConcreteProject())
            {
                var project = RequestContext.GetCurrentProject(false);

                if (project == null)
                {
                    Response.Redirect("messages.aspx", true);
                }
                else
                {
                    if (!ProjectSecurity.CanReadMessages(Project))
                    {
                        Response.Redirect("projects.aspx?prjID=" + project.ID, true);
                    }
                }
            }
            ((IStudioMaster)Master).DisabledSidePanel = true;

            int discussionId;

            if (int.TryParse(UrlParameters.EntityID, out discussionId))
            {
                if (Project == null)
                {
                    return;
                }

                Discussion = Global.EngineFactory.GetMessageEngine().GetByID(discussionId);

                if (string.Compare(UrlParameters.ActionType, "edit", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    if (ProjectSecurity.CanEdit(Discussion))
                    {
                        LoadDiscussionActionControl(Project, Discussion);
                    }
                    else
                    {
                        Response.Redirect("messages.aspx", true);
                    }
                }
                else if (Discussion != null && ProjectSecurity.CanRead(Discussion.Project) && Discussion.Project.ID == Project.ID)
                {
                    LoadDiscussionDetailsControl(Project, Discussion);
                }
                else
                {
                    LoadElementNotFoundControl(Project.ID);
                }
            }
            else
            {
                if (string.Compare(UrlParameters.ActionType, "add", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    if (ProjectSecurity.CanCreateMessage(Project))
                    {
                        LoadDiscussionActionControl(Project, null);
                    }
                    else
                    {
                        Response.Redirect("messages.aspx", true);
                    }
                }
                else
                {
                    LoadDiscussionsListControl(Project == null ? -1 : Project.ID);
                }
            }

            InitBreadCrumbs();

            Title = HeaderStringHelper.GetPageTitle(MessageResource.Messages, Master.BreadCrumbs);
        }
示例#16
0
        protected override void PageLoad()
        {
            InitScripts();

            var messageEngine = Global.EngineFactory.GetMessageEngine();

            if (RequestContext.IsInConcreteProject && !ProjectSecurity.CanReadMessages(Project))
            {
                Response.Redirect("projects.aspx?prjID=" + Project.ID, true);
            }

            CanCreate = RequestContext.CanCreateDiscussion(true);

            int discussionId;

            if (int.TryParse(UrlParameters.EntityID, out discussionId))
            {
                if (Project == null)
                {
                    return;
                }

                Discussion = messageEngine.GetByID(discussionId);

                if (string.Compare(UrlParameters.ActionType, "edit", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    if (ProjectSecurity.CanEdit(Discussion))
                    {
                        LoadDiscussionActionControl(Project, Discussion);
                    }
                    else
                    {
                        Response.Redirect("messages.aspx", true);
                    }

                    Title = HeaderStringHelper.GetPageTitle(Discussion.Title);
                }
                else if (Discussion != null && ProjectSecurity.CanRead(Discussion.Project) && Discussion.Project.ID == Project.ID)
                {
                    LoadDiscussionDetailsControl(Project, Discussion);

                    Master.EssenceTitle = Discussion.Title;

                    Title = HeaderStringHelper.GetPageTitle(Discussion.Title);

                    Master.IsSubcribed = messageEngine.IsSubscribed(Discussion);
                }
                else
                {
                    LoadElementNotFoundControl(Project.ID);

                    Title = HeaderStringHelper.GetPageTitle(MessageResource.MessageNotFound_Header);
                }
            }
            else
            {
                if (string.Compare(UrlParameters.ActionType, "add", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    if (CanCreate)
                    {
                        LoadDiscussionActionControl(Project, null);

                        Title = HeaderStringHelper.GetPageTitle(MessageResource.CreateMessage);
                    }
                    else
                    {
                        Response.Redirect("messages.aspx", true);
                    }
                }
                else
                {
                    var filter = new TaskFilter();

                    if (RequestContext.IsInConcreteProject)
                    {
                        filter.ProjectIds.Add(RequestContext.GetCurrentProjectId());
                    }

                    var allDiscCount = messageEngine.GetByFilterCount(filter);

                    if (allDiscCount > 0)
                    {
                        LoadDiscussionsListControl(Project == null ? -1 : Project.ID, allDiscCount);
                    }

                    var emptyScreenControl = new Studio.Controls.Common.EmptyScreenControl
                    {
                        ImgSrc   = WebImageSupplier.GetAbsoluteWebPath("empty_screen_discussions.png", ProductEntryPoint.ID),
                        Header   = MessageResource.DiscussionNotFound_Header,
                        Describe = MessageResource.DiscussionNotFound_Describe,
                        ID       = "emptyListDiscussion"
                    };

                    if (CanCreate)
                    {
                        emptyScreenControl.ButtonHTML = RequestContext.IsInConcreteProject
                            ? String.Format("<a href='messages.aspx?prjID={0}&action=add' class='baseLinkAction addFirstElement'>{1}</a>", Project.ID, MessageResource.StartFirstDiscussion)
                            : String.Format("<a href='messages.aspx?action=add' class='baseLinkAction addFirstElement'>{0}</a>", MessageResource.StartFirstDiscussion);
                    }

                    contentHolder.Controls.Add(emptyScreenControl);

                    Title = HeaderStringHelper.GetPageTitle(MessageResource.Messages);
                }
            }
        }