Esempio n. 1
0
        private void StartAudit(string sql)
        {
            var dataExportRepo = ((DataExportRepository)Request.DataExportRepository);

            var previousAudit = dataExportRepo.GetAllCumulativeExtractionResultsFor(Request.Configuration, Request.DatasetBundle.DataSet).ToArray();

            if (Request.IsBatchResume)
            {
                var match = previousAudit.FirstOrDefault(a => a.ExtractableDataSet_ID == Request.DatasetBundle.DataSet.ID);
                if (match == null)
                {
                    throw new Exception($"Could not find previous CumulativeExtractionResults for dataset {Request.DatasetBundle.DataSet} despite the Request being marked as a batch resume");
                }
                Request.CumulativeExtractionResults = match;
            }
            else
            {
                //delete old audit records
                foreach (var audit in previousAudit)
                {
                    audit.DeleteInDatabase();
                }

                var extractionResults = new CumulativeExtractionResults(dataExportRepo, Request.Configuration, Request.DatasetBundle.DataSet, sql);

                string filterDescriptions = RecursivelyListAllFilterNames(Request.Configuration.GetFilterContainerFor(Request.DatasetBundle.DataSet));

                extractionResults.FiltersUsed = filterDescriptions.TrimEnd(',');
                extractionResults.SaveToDatabase();

                Request.CumulativeExtractionResults = extractionResults;
            }
        }
Esempio n. 2
0
        private void StartAudit(string sql)
        {
            var dataExportRepo = ((DataExportRepository)Request.DataExportRepository);

            var previousAudit = dataExportRepo.GetAllCumulativeExtractionResultsFor(Request.Configuration, Request.DatasetBundle.DataSet).ToArray();

            //delete old audit records
            foreach (var audit in previousAudit)
            {
                audit.DeleteInDatabase();
            }

            var extractionResults = new CumulativeExtractionResults(dataExportRepo, Request.Configuration, Request.DatasetBundle.DataSet, sql);

            string filterDescriptions = RecursivelyListAllFilterNames(Request.Configuration.GetFilterContainerFor(Request.DatasetBundle.DataSet));

            extractionResults.FiltersUsed = filterDescriptions.TrimEnd(',');
            extractionResults.SaveToDatabase();

            Request.CumulativeExtractionResults = extractionResults;
        }