public Boolean actualizarExamenesYFormaPago(List <examenesEmpleado> listaExamenes,
                                                    Decimal ID_SOLICITUD,
                                                    Decimal ID_ENTIDAD,
                                                    String NUM_CUENTA,
                                                    String FORMA_PAGO,
                                                    String TIPO_CUENTA)
        {
            Boolean correcto = true;

            Conexion conexion = new Conexion(Empresa);

            conexion.IniciarTransaccion();

            try
            {
                radicacionHojasDeVida _radicacionHojasDeVida = new radicacionHojasDeVida(Empresa, Usuario);
                autoRecomendaciones   _auto = new autoRecomendaciones(Empresa, Usuario);

                if (_radicacionHojasDeVida.ActualizarEntidadNumCuenta(ID_SOLICITUD, ID_ENTIDAD, NUM_CUENTA, FORMA_PAGO, TIPO_CUENTA, conexion) == false)
                {
                    correcto     = false;
                    MensajeError = _radicacionHojasDeVida.MensajeError;
                    conexion.DeshacerTransaccion();
                }
                else
                {
                    foreach (examenesEmpleado examen in listaExamenes)
                    {
                        if (examen.ARCHIVO_EXAMEN == null)
                        {
                            if (ActualizarConRegExamenesEmpleado(examen.registro, examen.IdOrden, examen.IdExamen, 0, "S", examen.Fecha, conexion) == false)
                            {
                                correcto = false;
                                conexion.DeshacerTransaccion();
                                break;
                            }
                        }
                        else
                        {
                            if (ActualizarConRegExamenesEmpleadoConArchivo(examen.registro, examen.IdOrden, examen.IdExamen, 0, "S", examen.Fecha, examen.ARCHIVO_EXAMEN, examen.ARCHIVO_EXTENSION, examen.ARCHIVO_TAMANO, examen.ARCHIVO_TYPE, conexion) == false)
                            {
                                correcto = false;
                                conexion.DeshacerTransaccion();
                                break;
                            }
                        }

                        if (correcto == true)
                        {
                            if (String.IsNullOrEmpty(examen.AutoRecomendacion) == false)
                            {
                                if (_auto.AdicionarConRegAutoRecomendaciones(examen.registro, examen.AutoRecomendacion, examen.Fecha, conexion) <= 0)
                                {
                                    correcto     = false;
                                    MensajeError = _auto.MensajeError;
                                    conexion.DeshacerTransaccion();
                                    break;
                                }
                            }
                        }
                    }
                }

                if (correcto == true)
                {
                    conexion.AceptarTransaccion();
                }
            }
            catch (Exception ex)
            {
                conexion.DeshacerTransaccion();
                correcto     = false;
                MensajeError = ex.Message;
            }
            finally
            {
                conexion.Desconectar();
            }

            return(correcto);
        }
        public Boolean adicionarOrdenesExamenes(List <examenesEmpleado> examenesLab,
                                                Decimal ID_SOLICITUD,
                                                Decimal ID_ENTIDAD,
                                                String NUM_CUENTA,
                                                String FORMA_PAGO,
                                                String TIPO_CUENTA,
                                                Decimal ID_REQUERIMIENTO,
                                                String ID_CIUDAD,
                                                Decimal ID_CENTRO_C,
                                                Decimal ID_SUB_C,
                                                Decimal ID_SERVICIO,
                                                Decimal ID_EMPRESA,
                                                Boolean TIENE_CUENTA)
        {
            Boolean correcto = true;

            ordenExamenes orden   = new ordenExamenes(Empresa, Usuario);
            decimal       idOrden = 0;
            int           idLab   = 0;

            Conexion conexion = new Conexion(Empresa);

            conexion.IniciarTransaccion();

            try
            {
                foreach (examenesEmpleado item in examenesLab)
                {
                    if (item.valida == false)
                    {
                        idLab   = item.idLab;
                        idOrden = orden.AdicionarConRegOrdenExamen(item.idSolIngreso, item.idRequerimientos, conexion);
                        if (idOrden <= 0)
                        {
                            correcto = false;
                            conexion.DeshacerTransaccion();
                            MensajeError = orden.MensajeError;
                            break;
                        }
                        else
                        {
                            Decimal ID_EXAMEN_EMPLEADO = AdicionarConRegExamenesEmpleado(Convert.ToInt32(idOrden), item.registroAlmacen, 0, "N", item.fecha, conexion);

                            if (ID_EXAMEN_EMPLEADO <= 0)
                            {
                                correcto = false;
                                conexion.DeshacerTransaccion();
                                break;
                            }
                            else
                            {
                                item.valida = true;
                            }
                        }
                    }
                }

                if (correcto == true)
                {
                    radicacionHojasDeVida _radicacionHojasDeVida = new radicacionHojasDeVida(Empresa, Usuario);
                    if (_radicacionHojasDeVida.ActualizarEntidadNumCuenta(Convert.ToInt32(ID_SOLICITUD), Convert.ToInt32(ID_ENTIDAD), NUM_CUENTA, FORMA_PAGO, TIPO_CUENTA, conexion) == false)
                    {
                        correcto     = false;
                        MensajeError = _radicacionHojasDeVida.MensajeError;
                        conexion.DeshacerTransaccion();
                    }
                }

                if (correcto == true)
                {
                    ConRegContratoTemporal _contratoTemporal = new ConRegContratoTemporal(Empresa, Usuario);

                    Decimal ID_TEMPORAL = _contratoTemporal.AdicionarConRegContratoTemporal(ID_REQUERIMIENTO, ID_SOLICITUD, ID_CIUDAD, ID_CENTRO_C, ID_SUB_C, ID_SERVICIO, ID_EMPRESA, TIENE_CUENTA, conexion);

                    if (ID_TEMPORAL <= 0)
                    {
                        correcto     = false;
                        MensajeError = _contratoTemporal.MensajeError;
                        conexion.DeshacerTransaccion();
                    }
                }

                if (correcto == true)
                {
                    conexion.AceptarTransaccion();
                }
            }
            catch (ExecutionEngineException ex)
            {
                correcto     = false;
                MensajeError = ex.Message;
                conexion.DeshacerTransaccion();
            }
            finally
            {
                conexion.Desconectar();
            }

            return(correcto);
        }