private string reporte(Producto último, bool inverso)
 {
     if (último.siguiente == null)
     {
         return(último.ToString());
     }
     else
     {
         if (inverso)
         {
             return(reporte(último.siguiente, inverso) + último.ToString());
         }
         else
         {
             return(último.ToString() + reporte(último.siguiente, inverso));
         }
     }
 }
Beispiel #2
0
        private void btnInsertar_Click(object sender, EventArgs e)
        {
            bool     agregado = inventario.buscarInicio(Convert.ToInt16(txtCodigo.Text));
            Producto producto = new Producto(Convert.ToInt16(txtCodigo.Text), txtNombre.Text, Convert.ToInt16(txtCantidad.Text), Convert.ToInt16(txtPrecio.Text));

            if (txtPos.Text == "")
            {
                inventario.agregar(producto);
                if (agregado == false)
                {
                    MessageBox.Show("Producto guardado");
                    txtReporte.Text = producto.ToString();
                }
                else
                {
                    MessageBox.Show("Ese código ya existe");
                    txtReporte.Text = "";
                }
            }
            else
            {
                inventario.insertar(producto, Convert.ToInt16(txtPos.Text));

                if (agregado == false && inventario.insertar(producto, Convert.ToInt16(txtPos.Text)) == true)
                {
                    MessageBox.Show("Producto guardado");
                    txtReporte.Text = producto.ToString();
                }
                else if (agregado == true && inventario.insertar(producto, Convert.ToInt16(txtPos.Text)) == false)
                {
                    MessageBox.Show("Error, ese codigo ya existe");
                }
                else if (agregado == false && inventario.insertar(producto, Convert.ToInt16(txtPos.Text)) == false)
                {
                    MessageBox.Show("Error, posición fuera de rango");
                }
                else if (agregado == true && inventario.insertar(producto, Convert.ToInt16(txtPos.Text)) == true)
                {
                    MessageBox.Show("Error codigo existente y posición fuera de rango");
                    txtReporte.Text = "";
                }
            }
        }
        public String reporteInverso()
        {
            String datos = "";

            temp = ultimo;
            while (temp != null)
            {
                datos += temp.ToString() + Environment.NewLine;
                temp   = temp.anterior;
            }
            return(datos);
        }
        /// <summary>
        /// Muestra una lista con todos los productos agregados
        /// </summary>
        /// <returns></returns>
        public String reporte()
        {
            String datos = "";

            temp = inicio;
            while (temp != null)
            {
                datos += temp.ToString() + Environment.NewLine;
                temp   = temp.siguiente;
            }
            return(datos);
        }
Beispiel #5
0
        public override string ToString()
        {
            Producto aux     = primero;
            string   reporte = "";

            while (aux != null)
            {
                reporte += aux.ToString();
                aux      = aux.siguiente;
            }
            return(reporte);
        }
        public String reporte()
        {
            String   s      = "";
            Producto actual = inicial;

            while (actual != null)
            {
                s     += actual.ToString() + Environment.NewLine;
                actual = actual.siguiente;
            }
            return(s);
        }
Beispiel #7
0
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            Producto productoBuscado = nuevoAlmacen.buscarProducto(Convert.ToInt16(txtCodigo.Text));

            if (productoBuscado == null)
            {
            }
            else
            {
                txtReporte.Text = productoBuscado.ToString();
            }
        }
        public String reporteInverso()
        {
            String   s      = "";
            Producto actual = final;

            do
            {
                s     += actual.ToString() + Environment.NewLine;
                actual = actual.anterior;
            } while (actual != null);
            return(s);
        }
Beispiel #9
0
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            Producto buscado = inventario.buscar(Convert.ToInt16(txtCodigoConsulta.Text));

            if (buscado != null)
            {
                txtReporte.Text = buscado.ToString();
            }
            else
            {
                MessageBox.Show("Error, producto no encontrado");
            }
        }
Beispiel #10
0
 private void btnBuscar_Click(object sender, EventArgs e)
 {
     if (txtNombre.Text != "")
     {
         Producto buscado = miInventario.buscar(txtNombre.Text);
         if (buscado == null)
         {
             txtNombre.Text = "";
         }
         else
         {
             txtReporte.Text = buscado.ToString();
         }
     }
 }
Beispiel #11
0
        public string Reporte()
        {
            string salida = " ";

            if (inicio != null)
            {
                Producto actual = inicio;
                while (actual != null)
                {
                    salida += actual.ToString() + Environment.NewLine;
                    actual  = actual.siguiente;
                }
            }
            return(salida);
        }
Beispiel #12
0
 private void btnBuscar_Click(object sender, EventArgs e)
 {
     if (txtCodigo.Text != "")
     {
         int      codigo = Convert.ToInt32(txtCodigo.Text);
         Producto buscar = inventario.buscar(codigo);
         if (buscar != null)
         {
             lblEstado.Text = "Producto encontrado";
             MessageBox.Show(buscar.ToString());
         }
         else
         {
             lblEstado.Text = "Producto no encontrado";
         }
     }
 }
Beispiel #13
0
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            //agregado sirve para decirme si ya existe el codigo ingresado cuando es true el codigo ya existe
            //cuando es false el codigo no existe y lo guarda
            bool     agregado = inventario.buscarInicio(Convert.ToInt16(txtCodigo.Text));
            Producto producto = new Producto(Convert.ToInt16(txtCodigo.Text), txtNombre.Text, Convert.ToInt16(txtCantidad.Text), Convert.ToInt16(txtPrecio.Text));

            inventario.agregar(producto);
            if (agregado == false)
            {
                MessageBox.Show("Producto guardado");
                txtReporte.Text = producto.ToString();
            }
            else
            {
                MessageBox.Show("Ese código ya existe");
                txtReporte.Text = "";
            }
        }
Beispiel #14
0
        //---------------------------------------------------------------------------------------------------------------------------------------------------------
        //METODO REPORTE INVERSO
        public string reporteInverso()
        {
            string reporte = string.Empty;

            if (productUltimo != null)
            {
                Producto temp = productUltimo;

                while (temp != null)
                {
                    reporte += temp.ToString();
                    temp     = temp.anterior;
                }
            }
            else
            {
                reporte = "No se encontro ningun reporte";
            }

            return(reporte);
        }
Beispiel #15
0
        //---------------------------------------------------------------------------------------------------------------------------------------------------------
        //METODO REPORTE
        public string Reporte()
        {
            string reporte = string.Empty;

            if (productInicio != null)
            {
                Producto temp = productInicio;

                while (temp != null)
                {
                    reporte += temp.ToString();

                    temp = temp.siguiente;
                }
            }
            else
            {
                reporte = "No se encontro ningun reporte";
            }

            return(reporte);
        }