private void BtnNuevo_Click(object sender, RoutedEventArgs e) { SubProducto form = new SubProducto(); form.TipoAccion = 0; form.ShowDialog(); MostrarProductos(); }
private void BtnActualizar_Click(object sender, RoutedEventArgs e) { if (dgProducto.SelectedItem != null) { object item = dgProducto.SelectedItem; string id = (dgProducto.SelectedCells[4].Column.GetCellContent(item) as TextBlock).Text; object item1 = dgProducto.SelectedItem; string idcategoria = (dgProducto.SelectedCells[5].Column.GetCellContent(item) as TextBlock).Text; SubProducto form = new SubProducto(); form.IdProducto = id; form.IdCategoria = idcategoria; form.CodigoProducto = (dgProducto.SelectedCells[0].Column.GetCellContent(item) as TextBlock).Text; form.Descripcion = (dgProducto.SelectedCells[1].Column.GetCellContent(item) as TextBlock).Text; form.Cantidad = (dgProducto.SelectedCells[6].Column.GetCellContent(item) as TextBlock).Text; form.Precio = (dgProducto.SelectedCells[7].Column.GetCellContent(item) as TextBlock).Text; form.TipoAccion = 1; form.ShowDialog(); MostrarProductos(); } }