This commit is contained in:
12
HanyadikHetVan/DTO/PauseDTO.cs
Normal file
12
HanyadikHetVan/DTO/PauseDTO.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
|
||||
namespace HanyadikHetVan.DTO
|
||||
{
|
||||
public class PauseDTO
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int WeeklyTimeSpanId { get; set; }
|
||||
public DateTime Startdate { get; set; }
|
||||
public DateTime Enddate { get; set; }
|
||||
}
|
||||
}
|
7
HanyadikHetVan/DTO/PurseDTO.cs
Normal file
7
HanyadikHetVan/DTO/PurseDTO.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace HanyadikHetVan.DTO
|
||||
{
|
||||
public class PurseDTO
|
||||
{
|
||||
public int Balance { get; set; }
|
||||
}
|
||||
}
|
27
HanyadikHetVan/DTO/WeeklyTimeSpanDTO.cs
Normal file
27
HanyadikHetVan/DTO/WeeklyTimeSpanDTO.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HanyadikHetVan.DTO
|
||||
{
|
||||
public class WeeklyTimeSpanDTO
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public DateTime Startdate { get; set; }
|
||||
|
||||
public virtual ICollection<PauseDTO> Pauses { get; set; }
|
||||
|
||||
public int CurrentWeek
|
||||
{
|
||||
get
|
||||
{
|
||||
TimeSpan allPause = this.Pauses.Aggregate(TimeSpan.Zero, (sumSoFar, nextPause) => sumSoFar + (nextPause.Enddate - nextPause.Startdate));
|
||||
|
||||
TimeSpan wtsLength = DateTime.Now - this.Startdate;
|
||||
|
||||
return (wtsLength - allPause).Days / 7;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user