private void RefreshFormSqlite() { SQLite.ADO.DataMgr dataMgr = new SQLite.ADO.DataMgr(); string strScenarioDir = frmMain.g_oFrmMain.frmProject.uc_project1.txtRootDirectory.Text.Trim() + "\\" + ScenarioType + "\\" + Tables.ProcessorScenarioRuleDefinitions.DefaultSqliteDbFile; string strConn = dataMgr.GetConnectionString(strScenarioDir); try { using (System.Data.SQLite.SQLiteConnection con = new System.Data.SQLite.SQLiteConnection(strConn)) { con.Open(); string strSQL = "select * from scenario where scenario_id = '" + this.lstScenario.SelectedItem.ToString() + "';"; dataMgr.SqlQueryReader(con, strSQL); if (dataMgr.m_DataReader.HasRows) { while (dataMgr.m_DataReader.Read()) { txtScenarioId.Text = dataMgr.m_DataReader["scenario_id"].ToString(); txtDescription.Text = dataMgr.m_DataReader["description"].ToString(); txtScenarioPath.Text = dataMgr.m_DataReader["path"].ToString(); break; } } dataMgr.m_DataReader.Close(); } } catch (Exception caught) { intError = -1; strError = caught.Message; MessageBox.Show(strError, "FIA Biosum"); } }
public void populate_scenario_listbox_sqlite() { string strScenarioId = ""; string strDescription = ""; string strScenarioPath = ""; SQLite.ADO.DataMgr dataMgr = new SQLite.ADO.DataMgr(); string strScenarioDir = frmMain.g_oFrmMain.frmProject.uc_project1.txtRootDirectory.Text.Trim() + "\\" + ScenarioType + "\\" + Tables.ProcessorScenarioRuleDefinitions.DefaultSqliteDbFile; string strConn = dataMgr.GetConnectionString(strScenarioDir); try { lstScenario.Items.Clear(); using (System.Data.SQLite.SQLiteConnection con = new System.Data.SQLite.SQLiteConnection(strConn)) { con.Open(); dataMgr.SqlQueryReader(con, "select * from scenario"); if (dataMgr.m_DataReader.HasRows) { while (dataMgr.m_DataReader.Read()) { strScenarioId = dataMgr.m_DataReader["scenario_id"].ToString(); strDescription = dataMgr.m_DataReader["description"].ToString(); strScenarioPath = dataMgr.m_DataReader["path"].ToString(); this.lstScenario.Items.Add(strScenarioId); } } } this.lstScenario.SelectedIndex = this.lstScenario.Items.Count - 1; this.txtScenarioPath.Text = strScenarioPath; this.txtDescription.Text = strDescription; } catch (Exception caught) { intError = -1; strError = caught.Message; MessageBox.Show(strError, "FIA Biosum"); } }
private void loadgridSqlite() { // //OPEN CONNECTION TO DB FILE CONTAINING Processor Scenario TABLE // //scenario mdb connection string strProcessorScenarioDB = frmMain.g_oFrmMain.frmProject.uc_project1.txtRootDirectory.Text.Trim() + "\\processor\\" + Tables.ProcessorScenarioRuleDefinitions.DefaultSqliteDbFile; SQLite.ADO.DataMgr oDataMgr = new SQLite.ADO.DataMgr(); using (System.Data.SQLite.SQLiteConnection conn = new System.Data.SQLite.SQLiteConnection(oDataMgr.GetConnectionString(strProcessorScenarioDB))) { conn.Open(); // //get a list of all the scenarios // oDataMgr.SqlQueryReader(conn, "SELECT scenario_id,description " + "FROM scenario " + "WHERE scenario_id IS NOT NULL AND " + "LENGTH(TRIM(scenario_id)) > 0"); int x = 0; ListViewItem entryListItem = null; if (oDataMgr.m_DataReader.HasRows) { while (oDataMgr.m_DataReader.Read()) { if (oDataMgr.m_DataReader["scenario_id"] != DBNull.Value && oDataMgr.m_DataReader["scenario_id"].ToString().Trim().Length > 0 && ReferenceCurrentScenarioItem.ScenarioId.Trim().ToUpper() != oDataMgr.m_DataReader["scenario_id"].ToString().Trim().ToUpper()) { entryListItem = lvProcessorScenario.Items.Add(" "); entryListItem.UseItemStyleForSubItems = false; this.m_oLvAlternateColors.AddRow(); this.m_oLvAlternateColors.AddColumns(x, lvProcessorScenario.Columns.Count); entryListItem.SubItems.Add(oDataMgr.m_DataReader["scenario_id"].ToString().Trim()); if (oDataMgr.m_DataReader["description"] != DBNull.Value && oDataMgr.m_DataReader["description"].ToString().Trim().Length > 0) { entryListItem.SubItems.Add(oDataMgr.m_DataReader["description"].ToString().Trim()); } else { entryListItem.SubItems.Add(" "); } x = x + 1; } } oDataMgr.m_DataReader.Close(); this.m_oLvAlternateColors.ListView(); } else { MessageBox.Show("!!No Scenarios To Copy!!", "FIA Bisoum"); btnCopy.Enabled = false; } } }