private void btnRegistrarTurno_Click(object sender, EventArgs e) { if (validarCampos()) { if ((oTurnoService.recuperarTurnoFechaDni(Convert.ToDateTime(txtFecha.Text), txtDni.Text) != null)) { MessageBox.Show("El paciente ingresado ya tiene un turno asignado para la fecha seleccionada", "Turno no asignado", MessageBoxButtons.OK, MessageBoxIcon.Error); limpiarCampos(); return; } oTurno.Fecha = Convert.ToDateTime(txtFecha.Text); oTurno.Id_profesional = oProfesional.Matricula; oTurno.Id_obra_social = (oObraSocialService.recuperarObraSocialPorNom(cboObraSocial.Text)).Codigo; oTurno.Id_paciente = Convert.ToInt32(txtDni.Text); oTurno.Hora = grdTurnosDisp.CurrentRow.Cells["Hora"].Value.ToString(); string disponible = grdTurnosDisp.CurrentRow.Cells["Disponible"].Value.ToString(); if (oTurnoService.validarTurno(oTurno, disponible)) { if (oTurnoService.crearTurnoConHistorial(oTurno, txtObservaciones.Text)) { MessageBox.Show("Se registró el turno correctamente", "Turno registrado", MessageBoxButtons.OK, MessageBoxIcon.Information); clickChBox(); } else { MessageBox.Show("Hubo un problema con el registro de turno", "Error en registro", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }