Exemplo n.º 1
0
 private void btnSell_Click(object sender, EventArgs e)
 {
     Prod = Invent.Buscar(Convert.ToInt32(txSearchCode.Text));
     if (Prod.Vender(Convert.ToInt32(txHowMany.Text)))
     { }
     else
     {
         MessageBox.Show("No hay suficiente producto para vender.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemplo n.º 2
0
        public static int Agregar(Producto pProducto)
        {
            using (SqlConnection Conn = BDComun.ObtenerConexion())
            {
                SqlCommand Comando = new SqlCommand(string.Format("Insert Into Cafeteria (Nombre_Producto, Cantidad_del_Producto, Unidad_de_medida, Nombre_del_Proovedor, Empresa_del_Proovedor, Telefono) values ('" + pProducto.Nombre_Producto + "','" + pProducto.Cantidad_del_Producto + "','" + pProducto.Unidad_de_medida + "','" + pProducto.Nombre_del_Proovedor + "','" + pProducto.Empresa_del_Proovedor + "','"+pProducto.Telefono+"')"),Conn);

                retorno= Comando.ExecuteNonQuery();
            }
            return retorno;
        }
Exemplo n.º 3
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     //Recepción de los datos del producto.
     Nombre = txName.Text;
     Precio = Convert.ToInt32(txPrice.Text);
     Cantidad = Convert.ToInt32(txCant.Text);
     Codigo = Convert.ToInt32(txCode.Text);
        //Se crea el producto nuevo.
     Prod = new Producto(Codigo, Nombre, Cantidad, Precio);
     //Agrega el producto al inventario.
     Invent.Agregar(Prod);
 }
Exemplo n.º 4
0
        private void button2_Click(object sender, EventArgs e)
        {
            Producto Producto = new Producto();
            Producto.Nombre_Producto = txtNombre_Producto.Text;
            Producto.Cantidad_del_Producto = txtCantidad_del_Producto.Text;
            Producto.Unidad_de_medida = txtUnidad_de_medida.Text;
            Producto.Nombre_del_Proovedor = txtNombre_del_Proovedor.Text;
            Producto.Empresa_del_Proovedor = txtEmpresa_del_proovedor.Text;
            Producto.Telefono = txtTelefono.Text;

            int resultado = ProductoDAL.Agregar(Producto);
            if (resultado >0)
            {
                MessageBox.Show("Datos Guardados Correctamente", "Datos Guardados", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("No se Guardaron los Datos", "Error al Guardar", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Exemplo n.º 5
0
 private void btnBuy_Click(object sender, EventArgs e)
 {
     Prod = Invent.Buscar(Convert.ToInt32(txSearchCode.Text));
     Prod.Comprar(Convert.ToInt32(txHowMany.Text));
 }
Exemplo n.º 6
0
 //---------------------------------------------------------------------------------------------------------------------------------------------------------
 //METODO AGREGAR
 public void Agregar(Producto product)
 {
     _vecProduct[_contador] = product;   //se agrega un producto
     _contador++;                        //y se incrementa el contador
 }
Exemplo n.º 7
0
 /// <summary>
 /// Agrega un producto al inventario.
 /// </summary>
 /// <param name="Product">Un producto.</param>
 public void Agregar(Producto Product)
 {
     _Productos[ID] = Product;
     ID++;
 }
 public void eliminarUltimo()
 {
     final           = final.anterior;
     final.siguiente = null;
 }
 public void eliminarPrimero()
 {
     inicial          = inicial.siguiente;
     inicial.anterior = null;
 }
 public void agregar(string codigo, string nombre, int cantidad, double precio)
 {
     inv[actual] = new Producto(codigo, nombre, cantidad, precio);
     actual++;
 }
Exemplo n.º 11
0
 /// <summary>
 /// Añade un producto al inventario.
 /// </summary>
 /// <param name="Product">Producto a añadir.</param>
 public void Agregar(Producto Product)
 {
     _Productos.Add(Product.Codigo, Product);
 }