Ejemplo n.º 1
0
 public frmAddToDB(ISystemDataProvider irmDbDataProvider, IClientDataProvider encounterDataProvider)
 {
     InitializeComponent();
     DataProvider = encounterDataProvider;
     IrmDbDataProvider = irmDbDataProvider;
     gvClientOrgs.TableElement.AlternatingRowColor = System.Drawing.Color.BlanchedAlmond;
     LoadDropDowns();
 }
Ejemplo n.º 2
0
        public void SaveToStaging(Job job, int lineNumber, string rawLine, IClientDataProvider DataProvider)
        {
            // parse the appropriate objects out and save to the database
            EncounterImport import = new EncounterImport()
            {
                FileID = job.FileID,
                EncounterNumber = this.EncounterNumber,
                PatientNumber = this.PatientNumber,
                Facility = this.Facility,
                RawLine = rawLine,
                RowNumber = lineNumber
            };
            DataProvider.EncounterImportSave(ref import);
            this.EncounterImportID = import.EncounterImportID;

            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    StagingAddress address = GetAddressValues(job);
                    address.EncounterImportID = this.EncounterImportID;
                    DataProvider.StagingAddressSave(ref address);

                    StagingEncounterFile encounter = GetEncounterValues(job);
                    encounter.EncounterImportID = this.EncounterImportID;
                    DataProvider.StagingEncounterFileSave(ref encounter);

                    StagingPerson person = GetPersonValues(job);
                    person.EncounterImportID = this.EncounterImportID;
                    DataProvider.StagingPersonSave(ref person);

                    //throw new Exception("Test transaction handling");
                    StagingPatient patient = GetPatientValues(job);
                    patient.EncounterImportID = this.EncounterImportID;
                    DataProvider.StagingPatientSave(ref patient);

                    StagingEncounterPayment payment = GetPaymentValues(job);
                    payment.EncounterImportID = this.EncounterImportID;
                    DataProvider.StagingEncounterPaymentSave(ref payment);

                    scope.Complete();
                }
            }
            catch (TransactionAbortedException ex)
            {
                log.Error(ex);
            }
            catch (Exception ex)
            {
                log.Error(ex);
            }
        }