public void readReport(string path) { bool secondLine = false; FileStream fs = File.Open(path, FileMode.Open, FileAccess.Read); IExcelDataReader excelReader = ExcelReaderFactory.CreateOpenXmlReader(fs); do { while (excelReader.Read()) { if (secondLine == true) { if (excelReader.GetString(1) != null) { string prsDetails = excelReader.GetString(1); DateTime date = excelReader.GetDateTime(7); string detection = excelReader.GetString(10); string icdLine = excelReader.GetString(11); compoundInfo temporary = new compoundInfo(prsDetails, icdLine, date, detection); if (findDuplicatesPatients(temporary) == false) { patients.Add(temporary); ConsoleOutputPatINF(temporary); } } } secondLine = true; } } while (excelReader.NextResult()); fs.Close(); }
private bool findDuplicatesPatients(compoundInfo temporary) { foreach (compoundInfo item in patients) { if (item.NAME == temporary.NAME && item.SURNAME == temporary.SURNAME && item.DATE == temporary.DATE && item.PROCEDURECELL == temporary.PROCEDURECELL) { return(true); } else { continue; } } return(false); }
private void ConsoleOutputPatINF(compoundInfo tmp) { Console.WriteLine("*** Wczytano linie o pacjencie {0} {1} z datÄ… wizyty {2} i procedurami {3}", tmp.NAME, tmp.SURNAME, tmp.DATE, tmp.PROCEDURECELL); }