public Compra(int id, int acidez, float pres, int cant) { d = new Disolvente(acidez, pres); clave = Conexion.getUltimaCompra() + 1; idCliente = id; cantidad = cant; totalC = d.calcularPrecio(cantidad); }
private void btCalcular_Click(object sender, RoutedEventArgs e) { float present = Conexion.getPresentacion(cbAcidez.SelectedIndex); MessageBox.Show("" + present); Disolvente d = new Disolvente(cbAcidez.SelectedIndex + 1, present); int cantidad = Int16.Parse(txtCantidad.Text); int total = d.calcularPrecio(cantidad); if (total > 0) { txtTotal.Text = total + ".0 $"; } else { MessageBox.Show("error "); } }