public bool Import(IImportComponent component) { var connection = new SQLiteConnection(string.Format("Data Source={0};Version=3;", this.path)); IEnumerable <PatientDto> result = new List <PatientDto>(); try { this.OnLogged(Messages.Log_StartImporting); var patients = new PatientImporter(connection, component); patients.Logged += (sender, e) => this.OnLogged(e.Data); patients.ProgressChanged += (sender, e) => this.OnProgressChanged(e.Data); patients.Import(); this.OnLogged(Messages.Log_EndImporting); this.OnProgressChanged(100); } catch (Exception ex) { this.HandleError(ex); } finally { if (connection.State != ConnectionState.Closed) { connection.Close(); } } return(this.hasError); }
public bool Import(IImportComponent component) { var connection = new SQLiteConnection(string.Format("Data Source={0};Version=3;", this.path)); IEnumerable<PatientDto> result = new List<PatientDto>(); try { this.OnLogged(Messages.Log_StartImporting); var patients = new PatientImporter(connection, component); patients.Logged += (sender, e) => this.OnLogged(e.Data); patients.ProgressChanged += (sender, e) => this.OnProgressChanged(e.Data); patients.Import(); this.OnLogged(Messages.Log_EndImporting); this.OnProgressChanged(100); } catch (Exception ex) { this.HandleError(ex); } finally { if (connection.State != ConnectionState.Closed) connection.Close(); } return this.hasError; }