private void btnEditScientificName_Click(object sender, EventArgs e) { if (txtScientificName.Text == string.Empty) { MessageBox.Show("Fill the name"); return; } DataTable dt = scientific.ScientificNameVerifyName(Convert.ToInt32(txtScientificID.Text), txtScientificName.Text); if (dt.Rows.Count > 0) { MessageBox.Show("This name is exist already", "Caution"); return; } try { scientific.ScientificNameUpdate(Convert.ToInt32(txtScientificID.Text), txtScientificName.Text); MessageBox.Show("Update Successfully", "Update"); dgvScientificNames.DataSource = scientific.ScientificNameSearch(""); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnAdd_Click(object sender, EventArgs e) { if (txtScientificName.Text == string.Empty) { MessageBox.Show("Fill the Name"); return; } DataTable dt = scientific.ScientificNameVerifyName(0, txtScientificName.Text); if (dt.Rows.Count > 0) { MessageBox.Show("This name is exist already"); return; } scientific.ScientificNameAdd(txtScientificName.Text); MessageBox.Show("Added Successfully", "Add"); frmBusiness.ClearTextBoxes(this.Controls); }