コード例 #1
0
        private void Txt_bebestible_PreviewTextInput(object sender, TextCompositionEventArgs e)
        {
            int tamanio = txt_Ingredientes.Text.Length;
            int ascii   = Convert.ToInt32(Convert.ToChar(e.Text));

            if (ascii >= 65 && ascii <= 90 || ascii >= 97 && ascii <= 122)
            {
                if (tamanio < 30)
                {
                    e.Handled = false;
                    bebestibleBLL         ib         = new bebestibleBLL();
                    string                nombre_ins = txt_bebestible.Text;
                    System.Data.DataTable dt         = ib.Get_BebestibleByName(nombre_ins);
                    dgListado.ItemsSource = dt.DefaultView;
                }
                else
                {
                    e.Handled = true;
                }
            }
            else
            {
                e.Handled = true;
            }
        }
コード例 #2
0
        private void Rbbebestible_Checked(object sender, RoutedEventArgs e)
        {
            bebestibleBLL bebBLL        = new bebestibleBLL();
            DataTable     bebestiblesDT = bebBLL.GetBebHabilitado();

            dtgInsumos.ItemsSource = bebestiblesDT.DefaultView;

            txtID.Text           = "";
            txtStockActual.Text  = "";
            txtStockAgregar.Text = "";
        }
コード例 #3
0
 public void CargaDtgInsumos()
 {
     if (rbIngrediente.IsChecked == true)
     {
         ingredienteBLL ingBLL         = new ingredienteBLL();
         DataTable      ingredientesDT = ingBLL.GetIngHab();
         dtgInsumos.ItemsSource = ingredientesDT.DefaultView;
     }
     else if (rbbebestible.IsChecked == true)
     {
         bebestibleBLL bebBLL        = new bebestibleBLL();
         DataTable     bebestiblesDT = bebBLL.GetBebHabilitado();
         dtgInsumos.ItemsSource = bebestiblesDT.DefaultView;
     }
 }
コード例 #4
0
        private void btnBuscar_Click(object sender, RoutedEventArgs e)
        {
            usuarioBLL ub = new usuarioBLL();

            if (rbtIngredientes.IsChecked == true)
            {
                ingredienteBLL        ib = new ingredienteBLL();
                System.Data.DataTable dt = ib.GetAllIngredientes();
                dgListado.ItemsSource = dt.DefaultView;
            }
            else if (rbtBebestibles.IsChecked == true)
            {
                bebestibleBLL         ib = new bebestibleBLL();
                System.Data.DataTable dt = ib.Get_allbebest();
                dgListado.ItemsSource = dt.DefaultView;
            }
        }
コード例 #5
0
        private void BtnListar_critico_Click(object sender, RoutedEventArgs e)
        {
            DataTable      dtcriticos = new DataTable();
            bebestibleBLL  bb         = new bebestibleBLL();
            ingredienteBLL ib         = new ingredienteBLL();

            if (rbtBebestibles.IsChecked == true)
            {
                dtcriticos            = bb.Get_bebCritico();
                dgListado.ItemsSource = dtcriticos.DefaultView;
            }
            else if (rbtIngredientes.IsChecked == true)
            {
                dtcriticos            = ib.Get_ingCritico();
                dgListado.ItemsSource = dtcriticos.DefaultView;
            }
        }
コード例 #6
0
 private void TxtID_TextChanged(object sender, TextChangedEventArgs e)
 {
     if (txtID.Text.Length > 0)
     {
         if (rbIngrediente.IsChecked == true)
         {
             ingredienteBLL ingBLL = new ingredienteBLL();
             double         stock  = ingBLL.GetStock(int.Parse(txtID.Text));
             txtStockActual.Text = "" + stock;
         }
         else if (rbbebestible.IsChecked == true)
         {
             bebestibleBLL bebBLL = new bebestibleBLL();
             double        stock  = bebBLL.GetStock(int.Parse(txtID.Text));
             txtStockActual.Text = "" + stock;
         }
     }
 }
コード例 #7
0
 private void BtnAceptar_Click(object sender, RoutedEventArgs e)
 {
     if (rbIngrediente.IsChecked == true && txtID.Text.Length > 0)
     {
         if (rbCambiaStock.IsChecked == true)
         {
             if (txtStockAgregar.Text.Length > 0)
             {
                 ingredienteBLL ingBLL   = new ingredienteBLL();
                 int            id       = int.Parse(txtID.Text);
                 double         cantidad = double.Parse(txtStockAgregar.Text);
                 if (ingBLL.UpdateOnlyStockingrediente(id, cantidad))
                 {
                     PopupNotifier popup = new PopupNotifier();
                     popup.TitleText         = "Aviso";
                     popup.Image             = Properties.Resources.add;
                     popup.ContentText       = "Stock Actualizado Correctamente";
                     popup.AnimationDuration = 500;
                     popup.Delay             = 1500;
                     popup.Popup();
                     txtStockAgregar.Text = "";
                     CargaDtgInsumos();
                     txtStockAgregar.Text = "";
                     CargaDtgInsumos();
                 }
                 else
                 {
                     PopupNotifier popup = new PopupNotifier();
                     popup.TitleText         = "Aviso";
                     popup.Image             = Properties.Resources.delete;
                     popup.ContentText       = "No se pudo Actualizar correctamente el Stock";
                     popup.AnimationDuration = 500;
                     popup.Delay             = 2500;
                     popup.Popup();
                 }
             }
             else
             {
                 lbstock.Content = ("Ingrese un Valor de Stock");
             }
         }
         else if (rbAgregaStock.IsChecked == true)
         {
             if (txtStockAgregar.Text.Length > 0)
             {
                 ingredienteBLL ingBLL   = new ingredienteBLL();
                 int            id       = int.Parse(txtID.Text);
                 double         cantidad = double.Parse(txtStockAgregar.Text);
                 if (ingBLL.UpdateStockAddIngrediente(id, cantidad))
                 {
                     PopupNotifier popup = new PopupNotifier();
                     popup.TitleText         = "Aviso";
                     popup.Image             = Properties.Resources.add;
                     popup.ContentText       = "Stock Actualizado Correctamente";
                     popup.AnimationDuration = 500;
                     popup.Delay             = 1500;
                     popup.Popup();
                     txtStockAgregar.Text = "";
                     CargaDtgInsumos();
                 }
                 else
                 {
                     PopupNotifier popup = new PopupNotifier();
                     popup.TitleText         = "Aviso";
                     popup.Image             = Properties.Resources.delete;
                     popup.ContentText       = "No se pudo Actualizar correctamente el Stock";
                     popup.AnimationDuration = 500;
                     popup.Delay             = 2500;
                     popup.Popup();
                 }
             }
             else
             {
                 lbstock.Content = ("Ingrese un Valor de Stock");
             }
         }
         else
         {
             lbaccion.Content = "Seleccione una de las opciones de cambio de stock";
         }
     }
     else if (rbbebestible.IsChecked == true && txtID.Text.Length > 0)
     {
         if (rbCambiaStock.IsChecked == true)
         {
             if (txtStockAgregar.Text.Length > 0)
             {
                 bebestibleBLL bebBLL   = new bebestibleBLL();
                 int           id       = int.Parse(txtID.Text);
                 int           cantidad = int.Parse(txtStockAgregar.Text);
                 if (bebBLL.UpdateOnlyStockBeb(id, cantidad))
                 {
                     PopupNotifier popup = new PopupNotifier();
                     popup.TitleText         = "Aviso";
                     popup.Image             = Properties.Resources.add;
                     popup.ContentText       = "Stock Actualizado Correctamente";
                     popup.AnimationDuration = 500;
                     popup.Delay             = 1500;
                     popup.Popup();
                     txtStockAgregar.Text = "";
                     CargaDtgInsumos();
                 }
                 else
                 {
                     PopupNotifier popup = new PopupNotifier();
                     popup.TitleText         = "Aviso";
                     popup.Image             = Properties.Resources.delete;
                     popup.ContentText       = "No se pudo Actualizar correctamente el Stock";
                     popup.AnimationDuration = 500;
                     popup.Delay             = 2500;
                     popup.Popup();
                 }
             }
             else
             {
                 lbstock.Content = ("Ingrese un Valor de Stock");
             }
         }
         else if (rbAgregaStock.IsChecked == true)
         {
             if (txtStockAgregar.Text.Length > 0)
             {
                 bebestibleBLL bebBLL   = new bebestibleBLL();
                 int           id       = int.Parse(txtID.Text);
                 int           cantidad = int.Parse(txtStockAgregar.Text);
                 if (bebBLL.UpdateStockAddBeb(id, cantidad))
                 {
                     MessageBox.Show("Stock Actualizado correctamente");
                     txtStockAgregar.Text = "";
                     CargaDtgInsumos();
                 }
                 else
                 {
                     PopupNotifier popup = new PopupNotifier();
                     popup.TitleText         = "Aviso";
                     popup.Image             = Properties.Resources.delete;
                     popup.ContentText       = "No se pudo Actualizar correctamente el Stock";
                     popup.AnimationDuration = 500;
                     popup.Delay             = 2500;
                     popup.Popup();
                 }
             }
             else
             {
                 lbstock.Content = ("Ingrese un Valor de Stock");
             }
         }
         else
         {
             lbaccion.Content = "Seleccione una de las opciones de cambio de stock";
         }
     }
     else
     {
         lbtipo.Content = "Seleccione una opcion de ingrediente o bebestible y seleccione un item de la lista";
     }
 }
コード例 #8
0
        private void Btn_add_row_Click(object sender, RoutedEventArgs e)
        {
            PedidoBLL      pb = new PedidoBLL();
            ingredienteBLL ib = new ingredienteBLL();
            bebestibleBLL  bb = new bebestibleBLL();

            DataTable dt       = pb.Get_ultimopedido();
            DataRow   row      = dt.Rows[0];
            int       id       = Int32.Parse(row[0].ToString());
            int       idactual = id + 1;


            if (rbtBebestibles.IsChecked == true)
            {
                foreach (DataRow line in dtlb.Rows)
                {
                    DataTable dtt           = pb.Get_ultimopedido();
                    DataRow   roww          = dtt.Rows[0];
                    int       idd           = Int32.Parse(roww[0].ToString());
                    DateTime  fecha         = System.DateTime.Now;
                    int       monto         = 0;
                    int       cant          = 0;
                    string    nombre        = line["nombre"].ToString();
                    int       id_insumo     = bb.Get_bebyid(nombre);
                    string    prov          = line["proveedor"].ToString();
                    int       id_prov       = pb.get_idprovbyname(prov);
                    string    stock         = line["stock"].ToString();
                    string    stock_cocina  = line["stock bar"].ToString();
                    string    stock_critico = line["stock critico"].ToString();
                    string    estado        = "EN ESPERA DE APROBACIÓN";
                    string    tipo          = "Pedido de bebestibles";


                    if (idd == idactual)
                    {
                        pb.InsertarDetallePedido(idactual, monto, estado, id_insumo, id_prov, tipo, cant);
                    }
                    else
                    {
                        pb.Insert_Pedido(fecha, monto);
                        pb.InsertarDetallePedido(idactual, monto, estado, id_insumo, id_prov, tipo, cant);
                    }
                }
                dt.Clear();
            }

            else if (rbtIngredientes.IsChecked == true)
            {
                foreach (DataRow line in dtlist.Rows)
                {
                    DataTable dtt  = pb.Get_ultimopedido();
                    DataRow   roww = dtt.Rows[0];
                    int       idd  = Int32.Parse(roww[0].ToString());

                    DateTime fecha = System.DateTime.Now;

                    int monto = 0;

                    int    cant         = 0;
                    string nombre       = line["nombre"].ToString();
                    int    id_insumo    = ib.Get_idbynom(nombre);
                    string prov         = line["proveedor"].ToString();
                    int    id_prov      = pb.get_idprovbyname(prov);
                    string stock        = line["stock"].ToString();
                    string stock_cocina = line["stock cocina"].ToString();
                    string estado       = "EN ESPERA DE APROBACIÓN";
                    string tipo         = "Pedido de ingredientes";

                    if (idd == idactual)
                    {
                        pb.InsertarDetallePedido(idactual, monto, estado, id_insumo, id_prov, tipo, cant);
                    }
                    else
                    {
                        pb.Insert_Pedido(fecha, monto);
                        pb.InsertarDetallePedido(idactual, monto, estado, id_insumo, id_prov, tipo, cant);
                    }
                }
                dtg_2.ItemsSource = null;
                PopupNotifier popup = new PopupNotifier();
                popup.TitleText         = "Aviso";
                popup.Image             = Properties.Resources.add;
                popup.ContentText       = "Se ha enviado la solicitud de insumos al administrador \n de forma exitosa";
                popup.AnimationDuration = 800;
                popup.Delay             = 1000;
                popup.Popup();
            }
        }
コード例 #9
0
        private void btnAceptar_Click(object sender, RoutedEventArgs e)
        {
            bool txtingrediente1 = true;
            bool txtbebestible1  = true;
            bool txtingrediente2 = true;
            bool txtbebestible2  = true;

            if (txtInsumos.Text == "" && txtBebestible.Text == "")
            {
                txtingrediente1         = false;
                lblCompletar.Content    = "Debe completar el campo";
                lblCompletar.Visibility = Visibility.Visible;
            }
            if (txtBebestible.Text == "" && txtInsumos.Text == "")
            {
                txtbebestible2          = false;
                lblCompletar.Content    = "Debe completar el campo";
                lblCompletar.Visibility = Visibility.Visible;
            }
            if (txtCantidad.Text == "" && txtcantBebestible.Text == "")
            {
                txtingrediente2          = false;
                lblCompletar2.Content    = "Debe completar el campo";
                lblCompletar2.Visibility = Visibility.Visible;
            }
            if (txtcantBebestible.Text == "" && txtCantidad.Text == "")
            {
                txtbebestible2           = false;
                lblCompletar2.Content    = "Debe completar el campo";
                lblCompletar2.Visibility = Visibility.Visible;
            }
            if (rbtIngredientes.IsChecked == false && rbtBebestibles.IsChecked == false)
            {
                lblCompletar3.Content    = "Debe seleccionar un insumo";
                lblCompletar3.Visibility = Visibility.Visible;
            }


            if (txtingrediente1 && txtingrediente2 && txtbebestible1 && txtbebestible2)
            {
                if (rbtIngredientes.IsChecked == true)
                {
                    ingredienteBLL ib = new ingredienteBLL();
                    ib.nombre_ins = txtInsumos.Text;
                    ib.stock      = Double.Parse(txtCantidad.Text);
                    bool estado = ib.btnAceptar(ib);
                    if (estado)
                    {
                        MessageBox.Show("Ingrediente solicitado correctamente");
                    }
                    else
                    {
                        MessageBox.Show("Ingrediente no ingresado para la solicitud");
                    }
                    txtBebestible.Clear();
                    txtcantBebestible.Clear();
                }

                else if (rbtBebestibles.IsChecked == true)
                {
                    bebestibleBLL ib = new bebestibleBLL();
                    ib.nombre_ins = txtBebestible.Text;
                    ib.stock      = Double.Parse(txtcantBebestible.Text);
                    bool estado = ib.btnAceptar(ib);
                    if (estado)
                    {
                        MessageBox.Show("Bebestible solicitado correctamente");
                    }
                    else
                    {
                        MessageBox.Show("Bebestible no ingresado para la solicitud");
                    }
                }
            }
        }