public void ImportFromExcelFile(string path) { var excelRepository = new ExcelRepository(); var data = excelRepository.GetAllDataFrom(path, "TUSS.xls", "TUSS"); var list = new List<TUSS>(); foreach (DataRow row in data.Rows) { var tus = new TUSS(); foreach (DataColumn column in data.Columns) { switch (column.Caption) { case "Código do Termo": tus.Code = row[column].ToString(); break; case "Termo": tus.Description = row[column].ToString(); break; } } list.Add(tus); } var tusRepository = new TUSSRepository(); tusRepository.SaveList(list); }
public static TUSSModel MapTUSSModelFrom(TUSS tuss) { Mapper.CreateMap<TUSS, TUSSModel>(); var tussModel = Mapper.Map<TUSS, TUSSModel>(tuss); return tussModel; }
private void AddToIndex(TUSS treatment, IndexWriter writer) { //Não precisa remover o tratamento, pois existem varios tratamentos com o id igual. // RemoveIndex(treatment, writer); var doc = new Document(); AddFields(treatment, doc); writer.AddDocument(doc); }
private void AddFields(TUSS tus, Document doc) { doc.Add(new Field("Id", tus.Id.ToString(CultureInfo.InvariantCulture), Field.Store.YES, Field.Index.ANALYZED)); doc.Add(new Field("Description", tus.Description.ToLower(), Field.Store.YES, Field.Index.ANALYZED)); doc.Add(new Field("Code", tus.Code.ToLower(), Field.Store.YES, Field.Index.ANALYZED)); }
public void UpdateIndex(TUSS tuss) { UpdateIndex(new List<TUSS> { tuss }); Optimize(); }
private TUSS _mapLuceneDocumentToData(Document doc) { var tus = new TUSS { Id = short.Parse(doc.Get("Id")), Description = doc.Get("Description"), Code = doc.Get("Code"), }; return tus; }
private void RemoveIndex(TUSS tus, IndexWriter writer) { var searchQuery = new TermQuery(new Term("Id", tus.Id.ToString(CultureInfo.InvariantCulture))); writer.DeleteDocuments(searchQuery); }