Ejemplo n.º 1
0
        private TimeEntryType GetMostUsedTimeEntryType(DayItemHeaderViewmodel dayItemHeaderViewmodel)
        {
            var timeEntries = dayItemHeaderViewmodel.TimeEntries
                              .ToList();

            if (!timeEntries.Any())
            {
                return(TimeEntryTypes.SingleOrDefault(x => x.IsDefault)); // Can be empty if resync is in progress
            }
            var mostUsedTimeEntryType = timeEntries
                                        .GroupBy(x => x.TimeEntryType.Id)
                                        .OrderByDescending(x => x.Count())
                                        .First().Key;

            return(TimeEntryTypes.SingleOrDefault(x => x.Id == mostUsedTimeEntryType)); // Can be empty if resync is in progress
        }
Ejemplo n.º 2
0
 private void UpdateDay6()
 {
     Day6 = new DayItemHeaderViewmodel(StartDate.AddDays(5), Rows.Select(x => x.Saturday));
     Day6.SelectTimeEntryType = GetMostUsedTimeEntryType(Day6);
 }
Ejemplo n.º 3
0
 private void UpdateDay7()
 {
     Day7 = new DayItemHeaderViewmodel(StartDate.AddDays(6), Rows.Select(x => x.Sunday));
     Day7.SelectTimeEntryType = GetMostUsedTimeEntryType(Day7);
 }
Ejemplo n.º 4
0
 private void UpdateDay5()
 {
     Day5 = new DayItemHeaderViewmodel(StartDate.AddDays(4), Rows.Select(x => x.Friday));
     Day5.SelectTimeEntryType = GetMostUsedTimeEntryType(Day5);
 }
Ejemplo n.º 5
0
 private void UpdateDay4()
 {
     Day4 = new DayItemHeaderViewmodel(StartDate.AddDays(3), Rows.Select(x => x.Thursday));
     Day4.SelectTimeEntryType = GetMostUsedTimeEntryType(Day4);
 }
Ejemplo n.º 6
0
 private void UpdateDay3()
 {
     Day3 = new DayItemHeaderViewmodel(StartDate.AddDays(2), Rows.Select(x => x.Wednesday));
     Day3.SelectTimeEntryType = GetMostUsedTimeEntryType(Day3);
 }
Ejemplo n.º 7
0
 private void UpdateDay2()
 {
     Day2 = new DayItemHeaderViewmodel(StartDate.AddDays(1), Rows.Select(x => x.Tuesday));
     Day2.SelectTimeEntryType = GetMostUsedTimeEntryType(Day2);
 }
Ejemplo n.º 8
0
 private void UpdateDay1()
 {
     Day1 = new DayItemHeaderViewmodel(StartDate, Rows.Select(x => x.Monday));
     Day1.SelectTimeEntryType = GetMostUsedTimeEntryType(Day1);
 }