Beispiel #1
0
        private static void EnsureUnpaidTimeValid(CSCalendar calendar, DayOfWeek dayOfWeek)
        {
            CalendarDayInfo calendarDayInfo = new CalendarDayInfo(calendar, dayOfWeek);

            if (calendarDayInfo.UnpaidTime == null)
            {
                if (calendarDayInfo.WorkDay == true)
                {
                    SetUnpaidTime(calendar, dayOfWeek, 0);
                }
                return;
            }

            double maxPossibleBreak = calendarDayInfo.GetMaxPossibleUnpaidBreak();

            if (maxPossibleBreak > MinutesInDay)
            {
                maxPossibleBreak = MinutesInDay;
            }
            if (maxPossibleBreak < 0)
            {
                maxPossibleBreak = 0;
            }

            if (calendarDayInfo.UnpaidTime < 0 || calendarDayInfo.UnpaidTime > maxPossibleBreak)
            {
                SetUnpaidTime(calendar, dayOfWeek, (int)maxPossibleBreak);
            }
        }
Beispiel #2
0
        public static double GetMaxPossibleUnpaidBreak(CSCalendar calendar, DayOfWeek dayOfWeek)
        {
            CalendarDayInfo calendarDayInfo = new CalendarDayInfo(calendar, dayOfWeek);

            return(calendarDayInfo.GetMaxPossibleUnpaidBreak());
        }
Beispiel #3
0
        public static decimal GetHoursWorkedOnDay(CSCalendar calendar, DayOfWeek dayOfWeek)
        {
            CalendarDayInfo calendarDayInfo = new CalendarDayInfo(calendar, dayOfWeek);

            return(calendarDayInfo.GetHoursWorkedOnDay());
        }