/// <summary> /// Creates an instance of HolidayCalculator and returns /// </summary> /// <returns></returns> protected virtual HolidayCalculator CreateHolidayCalculator(IBaseRepository <DailyActual> dailyActualRepository, IBaseRepository <ScorecardHolidayPattern> scorecardHolidayPatternRepository, IBaseRepository <ScorecardWorkdayPattern> scorecardWorkdayPatternRepository, IBaseRepository <ScorecardWorkdayTracker> scorecardWorkdayTrackerRepository) { if (holidayCalculator == null) { holidayCalculator = new HolidayCalculator(dailyActualRepository, scorecardHolidayPatternRepository, scorecardWorkdayPatternRepository, scorecardWorkdayTrackerRepository); } return(holidayCalculator); }
/// <summary> /// Parameterized constructor /// </summary> /// <param name="targetRepository">Target repository</param> /// <param name="dailyActualRepository">Daily Actual Repository</param> public ScorecardGoalCalculator(IBaseRepository <Target> targetRepository, IBaseRepository <DailyActual> dailyActualRepository, IBaseRepository <ScorecardWorkdayPattern> scorecardWorkdayPatternRepository, IBaseRepository <ScorecardHolidayPattern> scorecardHolidayPatternRepository, IBaseRepository <ScorecardWorkdayTracker> scorecardWorkdayTrackerRepository) { if (targetRepository == null || dailyActualRepository == null) { throw new ArgumentNullException("Repository", "The given parameter cannot be null."); } this.targetRepository = targetRepository; this.dailyActualRepository = dailyActualRepository; this.holidayCalculator = CreateHolidayCalculator(dailyActualRepository, scorecardHolidayPatternRepository, scorecardWorkdayPatternRepository, scorecardWorkdayTrackerRepository); }
/// <summary> /// Parametrized constructor /// </summary> /// <param name="dailyTargetRepository">The daily target repository.</param> /// <param name="monthlyTargetRepository">The monthly target repository.</param> /// <exception cref="System.ArgumentNullException">Repository - The given parameter cannot be null.</exception> public TargetModifier(IBaseRepository <DailyTarget> dailyTargetRepository, IBaseRepository <MonthlyTarget> monthlyTargetRepository, IBaseRepository <User> userRepository, IBaseRepository <Metric> metricRepository, ScorecardGoalCalculator goalCalculator, HolidayCalculator holidayCalculator) { if (dailyTargetRepository == null || monthlyTargetRepository == null || userRepository == null || metricRepository == null) { throw new ArgumentNullException("Repository", "The given parameter cannot be null."); } this.dailyTargetRepository = dailyTargetRepository; this.monthlyTargetRepository = monthlyTargetRepository; this.userRepository = userRepository; this.metricRepository = metricRepository; this.goalCalculator = goalCalculator; this.holidayCalculator = holidayCalculator; }