private void btn_listar_Click(object sender, RoutedEventArgs e) { PlatoBLL ub = new PlatoBLL(); System.Data.DataTable dt = ub.AllplatosList(); dtg_rec.ItemsSource = dt.DefaultView; dtg_rec.Visibility = Visibility.Visible; }
private void btn_eliminar_Click(object sender, RoutedEventArgs e) { bool idre = true; Generic gen = new Generic(); gen.ACCION.Content = "deshabilitar"; gen.ACCION.Visibility = Visibility.Hidden; PlatoBLL us = new PlatoBLL(); if (txt_id_receta.Text.Trim() == "") { idre = false; lbl1.Content = "Debe ingresar una ID"; } if (idre) { int idplato = Int32.Parse(txt_id_receta.Text); try { DataTable da = us.DatosDesPlato(idplato); DataRow row = da.Rows[0]; string id = row[0].ToString(); string Nombre = row[1].ToString(); gen.lb_titulo.FontSize = 18; gen.lb_confirmacion.FontSize = 16; gen.lb_contenido.FontSize = 16; gen.lb_titulo.Content = "¿Desea deshabilitar este plato?"; gen.lb_confirmacion.Content = "Al realizar esta accion, se deshabilitara el plato:"; gen.lb_contenido.Content = "id : " + id + "\n" + "Nombre: " + Nombre; gen.Title = "Confirmación"; gen.btn_Cancelar.Content = "Volver"; gen.btn_Confirmar.Content = "Deshabilitar"; gen.lb_rut.Content = txt_id_receta.Text; gen.Owner = this; gen.ShowDialog(); PlatoBLL pb = new PlatoBLL(); dtg_receta.ItemsSource = pb.AllplatosList().DefaultView; } catch (Exception ex) { MessageBox.Show("Este plato no existe en el sistema"); MessageBox.Show("" + ex); } } }
private void MetroWindow_Loaded(object sender, RoutedEventArgs e) { PlatoBLL pb = new PlatoBLL(); dtg_receta.ItemsSource = pb.AllplatosList().DefaultView; }