public void ImportFromExcelFile(string path) { var excelRepository = new ExcelRepository(); var data = excelRepository.GetAllDataFrom(path, "CID.xls", "CID10"); var list = new List<CID>(); foreach (DataRow row in data.Rows) { var cid = new CID(); foreach (DataColumn column in data.Columns) { switch (column.Caption) { case "CODIGO": cid.Code = (string)row[column]; break; case "DESCRICAO": cid.Description = (string)row[column]; break; case "DESCRABREV": cid.AbbreviatedDescription = (string)row[column]; break; } } list.Add(cid); } var cids = new CIDRepository(); cids.SaveList(list); }
private void SetCid(CID cid) { Assertion.NotNull(cid, "Cid não informado.").Validate(); Cid = cid; Assertion.Equals(Cid, cid, "Cid não foi atribuido corretamente.").Validate(); }
private void AddDiagnostics(Legacy.Summary legacySummary, Summary newSummary) { var diagnosticTypesRepository = new Types<DiagnosticType>(); foreach (var legacyDiagnostic in legacySummary.Diagnostics) { if (legacyDiagnostic != null && !String.IsNullOrWhiteSpace(legacyDiagnostic.Type)) { short diagnosticTypeId = Convert.ToInt16(legacyDiagnostic.Type); DiagnosticType diagnosticType = diagnosticTypesRepository.Get(diagnosticTypeId); CID cid = new CID { Code = legacyDiagnostic.Cid }; newSummary.CreateDiagnostic(diagnosticType, cid); } } }
private void AddFields(CID cid, Document doc) { doc.Add(new Field("Id", cid.Id.ToString(CultureInfo.InvariantCulture), Field.Store.YES, Field.Index.ANALYZED)); doc.Add(new Field("Description", cid.Description.ToLower(), Field.Store.YES, Field.Index.ANALYZED)); doc.Add(new Field("Code", cid.Code.ToLower(), Field.Store.YES, Field.Index.ANALYZED)); }
public void UpdateIndex(CID cids) { UpdateIndex(new List<CID> { cids }); Optimize(); }
private CID _mapLuceneDocumentToData(Document doc) { var cid = new CID { Id = short.Parse(doc.Get("Id")), Description = doc.Get("Description"), Code = doc.Get("Code"), }; return cid; }
private void _addToLuceneIndex(CID cid, IndexWriter writer) { //Não precisa remover o tratamento, pois existem varios tratamentos com o id igual. // RemoveIndex(treatment, writer); var doc = new Document(); AddFields(cid, doc); writer.AddDocument(doc); }
private void RemoveIndex(CID cid, IndexWriter writer) { var searchQuery = new TermQuery(new Term("Id", cid.Id.ToString(CultureInfo.InvariantCulture))); writer.DeleteDocuments(searchQuery); }
public static CidModel MapCidModelFrom(CID cid) { Mapper.CreateMap<CID, CidModel>(); return Mapper.Map<CID, CidModel>(cid); }