I ran in a scenario where I need to find the total number of hours that fall for the current period. I have time and time, as well as the time that I want to get when the employees worked from 22 to 4 hours the next day. How do I get the result of hours worked.
I created an extension method, for example:
public static decimal GetNightDifferentialValue(this DailyTime dtr, Employee201 employee, PayrollSettings settings, IEnumerable<Holidays> holidays)
{
var days = Enumerable.Range(0, (int)(dtr.TimeOut - dtr.TimeIn).TotalHours + 1)
.Select(i => dtr.TimeIn.AddHours(i))
.Where(date => !(date.Hour >= 22)).Count();
return days* employee.Rate;
}
My problem is where method, how can I filter hours that fall only in my category.
source
share