-
Notifications
You must be signed in to change notification settings - Fork 0
/
Event.cs
107 lines (89 loc) · 3.23 KB
/
Event.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Cain.Domain.Entities.Enums;
namespace Cain.Domain.Entities
{
public class Event
{
private Event() { }
public Event(string Title, string Description, DateTime InitialDateTime, DateTime FinalDateTime, string EnviromentLocation, EventKind Kind)
{
this.Title = Title;
this.Description = this.Description;
this.InitialDateTime = InitialDateTime;
this.FinalDateTime = FinalDateTime;
this.EnvironmentLocation = EnvironmentLocation;
this.Kind = Kind;
// - Default properties.
this.CreationDateTime = DateTime.Now;
this.ModificationDateTime = DateTime.Now;
this.Status = EventStatus.Created;
}
public int Id { get; private set; }
public string Title { get; private set; }
public string Description { get; private set; }
public DateTime CreationDateTime { get; private set; }
public DateTime ModificationDateTime { get; private set; }
public DateTime InitialDateTime { get; private set; }
public DateTime FinalDateTime { get; private set; }
public string EnvironmentLocation { get; private set; }
public EventKind Kind { get; private set; }
public EventStatus Status { get; private set; }
public virtual ICollection<Problem> Problems { get; private set; }
public virtual ICollection<Student> Students { get; private set; }
public void Upload() {
this.Status = EventStatus.Uploaded;
this.ModificationDateTime = DateTime.Now;
}
public void Unload() {
this.Status = EventStatus.Unloaded;
}
public void Cancel() {
this.Status = EventStatus.Canceled;
}
public void Start() {
this.Status = EventStatus.Started;
}
public void Finish() {
this.Status = EventStatus.Finished;
}
public void Archive() {
this.Status = EventStatus.Archived;
}
public void Update(DateTime InitialDateTime, DateTime FinalDateTime) {
this.InitialDateTime = InitialDateTime;
this.FinalDateTime = FinalDateTime;
this.ModificationDateTime = DateTime.Now;
}
public void Update(string Title, string Description)
{
this.Title = Title;
this.Description = Description;
this.ModificationDateTime = DateTime.Now;
}
public Problem AddProblem(Problem problem) {
Problems.Add(problem);
return problem;
}
public void RemoveProblem(Problem problem) {
Problems.Remove(problem);
}
public Student AddStudent(Student student) {
Students.Add(student);
return student;
}
public void RemoveStudent(Student student) {
Students.Remove(student);
}
public void AddGroup(Group group)
{
foreach (var student in group.Students)
{
this.AddStudent(student);
}
}
}
}