private void RecuperarBD() { if (this._IdGasto > 0) { ClinicaPro.Entities.Gasto Entidad = new ClinicaPro.DB.GastosIngresos.GastosDB().GetGasto(this._IdGasto); if (Entidad != null) { numCantidad.Value = Entidad.CantidadGasto; // cbCategoria.SelectedValue = Entidad.CategoriasGasto.IdCategoriaGasto; // cbFuenteIngreso.SelectedValue = Entidad.FuenteIngreso.IdFuenteIngreso; txtDescripcion.Text = Entidad.DescripcionBreve; dtFecha.Value = Entidad.FechaDeGasto; try { cbCategoria.SelectedValue = Entidad.CategoriasGasto.IdCategoriaGasto; cbFuenteIngreso.SelectedValue = Entidad.FuenteIngreso.IdFuenteIngreso; } catch (Exception ex) { MessageBox.Show(ex.InnerException.ToString()); throw; } } } }
private void btnGuardar_Click_1(object sender, EventArgs e) { if (!Validar()) { if (_IdGasto < 1) { int result = new ClinicaPro.DB.GastosIngresos.GastosDB().Agregar_Modificar(Gasto_Controles_A_Clase(), ClinicaPro.General.accion.Agregar); if (result > 0) { MensajeDeActulizacion(); this._IdGasto = result; } } else { int result = new ClinicaPro.DB.GastosIngresos.GastosDB().Agregar_Modificar(Gasto_Controles_A_Clase(), ClinicaPro.General.accion.Modificar); if (result > 0) { MensajeDeActulizacion(); } } } }