//Load tables for selected user in to the list box //Value of each list item is the sql query to create that item! void loadUserHistory() { if (global.sqlLiteDbFilePath.Length > 3) { addStatus("db file: " + global.sqlLiteDbFilePath); List<ComboboxItem> tblList = SqlLiteDbUtil.getTableList(global.sqlLiteDbFilePath); if (null != tblList && tblList.Count > 0) { tblList.Sort(); foreach (ComboboxItem ci in tblList) { listBoxTables.Items.Add(ci); } addStatus("Skype history found for the user " + comboBoxUsers.Text + ". To view records, please select the table from the left list box."); if (global.connectDb) buttonExportAll.Enabled = true; } else { addStatus("No database file found for the user"); } } }
//Export All tables to database private void buttonExportAll_Click(object sender, EventArgs e) { if (!(global.connectDb)) { addStatus("Please set destination database and click Export again"); } else { foreach (ComboboxItem lbi in listBoxTables.Items) { string tableName = lbi.ToString(); string query = lbi.Value.ToString(); currentDt = SqlLiteDbUtil.getTableData(global.sqlLiteDbFilePath, tableName); exportTable(tableName, query, currentDt); } } }
//Upon clicking on the table name from the list box (on the left side) //it load data for that table and display it on the data grid view private void listBoxTables_SelectedIndexChanged(object sender, EventArgs e) { string tableName = listBoxTables.SelectedItem.ToString(); currentDt = SqlLiteDbUtil.getTableData(global.sqlLiteDbFilePath, tableName); if (null != currentDt) { dataGridView1.DataSource = currentDt; addStatus("Table read successfull. History is ready to export."); if (global.connectDb) { buttonExportSel.Enabled = true; } } else { addStatus("Falied to read the table."); } }