internal static void FeedAdd(string action, Note note)
        {
            var feed = FeedRepository.FeedNew(action, SourceType.Note, note.NoteId);

            switch ((SourceType)note.SourceTypeId)
            {
            case SourceType.Project:
                feed.Sources.Add(SourceType.Project, note.SourceId);
                break;

            case SourceType.Sprint:
                var sprint = SprintRepository.SprintFetch(note.SourceId);
                feed.Sources.Add(SourceType.Project, sprint.ProjectId);
                feed.Sources.Add(SourceType.Sprint, sprint.SprintId);
                break;

            case SourceType.Story:
                var story = StoryRepository.StoryFetch(note.SourceId);
                feed.Sources.Add(SourceType.Project, story.ProjectId);
                feed.Sources.Add(SourceType.Story, story.StoryId);
                break;
            }

            feed.Description = note.Body;

            feed.Save();
        }
        internal static void FeedAdd(string action, ProjectUser projectUser)
        {
            var feed = FeedRepository.FeedNew(action, SourceType.ProjectUser, projectUser.ProjectUserMemberId);

            feed.Sources.Add(SourceType.Project, projectUser.ProjectId);
            feed.Sources.Add(SourceType.User, projectUser.UserId);

            feed.Save();
        }
Exemple #3
0
        public static Story StoryInsert(Story story)
        {
            story = story.Save();

            SourceRepository.SourceAdd(story.StoryId, SourceType.Story, story.StoryId.ToString());

            FeedRepository.FeedAdd(FeedAction.Created, story);

            return(story);
        }
Exemple #4
0
        public static Sprint SprintInsert(Sprint sprint)
        {
            sprint = sprint.Save();

            SourceRepository.SourceAdd(sprint.SprintId, SourceType.Sprint, sprint.Name);

            FeedRepository.FeedAdd(FeedAction.Created, sprint);

            return(sprint);
        }
Exemple #5
0
        public static Status StatusInsert(Status status)
        {
            status = status.Save();

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

            FeedRepository.FeedAdd(FeedAction.Created, status);

            return(status);
        }
        public static ProjectUser ProjectUserInsert(ProjectUser projectUser)
        {
            projectUser = projectUser.Save();

            SourceRepository.SourceAdd(projectUser.ProjectUserMemberId, SourceType.ProjectUser, string.Empty);

            FeedRepository.FeedAdd(FeedAction.Created, projectUser);

            return(projectUser);
        }
        public static Hour HourInsert(Hour hour)
        {
            hour = hour.Save();

            SourceRepository.SourceAdd(hour.HourId, SourceType.Hour, hour.Date.ToShortDateString());

            FeedRepository.FeedAdd(FeedAction.Created, hour);

            return(hour);
        }
 public static FeedInfoList FeedFetchInfoList(int maximumRecords)
 {
     return(FeedRepository.FeedFetchInfoList(
                new FeedDataCriteria
     {
         SortBy = "CreatedDate",
         SortOrder = ListSortDirection.Descending,
         MaximumRecords = maximumRecords
     }));
 }
Exemple #9
0
        public static Note NoteInsert(Note note)
        {
            note = note.Save();

            SourceRepository.SourceAdd(note.NoteId, SourceType.Note, note.Body);

            FeedRepository.FeedAdd(FeedAction.Created, note);

            return(note);
        }
 public static FeedInfoList FeedFetchInfoList(DateTime createdDateFrom, DateTime createdDateTo, int maximumRecords)
 {
     return(FeedRepository.FeedFetchInfoList(
                new FeedDataCriteria
     {
         CreatedDate = new DateRangeCriteria(createdDateFrom, createdDateTo),
         SortBy = "CreatedDate",
         SortOrder = ListSortDirection.Descending,
         MaximumRecords = maximumRecords
     }));
 }
Exemple #11
0
        public static bool StatusDelete(Status status)
        {
            Status.DeleteStatus(
                new StatusDataCriteria
            {
                StatusId = status.StatusId
            });

            FeedRepository.FeedAdd(FeedAction.Deleted, status);

            return(true);
        }
Exemple #12
0
        public static bool NoteDelete(Note note)
        {
            Note.DeleteNote(
                new NoteDataCriteria
            {
                NoteId = note.NoteId
            });

            FeedRepository.FeedAdd(FeedAction.Deleted, note);

            return(true);
        }
        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);
        }
Exemple #14
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);
        }
        public static bool ProjectDelete(Project project)
        {
            ProjectUserRepository.AuthorizeProjectUser(project.ProjectId);

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

            FeedRepository.FeedAdd(FeedAction.Deleted, project);

            return(true);
        }
        public static bool HourDelete(Hour hour)
        {
            Hour.DeleteHour(
                new HourDataCriteria
            {
                HourId = hour.HourId
            });

            StoryRepository.StoryUpdateDuration(hour.StoryId);

            FeedRepository.FeedAdd(FeedAction.Deleted, hour);

            return(true);
        }
Exemple #17
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);
        }
Exemple #18
0
        public static Note NoteUpdate(Note note)
        {
            if (!note.IsDirty)
            {
                return(note);
            }

            note = note.Save();

            SourceRepository.SourceUpdate(note.NoteId, SourceType.Note, note.Body);

            FeedRepository.FeedAdd(FeedAction.Edited, note);

            return(note);
        }
        public static Hour HourUpdate(Hour hour)
        {
            if (!hour.IsDirty)
            {
                return(hour);
            }

            hour = hour.Save();

            SourceRepository.SourceUpdate(hour.HourId, SourceType.Hour, hour.Date.ToShortDateString());

            FeedRepository.FeedAdd(FeedAction.Edited, hour);

            return(hour);
        }
        internal static void FeedAdd(string action, Project project)
        {
            var feed = FeedRepository.FeedNew(action, SourceType.Project, project.ProjectId);

            if (action == FeedAction.Edited)
            {
                feed.Description = project.Auditor.Audit(project);
            }
            else
            {
                feed.Description = project.Description;
            }

            feed.Save();
        }
        public static ProjectUser ProjectUserUpdate(ProjectUser projectUser)
        {
            if (!projectUser.IsDirty)
            {
                return(projectUser);
            }

            projectUser = projectUser.Save();

            SourceRepository.SourceUpdate(projectUser.ProjectUserMemberId, SourceType.ProjectUser, string.Empty);

            FeedRepository.FeedAdd(FeedAction.Edited, projectUser);

            return(projectUser);
        }
Exemple #22
0
        public static Sprint SprintUpdate(Sprint sprint)
        {
            if (!sprint.IsDirty)
            {
                return(sprint);
            }

            sprint = sprint.Save();

            SourceRepository.SourceUpdate(sprint.SprintId, SourceType.Sprint, sprint.Name);

            FeedRepository.FeedAdd(FeedAction.Edited, sprint);

            return(sprint);
        }
Exemple #23
0
        public static Story StoryUpdate(Story story)
        {
            if (!story.IsDirty)
            {
                return(story);
            }

            story = story.Save();

            SourceRepository.SourceUpdate(story.StoryId, SourceType.Story, story.StoryId.ToString());

            FeedRepository.FeedAdd(FeedAction.Edited, story);

            return(story);
        }
        internal static void FeedAdd(string action, Story story)
        {
            var feed = FeedRepository.FeedNew(action, SourceType.Story, story.StoryId);

            if (action == FeedAction.Edited)
            {
                feed.Description = story.Auditor.Audit(story);
            }
            else
            {
                feed.Description = story.Description;
            }

            feed.Sources.Add(SourceType.Project, story.ProjectId);

            feed.Save();
        }
Exemple #25
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 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 void FeedAdd(string action, Sprint sprint)
        {
            var feed = FeedRepository.FeedNew(action, SourceType.Sprint, sprint.SprintId);

            if (action == FeedAction.Edited)
            {
                feed.Description = sprint.Auditor.Audit(sprint);
            }
            else
            {
                feed.Description = sprint.Description;
            }

            feed.Sources.Add(SourceType.Project, sprint.ProjectId);

            feed.Save();
        }
        internal static void FeedAdd(string action, Hour hour)
        {
            var feed = FeedRepository.FeedNew(action, SourceType.Hour, hour.HourId);

            if (action == FeedAction.Edited)
            {
                feed.Description = hour.Auditor.Audit(hour);
            }
            else
            {
                feed.Description = hour.Notes;
            }

            feed.Sources.Add(SourceType.Project, hour.ProjectId);
            feed.Sources.Add(SourceType.Story, hour.StoryId);
            feed.Sources.Add(SourceType.User, hour.UserId);

            feed.Save();
        }
        public static Feed FeedSave(Feed feed)
        {
            if (!feed.IsValid)
            {
                return(feed);
            }

            Feed result;

            if (feed.IsNew)
            {
                result = FeedRepository.FeedInsert(feed);
            }
            else
            {
                result = FeedRepository.FeedUpdate(feed);
            }

            return(result);
        }
        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);
        }