/// <summary>
        /// Genera un formulario para vender el producto Pelota.
        /// Si se vende con exito y el stock del producto llega a cero, lo elimina de la lista.
        /// </summary>
        private void VenderPelotas()
        {
            int     i    = this.dgvGrilla.SelectedRows[0].Index;
            DataRow fila = this.dtPelotas.Rows[i];

            EDeporte deporte = (EDeporte)Enum.Parse(typeof(EDeporte), fila["deporte"].ToString(), true);
            string   marca   = fila["marca"].ToString();
            float    precio  = float.Parse(fila["precio"].ToString());
            int      stock   = int.Parse(fila["stock"].ToString());

            Pelota             pelota = new Pelota(marca, precio, stock, deporte);
            FormVenta <Pelota> frm    = new FormVenta <Pelota>(pelota);

            frm.StartPosition = FormStartPosition.CenterScreen;

            if (frm.ShowDialog() == DialogResult.OK)
            {
                if (frm.Producto.Stock == 0)
                {
                    fila.Delete();
                }
                else if (frm.Producto.Stock > 0)
                {
                    fila["stock"] = frm.Producto.Stock;
                }
                this.registros.pelotasVendidas.Add(frm.Venta);
            }
        }
        /// <summary>
        /// Elimina un producto Pelota del inventario.
        /// </summary>
        private void EliminarPelotas()
        {
            int     i    = this.dgvGrilla.SelectedRows[0].Index;
            DataRow fila = this.dtPelotas.Rows[i];

            EDeporte deporte = (EDeporte)Enum.Parse(typeof(EDeporte), fila["deporte"].ToString(), true);
            string   marca   = fila["marca"].ToString();
            float    precio  = float.Parse(fila["precio"].ToString());
            int      stock   = int.Parse(fila["stock"].ToString());

            Pelota pelota = new Pelota(marca, precio, stock, deporte);

            if (MessageBox.Show(pelota.ToString(), "Eliminar este producto?", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
            {
                fila.Delete();
            }
        }
        /// <summary>
        /// Modifica un producto Pelota del inventario.
        /// </summary>
        private void ModificarPelotas()
        {
            int     i    = this.dgvGrilla.SelectedRows[0].Index;
            DataRow fila = this.dtPelotas.Rows[i];

            EDeporte deporte = (EDeporte)Enum.Parse(typeof(EDeporte), fila["deporte"].ToString(), true);
            string   marca   = fila["marca"].ToString();
            float    precio  = float.Parse(fila["precio"].ToString());
            int      stock   = int.Parse(fila["stock"].ToString());

            Pelota     pelota = new Pelota(marca, precio, stock, deporte);
            FormPelota frm    = new FormPelota(pelota);

            frm.StartPosition = FormStartPosition.CenterScreen;

            if (frm.ShowDialog() == DialogResult.OK)
            {
                fila["deporte"] = frm.Pelota.Deporte.ToString();
                fila["marca"]   = frm.Pelota.Marca;
                fila["precio"]  = frm.Pelota.Precio;
                fila["stock"]   = frm.Pelota.Stock;
            }
        }
Beispiel #4
0
 public Pelota(string marca, float precio, int stock, EDeporte deporte)
     : base(marca, precio, stock)
 {
     this.deporte = deporte;
 }
Beispiel #5
0
 public Equipo(string nombre, DirectorTecnico dt, EDeporte deporte) : this()
 {
     this._nombre = nombre;
     this._dt     = dt;
     this.Deporte = deporte;
 }