/* Add species record */ private void button1_Click(object sender, EventArgs e) { //Get info about the specie to add string speciesName = speciesNameTextBox.Text; string country = countryTextBox.Text; //Only add specie if namn contains characters if (speciesName.Length > 0) { //Try to add species if (_dataAccess.AddSpecies(speciesName, enviormentComboBox.Text, foodTypeComboBox.Text, country)) { infoLabel.Text = "The specie were added."; speciesNameTextBox.Text = ""; countryTextBox.Text = ""; //Reload the species in zoo forms zoo.LoadSpecies(); } else { infoLabel.Text = "Could not add specie. " + "\nCheck that the specie name dosen't exist."; } } else { infoLabel.Text = "You have to specify a name for the specie."; } }
private void editSpeciesBTN_Click(object sender, EventArgs e) { //Edit specie if (_dataAccess.EditSpecies(speciesNameTextBox.Text, enviormentComboBox.Text, foodTypeComboBox.Text, countryTextBox.Text)) { infoLabel.Text = speciesNameTextBox.Text + " were succesfully edited."; //Reload species in zoo form zoo.LoadSpecies(); //Reload search results in zoo form zoo.Search(); } else { infoLabel.Text = speciesNameTextBox.Text + " edit failed."; } }