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)); }
public static void CalculateStartEndTime(PXGraph graph, string calendarID, DateTime date, out DateTime startDate, out DateTime endDate) { CSCalendar calendar = PXSelect <CSCalendar> .Search <CSCalendar.calendarID>(graph, calendarID); if (calendar == null) { throw new InvalidOperationException(Messages.FailedToSelectCalenderId); } CSCalendarExceptions cse = PXSelect <CSCalendarExceptions> . Search <CSCalendarExceptions.calendarID, CSCalendarExceptions.date>(graph, calendarID, date); CalendarHelper helper = new CalendarHelper(calendar, cse, date); helper.CalculateStartEndTime(out startDate, out endDate); }
private TimeSpan CalculateOvertime(DateTime start, DateTime end, int?employeeID, int?locationID) { string calendarId = null; /*if (CurrentServiceCaseClass.Current != null && !string.IsNullOrEmpty(CurrentServiceCaseClass.Current.CalendarID)) * calendarId = CurrentServiceCaseClass.Current.CalendarID; * else*/ if (string.IsNullOrEmpty(calendarId) && employeeID != null) { calendarId = ((EPEmployee)PXSelect <EPEmployee, Where <EPEmployee.bAccountID, Equal <Required <EPEmployee.bAccountID> > > > . Select(this, employeeID)). With(e => e.CalendarID); } if (string.IsNullOrEmpty(calendarId) && locationID != null) { calendarId = ((Location)PXSelect <Location, Where <Location.locationID, Equal <Required <Location.locationID> > > > . Select(this, locationID)). With(l => l.CCalendarID); } return(calendarId == null ? new TimeSpan() : CalendarHelper.CalculateOvertime(this, start, end, calendarId)); }
public static void CalculateStartEndTime(PXGraph graph, string calendarID, DateTime date, out DateTime startDate, out DateTime endDate) { CSCalendar calendar = PXSelect<CSCalendar>.Search<CSCalendar.calendarID>(graph, calendarID); if (calendar == null) throw new InvalidOperationException(Messages.FailedToSelectCalenderId); CSCalendarExceptions cse = PXSelect<CSCalendarExceptions>. Search<CSCalendarExceptions.calendarID, CSCalendarExceptions.date>(graph, calendarID, date); CalendarHelper helper = new CalendarHelper(calendar, cse, date); helper.CalculateStartEndTime(out startDate, out endDate); }
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); }
protected virtual TimeSpan CalculateOvertime(DateTime start, DateTime end) { var calendarId = CalendarID; return(calendarId == null ? new TimeSpan() : CalendarHelper.CalculateOvertime(_Graph, start, end, calendarId)); }