private void rbt_ing_Checked(object sender, RoutedEventArgs e) { IngredienteBLL ib = new IngredienteBLL(); System.Data.DataTable dt = ib.AllingredientesList(); dtg_eli.ItemsSource = dt.DefaultView; txt_id_eli_ing.Visibility = Visibility.Visible; txt_id_eli_bebi.Visibility = Visibility.Hidden; txt_id_eli_ing.IsEnabled = true; }
private void btn_listar_ingrediente_Click(object sender, RoutedEventArgs e) { if (rbt_ing.IsChecked == true) { IngredienteBLL ib = new IngredienteBLL(); System.Data.DataTable dt = ib.AllingredientesList(); dtg_ingredientes.ItemsSource = dt.DefaultView; } else if (rbt_bebi.IsChecked == true) { BebestibleBLL ib = new BebestibleBLL(); System.Data.DataTable dt = ib.Allbebestible(); dtg_ingredientes.ItemsSource = dt.DefaultView; } }
private void rbt_ing_Checked(object sender, RoutedEventArgs e) { txt_id_alimento.Visibility = Visibility.Visible; txt_nombre_ali.Visibility = Visibility.Visible; txt_stock_ali.Visibility = Visibility.Visible; txt_stock_coci_alimento.Visibility = Visibility.Visible; txt_proveedor.Visibility = Visibility.Visible; cmb_habili_ing.Visibility = Visibility.Visible; txt_proveedor.SelectedIndex = -1; lbl_iding.Visibility = Visibility.Visible; lbl_insumo_alimento.Visibility = Visibility.Visible; lbl_stock_alimento.Visibility = Visibility.Visible; lbl_stock_coci_alimento.Visibility = Visibility.Visible; lbl_alimento.Visibility = Visibility.Visible; lbl_habili_ing.Visibility = Visibility.Visible; lb_stock_critico.Visibility = Visibility.Visible; txt_stock_critico.Visibility = Visibility.Visible; Buscar_ID.Visibility = Visibility.Visible; dtg_modi.Visibility = Visibility.Visible; lbl_idbebi.Visibility = Visibility.Hidden; lbl_insumo_bebi.Visibility = Visibility.Hidden; lbl_stock_bebi.Visibility = Visibility.Hidden; lbl_stock_coci_bebi.Visibility = Visibility.Hidden; lbl_marca_bebi.Visibility = Visibility.Hidden; lbl_precio_bebi.Visibility = Visibility.Hidden; lbl_habili_bebi.Visibility = Visibility.Hidden; lbl_conpre_bebi.Visibility = Visibility.Hidden; txt_id_bebida.Visibility = Visibility.Hidden; txt_nombre_bebi.Visibility = Visibility.Hidden; txt_stock_bebi.Visibility = Visibility.Hidden; txt_stock_bar_bebi.Visibility = Visibility.Hidden; txt_marca_bebi.Visibility = Visibility.Hidden; txt_precio_bebi.Visibility = Visibility.Hidden; cmb_habili_bebi.Visibility = Visibility.Hidden; cmb_conpre_bebi.Visibility = Visibility.Hidden; Modificar_id.IsEnabled = true; lbl1.Content = ""; lbl2.Content = ""; lbl3.Content = ""; lbl4.Content = ""; lbl5.Content = ""; lbl6.Content = ""; lbl7.Content = ""; lbl8.Content = ""; txt_id_bebida.Clear(); txt_nombre_bebi.Clear(); txt_stock_bebi.Clear(); txt_stock_bar_bebi.Clear(); txt_marca_bebi.Clear(); txt_precio_bebi.Clear(); cmb_habili_bebi.SelectedIndex = -1; cmb_conpre_bebi.SelectedIndex = -1; IngredienteBLL ib = new IngredienteBLL(); System.Data.DataTable dt = ib.AllingredientesList(); dtg_modi.ItemsSource = dt.DefaultView; }
private void Modificar_id_Click(object sender, RoutedEventArgs e) { bool txtcampo1 = true; bool txtcampo2 = true; bool txtcampo3 = true; bool txtcampo4 = true; bool txtcampo5 = true; bool txtcampo6 = true; bool txtcampo7 = true; bool txtcampo8 = true; bool scv = true; if (rbt_ing.IsChecked == true) { if (txt_id_bebida.Text.Trim() == "" && txt_id_alimento.Text.Trim() == "") { txtcampo1 = false; lbl1.Content = "Debe Completar el campo"; } if (txt_stock_critico.Text == "") { scv = false; lb_stock_critico.Content = "Complete el campo"; } if (txt_nombre_ali.Text.Trim() == "" && txt_nombre_bebi.Text.Trim() == "") { txtcampo2 = false; lbl2.Content = "Debe Completar el campo"; } if (txt_stock_ali.Text.Trim() == "" && txt_stock_bebi.Text.Trim() == "") { txtcampo3 = false; lbl3.Content = "Debe Completar el campo"; } if (txt_stock_coci_alimento.Text.Trim() == "" && txt_stock_bar_bebi.Text.Trim() == "") { txtcampo4 = false; lbl4.Content = "Debe Completar el campo"; } if (txt_proveedor.Text.Trim() == "" && txt_marca_bebi.Text.Trim() == "") { txtcampo5 = false; lbl5.Content = "Debe Completar el campo"; } if (txt_precio_bebi.Text.Trim() == "" && cmb_habili_ing.Text.Trim() == "") { txtcampo6 = false; lbl6.Content = "Debe Completar el campo"; } if (txtcampo1 && txtcampo2 && txtcampo3 && txtcampo4 && txtcampo5 && txtcampo6) { IngredienteBLL ub = new IngredienteBLL(); ub.id_ingrediente = Int32.Parse(txt_id_alimento.Text); ub.nombre_ingrediente = txt_nombre_ali.Text; ub.proveedor = txt_proveedor.Text; ub.habilitado = cmb_habili_ing.Text; ub.stock = Int32.Parse(txt_stock_ali.Text); ub.stock_cocina = Int32.Parse(txt_stock_coci_alimento.Text); ub.stock_critico = Int32.Parse(txt_stock_critico.Text); ub.AlterinIngrediente(ub); System.Data.DataTable dt = ub.AllingredientesList(); dtg_modi.ItemsSource = dt.DefaultView; PopupNotifier popup = new PopupNotifier(); popup.TitleText = "Aviso"; popup.Image = restaurantexxi_adminstrador.Properties.Resources.add; popup.ContentText = "Se ha modificado el Ingrediente: " + txt_nombre_ali.Text; popup.AnimationDuration = 800; popup.Delay = 1700; popup.Popup(); IngredienteBLL ib = new IngredienteBLL(); System.Data.DataTable dtt = ib.AllingredientesList(); dtg_modi.ItemsSource = dtt.DefaultView; } } else if (rbt_bebi.IsChecked == true) { if (txt_id_bebida.Text.Trim() == "" && txt_id_alimento.Text.Trim() == "") { txtcampo1 = false; lbl1.Content = "Debe Completar el campo"; } if (txt_nombre_ali.Text.Trim() == "" && txt_nombre_bebi.Text.Trim() == "") { txtcampo2 = false; lbl2.Content = "Debe Completar el campo"; } if (txt_stock_ali.Text.Trim() == "" && txt_stock_bebi.Text.Trim() == "") { txtcampo3 = false; lbl3.Content = "Debe Completar el campo"; } if (txt_stock_critico.Text == "") { scv = false; lb_stock_critico.Content = "Complete el campo"; } if (txt_stock_coci_alimento.Text.Trim() == "" && txt_stock_bar_bebi.Text.Trim() == "") { txtcampo4 = false; lbl4.Content = "Debe Completar el campo"; } if (txt_proveedor.Text.Trim() == "" && txt_marca_bebi.Text.Trim() == "") { txtcampo5 = false; lbl5.Content = "Debe Completar el campo"; } if (txt_precio_bebi.Text.Trim() == "" && cmb_habili_ing.Text.Trim() == "") { txtcampo6 = false; lbl6.Content = "Debe Completar el campo"; } if (cmb_habili_bebi.Text.Trim() == "") { txtcampo7 = false; lbl7.Content = "Debe Completar el campo"; } if (cmb_conpre_bebi.Text.Trim() == "") { txtcampo8 = false; lbl8.Content = "Debe Completar el campo"; } if (txtcampo1 && txtcampo2 && txtcampo3 && txtcampo4 && txtcampo5 && txtcampo6 && txtcampo7 && txtcampo8) { BebestibleBLL ub = new BebestibleBLL(); ub.id_bebestible = Int32.Parse(txt_id_bebida.Text); ub.nombre_beb = txt_nombre_bebi.Text; ub.marca = txt_proveedor.Text; ub.precio = Int32.Parse(txt_precio_bebi.Text); ub.stock = Int32.Parse(txt_stock_bebi.Text); ub.stock_bar = Int32.Parse(txt_stock_bar_bebi.Text); ub.stock_critico = Int32.Parse(txt_stock_critico.Text); ub.habilitado = cmb_habili_bebi.Text; ub.con_prep = cmb_conpre_bebi.Text; ub.AlterinBebestible(ub); System.Data.DataTable dt = ub.Allbebestible(); dtg_modi.ItemsSource = dt.DefaultView; PopupNotifier popup = new PopupNotifier(); popup.TitleText = "Aviso"; popup.Image = restaurantexxi_adminstrador.Properties.Resources.add; popup.ContentText = "Se ha modificado el bebestible: " + txt_nombre_bebi.Text; popup.AnimationDuration = 800; popup.Delay = 1700; popup.Popup(); BebestibleBLL ib = new BebestibleBLL(); System.Data.DataTable dtt = ib.Allbebestible(); dtg_modi.ItemsSource = dtt.DefaultView; } } }
private void btn_eli_Click(object sender, RoutedEventArgs e) { bool idid = true; Generic gen = new Generic(); gen.ACCION.Content = "deshabilitar"; gen.ACCION.Visibility = Visibility.Hidden; BebestibleBLL us = new BebestibleBLL(); IngredienteBLL ig = new IngredienteBLL(); if (txt_id_eli_bebi.Text == "" && txt_id_eli_ing.Text == "") { idid = false; lbl_1.Content = "El Debe selecionar una ID"; } if (idid) { if (rbt_bebi.IsChecked == true) { int idbebestible = Int32.Parse(txt_id_eli_bebi.Text); try { DataTable da = us.listarmodificar(idbebestible); 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 Bebestible?"; gen.lb_confirmacion.Content = "Al realizar esta accion, se deshabilitara el Bebestible:"; gen.lb_contenido.Content = "id : " + id + "\n" + "Nombre: " + Nombre; gen.Title = "Confirmación"; gen.btn_Cancelar.Content = "Volver"; gen.btn_Confirmar.Content = "Deshabilitar"; gen.ACCION.Content = "Modificarbebi"; gen.lb_rut.Content = txt_id_eli_bebi.Text; gen.Owner = this; gen.ShowDialog(); BebestibleBLL ib = new BebestibleBLL(); System.Data.DataTable dt = ib.Allbebestible(); dtg_eli.ItemsSource = dt.DefaultView; } catch (Exception ex) { Console.WriteLine(ex); MessageBox.Show("Este Bebestible no existe en el sistema"); } } else if (rbt_ing.IsChecked == true) { int idingrediente = Int32.Parse(txt_id_eli_ing.Text); try { int id = Int32.Parse(txt_id_eli_ing.Text); DataTable da = ig.listarmodificar(idingrediente); DataRow row = da.Rows[0]; string Nombre = row[0].ToString(); gen.lb_titulo.FontSize = 18; gen.lb_confirmacion.FontSize = 16; gen.lb_contenido.FontSize = 16; gen.lb_titulo.Content = "¿Desea deshabilitar este Ingrediente?"; gen.lb_confirmacion.Content = "Al realizar esta accion, se deshabilitara el Ingrediente:"; gen.lb_contenido.Content = "id : " + id + "\n" + "Nombre: " + Nombre; gen.Title = "Confirmación"; gen.btn_Cancelar.Content = "Volver"; gen.btn_Confirmar.Content = "Deshabilitar"; gen.ACCION.Content = "Modificaring"; gen.lb_rut.Content = txt_id_eli_ing.Text; gen.Owner = this; gen.ShowDialog(); IngredienteBLL ib = new IngredienteBLL(); System.Data.DataTable dt = ib.AllingredientesList(); dtg_eli.ItemsSource = dt.DefaultView; } catch (Exception ex) { Console.WriteLine(ex); MessageBox.Show("Este Ingrediente no existe en el sistema"); } } } }