private void NumericUpDownCantidad_Llenar(object sender, EventArgs e) { if (this.NumericUpDownCantidad.Enabled) { this.NumericUpDownCantidad.Maximum = (decimal)(ConsultasBaseDeDatos.ObtenerValorFloatDeBDLuiguiBaretta("Select Cantidad From Producto Where Descripcion Like '" + this.ComboBoxDescripcionDelProducto.Text + "' And Talla Like '" + this.ComboBoxTalla.Text + "'") - Valor_paraNumericdecimal()); if (this.NumericUpDownCantidad.Maximum > 0) { this.NumericUpDownCantidad.Minimum = 1; this.LabelCantidadMax.Text = "Max " + this.NumericUpDownCantidad.Maximum; this.LabelError.Visible = false; this.ButtonAnadirVenta.Enabled = true; } else { this.LabelError.Text = "La cantidad del producto seleccionado es 0"; this.LabelCantidadMax.Text = "Max 0"; this.LabelError.Visible = true; this.ButtonAnadirVenta.Enabled = false; } } else { this.NumericUpDownCantidad.Maximum = 0; } }
private void ButtonAnadirVenta_Click(object sender, EventArgs e) { float Precio = ConsultasBaseDeDatos.ObtenerValorFloatDeBDLuiguiBaretta("Select (PrecioVenta * GrupoPaquete) From Producto Where Descripcion Like '" + ComboBoxDescripcionDelProducto.Text + "' And Talla Like '" + ComboBoxTalla.Text + "'"); Precio *= (float)NumericUpDownCantidad.Value; this.DataGridViewVentas.Rows.Add(ComboBoxDescripcionDelProducto.Text, ComboBoxTalla.Text, NumericUpDownCantidad.Value, Precio); this.ButtonDeshacer.Enabled = true; this.TextBoxPagar.Enabled = true; EstablecerValoresTotales(); }