Example #1
0
        public Task <int> Load(bool diffSupport)
        {
            var mapper = diffSupport ? ExtractDiffMapper.Instance : ExtractMapper.Instance;

            try
            {
                //load temp extracts without errors
                var tempPatientExtracts = _tempPatientExtractRepository.GetAll().Where(a => a.CheckError == false).ToList();

                //Auto mapper
                var extractRecords = mapper.Map <List <TempMasterPatientIndex>, List <MasterPatientIndex> >(tempPatientExtracts);

                //Batch Insert
                // TODO PLEASE PAGE DIS
                _patientExtractRepository.BatchInsert(extractRecords);
                Log.Debug("saved batch");

                DomainEvents.Dispatch(new CbsNotification(new ExtractProgress(nameof(MasterPatientIndex), "Loading...", Found, 0, 0, 0, 0)));
                return(Task.FromResult(tempPatientExtracts.Count));
            }
            catch (Exception e)
            {
                Log.Error(e, $"Extract {nameof(MasterPatientIndex)} not Loaded");
                throw;
            }
        }
        public Task <int> Load()
        {
            try
            {
                //load temp extracts without errors
                var tempPatientExtracts = _tempPatientExtractRepository.GetAll().Where(a => a.CheckError == false).ToList();

                //Auto mapper
                var extractRecords = Mapper.Map <List <TempMasterPatientIndex>, List <MasterPatientIndex> >(tempPatientExtracts);

                //Batch Insert
                _patientExtractRepository.BatchInsert(extractRecords);
                Log.Debug("saved batch");


                return(Task.FromResult(tempPatientExtracts.Count));
            }
            catch (Exception e)
            {
                Log.Error(e, $"Extract {nameof(MasterPatientIndex)} not Loaded");
                throw;
            }
        }