private void Historial_Load(object sender, EventArgs e) { //Estilo.Buscar(btnBuscar); //this.AcceptButton = this.btnBuscar; gp = new GestionarPaciente(); listaPaciente = gp.Listar(); ActualizarLista(listaPaciente); }
private void AbmPaciente_Load(object sender, EventArgs e) { gestor = new GestionarPaciente(); Estilo.Guardar(btnAceptar); Estilo.Cancelar(btnCancelar); btnAceptar.DialogResult = DialogResult.OK; btnCancelar.DialogResult = DialogResult.Cancel; this.AcceptButton = this.btnAceptar; Actualizar(); dtFecha.MaxDate = DateTime.Now; }
private void ConsultarPaciente_Load(object sender, EventArgs e) { Estilo.Nuevo(btnNuevo); Estilo.Guardar(btnAceptar); Estilo.Cancelar(btnCancelar); Estilo.Modificar(btnModificar); btnAceptar.DialogResult = DialogResult.OK; btnCancelar.DialogResult = DialogResult.Cancel; gestor = new GestionarPaciente(); ActualizarLista(gestor.Listar()); if (this.Owner != null) { btnModificar.Visible = false; btnNuevo.Visible = false; } }
private void btnAceptar_Click(object sender, EventArgs e) { int respuesta; if (Seleccionado == null) { Seleccionado = new Paciente(); } try { if (this.ValidarTextbox()) { Seleccionado.Dni = int.Parse(txtDni.Text.Trim()); Seleccionado.Nombre = txtNombre.Text.Trim(); Seleccionado.Apellido = txtApellido.Text.Trim(); Seleccionado.FechaNacimiento = dtFecha.Value; Paciente existe = GestionarPaciente.Buscar(Seleccionado); if (existe == null) { respuesta = gestor.Insertar(Seleccionado); } else { respuesta = gestor.Modificar(Seleccionado); } if (respuesta == 0) { Mensaje("msgErrorAlta", "msgError"); } else { Mensaje("msgOperacionOk"); this.Close(); } } else { this.DialogResult = DialogResult.None; } } catch (Exception ex) { GestionarError.loguear(ex.ToString()); Mensaje("errorDatoMal", "msgFaltaCompletarTitulo"); } }