Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
        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);
        }