Example #1
0
        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;
                }
            }
        }
Example #2
0
        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;

            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_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.AlterinIngrediente(ub);
                    MessageBox.Show("Usuario Modificado correctamente");
                }
            }
            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_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_marca_bebi.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.habilitado    = cmb_habili_bebi.Text;
                    ub.con_prep      = cmb_conpre_bebi.Text;
                    ub.AlterinBebestible(ub);
                    MessageBox.Show("Usuario Modificado correctamente");
                }
            }
        }