57 lines
1.8 KiB
C#
57 lines
1.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using InternshipSystem.Core.Entity.Internship;
|
|
using InternshipSystem.Core.UglyOrmArtifacts;
|
|
|
|
namespace InternshipSystem.Core
|
|
{
|
|
public class Edition
|
|
{
|
|
public Guid Id { get; set; }
|
|
public DateTime EditionStart { get; set; }
|
|
public DateTime EditionFinish { get; set; }
|
|
public DateTime ReportingStart { get; set; }
|
|
public Course Course { get; set; }
|
|
public List<Internship> Internships { get; set; }
|
|
|
|
public InternshipType AllowedInternshipTypes { get; set; }
|
|
|
|
public List<EditionSubject> AvailableSubjects { get; set; }
|
|
public List<EditionInternshipType> AvailableInternshipTypes { get; set; }
|
|
|
|
public bool IsOpen => EditionFinish < DateTime.Today;
|
|
|
|
public Edition CreateEdition(DateTime start, DateTime end, DateTime reportingStart)
|
|
{
|
|
return new Edition
|
|
{
|
|
EditionStart = start,
|
|
EditionFinish = end,
|
|
ReportingStart = reportingStart
|
|
};
|
|
}
|
|
|
|
public bool IsInternshipTypeAllowed(InternshipType registrationQueryType)
|
|
{
|
|
return AvailableInternshipTypes.Select(it => it.InternshipType).Contains(registrationQueryType);
|
|
}
|
|
|
|
public void RegisterInternship(Student student)
|
|
{
|
|
var internship = Internship.CreateStudentsInternship(student);
|
|
|
|
Internships.Add(internship);
|
|
}
|
|
|
|
public bool IsDateDuringEdition(DateTime start, DateTime end)
|
|
{
|
|
return start >= EditionStart && end <= EditionFinish;
|
|
}
|
|
|
|
public bool IsInternshiptypeAllowed(InternshipType internshipType)
|
|
{
|
|
return AllowedInternshipTypes.HasFlag(internshipType);
|
|
}
|
|
}
|
|
} |