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); } }
private bool WorkedOnRedDay(DateEntry day, List <DateTime> redDays) { if ((IsWeekend(day) || redDays.Contains(day.Date)) && day.GetWorkingHours() > 0) { return(true); } return(false); }
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); }