FlexitimeTracker/DataCenter_Windows/WindowsDataCenter/Interfaces/TimeLogList.cs
Chris.Watts90@outlook.com 69aaf53bb4 Added method to calculate the daily logs.
extended TimeLogList object:
 > to group logs into days with the "DailyLogs" object
 > to calculate the WeeklyTotal hours automatically based on the TimeLogs.DailyLogs object for each day.

Created DailyLogs object:
 > holds the number of entries for a day.
 > holds the time "in"/"at work" for that day (dailytotal).

#15
2017-02-14 17:06:16 +00:00

21 lines
623 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
namespace Interfaces
{
public class TimeLogList
{
public TimeLogList()
{
TimeLogs = new Dictionary<DayOfWeek, DailyLogs>();
}
public DateTime SelectedDate { get; set; }
public int CalendarWeek { get; set; }
public int TimeLogCount { get { return TimeLogs.Values.Sum(x => x.LogCount); } }
public Dictionary<DayOfWeek,DailyLogs> TimeLogs { get; set; }
public double WeeklyTotal {
get { return TimeLogs.Values.Sum(x => x.DailyTotal)/60.0d; }
}
}
}