Beispiel #1
0
        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();
                    }

                    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
                    {
                        DataTable da     = ig.listarmodificar(idingrediente);
                        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 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();
                    }

                    catch (Exception ex)
                    {
                        Console.WriteLine(ex);
                        MessageBox.Show("Este Ingrediente no existe en el sistema");
                    }
                }
            }
        }
Beispiel #2
0
        private void Buscar_ID_Click(object sender, RoutedEventArgs e)
        {
            if (rbt_ing.IsChecked == true)
            {
                IngredienteBLL us = new IngredienteBLL();
                bool           id = true;
                if (txt_id_alimento.Text == "")
                {
                    id           = false;
                    lbl1.Content = "Debe ingresar una id";
                }

                if (id)
                {
                    int id_ingrediente = Int32.Parse(txt_id_alimento.Text);
                    try
                    {
                        DataTable da  = us.listarmodificar(id_ingrediente);
                        DataRow   row = da.Rows[0];
                        txt_nombre_ali.Text          = row[0].ToString();
                        txt_proveedor.Text           = row[1].ToString();
                        txt_stock_ali.Text           = row[2].ToString();
                        txt_stock_coci_alimento.Text = row[3].ToString();
                        cmb_habili_ing.Text          = row[4].ToString();
                        txt_stock_critico.Text       = row[5].ToString();



                        txt_id_alimento.IsEnabled         = true;
                        txt_nombre_ali.IsEnabled          = true;
                        txt_stock_ali.IsEnabled           = true;
                        txt_stock_coci_alimento.IsEnabled = true;
                        txt_proveedor.IsEnabled           = true;
                        cmb_habili_ing.IsEnabled          = true;
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("" + ex);
                    }
                }
            }
            else if (rbt_bebi.IsChecked == true)
            {
                BebestibleBLL us = new BebestibleBLL();
                if (txt_id_bebida.Text == "")
                {
                    MessageBox.Show("Debe ingresar un ID para poder buscar a un Insumo");
                }
                else if (txt_id_bebida.Text != "")
                {
                    int id_bebestible = Int32.Parse(txt_id_bebida.Text);
                    us.listarmodificar(id_bebestible);
                    try
                    {
                        DataTable da  = us.listarmodificar(id_bebestible);
                        DataRow   row = da.Rows[0];
                        txt_nombre_bebi.Text    = row[1].ToString();
                        txt_proveedor.Text      = row[2].ToString();
                        txt_precio_bebi.Text    = row[3].ToString();
                        txt_stock_bebi.Text     = row[4].ToString();
                        txt_stock_bar_bebi.Text = row[5].ToString();
                        cmb_habili_bebi.Text    = row[6].ToString();
                        cmb_conpre_bebi.Text    = row[7].ToString();
                        txt_stock_critico.Text  = row[8].ToString();

                        txt_id_bebida.IsEnabled      = true;
                        txt_nombre_bebi.IsEnabled    = true;
                        txt_stock_bebi.IsEnabled     = true;
                        txt_stock_bar_bebi.IsEnabled = true;
                        txt_precio_bebi.IsEnabled    = true;
                        cmb_habili_bebi.IsEnabled    = true;
                        txt_proveedor.IsEnabled      = true;
                        cmb_conpre_bebi.IsEnabled    = true;
                    }
                    catch
                    {
                        MessageBox.Show("Esta ID no existe en el sistema");
                    }
                }
            }
        }