private CategoriaIngreso CategoriaIngreso_ControlAClase() { CategoriaIngreso ingreso = new CategoriaIngreso(); ingreso.Nombre = txtNombre.Text.Trim(); return(ingreso); }
private void btnAgregar_Click(object sender, EventArgs e) { if (!Validar()) { CategoriaIngreso fuente = CategoriaIngreso_ControlAClase(); CategoriaIngresoDB fuenteIngresoDB = new CategoriaIngresoDB(); if (fuenteIngresoDB.Agregar_Modificar(fuente, ClinicaPro.General.accion.Agregar) != IdVacia) { Limpiar(); } } }
private void btnActualizar_Click(object sender, EventArgs e) { if (!Validar()) { if (dgFuente.SelectedRows.Count == 1) { this.IdCategoriaIngreso = (byte)dgFuente.CurrentRow.Cells[comboNombreIDs.CategoriaIngreso].Value; } CategoriaIngreso fuente = CategoriaIngreso_ControlAClase(); fuente.IdCategoriaIngreso = this.IdCategoriaIngreso; CategoriaIngresoDB fuenteIngresoDB = new CategoriaIngresoDB(); if (fuenteIngresoDB.Agregar_Modificar(fuente, ClinicaPro.General.accion.Modificar) != IdVacia) { Limpiar(); MensajeDeActulizacion(); } else { MessageBox.Show(Mensajes.No_Se_Actualizo + "\n" + Mensajes.Refresh, Mensajes.AlgoPaso, MessageBoxButtons.OK, MessageBoxIcon.Information); } } }