private void button1_Click(object sender, EventArgs e) { if (WithErrors()) { MessageBox.Show("Existen campos en blanco que se deben rellenar, verificar campos vacíos!", "Campos vacíos!!", MessageBoxButtons.OK); } else { EFF.Ingreso ingr = new EFF.Ingreso(); ingr.Nombre = textBoxNombre.Text; ingr.Descripcion = textBoxDescripcion.Text; ingr.Fecha = DateTime.Now; ingr.MontoColones = decimal.Parse(textBoxMontoColones.Text); ingr.MontoDolares = decimal.Parse(textBoxMontoDolares.Text); ingr.IdProyecto = int.Parse(comboBoxProyecto.SelectedValue.ToString()); ingr.IdTipoCambio = int.Parse(comboBoxTipocambio.SelectedValue.ToString()); if (textBoxId.Text == string.Empty) { ingre.AddIngreso(ingr); } else { ingr.Id = int.Parse(textBoxId.Text); ingre.UpdateIngreso(ingr); } this.Close(); new IngresosForm().Show(); } }