//edycja - otwarcie panelu AddGame i wypełnienie go danymi zaznaczonej gry private void ListEdit_btn_Click(object sender, RoutedEventArgs e) { DBConnection db = new DBConnection(); AddGame addGame = new AddGame(); List <string> QueryList = new List <string>(); QueryList.Add(PobranyTytul); QueryList.Add(db.DatabaseDataGetOne("SELECT category.title_category FROM board_game, category WHERE category.id_category = board_game.id_category AND board_game.title = '" + PobranyTytul + "'")); QueryList.Add(db.DatabaseDataGetOne("SELECT min_players FROM board_game WHERE title = '" + PobranyTytul + "'")); QueryList.Add(db.DatabaseDataGetOne("SELECT max_players FROM board_game WHERE title = '" + PobranyTytul + "'")); QueryList.Add(db.DatabaseDataGetOne("SELECT rate FROM board_game WHERE title = '" + PobranyTytul + "'")); try { addGame.Title_txtbox.Text = QueryList[0]; addGame.Category_combobox.SelectedValue = QueryList[1]; addGame.MinLiczba_combo.SelectedValue = Convert.ToInt32(QueryList[2]); addGame.MaxLiczba_combo.SelectedValue = Convert.ToInt32(QueryList[3]); addGame.Rate_slider.Value = Convert.ToInt32(QueryList[4]); } catch (ArgumentException ex) { MessageBox.Show("Błędne dane", "Błąd", MessageBoxButton.OK, MessageBoxImage.Error); Console.WriteLine(ex.Message); Console.WriteLine(ex.StackTrace); } addGame.ShowDialog(); GridRefresh(); }
private void ButtonAdd_Click(object sender, RoutedEventArgs e) { AddGame addGame = new AddGame(); addGame.ShowDialog(); GridRefresh(); }