private static List <BiometryCalculatedDetailTime> RemoveFromRangeAndGetRemain( BiometryCalculatedDetailTime remain , List <BiometryCalculatedDetailTime> allWorkTimesInRange) { List <BiometryCalculatedDetailTime> _remain = new List <BiometryCalculatedDetailTime>(); List <BiometryCalculatedDetailTime> intervals = new List <BiometryCalculatedDetailTime>(); _remain.Add(remain); foreach (var detailTime in allWorkTimesInRange) { foreach (var rm in _remain.ToList()) { var res = IntervalHelperDepricated.RemoveInterval(detailTime, rm); intervals.AddRange(res); if (res.Count > 0) { _remain.Remove(rm); } _remain.AddRange(intervals.Where(i => i.Type == BiometryCalculatedDetailTimeType.NotValid || i.Type == BiometryCalculatedDetailTimeType.HurryUp || i.Type == BiometryCalculatedDetailTimeType.Delay || i.Type == BiometryCalculatedDetailTimeType.Absence || i.Type == BiometryCalculatedDetailTimeType.Overtime).ToList()); intervals = intervals.Where(i => i.Type == BiometryCalculatedDetailTimeType.Valid).ToList(); } } return(intervals); }
public static List <BiometryCalculatedDetailTime> CompareAndGetIntervals(ICollection <BiometricDataTime> workdayTimes, List <ObligatedRangeDayTimes> obligationRanges) { List <BiometryCalculatedDetailTime> allWorkDayTimes = new List <BiometryCalculatedDetailTime>(); foreach (var obligationRange in obligationRanges) { List <BiometryCalculatedDetailTime> allWorkTimesInRange = IntervalHelperDepricated.GetAllRelatdIntervals(obligationRange, workdayTimes); BiometryCalculatedDetailTime remain = IntervalHelperDepricated.ToInterval(obligationRange); var res = IntervalHelperDepricated.RemoveFromRangeAndGetRemain(remain, allWorkTimesInRange); allWorkDayTimes.AddRange(res); } return(allWorkDayTimes); }