/// <summary> /// Insert the facts of a document into the mongo database. /// </summary> /// <param name="documentoInstanciXbrlDto">Documento to evaluate.</param> /// <param name="reportParams">Extra params to include.</param> /// <param name="factsList">Extra facts to include.</param> /// <param name="taskList">List of task to wait befor ends.</param> /// <param name="registrationDate">Registration date of the document.</param> /// <param name="abaxXBRLCellStoreMongo">Data access object of mongo.</param> public static void InsertFacts( DocumentoInstanciaXbrlDto documentoInstanciXbrlDto, IDictionary <String, String> reportParams, IList <FactJBRL> factsList, IList <Task> taskList, DateTime registrationDate, AbaxXBRLCellStoreMongo abaxXBRLCellStoreMongo) { var mongoDB = abaxXBRLCellStoreMongo.GetMongoDB(); JBRLUtils.SetReportParams(documentoInstanciXbrlDto, reportParams); var reportId = JBRLUtils.CreateReportId(reportParams); var reportRecordId = JBRLUtils.CreateReportRecordId(reportId, registrationDate); if (JBRLUtils.ExistsReportRecord(reportRecordId, abaxXBRLCellStoreMongo)) { return; } var replacementId = JBRLUtils.SarchReplacementId(reportId, reportRecordId, registrationDate, abaxXBRLCellStoreMongo); if (replacementId == null) { var taskVersion = JBRLUtils.UpdateReportsReplacementVersionAsync(reportId, reportRecordId, abaxXBRLCellStoreMongo); taskList.Add(taskVersion); } foreach (var hechoId in documentoInstanciXbrlDto.HechosPorId.Keys) { var hecho = documentoInstanciXbrlDto.HechosPorId[hechoId]; if (hecho.TipoDatoXbrl.Contains("64")) { continue; } var hechoJbrl = FactJBRL.Parse( hecho, documentoInstanciXbrlDto, reportId, reportRecordId, registrationDate, reportParams, replacementId); if (hechoJbrl != null) { factsList.Add(hechoJbrl); } else { LogUtil.Error(new Dictionary <string, object>() { { "Error", "No fué posible convertir el hecho a JBRL" }, { "HechoId", hecho.Id ?? "null" }, { "Concepto", hecho.IdConcepto ?? "null" }, { "Hecho", hecho } }); } } var modeloBaseList = new List <IModeloBase>(); modeloBaseList.AddRange(factsList); abaxXBRLCellStoreMongo.InserttChunksCollection(mongoDB, JBRLUtils.COLLECTION_NAME, modeloBaseList); var taskFactsEvaluation = JBRLUtils. UpdatePreviousFactsReplacementVersionAsync(factsList, abaxXBRLCellStoreMongo); taskList.Add(taskFactsEvaluation); }