public static void AuthorizeProjectUser(int[] projectIds)
        {
            var userId =
                ((IBusinessIdentity)Csla.ApplicationContext.User.Identity).UserId;

            ProjectUserRepository.AuthorizeProjectUser(projectIds, userId);
        }
示例#2
0
        public static SprintInfoList SprintFetchInfoList(IProject project)
        {
            ProjectUserRepository.AuthorizeProjectUser(project.ProjectId);

            return(SprintInfoList.FetchSprintInfoList(
                       new SprintDataCriteria
            {
                ProjectId = new[] { project.ProjectId }
            }));
        }
        public static ProjectUserInfoList ProjectUserFetchInfoList(int projectId)
        {
            ProjectUserRepository.AuthorizeProjectUser(projectId);

            return(ProjectUserInfoList.FetchProjectUserInfoList(
                       new ProjectUserMemberDataCriteria
            {
                ProjectId = projectId
            }));
        }
示例#4
0
        public static StatusInfoList StatusFetchInfoList(int projectId)
        {
            ProjectUserRepository.AuthorizeProjectUser(projectId);

            return(StatusInfoList.FetchStatusInfoList(
                       new StatusDataCriteria
            {
                ProjectId = projectId
            }));
        }
        public static ProjectUser ProjectUserAdd(int projectId, int userId, Role role)
        {
            var projectUser = ProjectUser.NewProjectUser(projectId, userId);

            projectUser.RoleId = (int)role;

            projectUser = ProjectUserRepository.ProjectUserSave(projectUser);

            return(projectUser);
        }
示例#6
0
        public static StoryInfoList StoryFetchInfoList(ISprint sprint)
        {
            ProjectUserRepository.AuthorizeProjectUser(sprint.ProjectId);

            return(StoryInfoList.FetchStoryInfoList(
                       new StoryDataCriteria
            {
                ProjectId = new[] { sprint.ProjectId },
                SprintId = sprint.SprintId
            }));
        }
示例#7
0
        public static StoryInfoList StoryFetchInfoList(IProject project, bool?isArchived)
        {
            ProjectUserRepository.AuthorizeProjectUser(project.ProjectId);

            return(StoryInfoList.FetchStoryInfoList(
                       new StoryDataCriteria
            {
                ProjectId = new[] { project.ProjectId },
                IsArchived = isArchived
            }));
        }
        public static Project ProjectInsert(Project project)
        {
            project = project.Save();

            SourceRepository.SourceAdd(project.ProjectId, SourceType.Project, project.Name);

            FeedRepository.FeedAdd(FeedAction.Created, project);

            ProjectUserRepository.ProjectUserAdd(
                project.ProjectId, ((IBusinessIdentity)Csla.ApplicationContext.User.Identity).UserId, Role.Owner, true);

            return(project);
        }
示例#9
0
        public static SprintInfoList SprintFetchInfoList(IProject[] projects, bool?isArchived)
        {
            var projectIds = projects.Select(row => row.ProjectId).ToArray();

            ProjectUserRepository.AuthorizeProjectUser(projectIds);

            return(SprintInfoList.FetchSprintInfoList(
                       new SprintDataCriteria
            {
                ProjectId = projectIds,
                IsArchived = isArchived
            }));
        }
        public static Project ProjectFetch(int projectId)
        {
            ProjectUserRepository.AuthorizeProjectUser(projectId);

            var result = Project.FetchProject(
                new ProjectDataCriteria
            {
                ProjectId = projectId
            });

            result.Auditor = new ProjectAuditor(result.Clone());

            return(result);
        }
        public static bool ProjectDelete(Project project)
        {
            ProjectUserRepository.AuthorizeProjectUser(project.ProjectId);

            Project.DeleteProject(
                new ProjectDataCriteria
            {
                ProjectId = project.ProjectId
            });

            FeedRepository.FeedAdd(FeedAction.Deleted, project);

            return(true);
        }
示例#12
0
        public static bool StoryDelete(Story story)
        {
            ProjectUserRepository.AuthorizeProjectUser(story.ProjectId);

            Story.DeleteStory(
                new StoryDataCriteria
            {
                StoryId = story.StoryId
            });

            FeedRepository.FeedAdd(FeedAction.Deleted, story);

            return(true);
        }
示例#13
0
        public static bool SprintDelete(Sprint sprint)
        {
            ProjectUserRepository.AuthorizeProjectUser(sprint.ProjectId);

            Sprint.DeleteSprint(
                new SprintDataCriteria
            {
                SprintId = sprint.SprintId
            });

            FeedRepository.FeedAdd(FeedAction.Deleted, sprint);

            return(true);
        }
        public static Project ProjectUpdate(Project project)
        {
            if (!project.IsDirty)
            {
                return(project);
            }

            ProjectUserRepository.AuthorizeProjectUser(project.ProjectId);

            project = project.Save();

            SourceRepository.SourceUpdate(project.ProjectId, SourceType.Project, project.Name);

            FeedRepository.FeedAdd(FeedAction.Edited, project);

            return(project);
        }
        internal static ProjectUser ProjectUserAdd(int projectId, int userId, Role role, bool ignoreAuthorization)
        {
            var projectUser = ProjectUser.NewProjectUser(projectId, userId);

            projectUser.RoleId = (int)role;

            if (ignoreAuthorization)
            {
                projectUser = ProjectUserRepository.ProjectUserInsert(projectUser);
            }
            else
            {
                projectUser = ProjectUserRepository.ProjectUserSave(projectUser);
            }

            return(projectUser);
        }
示例#16
0
        public static Status StatusUpdate(Status status)
        {
            if (!status.IsDirty)
            {
                return(status);
            }

            ProjectUserRepository.AuthorizeProjectUser(status.ProjectId);

            status = status.Save();

            SourceRepository.SourceUpdate(status.StatusId, SourceType.Status, status.Name);

            FeedRepository.FeedAdd(FeedAction.Edited, status);

            return(status);
        }
        public static bool ProjectUserDelete(ProjectUser projectUser)
        {
            ProjectUserRepository.AuthorizeProjectUser(projectUser.ProjectId);

            if (ProjectUserRepository.ProjectUserFetch(
                    projectUser.ProjectId, projectUser.UserId).RoleId == (int)Role.Owner)
            {
                throw new NotSupportedException("You cannot delete the owner of a project");
            }

            ProjectUser.DeleteProjectUser(
                new ProjectUserMemberDataCriteria
            {
                ProjectUserMemberId = projectUser.ProjectUserMemberId
            });

            FeedRepository.FeedAdd(FeedAction.Deleted, projectUser);

            return(true);
        }
示例#18
0
        public static Story StorySave(Story story)
        {
            if (!story.IsValid)
            {
                return(story);
            }

            ProjectUserRepository.AuthorizeProjectUser(story.ProjectId);

            Story result;

            if (story.IsNew)
            {
                result = StoryRepository.StoryInsert(story);
            }
            else
            {
                result = StoryRepository.StoryUpdate(story);
            }

            return(result);
        }
示例#19
0
        public static Sprint SprintSave(Sprint sprint)
        {
            if (!sprint.IsValid)
            {
                return(sprint);
            }

            ProjectUserRepository.AuthorizeProjectUser(sprint.ProjectId);

            Sprint result;

            if (sprint.IsNew)
            {
                result = SprintRepository.SprintInsert(sprint);
            }
            else
            {
                result = SprintRepository.SprintUpdate(sprint);
            }

            return(result);
        }
        public static ProjectUser ProjectUserSave(ProjectUser projectUser)
        {
            if (!projectUser.IsValid)
            {
                return(projectUser);
            }

            ProjectUserRepository.AuthorizeProjectUser(projectUser.ProjectId);

            ProjectUser result;

            if (projectUser.IsNew)
            {
                result = ProjectUserRepository.ProjectUserInsert(projectUser);
            }
            else
            {
                result = ProjectUserRepository.ProjectUserUpdate(projectUser);
            }

            return(result);
        }
 public static bool ProjectUserDelete(int projectId)
 {
     return(ProjectUserRepository.ProjectUserDelete(
                ProjectUserRepository.ProjectUserFetch(projectId)));
 }