Exemplo n.º 1
0
        public void CommitToDatabase(Evaluation evaluation, Catalogue catalogue, DbConnection con, DbTransaction transaction)
        {
            if (!_correctValuesCalculated)
            {
                throw new Exception("You must call CalculateFinalValues before committing to the database");
            }

            IEnumerable <int> novelDataLoadRunIDs = RowsPassingValidationByDataLoadRunID.Keys;

            //now for every load batch we encountered in our evaluations
            foreach (int dataLoadRunID in novelDataLoadRunIDs)
            {
                //record the row states calculation (how many total rows are good/bad/ugly etc)
                evaluation.AddRowState(dataLoadRunID,
                                       RowsPassingValidationByDataLoadRunID[dataLoadRunID],
                                       WorstConsequencesByDataLoadRunID[dataLoadRunID][Consequence.Missing],
                                       WorstConsequencesByDataLoadRunID[dataLoadRunID][Consequence.Wrong],
                                       WorstConsequencesByDataLoadRunID[dataLoadRunID][Consequence.InvalidatesRow],
                                       catalogue.ValidatorXML,
                                       _pivotCategory,
                                       con,
                                       transaction
                                       );

                //record the column states calculations (how many total values in column x are good/bad/ugly etc)
                foreach (var columnState in AllColumnStates[dataLoadRunID])
                {
                    columnState.Commit(evaluation, _pivotCategory, con, transaction);
                }
            }
        }