private void RecuperarBD() { if (this._Idingreso > 0) { ClinicaPro.Entities.Ingreso Entidad = new ClinicaPro.DB.GastosIngresos.IngresoDB().GetIngreso(this._Idingreso); if (Entidad != null) { numCantidad.Value = Entidad.CantidadIngreso; txtDescripcion.Text = Entidad.DescripcionBreve; dtFecha.Value = Entidad.FechaDeIngreso; try { cbCategoria.SelectedValue = Entidad.CategoriaIngreso.IdCategoriaIngreso; cbFuenteIngreso.SelectedValue = Entidad.FuenteIngreso.IdFuenteIngreso; } catch (Exception ex) { MessageBox.Show(ex.InnerException.ToString()); throw; } } } }
private void btnGuardar_Click(object sender, EventArgs e) { if (!Validar()) { if (_Idingreso < 1) { int result = new ClinicaPro.DB.GastosIngresos.IngresoDB().Agregar_Modificar(Ingreso_Controles_A_Clase(), ClinicaPro.General.accion.Agregar); if (result > 0) { MensajeDeActulizacion(); this._Idingreso = result; } } else { int result = new ClinicaPro.DB.GastosIngresos.IngresoDB().Agregar_Modificar(Ingreso_Controles_A_Clase(), ClinicaPro.General.accion.Modificar); if (result > 0) { MensajeDeActulizacion(); } } } }