コード例 #1
0
 public DiscussionClosed(Tenant tenantId, ForumId forumId, DiscussionId discussionId, string exclusiveOwner)
 {
     this.TenantId = tenantId;
     this.ForumId = forumId;
     this.DiscussionId = discussionId;
     this.ExclusiveOwner = exclusiveOwner;
 }
コード例 #2
0
 public CalendarDescriptionChanged(Tenant tenant, CalendarId calendarId, string name, string description)
 {
     this.Tenant = tenant;
     this.CalendarId = calendarId;
     this.Name = name;
     this.Description = description;
 }
コード例 #3
0
 public CalendarShared(Tenant tenant, CalendarId calendarId, string name, CalendarSharer sharedWith)
 {
     this.Tenant = tenant;
     this.CalendarId = calendarId;
     this.Name = name;
     this.SharedWith = sharedWith;
 }
コード例 #4
0
 public ForumSubjectChanged(Tenant tenantId, ForumId forumId, string subject, string exclusiveOwner)
 {
     this.TenantId = tenantId;
     this.ForumId = forumId;
     this.Subject = subject;
     this.ExclusiveOwner = exclusiveOwner;
 }
コード例 #5
0
        public CalendarEntry(
            Tenant tenant,
            CalendarId calendarId,
            CalendarEntryId calendarEntryId,
            string description,
            string location,
            Owner owner,
            DateRange timeSpan,
            Repetition repetition,
            Alarm alarm,
            IEnumerable<Participant> invitees = null)
        {
            AssertionConcern.AssertArgumentNotNull(tenant, "The tenant must be provided.");
            AssertionConcern.AssertArgumentNotNull(calendarId, "The calendar id must be provided.");
            AssertionConcern.AssertArgumentNotNull(calendarEntryId, "The calendar entry id must be provided.");
            AssertionConcern.AssertArgumentNotEmpty(description, "The description must be provided.");
            AssertionConcern.AssertArgumentNotEmpty(location, "The location must be provided.");
            AssertionConcern.AssertArgumentNotNull(owner, "The owner must be provided.");
            AssertionConcern.AssertArgumentNotNull(timeSpan, "The time span must be provided.");
            AssertionConcern.AssertArgumentNotNull(repetition, "The repetition must be provided.");
            AssertionConcern.AssertArgumentNotNull(alarm, "The alarm must be provided.");

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

            AssertTimeSpans(repetition, timeSpan);

            Apply(new CalendarEntryScheduled(tenant, calendarId, calendarEntryId, description, location, owner, timeSpan, repetition, alarm, invitees));
        }
コード例 #6
0
 public ForumModeratorChanged(Tenant tenantId, ForumId forumId, Moderator moderator,string exclusiveOwner)
 {
     this.TenantId = tenantId;
     this.ForumId = forumId;
     this.Moderator = moderator;
     this.ExclusiveOwner = exclusiveOwner;
 }
コード例 #7
0
 public ForumDescriptionChanged(Tenant tenantId, ForumId forumId, string description, string exclusiveOwner)
 {
     this.TenantId = tenantId;
     this.ForumId = forumId;
     this.Description = description;
     this.ExclusiveOwner = exclusiveOwner;
 }
コード例 #8
0
 public Calendar(Tenant tenant, CalendarId calendarId, string name, string description, Owner owner, IEnumerable<CalendarSharer> sharedWith = null)
 {
     AssertionConcern.AssertArgumentNotNull(tenant, "The tenant must be provided.");
     AssertionConcern.AssertArgumentNotNull(calendarId, "The calendar id must be provided.");
     AssertionConcern.AssertArgumentNotEmpty(name, "The name must be provided.");
     AssertionConcern.AssertArgumentNotEmpty(description, "The description must be provided.");
     AssertionConcern.AssertArgumentNotNull(owner, "The owner must be provided.");
     Apply(new CalendarCreated(tenant, calendarId, name, description, owner, sharedWith));
 }
コード例 #9
0
 public PostedContentAltered(Tenant 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;
 }
コード例 #10
0
 public DiscussionStarted(Tenant 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;
 }
コード例 #11
0
 public CalendarCreated(Tenant tenant, CalendarId calendarId, string name, string description, Owner owner, IEnumerable<CalendarSharer> sharedWith)
 {
     this.Tenant = tenant;
     this.CalendarId = calendarId;
     this.Name = name;
     this.Description = description;
     this.Owner = owner;
     this.SharedWith = sharedWith;
 }
コード例 #12
0
        public Discussion(Tenant tenantId, ForumId forumId, DiscussionId discussionId, Author author, string subject, string exclusiveOwner = null)
        {
            AssertionConcern.AssertArgumentNotNull(tenantId, "The tenant must be provided.");
            AssertionConcern.AssertArgumentNotNull(forumId, "The forum id must be provided.");
            AssertionConcern.AssertArgumentNotNull(discussionId, "The discussion id must be provided.");
            AssertionConcern.AssertArgumentNotNull(author, "The author must be provided.");
            AssertionConcern.AssertArgumentNotEmpty(subject, "The subject must be provided.");

            Apply(new DiscussionStarted(tenantId, forumId, discussionId, author, subject, exclusiveOwner));
        }
コード例 #13
0
ファイル: ForumStarted.cs プロジェクト: asr0/IDDD_Samples_NET
 public ForumStarted(Tenant 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;
 }
コード例 #14
0
 ISet<Participant> GetInviteesFrom(Tenant tenant, ISet<string> participantsToInvite)
 {
     var invitees = new HashSet<Participant>();
     foreach (string participatnId in participantsToInvite)
     {
         var participant = this.collaboratorService.GetParticipantFrom(tenant, participatnId);
         invitees.Add(participant);
     }
     return invitees;
 }
コード例 #15
0
ファイル: Post.cs プロジェクト: asr0/IDDD_Samples_NET
 void When(PostedToDiscussion e)
 {
     this.tenantId = e.TenantId;
     this.forumId = e.ForumId;
     this.discussionId = e.DiscussionId;
     this.postId = e.PostId;
     this.author = e.Author;
     this.subject = e.Subject;
     this.bodyText = e.BodyText;
     this.replyToPostId = e.ReplyToPostId;
 }
コード例 #16
0
ファイル: Post.cs プロジェクト: asr0/IDDD_Samples_NET
        public Post(Tenant tenantId, ForumId forumId, DiscussionId discussionId, PostId postId, Author author, string subject, string bodyText, PostId replyToPostId = null)
        {
            AssertionConcern.AssertArgumentNotNull(tenantId, "The tenant must be provided.");
            AssertionConcern.AssertArgumentNotNull(forumId, "The forum id must be provided.");
            AssertionConcern.AssertArgumentNotNull(discussionId, "The discussion id must be provided.");
            AssertionConcern.AssertArgumentNotNull(postId, "The post id must be provided.");
            AssertionConcern.AssertArgumentNotNull(author, "The author must be provided.");
            AssertPostContent(subject, bodyText);

            Apply(new PostedToDiscussion(tenantId, forumId, discussionId, postId, author, subject, bodyText, replyToPostId));
        }
コード例 #17
0
 public CalendarEntryRelocated(
     Tenant tenant,
     CalendarId calendarId,
     CalendarEntryId calendarEntryId,
     string location)
 {
     this.Tenant = tenant;
     this.CalendarId = calendarId;
     this.CalendarEntryId = calendarEntryId;
     this.Location = location;
 }
コード例 #18
0
 public CalendarEntryDescriptionChanged(
     Tenant tenant,
     CalendarId calendarId,
     CalendarEntryId calendarEntryId,
     string description)
 {
     this.Tenant = tenant;
     this.CalendarId = calendarId;
     this.CalendarEntryId = calendarEntryId;
     this.Description = description;
 }
コード例 #19
0
ファイル: Forum.cs プロジェクト: nutshellit/IDDD_Samples_NET
        public Forum(Tenant tenantId, ForumId forumId, Creator creator, Moderator moderator, string subject, string description, string exclusiveOwner)
        {
            AssertionConcern.AssertArgumentNotNull(tenantId, "The tenant must be provided.");
            AssertionConcern.AssertArgumentNotNull(forumId, "The forum id must be provided.");
            AssertionConcern.AssertArgumentNotNull(creator, "The creator must be provided.");
            AssertionConcern.AssertArgumentNotNull(moderator, "The moderator must be provided.");
            AssertionConcern.AssertArgumentNotEmpty(subject, "The subject must be provided.");
            AssertionConcern.AssertArgumentNotEmpty(description, "The description must be provided.");

            Apply(new ForumStarted(tenantId, forumId, creator, moderator, subject, description, exclusiveOwner));
        }
コード例 #20
0
 public PostedToDiscussion(Tenant tenantId, ForumId forumId, DiscussionId discussionId, PostId postId, Author author, string subject, string bodyText, PostId replyToPostId)
 {
     this.TenantId = tenantId;
     this.ForumId = forumId;
     this.DiscussionId = discussionId;
     this.PostId = postId;
     this.Author = author;
     this.Subject = subject;
     this.BodyText = bodyText;
     this.ReplyToPostId = replyToPostId;
 }
コード例 #21
0
 public CalendarEntryParticipantUninvited(
     Tenant tenant,
     CalendarId calendarId,
     CalendarEntryId calendarEntryId,
     Participant participant)
 {
     this.Tenant = tenant;
     this.CalendarId = calendarId;
     this.CalendarEntryId = calendarEntryId;
     this.Participant = participant;
 }
コード例 #22
0
        public void ShareCalendarWith(string tenantId, string calendarId, ISet<string> participantsToShareWith)
        {
            var tenant = new Tenant(tenantId);
            var calendar = this.calendarRepository.Get(tenant, new CalendarId(calendarId));

            foreach (var sharer in GetSharersFrom(tenant, participantsToShareWith))
            {
                calendar.ShareCalendarWith(sharer);
            }

            this.calendarRepository.Save(calendar);
        }
コード例 #23
0
        public void UninviteCalendarEntryParticipant(string tenantId, string calendarEntryId, ISet<string> participantsToUninvite)
        {
            var tenant = new Tenant(tenantId);
            var calendarEntry = this.calendarEntryRepository.Get(tenant, new CalendarEntryId(calendarEntryId));

            foreach (var participant in GetInviteesFrom(tenant, participantsToUninvite))
            {
                calendarEntry.Uninvite(participant);
            }

            this.calendarEntryRepository.Save(calendarEntry);
        }
コード例 #24
0
        public void CreateCalendar(string tenantId, string name, string description, string ownerId, ISet<string> participantsToShareWith, ICalendarCommandResult calendarCommandResult)
        {
            var tenant = new Tenant(tenantId);
            var owner = this.collaboratorService.GetOwnerFrom(tenant, ownerId);
            var sharers = GetSharersFrom(tenant, participantsToShareWith);

            var calendar = new Calendar(tenant, this.calendarRepository.GetNextIdentity(), name, description, owner, sharers);

            this.calendarRepository.Save(calendar);

            calendarCommandResult.SetResultingCalendarId(calendar.CalendarId.Id);
        }
コード例 #25
0
        public void AssignModeratorToForum(string tenantId, string forumId, string moderatorId)
        {
            var tenant = new Tenant(tenantId);

            var forum = this.forumRepository.Get(tenant, new ForumId(forumId));

            var moderator = this.collaboratorService.GetModeratorFrom(tenant, moderatorId);

            forum.AssignModerator(moderator);

            this.forumRepository.Save(forum);
        }
コード例 #26
0
 void When(CalendarEntryScheduled e)
 {
     this.tenant = e.Tenant;
     this.calendarId = e.CalendarId;
     this.calendarEntryId = e.CalendarEntryId;
     this.description = e.Description;
     this.location = e.Location;
     this.owner = e.Owner;
     this.timeSpan = e.TimeSpan;
     this.repetition = e.Repetition;
     this.alarm = e.Alarm;
     this.invitees = new HashSet<Participant>(e.Invitees ?? Enumerable.Empty<Participant>());
 }
コード例 #27
0
 public CalendarEntryRescheduled(
     Tenant tenant,
     CalendarId calendarId,
     CalendarEntryId calendarEntryId,
     DateRange timeSpan,
     Repetition repetition,
     Alarm alarm)
 {
     this.Tenant = tenant;
     this.CalendarId = calendarId;
     this.CalendarEntryId = calendarEntryId;
     this.TimeSpan = timeSpan;
     this.Repetition = repetition;
     this.Alarm = alarm;
 }
コード例 #28
0
        public void ModeratePost(
            string tenantId,
            string forumId,
            string postId,
            string moderatorId,
            string subject,
            string bodyText)
        {
            var tenant = new Tenant(tenantId);

            var forum = this.forumRepository.Get(tenant, new ForumId(forumId));

            var moderator = this.collaboratorService.GetModeratorFrom(tenant, moderatorId);

            var post = this.postRepository.Get(tenant, new PostId(postId));

            forum.ModeratePost(post, moderator, subject, bodyText);

            this.postRepository.Save(post);
        }
コード例 #29
0
        public void ScheduleCalendarEntry(string tenantId, string calendarId, string description, string location, string ownerId, DateTime timeSpanBegins, DateTime timeSpanEnds,
            string repeatType, DateTime repeatEndsOn, string alarmType, int alarmUnits, ISet<string> participantsToInvite, ICalendarCommandResult calendarCommandResult)
        {
            var tenant = new Tenant(tenantId);

            var calendar = this.calendarRepository.Get(tenant, new CalendarId(calendarId));

            var calendarEntry = calendar.ScheduleCalendarEntry(
                this.calendarIdentityService,
                description,
                location,
                this.collaboratorService.GetOwnerFrom(tenant, ownerId),
                new DateRange(timeSpanBegins, timeSpanEnds),
                new Repetition((RepeatType)Enum.Parse(typeof(RepeatType), repeatType), repeatEndsOn),
                new Alarm((AlarmUnitsType)Enum.Parse(typeof(AlarmUnitsType), alarmType), alarmUnits),
                GetInviteesFrom(tenant, participantsToInvite));

            this.calendarEntryRepository.Save(calendarEntry);

            calendarCommandResult.SetResultingCalendarId(calendar.CalendarId.Id);
            calendarCommandResult.SetResultingCalendarEntryId(calendarEntry.CalendarEntryId.Id);
        }
コード例 #30
0
 public CalendarEntryScheduled(
     Tenant tenant, 
     CalendarId calendarId, 
     CalendarEntryId calendarEntryId, 
     string description, 
     string location, 
     Owner owner, 
     DateRange timeSpan, 
     Repetition repetition,
     Alarm alarm,
     IEnumerable<Participant> invitees)
 {
     this.Tenant = tenant;
     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;
 }