Browse Source

Introduced tracks, sesions and speakers.

pull/79/head
Halil İbrahim Kalkan 5 years ago
parent
commit
d5ff028335
  1. 1
      src/EventHub.Domain.Shared/EventHubErrorCodes.cs
  2. 14
      src/EventHub.Domain.Shared/Events/SessionConsts.cs
  3. 7
      src/EventHub.Domain.Shared/Events/TrackConsts.cs
  4. 3
      src/EventHub.Domain.Shared/Localization/EventHub/en.json
  5. 7
      src/EventHub.Domain/Events/Event.cs
  6. 70
      src/EventHub.Domain/Events/Session.cs
  7. 23
      src/EventHub.Domain/Events/Speaker.cs
  8. 39
      src/EventHub.Domain/Events/Track.cs

1
src/EventHub.Domain.Shared/EventHubErrorCodes.cs

@ -5,6 +5,7 @@
public const string OrganizationNameAlreadyExists = "EventHub:OrganizationNameAlreadyExists";
public const string NotAuthorizedToCreateEventInThisOrganization = "EventHub:NotAuthorizedToCreateEventInThisOrganization";
public const string EventEndTimeCantBeEarlierThanStartTime = "EventHub:EventEndTimeCantBeEarlierThanStartTime";
public const string SessionEndTimeCantBeEarlierThanStartTime = "EventHub:SessionEndTimeCantBeEarlierThanStartTime";
public const string CantRegisterOrUnregisterForAPastEvent = "EventHub:CantRegisterOrUnregisterForAPastEvent";
public const string NotAuthorizedToUpdateOrganizationProfile = "EventHub:NotAuthorizedToUpdateOrganizationProfile";
public const string CapacityOfEventFull = "EventHub:CapacityOfEventFull";

14
src/EventHub.Domain.Shared/Events/SessionConsts.cs

@ -0,0 +1,14 @@
namespace EventHub.Events
{
public class SessionConsts
{
public const int MinTitleLength = 8;
public const int MaxTitleLength = 128;
public const int MinDescriptionLength = 50;
public const int MaxDescriptionLength = 2000;
public const int MinLanguageLength = 2;
public const int MaxLanguageLength = 16;
}
}

7
src/EventHub.Domain.Shared/Events/TrackConsts.cs

@ -0,0 +1,7 @@
namespace EventHub.Events
{
public class TrackConsts
{
public const int MaxNameLength = 64;
}
}

3
src/EventHub.Domain.Shared/Localization/EventHub/en.json

@ -82,6 +82,7 @@
"EventTimingPreview": "Event Timing Preview",
"CoverImagePreview": "Cover Image Preview",
"EventTimingChangeSuccessMessage": "The time of the event has been changed successfully!",
"PastEvent": "Past Event"
"PastEvent": "Past Event",
"EventHub:SessionEndTimeCantBeEarlierThanStartTime": "Session end time can not be earlier than the start time."
}
}

7
src/EventHub.Domain/Events/Event.cs

@ -1,4 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using Volo.Abp;
using Volo.Abp.Domain.Entities.Auditing;
@ -41,6 +43,8 @@ namespace EventHub.Events
public int TimingChangeCount { get; set; }
public bool IsTimingChangeEmailSent { get; set; }
public ICollection<Track> Tracks { get; private set; }
private Event()
{
@ -59,9 +63,12 @@ namespace EventHub.Events
{
OrganizationId = organizationId;
UrlCode = Check.NotNullOrWhiteSpace(urlCode, urlCode, EventConsts.UrlCodeLength, EventConsts.UrlCodeLength);
SetTitle(title);
SetDescription(description);
SetTimeInternal(startTime, endTime);
Tracks = new Collection<Track>();
}
public Event SetTitle(string title)

70
src/EventHub.Domain/Events/Session.cs

@ -0,0 +1,70 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using Volo.Abp;
using Volo.Abp.Domain.Entities;
namespace EventHub.Events
{
public class Session : Entity<Guid>
{
public Guid TrackId { get; private set; }
public string Title { get; private set; }
public DateTime StartTime { get; private set; }
public DateTime EndTime { get; private set; }
public string Description { get; private set; }
public string Language { get; set; }
public ICollection<Speaker> Speakers { get; private set; }
private Session()
{
}
internal Session(
Guid id,
Guid trackId,
string title,
DateTime startTime,
DateTime endTime,
string description)
: base(id)
{
TrackId = trackId;
SetTitle(title);
SetDescription(description);
SetTime(startTime, endTime);
Speakers = new Collection<Speaker>();
}
public Session SetTitle(string title)
{
Title = Check.NotNullOrWhiteSpace(title, nameof(title), SessionConsts.MaxTitleLength, SessionConsts.MinTitleLength);
return this;
}
public Session SetDescription(string description)
{
Description = Check.NotNullOrWhiteSpace(description, nameof(description), SessionConsts.MaxDescriptionLength, SessionConsts.MinDescriptionLength);
return this;
}
internal Session SetTime(DateTime startTime, DateTime endTime)
{
if (startTime > endTime)
{
throw new BusinessException(EventHubErrorCodes.SessionEndTimeCantBeEarlierThanStartTime);
}
StartTime = startTime;
EndTime = endTime;
return this;
}
}
}

23
src/EventHub.Domain/Events/Speaker.cs

@ -0,0 +1,23 @@
using System;
using Volo.Abp.Domain.Entities;
namespace EventHub.Events
{
public class Speaker : Entity
{
public Guid SessionId { get; private set; }
public Guid UserId { get; private set; }
public Speaker(Guid sessionId, Guid userId)
{
SessionId = sessionId;
UserId = userId;
}
public override object[] GetKeys()
{
return new object[] {SessionId, UserId};
}
}
}

39
src/EventHub.Domain/Events/Track.cs

@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using Volo.Abp;
using Volo.Abp.Domain.Entities;
namespace EventHub.Events
{
public class Track : Entity<Guid>
{
public Guid EventId { get; private set; }
public string Name { get; private set; }
public ICollection<Session> Sessions { get; private set; }
private Track()
{
}
internal Track(
Guid id,
Guid eventId,
string name)
: base(id)
{
EventId = eventId;
Name = name;
Sessions = new Collection<Session>();
}
public Track SetName(string name)
{
Name = Check.NotNullOrWhiteSpace(name, nameof(name), TrackConsts.MaxNameLength);
return this;
}
}
}
Loading…
Cancel
Save