-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLocationAppointment.cs
More file actions
31 lines (26 loc) · 1.41 KB
/
LocationAppointment.cs
File metadata and controls
31 lines (26 loc) · 1.41 KB
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
public class LocationAppointment : Wrapper<Appointment>
{
private LocationAppointment(Appointment appt) : base(appt)
{
if (appt.LocationId == Guid.Empty)
throw new Exception("Appointment must have a valid LocationId");
if (appt.BookedStart == DateTime.MinValue)
throw new Exception($"{nameof(LocationAppointment)} must have a valid {nameof(Appointment.BookedStart)} date");
if (appt.BookedEnd == DateTime.MinValue)
throw new Exception($"{nameof(LocationAppointment)} must have a valid {nameof(Appointment.BookedEnd)} date");
}
public Guid LocationId => Entity.LocationId;
public IReadOnlyCollection<SelectedAppointmentResource> SelectedAppointmentResources => Entity.SelectedAppointmentResources;
public IReadOnlyCollection<SelectedAppointmentEmployee> SelectedAppointmentEmployees => Entity.SelectedAppointmentEmployees;
public DateTime BookedStart => Entity.BookedStart;
public DateTime BookedEnd => Entity.BookedEnd;
public void SelectResource(MatchingResource matchingResource)
{
this.Entity.AddSelectedResource(matchingResource);
}
public static LocationAppointment From(Appointment appt) => new(appt);
public ResourceAppointment ToResourceAppointment()
=> ResourceAppointment.From(this); // TODO: See below
public EmployeeAppointment ToEmployeeAppointment()
=> EmployeeAppointment.From(this);
}