コード例 #1
0
    private IEnumerable <OvertimeEntry> CreateOvertimeEntries(DateEntry day, bool isRedDay)
    {
        var overtimeEntries = new List <OvertimeEntry>();

        var overtimeHours = isRedDay ? day.GetWorkingHours() : day.GetWorkingHours() - HoursInRegularWorkday;

        foreach (var entry in day.Entries.OrderBy(task => task.CompensationRate))
        {
            if (overtimeHours <= 0)
            {
                break;
            }

            if (isRedDay && (entry.TaskId == _paidHolidayTask || entry.TaskId == _unpaidHolidayTask))
            {
                continue;
            }

            OvertimeEntry overtimeEntry = new OvertimeEntry
            {
                Hours            = Math.Min(overtimeHours, entry.Value),
                CompensationRate = entry.CompensationRate,
                Date             = day.Date,
                TaskId           = entry.TaskId
            };

            overtimeHours -= overtimeEntry.Hours;

            yield return(overtimeEntry);
        }
    }
コード例 #2
0
 private bool WorkedOnRedDay(DateEntry day, List <DateTime> redDays)
 {
     if ((IsWeekend(day) ||
          redDays.Contains(day.Date)) &&
         day.GetWorkingHours() > 0)
     {
         return(true);
     }
     return(false);
 }
コード例 #3
0
 private bool WorkedOnRedDay(DateEntry day, List <DateTime> redDays)
 {
     if ((day.Date.DayOfWeek == DayOfWeek.Sunday ||
          day.Date.DayOfWeek == DayOfWeek.Saturday ||
          redDays.Contains(day.Date)) &&
         day.GetWorkingHours() > 0)
     {
         return(true);
     }
     return(false);
 }