protected virtual void DoImport()
        {
            AppendAuditLogEvent("Importing CSV file \"{0}\" ...", _csvFilePath);

            try
            {
                AqsDeserializeCsv cdr = new AqsDeserializeCsv(_baseDao);

                AppendAuditLogEvent("Generating AQS data from CSV file \"{0}\" ...", _csvFilePath);
                AirQualitySubmissionType data =
                    cdr.GetAirQualityData(_csvFilePath, Windsor.Node2008.WNOSPlugin.AQS3.AqsDeserializeCsv.AqsFileType.rawResults,
                                          _mappingTemplateName, this);

                AppendAuditLogEvent("Importing AQS data into database ...");

                AQSPersistDataToDatabase dataPersister = new AQSPersistDataToDatabase(_baseDao, _clearMetadata);
                dataPersister.UpsertAirQualityData(data, this);

                AppendAuditLogEvent("Successfully imported CSV file");
            }
            catch (Exception e)
            {
                AppendAuditLogEvent("Failed to import CSV file with error: {0}",
                                    ExceptionUtils.GetDeepExceptionMessage(e));
                throw;
            }
        }
Exemple #2
0
        protected virtual void DoImport()
        {
            try
            {
                AppendAuditLogEvent("Deserializing AQS XML from file \"{0}\" ...", _xmlFilePath);
                AirQualitySubmissionType data = _serializationHelper.Deserialize <AirQualitySubmissionType>(_xmlFilePath);

                AppendAuditLogEvent("Importing AQS data into database ...");

                AQSPersistDataToDatabase dataPersister = new AQSPersistDataToDatabase(_baseDao, _clearMetadata);
                dataPersister.UpsertAirQualityData(data, this);

                AppendAuditLogEvent("Successfully imported AQS XML into database.");
            }
            catch (Exception e)
            {
                AppendAuditLogEvent("Failed to import AQS XML into database with error: {0}",
                                    ExceptionUtils.GetDeepExceptionMessage(e));
                throw;
            }
        }