private void button3_Click(object sender, EventArgs e) { List <string[]> path = bd.selectPathToPicturesByComplexityOrder(comboBox2.SelectedItem.ToString()); List <string> id_piece = new List <string>(); if (listView1.SelectedIndices.Count != 0) { int t = listView1.SelectedIndices[0]; string id_picture = bd.selectIdByPathPicture(path[t][0]); string id_puzzle = bd.selectPuzzleByIdPuzzleByIdPicture(id_picture); id_piece = bd.selectIdPiece(id_puzzle); //удалить сначала сейвы с этой картинкой bd.deleteSaveByIdPuzzle(id_puzzle); bd.deleteGameByIdPuzzle(id_puzzle); //bd.deletePuzzle(id_puzzle); for (int i = 0; i < id_piece.Count; i++) { bd.deletePiecePuzzleByIdPuzzleAndOrIdPuzzle(id_puzzle, id_piece[i]); } // bd.deletePiecePuzzleByIdPuzzleAndOrIdPicture("", bd.selectIdByPathPicture(path[t][0])); //удалить геймы с этой картинкой bd.deletePictures(path[t][0]); updateListView(); } }
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { Point xy = dataGridView1.CurrentCellAddress; int x = xy.X; int y = xy.Y; if (x == 4) { List <string[]> res = bd.selectPuzzlesByComplexity(""); List <string> id_piece = new List <string>(); if (y < res.Count) { string id = res[y][0]; id_piece = bd.selectIdPiece(id); bd.deleteSaveByIdPuzzle(id); for (int i = 0; i < id_piece.Count; i++) { bd.deletePiecePuzzleByIdPuzzleAndOrIdPuzzle(id, id_piece[i]); } bd.deleteGameByIdPuzzle(id); bd.deletePuzzle(id); dataGridView1.Rows.RemoveAt(y); } } }