private void BtnRegistrar_Click(object sender, EventArgs e) { marcaservice = new MarcaService(ConfigConnection.ConnectionString); productoservice = new ProductoService(ConfigConnection.ConnectionString); if (TxtCodigo.Text.Equals("") || TxtInstrumento.Text.Equals("") || TxtPrecio.Text.Equals("") || CmbMarca.Text.Equals("")) { MessageBox.Show("Complete los campos. "); } else { try { decimal precio = decimal.Parse(TxtPrecio.Text.Trim()); Producto producto = new Producto(); producto.Codigo = TxtCodigo.Text.Trim().ToUpper(); producto.Marca = marcaservice.FiltrarMarca(CmbMarca.Text); producto.Nombre = TxtInstrumento.Text.Trim().ToUpper(); producto.Precio = precio; MessageBox.Show(productoservice.GuardarProducto(producto)); Inventario.Actualizar(); UnlockInventario.unlockInventario(); this.Close(); } catch (FormatException ex) { MessageBox.Show("Error " + ex.Message.ToString()); } } }