public void AssignModeratorToForum(string tenantId, string forumId, string moderatorId)
 {
     TenantId tenant = new TenantId(tenantId);
     Forum forum = this._forumRepository.Get(tenant, new ForumId(forumId));
     Moderator moderator = this._collaboratorService.GetModeratorFrom(tenant, moderatorId);
     forum.AssignModerator(moderator);
     this._forumRepository.Save(forum);
 }
        public ForumReopened(TenantId tenantId, ForumId forumId, string exclusiveOwner)
        {
            this.TenantId = tenantId;
            this.ForumId = forumId;
            this.ExclusiveOwner = exclusiveOwner;

            this.EventVersion = 1;
            this.OccurredOn = DateTime.Now;
        }
        public Discussion(TenantId tenantId, ForumId forumId, DiscussionId discussionId, Author author, string subject, string exclusiveOwner = null)
        {
            AssertionConcern.NotNull(tenantId, "The tenant must be provided.");
            AssertionConcern.NotNull(forumId, "The forum id must be provided.");
            AssertionConcern.NotNull(discussionId, "The discussion id must be provided.");
            AssertionConcern.NotNull(author, "The author must be provided.");
            AssertionConcern.NotEmpty(subject, "The subject must be provided.");

            this.Apply(new DiscussionStarted(tenantId, forumId, discussionId, author, subject, exclusiveOwner));
        }
        public CalendarEntryParticipantUninvited(TenantId tenantId, CalendarId calendarId, CalendarEntryId calendarEntryId, Participant participant)
        {
            this.TenantId = tenantId;
            this.CalendarId = calendarId;
            this.CalendarEntryId = calendarEntryId;
            this.Participant = participant;

            this.EventVersion = 1;
            this.OccurredOn = DateTime.Now;
        }
        public ForumSubjectChanged(TenantId tenantId, ForumId forumId, string subject, string exclusiveOwner)
        {
            this.TenantId = tenantId;
            this.ForumId = forumId;
            this.Subject = subject;
            this.ExclusiveOwner = exclusiveOwner;

            this.EventVersion = 1;
            this.OccurredOn = DateTime.Now;
        }
        public CalendarUnhared(TenantId tenantId, CalendarId calendarId, string name, CalendarSharer unsharedWith)
        {
            this.TenantId = tenantId;
            this.CalendarId = calendarId;
            this.Name = name;
            this.UnsharedWith = unsharedWith;

            this.EventVersion = 1;
            this.OccurredOn = DateTime.Now;
        }
        public DiscussionClosed(TenantId tenantId, ForumId forumId, DiscussionId discussionId, string exclusiveOwner)
        {
            this.TenantId = tenantId;
            this.ForumId = forumId;
            this.DiscussionId = discussionId;
            this.ExclusiveOwner = exclusiveOwner;

            this.EventVersion = 1;
            this.OccurredOn = DateTime.Now;
        }
        public ForumModeratorChanged(TenantId tenantId, ForumId forumId, Moderator moderator, string exclusiveOwner)
        {
            this.TenantId = tenantId;
            this.ForumId = forumId;
            this.Moderator = moderator;
            this.ExclusiveOwner = exclusiveOwner;

            this.EventVersion = 1;
            this.OccurredOn = DateTime.Now;
        }
        public CalendarRenamed(TenantId tenantId, CalendarId calendarId, string name, string description)
        {
            this.TenantId = tenantId;
            this.CalendarId = calendarId;
            this.Name = name;
            this.Description = description;

            this.EventVersion = 1;
            this.OccurredOn = DateTime.Now;
        }
        public CalendarEntryRelocated(TenantId tenantId, CalendarId calendarId, CalendarEntryId calendarEntryId, string location)
        {
            this.TenantId = tenantId;
            this.CalendarId = calendarId;
            this.CalendarEntryId = calendarEntryId;
            this.Location = location;

            this.EventVersion = 1;
            this.OccurredOn = DateTime.Now;
        }
        public ForumDescriptionChanged(TenantId tenantId, ForumId formId, string description, string exclusiveOwner)
        {
            this.TenantId = tenantId;
            this.FormId = formId;
            this.Description = description;
            this.ExclusiveOwner = exclusiveOwner;

            this.EventVersion = 1;
            this.OccurredOn = DateTime.Now;
        }
        public CalendarEntryDescriptionChanged(TenantId tenantId, CalendarId calendarId, CalendarEntryId calendarEntryId, string description)
        {
            this.TenantId = tenantId;
            this.CalendarId = calendarId;
            this.CalendarEntryId = calendarEntryId;
            this.Description = description;

            this.EventVersion = 1;
            this.OccurredOn = DateTime.Now;
        }
        public Calendar(TenantId tenantId, CalendarId calendarId, string name, string description, Owner owner,
            IEnumerable<CalendarSharer> sharedWith = null)
        {
            AssertionConcern.NotNull(tenantId, "The tenant must be provided.");
            AssertionConcern.NotNull(calendarId, "The calendar id must be provided.");
            AssertionConcern.NotEmpty(name, "The name must be provided.");
            AssertionConcern.NotEmpty(description, "The description must be provided.");
            AssertionConcern.NotNull(owner, "The owner must be provided.");

            this.Apply(new CalendarCreated(tenantId, calendarId, name, description, owner, sharedWith));
        }
Example #14
0
        public Forum(TenantId tenantId, ForumId forumId, Creator creator, Moderator moderator, string subject,
            string description, string exclusiveOwner)
        {
            AssertionConcern.NotNull(tenantId, "The tenant must be provided.");
            AssertionConcern.NotNull(forumId, "The forum id must be provided.");
            AssertionConcern.NotNull(creator, "The creator must be provided.");
            AssertionConcern.NotNull(moderator, "The moderator must be provided.");
            AssertionConcern.NotEmpty(subject, "The subject must be provided.");
            AssertionConcern.NotEmpty(description, "The description must be provided.");

            this.Apply(new ForumStarted(tenantId, forumId, creator, moderator, subject, description, exclusiveOwner));
        }
        public CalendarCreated(TenantId tenantId, CalendarId calendarId, string name, string description, Owner owner, IEnumerable<CalendarSharer> sharedWith)
        {
            this.TenantId = tenantId;
            this.CalendarId = calendarId;
            this.Name = name;
            this.Description = description;
            this.Owner = owner;
            this.SharedWith = sharedWith;

            this.EventVersion = 1;
            this.OccurredOn = DateTime.Now;
        }
 public PostedToDiscussion(TenantId tenantIdId, ForumId forumId, DiscussionId discussionId, PostId postId,
     Author author, string subject, string bodyText, PostId replyToPostId)
 {
     this.TenantIdId = tenantIdId;
     this.ForumId = forumId;
     this.DiscussionId = discussionId;
     this.PostId = postId;
     this.Author = author;
     this.Subject = subject;
     this.BodyText = bodyText;
     this.ReplyToPostId = replyToPostId;
 }
        public CalendarEntryRescheduled(TenantId tenantId, CalendarId calendarId, CalendarEntryId calendarEntryId,
            DateRange timeSpan, Repetition repetition, Alarm alarm)
        {
            this.TenantId = tenantId;
            this.CalendarId = calendarId;
            this.CalendarEntryId = calendarEntryId;
            this.TimeSpan = timeSpan;
            this.Repetition = repetition;
            this.Alarm = alarm;

            this.EventVersion = 1;
            this.OccurredOn = DateTime.Now;
        }
        public PostedContentAltered(TenantId tenantId, ForumId forumId, DiscussionId discussionId, PostId postId,
            string subject, string bodyText)
        {
            this.TenantId = tenantId;
            this.ForumId = forumId;
            this.DiscussionId = discussionId;
            this.PostId = postId;
            this.Subject = subject;
            this.BodyText = bodyText;

            this.EventVersion = 1;
            this.OccurredOn = DateTime.Now;
        }
Example #19
0
        public Post(TenantId tenantId, ForumId forumId, DiscussionId discussionId, PostId postId, Author author, 
            string subject, string bodyText, PostId replyToPostId=null)
        {
            AssertionConcern.NotNull(tenantId, "The tenant must be provided.");
            AssertionConcern.NotNull(forumId, "The forum id must be provided.");
            AssertionConcern.NotNull(discussionId, "The discussion id must be provided.");
            AssertionConcern.NotNull(postId, "The post id must be provided.");
            AssertionConcern.NotNull(author, "The author must be provided.");

            this.AssertPostContent(subject, bodyText);

            this.Apply(new PostedToDiscussion(tenantId, forumId, discussionId, postId, author, subject, bodyText, replyToPostId));
        }
        public DiscussionStarted(TenantId tenantId, ForumId forumId, DiscussionId discussionId, Author author,
            string subject, string exclusiveOwner)
        {
            this.TenantId = tenantId;
            this.ForumId = forumId;
            this.DiscussionId = discussionId;
            this.Author = author;
            this.Subject = subject;
            this.ExclusiveOwner = exclusiveOwner;

            this.EventVersion = 1;
            this.OccurredOn = DateTime.Now;
        }
        public ForumStarted(TenantId tenantId, ForumId forumId, Creator creator, Moderator moderator, string subject,
            string description, string exclusiveOwner)
        {
            this.TenantId = tenantId;
            this.ForumId = forumId;
            this.Creator = creator;
            this.Moderator = moderator;
            this.Subject = subject;
            this.Description = description;
            this.ExclusiveOwner = exclusiveOwner;

            this.EventVersion = 1;
            this.OccurredOn = DateTime.Now;
        }
        public void StartExclusiveForum(string tenantId, string exclusiveOwner, string creatorId, string moderatorId,
            string subject, string description, IForumCommandResult result = null)
        {
            TenantId tenant = new TenantId(tenantId);
            Forum forum = null;
            string forumId = this._forumQueryService.GetForumIdByExclusiveOwner(tenantId, exclusiveOwner);
            if(forumId!=null) {
                forum = this._forumRepository.Get(tenant, new ForumId(forumId));
            }

            if(forum==null) {
                forum = StartNewForum(tenant, creatorId, moderatorId, subject, description, exclusiveOwner);
            }

            if(result!=null) {
                result.SetResultingForumId(forum.ForumId.Id);
            }
        }
        public CalendarEntryScheduled(TenantId tenantId, CalendarId calendarId, CalendarEntryId calendarEntryId,
            string description, string location, Owner owner, DateRange timeSpan, Repetition repetition, Alarm alarm,
            IEnumerable<Participant> invitees)
        {
            this.TenantId = tenantId;
            this.CalendarId = calendarId;
            this.CalendarEntryId = calendarEntryId;
            this.Description = description;
            this.Location = location;
            this.Owner = owner;
            this.TimeSpan = timeSpan;
            this.Repetition = repetition;
            this.Alarm = alarm;
            this.Invitees = invitees;

            this.EventVersion = 1;
            this.OccurredOn = DateTime.Now;
        }
        public CalendarEntry(TenantId tenantId, CalendarId calendarId, CalendarEntryId calendarEntryId,
            string description, string location, Owner owner, DateRange timeSpan, Repetition repetition, 
            Alarm alarm, IEnumerable<Participant> invitees = null)
        {
            AssertionConcern.NotNull(tenantId, "The tenant must be provided.");
            AssertionConcern.NotNull(calendarId, "The calendar id must be provided.");
            AssertionConcern.NotNull(calendarEntryId, "The calendar entry id must be provided.");
            AssertionConcern.NotEmpty(description, "The description must be provided.");
            AssertionConcern.NotEmpty(location, "The location must be provided.");
            AssertionConcern.NotNull(owner, "The owner must be provided.");
            AssertionConcern.NotNull(timeSpan, "The time span must be provided.");
            AssertionConcern.NotNull(repetition, "The repetition must be provided.");
            AssertionConcern.NotNull(alarm, "The alarm must be provided.");

            if(repetition.Repeats==RepeatType.DoesNotRepeat) {
                repetition = Repetition.DoesNotRepeat(timeSpan.Ends);
            }

            AssertTimeSpans(repetition, timeSpan);

            this.Apply(new CalendarEntryScheduled(tenantId, calendarId, calendarEntryId, description, location, owner,
                timeSpan, repetition, alarm, invitees));
        }
 private IEnumerable<Participant> GetInviteesFrom(TenantId tenantId, IEnumerable<string> participantsToInvite)
 {
     HashSet<Participant> invitees = new HashSet<Participant>();
     foreach(string participantId in participantsToInvite) {
         Participant participant = this._collaboratorService.GetParticipantFrom(tenantId, participantId);
         invitees.Add(participant);
     }
     return invitees;
 }
 private void When(DiscussionStarted e)
 {
     this._tenantId = e.TenantId;
     this._forumId = e.ForumId;
     this._discussionId = e.DiscussionId;
     this._author = e.Author;
     this._subject = e.Subject;
     this._exclusiveOwner = e.ExclusiveOwner;
 }
        private Forum StartNewForum(TenantId tenantId, string creatorId, string moderatorId, string subject,
            string description, string exclusiveOwner)
        {
            Creator creator = this._collaboratorService.GetCreatorFrom(tenantId, creatorId);
            Moderator moderator = this._collaboratorService.GetModeratorFrom(tenantId, moderatorId);

            Forum forum = new Forum(tenantId, this._forumRepository.GetNextIdentity(), creator, moderator, subject,
                description, exclusiveOwner);
            this._forumRepository.Save(forum);

            return forum;
        }
        public void StartExclusiveForumWithDiscussion(string tenantId, string exclusiveOwner, string creatorId,
            string moderatorId, string authorId, string forumSubject, string forumDescription, string discussionSubject,
            IForumCommandResult result = null)
        {
            TenantId tenant = new TenantId(tenantId);
            Forum forum = null;
            string forumId = this._forumQueryService.GetForumIdByExclusiveOwner(tenantId, exclusiveOwner);
            if (forumId != null) {
                forum = this._forumRepository.Get(tenant, new ForumId(forumId));
            }

            if (forum == null) {
                forum = StartNewForum(tenant, creatorId, moderatorId, forumSubject, forumDescription, exclusiveOwner);
            }

            Discussion discussion = null;

            string discussionId = this._discussionQueryService.GetDiscussionIdByExclusiveOwner(tenantId, exclusiveOwner);
            if(discussionId!=null) {
                discussion = this._discussionRepository.Get(tenant, new DiscussionId(discussionId));
            }

            if(discussion==null) {
                Author author = this._collaboratorService.GetAuthorFrom(tenant, authorId);
                discussion = forum.StartDiscussionFor(this._forumIdentityService, author, discussionSubject,
                    exclusiveOwner);
                this._discussionRepository.Save(discussion);
            }

            if (result != null) {
                result.SetResultingForumId(forum.ForumId.Id);
                result.SetResultingDiscussionId(discussion.DiscussionId.Id);
            }
        }
Example #29
0
 private void When(ForumStarted e)
 {
     this._tenantId = e.TenantId;
     this._forumId = e.ForumId;
     this._creator = e.Creator;
     this._moderator = e.Moderator;
     this._subject = e.Subject;
     this._description = e.Description;
     this._exclusiveOwner = e.ExclusiveOwner;
 }
 private void When(CalendarCreated e)
 {
     this._tenantId = e.TenantId;
     this._calendarId = e.CalendarId;
     this._name = e.Name;
     this._description = e.Description;
     this._sharedWith = new HashSet<CalendarSharer>(e.SharedWith ?? Enumerable.Empty<CalendarSharer>());
 }