コード例 #1
0
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            Producto auxProducto = (Producto)dgvProductos.CurrentRow.DataBoundItem;

            Comercio.AgregarStock(auxProducto.Descripcion, Convert.ToInt32(txbCantidad.Text));
            dgvProductos.DataSource = null;
            dgvProductos.DataSource = Comercio.ListaProductos;
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: Gala90/CAI_VentaRepuesto
        private static void AgregarStock(Comercio c)
        {
            Console.WriteLine("Seleccione el codigo de repuesto a agregarle stock: ");
            int cod = int.Parse(Console.ReadLine());

            Console.WriteLine("Seleccione la cantidad de stock a agregar: ");
            int cant = int.Parse(Console.ReadLine());

            List <int> lst = new List <int>();

            foreach (Repuesto r in c.Repuestos)
            {
                lst.Add(r.Codigo);
            }

            if (!lst.Contains(cod))
            {
                Console.WriteLine("El repuesto no pertenece al Comercio.");
            }
            else
            {
                c.AgregarStock(cod, cant);
            }
        }
コード例 #3
0
 /// <summary>
 /// Botón que aumenta un valor de stock aleatorio a los productos
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btn_GenerarStock_Click(object sender, EventArgs e)
 {
     Comercio.AgregarStock();
     ActualizarDgvProductos();
 }