Example #1
0
        private void btn_crear_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 critico   = true;

            if (rbt_alimentos.IsChecked == true)
            {
                if (txt_insumo_alimento.Text.Trim() == "" && txt_insumo_bebi.Text.Trim() == "")
                {
                    txtcampo1    = false;
                    lbl1.Content = "Debe Completar el campo";
                }

                if (txt_stock_alimento.Text.Trim() == "" && txt_stock_bebi.Text.Trim() == "")
                {
                    txtcampo2    = false;
                    lbl2.Content = "Debe Completar el campo";
                }

                if (txt_stock_coci_alimento.Text.Trim() == "" && txt_stock_coci_bebi.Text.Trim() == "")
                {
                    txtcampo3    = false;
                    lbl3.Content = "Debe Completar el campo";
                }

                if (cmb_proveedor.Text.Trim() == "" && txt_marca_bebi.Text.Trim() == "")
                {
                    txtcampo4    = false;
                    lbl4.Content = "Debe Completar el campo";
                }

                if (txt_precio_bebi.Text.Trim() == "" && txt_habili_ingre.Text.Trim() == "")
                {
                    txtcampo5    = false;
                    lbl5.Content = "Debe Completar el campo";
                }

                if (txt_stock_critico.Text == "")
                {
                    critico     = false;
                    lb8.Content = "Debe Completar el campo";
                }

                if (txtcampo1 && txtcampo2 && txtcampo3 && txtcampo4 && txtcampo5 && critico)

                {
                    IngredienteBLL ib = new IngredienteBLL();
                    ib.nombre_ingrediente = txt_insumo_alimento.Text;
                    ib.proveedor          = cmb_proveedor.Text;
                    ib.habilitado         = txt_habili_ingre.Text;
                    ib.stock         = Int32.Parse(txt_stock_alimento.Text);
                    ib.stock_cocina  = Int32.Parse(txt_stock_coci_alimento.Text);
                    ib.stock_critico = Int32.Parse(txt_stock_critico.Text);
                    bool estado = ib.AddIngrediente(ib);

                    if (estado)
                    {
                        PopupNotifier popup = new PopupNotifier();
                        popup.TitleText         = "Aviso";
                        popup.Image             = restaurantexxi_adminstrador.Properties.Resources.add;
                        popup.ContentText       = "Se ha Creado el ingrediente: " + txt_insumo_alimento.Text;
                        popup.AnimationDuration = 800;
                        popup.Delay             = 1700;
                        popup.Popup();

                        txt_insumo_alimento.Clear();
                        txt_stock_alimento.Clear();
                        txt_stock_coci_alimento.Clear();
                        cmb_proveedor.SelectedIndex    = -1;
                        txt_habili_ingre.SelectedIndex = -1;
                    }
                    else
                    {
                        MessageBox.Show("Bebestible no fue creado");
                    }
                }
            }

            else if (rbt_bebestibles.IsChecked == true)
            {
                if (txt_insumo_alimento.Text.Trim() == "" && txt_insumo_bebi.Text.Trim() == "")
                {
                    txtcampo1    = false;
                    lbl1.Content = "Debe Completar el campo";
                }

                if (txt_stock_alimento.Text.Trim() == "" && txt_stock_bebi.Text.Trim() == "")
                {
                    txtcampo2    = false;
                    lbl2.Content = "Debe Completar el campo";
                }

                if (txt_stock_coci_alimento.Text.Trim() == "" && txt_stock_coci_bebi.Text.Trim() == "")
                {
                    txtcampo3    = false;
                    lbl3.Content = "Debe Completar el campo";
                }

                if (cmb_proveedor.Text.Trim() == "" && txt_marca_bebi.Text.Trim() == "")
                {
                    txtcampo4    = false;
                    lbl4.Content = "Debe Completar el campo";
                }

                if (txt_precio_bebi.Text.Trim() == "" && txt_habili_ingre.Text.Trim() == "")
                {
                    txtcampo5    = false;
                    lbl5.Content = "Debe Completar el campo";
                }

                if (txt_habili_bebi.Text.Trim() == "")
                {
                    txtcampo6    = false;
                    lbl6.Content = "Debe Completar el campo";
                }

                if (txt_conpre_bebi.Text.Trim() == "")
                {
                    txtcampo7    = false;
                    lbl7.Content = "Debe Completar el campo";
                }

                if (txt_stock_critico.Text == "")
                {
                    critico     = false;
                    lb8.Content = "Debe Completar el campo";
                }

                if (txtcampo1 && txtcampo2 && txtcampo3 && txtcampo4 && txtcampo5 && txtcampo6 && txtcampo7 && critico)

                {
                    BebestibleBLL ib = new BebestibleBLL();
                    ib.nombre_beb    = txt_insumo_bebi.Text;
                    ib.marca         = cmb_proveedor.Text;
                    ib.precio        = Int32.Parse(txt_precio_bebi.Text);
                    ib.stock         = Int32.Parse(txt_stock_bebi.Text);
                    ib.stock_bar     = Int32.Parse(txt_stock_coci_bebi.Text);
                    ib.stock_critico = Int32.Parse(txt_stock_critico.Text);
                    ib.imagen        = imageBt;
                    string habilitado = "";
                    if (si_habilitado.IsSelected)
                    {
                        habilitado = "Si";
                    }
                    else if (no_habilitado.IsSelected)
                    {
                        habilitado = "No";
                    }
                    else
                    {
                        MessageBox.Show("Debe seleccionar un estado para el Insumo");
                    }
                    ib.habilitado = habilitado;
                    string con_prep = "";
                    if (si_con.IsSelected)
                    {
                        con_prep = "Si";
                    }
                    else if (no_con.IsSelected)
                    {
                        con_prep = "No";
                    }
                    else
                    {
                        MessageBox.Show("Debe seleccionar un estadi para el Insumo");
                    }
                    ib.con_prep = con_prep;
                    bool estado = ib.AddBebestible(ib);
                    if (estado)
                    {
                        PopupNotifier popup = new PopupNotifier();
                        popup.TitleText         = "Aviso";
                        popup.Image             = restaurantexxi_adminstrador.Properties.Resources.add;
                        popup.ContentText       = "Se ha Creado el bebestible: " + txt_insumo_alimento.Text;
                        popup.AnimationDuration = 800;
                        popup.Delay             = 1700;
                        popup.Popup();

                        txt_insumo_bebi.Clear();
                        txt_stock_bebi.Clear();
                        txt_stock_coci_bebi.Clear();
                        txt_marca_bebi.Clear();
                        txt_precio_bebi.Clear();
                        txt_habili_bebi.SelectedIndex = -1;
                        txt_conpre_bebi.SelectedIndex = -1;
                    }
                    else
                    {
                        MessageBox.Show("Insumo no fue creado");
                    }
                }
            }
        }
Example #2
0
        private void btn_crear_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;

            if (rbt_alimentos.IsChecked == true)
            {
                if (txt_insumo_alimento.Text.Trim() == "" && txt_insumo_bebi.Text.Trim() == "")
                {
                    txtcampo1    = false;
                    lbl1.Content = "Debe Completar el campo";
                }

                if (txt_stock_alimento.Text.Trim() == "" && txt_stock_bebi.Text.Trim() == "")
                {
                    txtcampo2    = false;
                    lbl2.Content = "Debe Completar el campo";
                }

                if (txt_stock_coci_alimento.Text.Trim() == "" && txt_stock_coci_bebi.Text.Trim() == "")
                {
                    txtcampo3    = false;
                    lbl3.Content = "Debe Completar el campo";
                }

                if (cmb_proveedor.Text.Trim() == "" && txt_marca_bebi.Text.Trim() == "")
                {
                    txtcampo4    = false;
                    lbl4.Content = "Debe Completar el campo";
                }

                if (txt_precio_bebi.Text.Trim() == "" && txt_habili_ingre.Text.Trim() == "")
                {
                    txtcampo5    = false;
                    lbl5.Content = "Debe Completar el campo";
                }

                if (txtcampo1 && txtcampo2 && txtcampo3 && txtcampo4 && txtcampo5)

                {
                    IngredienteBLL ib = new IngredienteBLL();
                    ib.nombre_ingrediente = txt_insumo_alimento.Text;
                    ib.proveedor          = cmb_proveedor.Text;
                    ib.habilitado         = txt_habili_ingre.Text;
                    ib.stock        = Int32.Parse(txt_stock_alimento.Text);
                    ib.stock_cocina = Int32.Parse(txt_stock_coci_alimento.Text);
                    bool estado = ib.AddIngrediente(ib);

                    if (estado)
                    {
                        MessageBox.Show("Bebestible creado correctamente");
                        txt_insumo_alimento.Clear();
                        txt_stock_alimento.Clear();
                        txt_stock_coci_alimento.Clear();
                        cmb_proveedor.SelectedIndex    = -1;
                        txt_habili_ingre.SelectedIndex = -1;
                    }
                    else
                    {
                        MessageBox.Show("Bebestible no fue creado");
                    }
                }
            }

            else if (rbt_bebestibles.IsChecked == true)
            {
                if (txt_insumo_alimento.Text.Trim() == "" && txt_insumo_bebi.Text.Trim() == "")
                {
                    txtcampo1    = false;
                    lbl1.Content = "Debe Completar el campo";
                }

                if (txt_stock_alimento.Text.Trim() == "" && txt_stock_bebi.Text.Trim() == "")
                {
                    txtcampo2    = false;
                    lbl2.Content = "Debe Completar el campo";
                }

                if (txt_stock_coci_alimento.Text.Trim() == "" && txt_stock_coci_bebi.Text.Trim() == "")
                {
                    txtcampo3    = false;
                    lbl3.Content = "Debe Completar el campo";
                }

                if (cmb_proveedor.Text.Trim() == "" && txt_marca_bebi.Text.Trim() == "")
                {
                    txtcampo4    = false;
                    lbl4.Content = "Debe Completar el campo";
                }

                if (txt_precio_bebi.Text.Trim() == "" && txt_habili_ingre.Text.Trim() == "")
                {
                    txtcampo5    = false;
                    lbl5.Content = "Debe Completar el campo";
                }

                if (txt_habili_bebi.Text.Trim() == "")
                {
                    txtcampo6    = false;
                    lbl6.Content = "Debe Completar el campo";
                }

                if (txt_conpre_bebi.Text.Trim() == "")
                {
                    txtcampo7    = false;
                    lbl7.Content = "Debe Completar el campo";
                }

                if (txtcampo1 && txtcampo2 && txtcampo3 && txtcampo4 && txtcampo5 && txtcampo6 && txtcampo7)

                {
                    BebestibleBLL ib = new BebestibleBLL();
                    ib.nombre_beb = txt_insumo_bebi.Text;
                    ib.marca      = txt_marca_bebi.Text;
                    ib.precio     = Int32.Parse(txt_precio_bebi.Text);
                    ib.stock      = Int32.Parse(txt_stock_bebi.Text);
                    ib.stock_bar  = Int32.Parse(txt_stock_coci_bebi.Text);
                    ib.imagen     = imageBt;
                    string habilitado = "";
                    if (si_habilitado.IsSelected)
                    {
                        habilitado = "Si";
                    }
                    else if (no_habilitado.IsSelected)
                    {
                        habilitado = "No";
                    }
                    else
                    {
                        MessageBox.Show("Debe seleccionar un estado para el Insumo");
                    }
                    ib.habilitado = habilitado;
                    string con_prep = "";
                    if (si_con.IsSelected)
                    {
                        con_prep = "Si";
                    }
                    else if (no_con.IsSelected)
                    {
                        con_prep = "No";
                    }
                    else
                    {
                        MessageBox.Show("Debe seleccionar un estadi para el Insumo");
                    }
                    ib.con_prep = con_prep;
                    bool estado = ib.AddBebestible(ib);
                    if (estado)
                    {
                        MessageBox.Show("Insumo creado correctamente");
                        txt_insumo_bebi.Clear();
                        txt_stock_bebi.Clear();
                        txt_stock_coci_bebi.Clear();
                        txt_marca_bebi.Clear();
                        txt_precio_bebi.Clear();
                        txt_habili_bebi.SelectedIndex = -1;
                        txt_conpre_bebi.SelectedIndex = -1;
                    }
                    else
                    {
                        MessageBox.Show("Insumo no fue creado");
                    }
                }
            }
        }