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
21 lines
623 B
C#
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; }
|
|
}
|
|
}
|
|
} |