public CalendarHelper(CSCalendar calendar, CSCalendarExceptions calendarException, DateTime date) { if (calendar == null) throw new ArgumentNullException("calendar"); this.calendar = calendar; this.calendarException = calendarException; this.date = date; }
private bool IsWorkingDay(CSCalendar calendar) { switch (date.DayOfWeek) { case DayOfWeek.Friday: return calendar.FriWorkDay ?? false; case DayOfWeek.Monday: return calendar.MonWorkDay ?? false; case DayOfWeek.Saturday: return calendar.SatWorkDay ?? false; case DayOfWeek.Sunday: return calendar.SunWorkDay ?? false; case DayOfWeek.Thursday: return calendar.ThuWorkDay ?? false; case DayOfWeek.Tuesday: return calendar.TueWorkDay ?? false; case DayOfWeek.Wednesday: break; default: break; } throw new ArgumentOutOfRangeException(); }
private static TimeSpan CalculateOvertimeForDay(PXGraph graph, CSCalendar calendar, DateTime date, TimeSpan startTime, TimeSpan endTime) { var calendarExceptionsStart = (CSCalendarExceptions)PXSelect<CSCalendarExceptions>. Search<CSCalendarExceptions.calendarID, CSCalendarExceptions.date>(graph, calendar.CalendarID, date); var helperStart = new CalendarHelper(calendar, calendarExceptionsStart, date); return helperStart.CalculateOvertimeForOneDay(startTime, endTime); }