コード例 #1
0
        private int CalculateWorkHoursInMonth(UserData user, int fullWorkHours)
        {
            int result = fullWorkHours;

            bool recalculateForStartDate = user.StartDate.HasValue &&
                                           user.StartDate.Value.Year == _year &&
                                           user.StartDate.Value.Month == _month &&
                                           user.StartDate.Value.Day > 1;

            bool recalculateForTerminationDate = user.TerminationDate.HasValue &&
                                                 user.TerminationDate.Value.Year == _year &&
                                                 user.TerminationDate.Value.Month == _month;

            if (recalculateForStartDate || recalculateForTerminationDate)
            {
                DateTime startDate = recalculateForStartDate
               ? user.StartDate.Value
               : new DateTime(_year, _month, 1);

                DateTime terminationDate = recalculateForTerminationDate
               ? user.TerminationDate.Value
               : new DateTime(_year, _month, 1).AddMonths(1).AddDays(-1);

                MonthWorkHoursReporter userMonthWorkHoursReporter = new MonthWorkHoursReporter(
                    _workHoursReporter,
                    startDate,
                    terminationDate);
                result = userMonthWorkHoursReporter.Report();
            }

            return(result);
        }
コード例 #2
0
 public OvertimeReporter(AttendanceReporter attendanceReporter,
                         UsersActiveInMonthReporter usersActiveInMonthReporter,
                         MonthWorkHoursReporter workHoursReporter,
                         int year,
                         int month)
 {
     _attendanceReporter         = attendanceReporter;
     _usersActiveInMonthReporter = usersActiveInMonthReporter;
     _workHoursReporter          = workHoursReporter;
     _year  = year;
     _month = month;
 }
コード例 #3
0
 public FoodStampReporter(MonthWorkHoursReporter monthWorkHoursReporter,
                          AbsenceReporter absenceReporter,
                          UsersActiveInMonthReporter usersActiveInMonthReporter,
                          int year,
                          int month,
                          int previousYear,
                          int previousMonth)
 {
     _monthWorkHoursReporter     = monthWorkHoursReporter;
     _absenceReporter            = absenceReporter;
     _usersActiveInMonthReporter = usersActiveInMonthReporter;
     _year          = year;
     _month         = month;
     _previousYear  = previousYear;
     _previousMonth = previousMonth;
 }
コード例 #4
0
 public MonthWorkHoursReporter(MonthWorkHoursReporter other, DateTime start, DateTime end)
 {
     _holidayReporter = other._holidayReporter;
     _start           = start;
     _end             = end;
 }