コード例 #1
0
        private IEnumerable <TransferControl.Models.TransferControl> GetUnprocessedRecords(string jobKey)
        {
            var job = _jobRepository.GetJob(jobKey);

            var toProcess = _transferControlRepository.FindTransferControls(new TransferControlSearchCriteria
            {
                Processed = false,
                JobId     = job.JobId,
                JobType   = JobType.Outbound
            }).ToList();

            _log.Info("Found " + toProcess.Count + " outbound batches to process for " + jobKey);

            return(toProcess);
        }
コード例 #2
0
        public bool Process()
        {
            bool allSucceeded = true;


            var transferControls =
                _transferControlRepository.FindTransferControls(new TransferControlSearchCriteria
            {
                Processed = false,
                JobType   = _configuration.GetInboundJobType(),
            }).ToList();

            if (transferControls.Count == 0)
            {
                _log.Info("Inbound: No records to process");
                return(true);
            }

            foreach (var transferControl in transferControls)
            {
                try
                {
                    var fileList = new List <TransferControlMaster>();

                    foreach (var file in transferControl.Files.OrderByDescending(o => o.FileLocation))
                    {
                        // each file of the batch gets its own row
                        fileList.Add(UploadFile(file, transferControl));
                    }

                    AppendMasterControl(fileList, transferControl);
                }
                catch (Exception exception)
                {
                    _log.Exception("Inbound : Fatal exception processing batch " +
                                   transferControl.BatchControlNumber, exception);
                    allSucceeded = false;
                }
            }

            return(allSucceeded);
        }