示例#1
0
        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));
        }
        protected virtual TimeSpan CalculateOvertime(DateTime start, DateTime end)
        {
            var calendarId = CalendarID;

            return(calendarId == null ? new TimeSpan() : CalendarHelper.CalculateOvertime(_Graph, start, end, calendarId));
        }