public AwardCalculator(IAwardCalculationQueueRepository awardCalcRepository, IEventDefinitionService eventDefinitionService, IUserRepository userRepository, IErrorLog errorLog, IAwardDefinitionService awardDefinitionService, IUserAwardService userAwardService, IPointLedgerRepository pointLedgerRepository)
 {
     _awardCalcRepository    = awardCalcRepository;
     _eventDefinitionService = eventDefinitionService;
     _userRepository         = userRepository;
     _errorLog = errorLog;
     _awardDefinitionService = awardDefinitionService;
     _userAwardService       = userAwardService;
     _pointLedgerRepository  = pointLedgerRepository;
 }
예제 #2
0
		public AwardCalculator(IAwardCalculationQueueRepository awardCalcRepository, IEventDefinitionService eventDefinitionService, IUserRepository userRepository, IErrorLog errorLog, IAwardDefinitionService awardDefinitionService, IUserAwardService userAwardService, IPointLedgerRepository pointLedgerRepository)
		{
			_awardCalcRepository = awardCalcRepository;
			_eventDefinitionService = eventDefinitionService;
			_userRepository = userRepository;
			_errorLog = errorLog;
			_awardDefinitionService = awardDefinitionService;
			_userAwardService = userAwardService;
			_pointLedgerRepository = pointLedgerRepository;
		}
예제 #3
0
        public async Task ProcessCalculation(IAwardCalculator calculator, IAwardCalculationQueueRepository awardCalculationQueueRepository, IErrorLog errorLog)
        {
            try
            {
                var nextItem = await awardCalculationQueueRepository.Dequeue();

                if (string.IsNullOrEmpty(nextItem.Key))
                {
                    return;
                }
                await calculator.ProcessCalculation(nextItem.Key, nextItem.Value);
            }
            catch (Exception exc)
            {
                errorLog.Log(exc, ErrorSeverity.Error);
            }
        }
예제 #4
0
 public void ProcessCalculation(IAwardCalculator calculator, IAwardCalculationQueueRepository awardCalculationQueueRepository, IErrorLog errorLog)
 {
     if (!Monitor.TryEnter(_syncRoot))
     {
         return;
     }
     try
     {
         var nextItem = awardCalculationQueueRepository.Dequeue();
         if (string.IsNullOrEmpty(nextItem.Key))
         {
             return;
         }
         calculator.ProcessCalculation(nextItem.Key, nextItem.Value);
     }
     catch (Exception exc)
     {
         errorLog.Log(exc, ErrorSeverity.Error);
     }
     finally
     {
         Monitor.Exit(_syncRoot);
     }
 }