public static List <CategoryRow> Get_categories(string file_path) { SQLiteConnection connection = new SQLiteConnection(string.Format("DataSource={0}", file_path)); connection.Open(); SQLiteCommand command = new SQLiteCommand(connection) { CommandText = "SELECT * FROM categories;" }; SQLiteDataReader results_reader = command.ExecuteReader(); List <CategoryRow> rows = new List <CategoryRow>(); while (results_reader.Read()) { CategoryRow row = new CategoryRow { Id = Convert.ToInt32(results_reader["id"]), Category_name = Convert.ToString(results_reader["category"]) }; rows.Add(row); } results_reader.Close(); connection.Close(); return(rows); }
private void Currency_selected(object sender, RoutedEventArgs e) { int selected_row_index = SelectCategoryDialogDataGrid.SelectedIndex; if (selected_row_index != -1) { this.selected_row = this.datagrid_rows[selected_row_index]; this.selected = true; this.Close(); } }