Пример #1
0
        /// <summary>
        ///   Perform a Health check on the system.
        /// </summary>
        /// <param name="patService">The pat service.</param>
        /// <param name="lastBatchRun">The last batch run date and time.</param>
        /// <param name="how">How the job was invoked.</param>
        public static void HealthCheck(IPatService patService, DateTime lastBatchRun, string how)
        {
            var    auditService = patService.GetAuditService();
            string why;

            if (!ReadyToGenerateAgain(lastBatchRun, how, out why))
            {
                auditService.AuditActivity(string.Format("Health Check skipped ({1}) for now: last Run  {0}", lastBatchRun, why), DiskDiagnostics);
                return;
            }
            var stopwatch = new Stopwatch();

            stopwatch.Start();
            CheckDiskSpace(auditService);
            CheckAppSettings(auditService);

            var timeElapsed = AppHelper.StopTheWatch(stopwatch);

            auditService.AuditActivity(string.Format("Health Check complete:  in {0}", timeElapsed), DiskDiagnostics);
        }
Пример #2
0
        private static void BatchUpdateReviewOutcomes(IPatService patService
                                                      , string how
                                                      , PatControl control)
        {
            var    lastBatchRun = control.LastBatchRun;
            string auditMsg;

            string why;

            if (ReadyToGenerateAgain(lastBatchRun, how, out why))
            {
                var stopwatch = new Stopwatch();
                stopwatch.Start();

                var vm   = new BuroViewModel();
                var buro = new BuroProcess();
                vm = buro.Execute(vm
                                  , patService.GetUploadRepository()
                                  , patService.GetQuestionaireRepository()
                                  , patService.GetAuditService()
                                  , patService.GetReviewRepository()
                                  );

                control.LastBatchRun = DateTime.Now;
                control.UpdatedBy    = BatchUser;

                var timeElapsed = AppHelper.StopTheWatch(stopwatch);

                auditMsg = string.Format("BURO complete: {0} Reviews checked; {1} updated {3} errors in {2}",
                                         vm.ReviewsRead, vm.ReviewsUpdated, timeElapsed, vm.ValidationErrors);
            }
            else
            {
                auditMsg = string.Format("BURO skipped for now ({1}): last Run  {0}", lastBatchRun, why);
            }

            patService.SaveActivity(CreateAuditRecord(auditMsg, "BURO"));
        }