private void Aceptar_Click(object sender, EventArgs e) { AnimalesCL oAnimalesCl = new AnimalesCL(); oAnimalesCl.EditarAnimal(Convert.ToInt32(textID.Text),textNombre.Text, comboBoxEspecie.SelectedIndex, comboBoxTipo.SelectedIndex, textDueño.Text); if (oAnimalesCl.IsError) { MessageBox.Show(oAnimalesCl.ErrorDescripcion, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show("Animal Editado", "Inforamcion", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void CargarDatos() { AnimalesCL oAnimalesCL = new AnimalesCL(); DataSet odatos = oAnimalesCL.TraerAnimales(txtBuscar.Text); if (oAnimalesCL.IsError) { MessageBox.Show(oAnimalesCL.ErrorDescripcion, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { dtgAnimales.DataSource=odatos.Tables[0]; } }
private void eliminarToolStripMenuItem_Click(object sender, EventArgs e) { if (dtgAnimales.SelectedRows.Count > 0) { AnimalesCL oAnimales = new AnimalesCL(); oAnimales.EliminarAnimal(Convert.ToInt32(dtgAnimales.SelectedRows[0].Cells[0].Value)); if (oAnimales.IsError) { MessageBox.Show(oAnimales.ErrorDescripcion, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show("Animal Eliminado", "Inforamcion", MessageBoxButtons.OK, MessageBoxIcon.Information); } this.CargarDatos(); } }