Exemplo n.º 1
0
 /// <summary>
 /// Parameterized constructor
 /// </summary>
 /// <param name="counterMeasureRepository">Counter measure repository</param>
 /// <param name="counterMeasureStatusRepository">Counter measure status repository</param>
 /// <param name="userRepository">User repository</param>
 /// <param name="targetRepository">Target repository</param>
 /// <param name="dailyActualRepository">The daily actual repository.</param>
 /// <param name="holidayRepository">The holiday repository.</param>
 /// <param name="yearRepository">The year repository.</param>
 /// <param name="counterMeasurePriorityRepository">The counter measure priority repository.</param>
 /// <exception cref="System.ArgumentNullException">Repository - The given parameter cannot be null.</exception>
 public CounterMeasureManager(IBaseRepository <CounterMeasure> counterMeasureRepository,
                              IBaseRepository <CounterMeasureStatus> counterMeasureStatusRepository,
                              INDMSUserRepository userRepository, IBaseRepository <Target> targetRepository,
                              IBaseRepository <DailyActual> dailyActualRepository,
                              IBaseRepository <ScorecardWorkdayPattern> scorecardWorkdayPatternRepository,
                              IBaseRepository <ScorecardHolidayPattern> scorecardHolidayPatternRepository,
                              IBaseRepository <ScorecardWorkdayTracker> scorecardWorkdayTrackerRepository,
                              IBaseRepository <Year> yearRepository,
                              IBaseRepository <CounterMeasurePriority> counterMeasurePriorityRepository)
 {
     if (counterMeasureRepository == null || counterMeasureStatusRepository == null ||
         userRepository == null || targetRepository == null ||
         dailyActualRepository == null || scorecardWorkdayPatternRepository == null || yearRepository == null ||
         counterMeasurePriorityRepository == null || scorecardHolidayPatternRepository == null ||
         scorecardWorkdayTrackerRepository == null)
     {
         throw new ArgumentNullException("Repository",
                                         "The given parameter cannot be null.");
     }
     this.counterMeasureRepository       = counterMeasureRepository;
     this.counterMeasureStatusRepository = counterMeasureStatusRepository;
     this.userRepository   = userRepository;
     this.targetRepository = targetRepository;
     this.yearRepository   = yearRepository;
     this.scorecardHolidayPatternRepository = scorecardHolidayPatternRepository;
     this.counterMeasurePriorityRepository  = counterMeasurePriorityRepository;
     this.scorecardWorkdayPatternRepository = scorecardWorkdayPatternRepository;
     this.scorecardWorkdayTrackerRepository = scorecardWorkdayTrackerRepository;
     this.actualCalculator = CreateScorecardActualCalculator(dailyActualRepository);
     this.goalCalculator   = CreateScorecardGoalCalculator(targetRepository,
                                                           dailyActualRepository, scorecardWorkdayPatternRepository,
                                                           scorecardHolidayPatternRepository, scorecardWorkdayTrackerRepository);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Creates an instance of ScorecardActualCalculator and returns
 /// </summary>
 /// <returns></returns>
 protected virtual ScorecardActualCalculator CreateScorecardActualCalculator(
     IBaseRepository <DailyActual> dailyActualRepository)
 {
     if (actualCalculator == null)
     {
         actualCalculator = new ScorecardActualCalculator(dailyActualRepository);
     }
     return(actualCalculator);
 }