private void BtnNuevo_Click(object sender, RoutedEventArgs e) { SubAnimal animal = new SubAnimal(); animal.TipoAccion = 0; animal.ShowDialog(); MostrarAnimales(); }
private void BtnActualizar_Click(object sender, RoutedEventArgs e) { if (dgAnimales.SelectedItem != null) { object item = dgAnimales.SelectedItem; string id = (dgAnimales.SelectedCells[3].Column.GetCellContent(item) as TextBlock).Text; SubAnimal animal = new SubAnimal(); animal.IdAnimal = id; animal.CodigoAnimal = (dgAnimales.SelectedCells[0].Column.GetCellContent(item) as TextBlock).Text; animal.EspecieAnimal = (dgAnimales.SelectedCells[1].Column.GetCellContent(item) as TextBlock).Text; animal.Cantidad = (dgAnimales.SelectedCells[2].Column.GetCellContent(item) as TextBlock).Text; animal.Precio = (dgAnimales.SelectedCells[4].Column.GetCellContent(item) as TextBlock).Text; animal.TipoAccion = 1; animal.ShowDialog(); MostrarAnimales(); } }