//****** Button Dodawania Kraju *************** private void addCountryButton_Click(object sender, RoutedEventArgs e) { AddCountry countryWindow = new AddCountry(); countryWindow.Owner = this; if (IsOpen == false) { countryWindow.deleteButton.Visibility = Visibility.Collapsed; countryWindow.Show(); countryWindow.Topmost = true; IsOpen = true; } }
//******** Button Edycja kraju *********** private void editCountryButton_Click(object sender, RoutedEventArgs e) { string id = ""; string name = ""; string flag = ""; string logo = ""; if (countriesListBox.SelectedItems.Count == 1) { OpenConnection(); MySqlCommand cmd = new MySqlCommand("Select * from countries where Country_ID = (select Country_ID from countries where Country_Name ='" + CountryName + "')", conn); MySqlDataReader rd = cmd.ExecuteReader(); while (rd.Read()) { id = rd.GetString(0); name = rd.GetString(1); flag = rd.GetString(2); logo = rd.GetString(3); } CloseConnection(); AddCountry addCountryWindow = new AddCountry(id, name, flag, logo, true); addCountryWindow.Owner = this; if (IsOpen == false) { addCountryWindow.Show(); IsOpen = true; } } else { MessageBox.Show("Prosze zaznaczyć kraj"); } }