public double GetAmountPayTimeOfDay(DailyHoursWork workDaily) { return(lstTimeOfDayPaid.Where(x => DateTime.Parse(workDaily.StartHour) >= DateTime.Parse(x.StartHour) && DateTime.Parse(workDaily.EndHour) <= DateTime.Parse(x.EndHour) && workDaily.IsWeekEnd == x.IsWeekEndDay ).Select(x => x.Amount).SingleOrDefault()); }
private void FillListOfDailyHoursWorked(Employee employee, string listOfScheduleWorked) { string[] dailyScheduleWorked = listOfScheduleWorked.Split(','); for (int index = 0; index < dailyScheduleWorked.Length; index++) { string day = dailyScheduleWorked[index].Substring(0, 2); string[] scheduleWorked = dailyScheduleWorked[index].Substring(2).Split('-'); string startHour = scheduleWorked[0]; string endHour = scheduleWorked[1]; DailyHoursWork dailyHoursWorkedEmployee = new DailyHoursWork(employee, day, startHour, endHour, 0, IsWeekEnd(day)); dailyHoursWorkedEmployee.AmountPay = dailyWorkScheduleBL.GetAmountPayTimeOfDay(dailyHoursWorkedEmployee); lstDailyHoursWorked.Add(dailyHoursWorkedEmployee); } }