Beispiel #1
0
        public void llenarLista(List <Asignacion> lproducto, string referencia, string talla, string cantidad)
        {
            lproducto = aux;
            if (val.validarVacio(cantidad) == true)
            {
                if (val.validarNumeros(cantidad) == true)
                {
                    Asignacion asignacion = new Asignacion();
                    asignacion.Referencia = referencia;
                    asignacion.Talla      = Convert.ToDouble(talla);
                    asignacion.Cantidad   = Convert.ToInt32(cantidad);

                    if (asignacion.Cantidad > 0)
                    {
                        if (lproducto == null)
                        {
                            lproducto = new List <Asignacion>();
                            lproducto.Add(asignacion);
                            aux = lproducto;

                            mensaje = msj1 + asignacion.Cantidad + ", " + asignacion.Referencia + ", " + asignacion.Talla + "";
                            return;
                        }
                        else
                        {
                            if (lproducto.Contains(asignacion))
                            {
                                mensaje = msj2;
                                return;
                            }
                            else
                            {
                                lproducto.Add(asignacion);

                                mensaje = msj3 + asignacion.Cantidad + asignacion.Referencia + asignacion.Talla + "";
                                return;
                            }
                        }
                    }
                    else
                    {
                        mensaje = msj4;
                        return;
                    }
                }
                else
                {
                    mensaje = msj5;
                    return;
                }
            }
            else
            {
                mensaje = msj6;
                return;
            }
        }
        public void regresarP(List <Asignacion> l, string sede, string observacion)
        {
            Pedido   devolver = new Pedido();
            DateTime fechaHoy = DateTime.Now;

            if (val.validarVacio(observacion) == false)
            {
                mensaje = msj7;
                return;
            }
            else
            {
                devolver.Sede   = sede;
                devolver.Fecha  = fechaHoy.ToString("d");
                devolver.Estado = false;
                dAO.crearPedido(devolver, observacion);
                DataTable id = new DataTable();
                id = dAO.verUltimoId();
                if (id.Rows.Count > 0)
                {
                    foreach (DataRow rowe in id.Rows)
                    {
                        devolver.Idpedido = Convert.ToInt32(rowe["f_verultimoid"]);
                    }
                    foreach (Asignacion a in l)
                    {
                        Asignacion temp = new Asignacion();
                        temp.Referencia = Convert.ToString(a.Referencia);
                        temp.Talla      = Convert.ToDouble(a.Talla);
                        temp.Cantidad   = Convert.ToInt32(a.Cantidad);
                        dAO.crearPedidos(temp, devolver.Idpedido);
                    }
                    mensaje = msj8 + a.Rows.Count + msj9;
                    return;
                }
            }
        }
Beispiel #3
0
        public string listaEnviar(List <Producto> lproducto, string referencia, string talla, string cantidad)
        {
            DAOUsuario dao = new DAOUsuario();

            int cantBodega = 0;

            if (val.validarVacio(referencia) == true && val.validarVacio(talla) && val.validarVacio(cantidad) == true)
            {
                if (val.validarNumeros(cantidad) == true)
                {
                    Producto p = new Producto();
                    p.Referencia = referencia;
                    p.Talla      = Convert.ToDouble(talla);
                    p.Cantidad   = Convert.ToInt64(cantidad);
                    DataTable r = dao.validarAsignacion(p.Referencia, p.Talla);
                    if (r.Rows.Count == 1)
                    {
                        foreach (DataRow row in r.Rows)
                        {
                            cantBodega   = Convert.ToInt32(row["cantidad"]);
                            p.Entregado  = Convert.ToInt32(row["entregado"]);
                            p.Idproducto = Convert.ToInt32(row["idproducto"]);
                            cantBodega   = cantBodega - p.Entregado;
                        }
                    }
                    else
                    {
                    }
                    if (p.Cantidad < cantBodega)
                    {
                        if ((cantBodega - p.Cantidad) >= 5)
                        {
                            if (lproducto == null)
                            {
                                lproducto = new List <Producto>();
                                lproducto.Add(p);
                                aux1 = lproducto;
                            }
                            else
                            {
                                lproducto.Add(p);
                                aux1 = lproducto;
                            }
                            return(msj9 + p.Referencia + msj10 + p.Talla + msj11 + p.Cantidad + ".");
                        }
                        else
                        {
                            return(msj12);
                        }
                    }
                    else
                    {
                        return(msj13);
                    }
                }
                else
                {
                    return(msj14);
                }
            }
            else
            {
                return(msj15);
            }
        }
Beispiel #4
0
        public List <Producto> AnalizarGridView(string cantidad, string talla, string refPro, string sede, List <Producto> listaVenta)
        {
            DAOUsuario dAO  = new DAOUsuario();
            int        cont = 0;

            Validaciones val = new Validaciones();

            if (val.validarVacio(talla) == true && val.validarVacio(refPro) == true)
            {
                if (val.validarVacio(cantidad) == true)
                {
                    if (val.validarNumeros(cantidad.ToString()) == true)
                    {
                        Producto producto = new Producto();
                        if (cantidad == "")
                        {
                            producto.Cantidad = 0;
                        }
                        else
                        {
                            producto.Cantidad = Convert.ToInt64(cantidad);
                        }
                        producto.Referencia = Convert.ToString(refPro);
                        producto.Talla      = Convert.ToDouble(talla);

                        if (producto.Cantidad > 0)
                        {
                            bool vof;
                            cont++;
                            vof = dAO.validarCantidad(producto, sede);
                            if (vof == false)
                            {
                                this.set_mensaje(msj1 + producto.Referencia + msj2 + producto.Talla + msj3);
                            }
                            else
                            {
                                producto.Precio     = dAO.traePrecio(producto.Referencia, producto.Talla);
                                producto.ValorTotal = producto.Precio * producto.Cantidad;
                                producto.Idproducto = cont;
                                if (listaVenta == null)
                                {
                                    listaVenta = new List <Producto>();
                                    listaVenta.Add(producto);
                                }
                                else
                                {
                                    if (listaVenta.Contains(producto))
                                    {
                                        this.set_mensaje(msj4);
                                    }
                                    else
                                    {
                                        listaVenta.Add(producto);

                                        this.set_mensaje(msj5);
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (listaVenta == null)
                            {
                                listaVenta = new List <Producto>();

                                this.set_mensaje(msj6);
                            }
                            else
                            {
                                return(listaVenta);
                            }
                        }
                    }
                    else
                    {
                        this.set_mensaje(msj7);
                    }
                }
                else
                {
                    this.set_mensaje(msj8);

                    if (listaVenta == null)
                    {
                        listaVenta = new List <Producto>();
                        this.set_mensaje(msj8);
                    }
                    else
                    {
                        return(listaVenta);
                    }
                }
            }
            else
            {
                if (listaVenta == null)
                {
                    listaVenta = new List <Producto>();

                    this.set_mensaje(msj9);
                }
                else
                {
                    return(listaVenta);
                }
            }

            if (cont == 0)
            {
                this.set_mensaje(msj10);
            }

            this.set_mensaje(msj11);
            return(listaVenta);
        }