Example #1
0
 public ResultService(IResultArchivePollingAgent resultArchivePollingAgent, ILogManager logManager)
 {
     InitializeComponent();
     _pollThread = new IntervalWorkThread(resultArchivePollingAgent.PollforUploadCompleteResultArchives);
     _timer = new Timer(x => _pollThread.Trigger(), new object(), new TimeSpan(0), _interval);
     _logger = logManager.GetLogger<ResultService>();
 }
Example #2
0
        public Service(IResultArchivePollingAgent resultArchivePollingAgent, ILogManager logManager, IMediaCleanUpPollingAgent mediaCleanUpPollingAgent,
                       IBloodTestResultParserPollingAgent bloodTestResultParserPollingAgent, IBloodLabResultParserPollingAgent bloodLabResultParserPolling,
                       ISettings settings, IDiabeticRetinopathyParserPollingAgent diabeticRetinopathyParserPollingAgent, IMarkFailedResultArchiveUploadPollingAgent markFailedResultArchiveUploadPollingAgent,
                       IEawvHraParserPollingAgent eawvHraParserPollingAgent, ILabReportParserPollingAgent labReportParserPollingAgent, IBloodResultParsePollingAgent bloodResultParsePollingAgent)
        {
            InitializeComponent();
            _settings = settings;

            _pollThreadResultArchivePolling = new IntervalWorkThread(resultArchivePollingAgent.PollforUploadCompleteResultArchives);
            _timerResultArchivePolling      = new Timer(x => _pollThreadResultArchivePolling.Trigger(), new object(), new TimeSpan(0), _interval);

            _mediaCleanUpPollingAgent = mediaCleanUpPollingAgent;
            _threadRoutineCleanUp     = new IntervalWorkThread(mediaCleanUpPollingAgent.PollForCleanUp);
            _timerRoutineCleanUp      = new Timer(x => _threadRoutineCleanUp.Trigger(), new object(), new TimeSpan(0), new TimeSpan(0, 0, 40, 0));

            //_pollThreadResultPacketGeneration = new IntervalWorkThread(resultPacketGeneratorPollingAgent.PollForResultPacketGeneration);


            _threadStartUpExecution = new Thread(ExecuteStartUp);
            //var intervalForPacketGeneration = ConfigurationManager.AppSettings["IntervalinMinutesforPdfGeneration"];
            //Int32 s;

            //if (!string.IsNullOrEmpty(intervalForPacketGeneration) && Int32.TryParse(intervalForPacketGeneration, out s))
            //{
            //    _timerResultPacketGeneration = new Timer(x => _pollThreadResultPacketGeneration.Trigger(), new object(), new TimeSpan(0), new TimeSpan(0, 0, s, 0));
            //}
            //else
            //{
            //    _timerResultPacketGeneration = new Timer(x => _pollThreadResultPacketGeneration.Trigger(), new object(), new TimeSpan(0), new TimeSpan(0, 0, 5, 0));
            //}

            //_pollThreadGenerateKynXmlPolling = new IntervalWorkThread(generateKynXmlPollingAgent.Polling);
            //_timerGenerateKynXmlPolling = new Timer(x => _pollThreadGenerateKynXmlPolling.Trigger(), new object(), new TimeSpan(0), new TimeSpan(0, 0, _settings.GenerateKynXmlInterval, 0));

            //_pollThreadKynXmlPolling = new IntervalWorkThread(kynXmlPollingAgent.PollForEventsForKynXml);
            //_timerKynXml = new Timer(x => _pollThreadKynXmlPolling.Trigger(), new object(), new TimeSpan(0), new TimeSpan(0, _settings.KynXmlIntervalInHours, _settings.KynXmlIntervalInMinutes, 0));


            _pollThreadBloodTestResultPolling = new IntervalWorkThread(bloodTestResultParserPollingAgent.Parse);
            _timerBloodTestResult             = new Timer(x => _pollThreadBloodTestResultPolling.Trigger(), new object(), new TimeSpan(0), new TimeSpan(0, 0, _settings.BloodTestResultParserInterval, 0));

            _pollThreadBloodLabResultPolling = new IntervalWorkThread(bloodLabResultParserPolling.Parse);
            _timerBloodLabResult             = new Timer(x => _pollThreadBloodLabResultPolling.Trigger(), new object(), new TimeSpan(0), new TimeSpan(0, 0, _settings.BloodTestResultParserInterval, 0));

            _pollThreadDiabeticRetinopathyParserPolling = new IntervalWorkThread(diabeticRetinopathyParserPollingAgent.Parse);
            _timerDiabeticRetinopathyParser             = new Timer(x => _pollThreadDiabeticRetinopathyParserPolling.Trigger(), new object(), new TimeSpan(0), new TimeSpan(0, 0, _settings.DiabeticRetinopathyResultParserInterval, 0));

            _pollThreadMarkFailedResultArchiveUploadPolling = new IntervalWorkThread(markFailedResultArchiveUploadPollingAgent.PollForFailedArchiveUpload);
            _timerMarkFailedResultArchiveUpload             = new Timer(x => _pollThreadMarkFailedResultArchiveUploadPolling.Trigger(), new object(), GetDueTime(_settings.MarkResultArchiveFailedScheduledTime), new TimeSpan(0, _settings.MarkResultArchiveFailedInterval, 0, 0));

            _pollThreadEawvHraParserPolling = new IntervalWorkThread(eawvHraParserPollingAgent.PollforParsing);
            _timerEawvHraParser             = new Timer(x => _pollThreadEawvHraParserPolling.Trigger(), new object(), new TimeSpan(0), new TimeSpan(0, 1, 0, 0));

            _pollThreadLabReportParserPolling = new IntervalWorkThread(labReportParserPollingAgent.Parse);
            _timerLabReportParser             = new Timer(x => _pollThreadLabReportParserPolling.Trigger(), new object(), new TimeSpan(0), new TimeSpan(0, 0, _settings.LabReportParserInterval, 0));

            _pollThreadBloodResultParsing = new IntervalWorkThread(bloodResultParsePollingAgent.Parse);
            _timerBloodResultParsing      = new Timer(x => _pollThreadBloodResultParsing.Trigger(), new object(), new TimeSpan(0), new TimeSpan(0, 0, _settings.BloodTestResultParserInterval, 0));

            _logger = logManager.GetLogger <Service>();
        }