public DateTime ObtenerFechaDiasHabiles(DateTime fechaInicial, Int32 numdias, Int32 proceso)
        {
            tools _tools = new tools();

            Conexion  conexion   = new Conexion(Empresa);
            DataSet   _dataSet   = new DataSet();
            DataView  _dataView  = new DataView();
            DataTable _dataTable = new DataTable();
            String    sql        = null;
            Boolean   ejecutar   = true;

            DateTime fechaRequiereCliente = DateTime.Now;

            sql = "usp_crt_calendario_obtenerFechaDesdeDiasParametrizados ";

            sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(fechaInicial) + "', ";
            sql += numdias + ", ";
            sql += proceso;

            if (ejecutar == true)
            {
                try
                {
                    _dataSet   = conexion.ExecuteReader(sql);
                    _dataView  = _dataSet.Tables[0].DefaultView;
                    _dataTable = _dataView.Table;
                }
                catch (Exception e)
                {
                    MensajeError = e.Message;
                }
                finally
                {
                    conexion.Desconectar();
                }
            }

            if (_dataTable.Rows.Count > 0)
            {
                DataRow _dataRow = _dataTable.Rows[0];
                fechaRequiereCliente = Convert.ToDateTime(_dataRow["FECHA_REQUIERE"]);
            }

            return(fechaRequiereCliente);
        }
        public DateTime ObtenerFechaDiasHabiles(DateTime fechaInicial, Int32 numdias, Int32 proceso)
        {
            tools _tools = new tools();

            Conexion conexion = new Conexion(Empresa);
            DataSet _dataSet = new DataSet();
            DataView _dataView = new DataView();
            DataTable _dataTable = new DataTable();
            String sql = null;
            Boolean ejecutar = true;

            DateTime fechaRequiereCliente = DateTime.Now;

            sql = "usp_crt_calendario_obtenerFechaDesdeDiasParametrizados ";

            sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(fechaInicial) + "', ";
            sql += numdias + ", ";
            sql += proceso;

            if (ejecutar == true)
            {
                try
                {
                    _dataSet = conexion.ExecuteReader(sql);
                    _dataView = _dataSet.Tables[0].DefaultView;
                    _dataTable = _dataView.Table;
                }
                catch (Exception e)
                {
                    MensajeError = e.Message;
                }
                finally
                {
                    conexion.Desconectar();
                }
            }

            if (_dataTable.Rows.Count > 0)
            {
                DataRow _dataRow = _dataTable.Rows[0];
                fechaRequiereCliente = Convert.ToDateTime(_dataRow["FECHA_REQUIERE"]);
            }

            return fechaRequiereCliente;
        }
        public Boolean ActualizarConRegExamenesEmpleadoConArchivo(Decimal REGISTRO,
            Decimal ID_ORDEN,
            Decimal ID_EXAMEN,
            Decimal COSTO,
            String VALIDADO,
            DateTime FECHA_EXAMEN,
            byte[] ARCHIVO_EXAMEN,
            String ARCHIVO_EXTENSION,
            Decimal ARCHIVO_TAMANO,
            String ARCHIVO_TYPE,
            Conexion conexion)
        {
            String informacion = null;
            Boolean ejecutar = true;
            Int32 registro = 0;

            tools _tools = new tools();

            String sql = "USP_CON_REG_EXAMENES_EMPLEADO_ACTUALIZAR ";

            #region validaciones
            if (REGISTRO != 0)
            {
                sql += REGISTRO + ", ";
                informacion += "REGISTRO = '" + REGISTRO.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo REGISTRO no puede ser nulo\n";
                ejecutar = false;
            }
            if (ID_ORDEN != 0)
            {
                sql += ID_ORDEN + ", ";
                informacion += "ID_ORDEN = '" + ID_ORDEN.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo ID_ORDEN no puede ser nulo\n";
                ejecutar = false;
            }
            if (ID_EXAMEN != 0)
            {
                sql += ID_EXAMEN + ", ";
                informacion += "ID_EXAMEN = '" + ID_EXAMEN.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo ID_EXAMEN no puede ser nulo\n";
                ejecutar = false;
            }
            if (COSTO != 0)
            {
                sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(COSTO) + ", ";
                informacion += "COSTO = '" + COSTO.ToString() + "', ";
            }
            else
            {
                sql += "0, ";
                informacion += "COSTO = '0', ";
            }
            if (!(String.IsNullOrEmpty(VALIDADO)))
            {
                sql += "'" + VALIDADO + "', ";
                informacion += "VALIDADO = '" + VALIDADO.ToString() + "', ";
            }
            else
            {
                sql += "'N', ";
                informacion += "VALIDADO = 'N', ";
            }
            if (!(String.IsNullOrEmpty(FECHA_EXAMEN.ToString())))
            {
                sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_EXAMEN) + "', ";
                informacion += "FECHA_EXAMEN = '" + FECHA_EXAMEN.ToString() + "', ";
            }

            sql += "'" + Usuario + "' ";
            informacion += "USU_MOD = '" + Usuario.ToString() + "' ";

            #endregion validaciones

            if (ejecutar)
            {
                try
                {
                    registro = conexion.ExecuteNonQueryParaActualizarConRegExamenesEmpleadoConArchivo(REGISTRO, ID_ORDEN, ID_EXAMEN, COSTO, VALIDADO, FECHA_EXAMEN, Usuario, ARCHIVO_EXAMEN, ARCHIVO_EXTENSION, ARCHIVO_TAMANO, ARCHIVO_TYPE);

                    if (registro == 0)
                    {
                        return false;
                    }
                    else
                    {
                        #region auditoria
                        auditoria _auditoria = new auditoria(Empresa);
                        _auditoria.Adicionar(Usuario, tabla.CON_REG_EXAMENES_EMPLEADO, tabla.ACCION_ACTUALIZAR, sql, informacion, conexion);
                        #endregion auditoria

                        return true;
                    }
                }
                catch (Exception e)
                {
                    MensajeError = e.Message;
                    return false;
                }
            }
            else
            {
                return false;
            }
        }
        public Decimal AdicionarConRegContratos(int ID_EMPLEADO, int ID_REQUERIMIENTO, int ID_SOLICITUD,
            int ID_CENTRO_C, int ID_SUB_C, String CLASE_CONTRATO, DateTime FECHA_INICIA, DateTime FECHA_TERMINA,
            String VIGENTE, String PAGO_LIQ, String SAL_INT, String TIPO_CONTRATO, int ID_SERVICIO_RESPECTIVO,
            String ID_CIUDAD, int ID_SERVICIO, Conexion conexion, String PAGO_DIAS_PRODUCTIVIDAD, String SENA_PRODICTIVO,
            String SENA_ELECTIVO, String PRACTICANTE_UNIVERSITARIO, Decimal VALOR_NOMINA, Decimal VALOR_CONTRATO,
            DateTime FECHA_INICIO_PERIODO, DateTime FECHA_FIN_PERIODO, String PERIODO_PAGO)
        {
            String sql = null;
            String identificador = null;
            String informacion = null;
            Boolean ejecutar = true;

            tools _tools = new tools();

            sql = "usp_con_reg_contratos_adicionar ";

            #region validaciones
            if (ID_EMPLEADO != 0)
            {
                sql += ID_EMPLEADO + ", ";
                informacion += "ID_EMPLEADO = '" + ID_EMPLEADO.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo ID_EMPLEADO no puede ser nulo\n";
                ejecutar = false;
            }
            if (ID_REQUERIMIENTO != 0)
            {
                sql += ID_REQUERIMIENTO + ", ";
                informacion += "ID_REQUERIMIENTO = '" + ID_REQUERIMIENTO.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo ID_REQUERIMIENTO no puede ser nulo\n";
                ejecutar = false;
            }
            if (ID_SOLICITUD != 0)
            {
                sql += ID_SOLICITUD + ", ";
                informacion += "ID_SOLICITUD = '" + ID_SOLICITUD.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo ID_SOLICITUD no puede ser nulo\n";
                ejecutar = false;
            }
            if (ID_CENTRO_C != 0)
            {
                sql += ID_CENTRO_C + ", ";
                informacion += "ID_CENTRO_C = '" + ID_CENTRO_C.ToString() + "', ";
            }
            else
            {
                sql += "0, ";
                informacion += "ID_CENTRO_C = 'null', ";
            }
            if (ID_SUB_C != 0)
            {
                sql += ID_SUB_C + ", ";
                informacion += "ID_SUB_C = '" + ID_SUB_C.ToString() + "', ";
            }
            else
            {
                sql += "0, ";
                informacion += "ID_SUB_C = '0', ";
            }
            if (!(String.IsNullOrEmpty(CLASE_CONTRATO)))
            {
                sql += "'" + CLASE_CONTRATO + "', ";
                informacion += "CLASE_CONTRATO = '" + CLASE_CONTRATO.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo CLASE_CONTRATO no puede ser nulo\n";
                ejecutar = false;
            }
            if (!(String.IsNullOrEmpty(FECHA_INICIA.ToString())))
            {
                sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_INICIA) + "', ";
                informacion += "FECHA_INICIA = '" + FECHA_INICIA.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo FECHA_INICIA no puede ser nulo\n";
                ejecutar = false;
            }
            if (!(String.IsNullOrEmpty(FECHA_TERMINA.ToString())))
            {
                sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_TERMINA) + "', ";
                informacion += "FECHA_TERMINA = '" + FECHA_TERMINA.ToString() + "', ";
            }
            else
            {
                sql += "null, ";
                informacion += "FECHA_TERMINA = 'null', ";
            }
            if (!(String.IsNullOrEmpty(VIGENTE)))
            {
                sql += "'" + VIGENTE + "', ";
                informacion += "VIGENTE = '" + VIGENTE.ToString() + "', ";
            }
            else
            {
                sql += "'S', ";
                informacion += "VIGENTE = '" + VIGENTE.ToString() + "', ";
            }
            if (!(String.IsNullOrEmpty(PAGO_LIQ)))
            {
                sql += "'" + PAGO_LIQ + "', ";
                informacion += "PAGO_LIQ = '" + PAGO_LIQ.ToString() + "', ";
            }
            else
            {
                sql += "'N', ";
                informacion += "PAGO_LIQ = '" + PAGO_LIQ.ToString() + "', ";
            }
            if (!(String.IsNullOrEmpty(SAL_INT)))
            {
                sql += "'" + SAL_INT + "', ";
                informacion += "SAL_INT = '" + SAL_INT.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo SAL_INT no puede ser nulo\n";
                ejecutar = false;
            }
            sql += "'" + Usuario + "', ";
            informacion += "USU_CRE= '" + Usuario.ToString() + "', ";

            if (!(String.IsNullOrEmpty(TIPO_CONTRATO)))
            {
                sql += "'" + TIPO_CONTRATO + "', ";
                informacion += "TIPO_CONTRATO = '" + TIPO_CONTRATO.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo TIPO_CONTRATO no puede ser nulo\n";
                ejecutar = false;
            }
            if (ID_SERVICIO_RESPECTIVO != 0)
            {
                sql += ID_SERVICIO_RESPECTIVO + ", ";
                informacion += "ID_SERVICIO_RESPECTIVO = '" + ID_SERVICIO_RESPECTIVO.ToString() + "' ";
            }
            else
            {
                MensajeError += "El campo ID_SERVICIO_RESPECTIVO no puede ser nulo\n";
                ejecutar = false;
            }
            if (!(String.IsNullOrEmpty(ID_CIUDAD)))
            {
                sql += "'" + ID_CIUDAD + "', ";
                informacion += "ID_CIUDAD = '" + ID_CIUDAD.ToString() + "', ";
            }
            else
            {
                sql += "Null,";
                informacion += "ID_CIUDAD = '0', ";
            }
            if (ID_SERVICIO != 0)
            {
                sql += ID_SERVICIO + ", ";
                informacion += "ID_SERVICIO = '" + ID_SERVICIO.ToString() + "', ";
            }
            else
            {
                sql += "0, ";
                informacion += "ID_SERVICIO = '0', ";
            }
            if (!(String.IsNullOrEmpty(PAGO_DIAS_PRODUCTIVIDAD)))
            {
                sql += "'" + PAGO_DIAS_PRODUCTIVIDAD + "', ";
                informacion += "PAGO_DIAS_PRODUCTIVIDAD = '" + PAGO_DIAS_PRODUCTIVIDAD.ToString() + "', ";
            }
            else
            {
                sql += "NULL, ";
                informacion += "PAGO_DIAS_PRODUCTIVIDAD = 'NULL', ";
            }
            if (!(String.IsNullOrEmpty(SENA_PRODICTIVO)))
            {
                sql += "'" + SENA_PRODICTIVO + "', ";
                informacion += "SENA_PRODICTIVO = '" + SENA_PRODICTIVO.ToString() + "', ";
            }
            else
            {
                sql += "NULL, ";
                informacion += "SENA_PRODICTIVO = 'NULL', ";
            }
            if (!(String.IsNullOrEmpty(SENA_ELECTIVO)))
            {
                sql += "'" + SENA_ELECTIVO + "', ";
                informacion += "SENA_ELECTIVO = '" + SENA_ELECTIVO.ToString() + "', ";
            }
            else
            {
                sql += "NULL, ";
                informacion += "SENA_ELECTIVO = 'NULL', ";
            }
            if (!(String.IsNullOrEmpty(PRACTICANTE_UNIVERSITARIO)))
            {
                sql += "'" + PRACTICANTE_UNIVERSITARIO + "', ";
                informacion += "PRACTICANTE_UNIVERSITARIO = '" + PRACTICANTE_UNIVERSITARIO.ToString() + "', ";
            }
            else
            {
                sql += "NULL, ";
                informacion += "PRACTICANTE_UNIVERSITARIO = 'NULL', ";
            }
            if (VALOR_NOMINA != 0)
            {
                sql += VALOR_NOMINA + ", ";
                informacion += "VALOR_NOMINA = '" + VALOR_NOMINA.ToString() + "', ";
            }
            else
            {
                sql += "0 ,";
                informacion += "VALOR_NOMINA = '0', ";
            }
            if (VALOR_CONTRATO != 0)
            {
                sql += VALOR_CONTRATO + " ,";
                informacion += "VALOR_CONTRATO = '" + VALOR_CONTRATO.ToString() + "', ";
            }
            else
            {
                sql += "0, ";
                informacion += "VALOR_CONTRATO = '0', ";
            }
            if (!(String.IsNullOrEmpty(FECHA_INICIO_PERIODO.ToString())))
            {
                sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_INICIO_PERIODO) + "', ";
                informacion += "FECHA_INICIO_PERIODO = '" + FECHA_INICIO_PERIODO.ToString() + "', ";
            }
            else
            {
                sql += "null, ";
                informacion += "FECHA_INICIO_PERIODO = 'null', ";
            }
            if (!(String.IsNullOrEmpty(FECHA_FIN_PERIODO.ToString())))
            {
                sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_FIN_PERIODO) + "', ";
                informacion += "FECHA_FIN_PERIODO = '" + FECHA_FIN_PERIODO.ToString() + "', ";
            }
            else
            {
                sql += "null, ";
                informacion += "FECHA_INICIO_PERIODO = 'null', ";
            }
            if (!(String.IsNullOrEmpty(PERIODO_PAGO)))
            {
                sql += "'" + PERIODO_PAGO + "' ";
                informacion += "PERIODO_PAGO = '" + PERIODO_PAGO.ToString() + "' ";
            }
            else
            {
                sql += "NULL ";
                informacion += "PERIODO_PAGO = 'NULL'";
            }
            #endregion validaciones

            if (ejecutar)
            {
                try
                {
                    identificador = conexion.ExecuteScalar(sql);

                    #region auditoria
                    auditoria _auditoria = new auditoria(Empresa);
                    _auditoria.Adicionar(Usuario, tabla.CON_REG_CONTRATOS, tabla.ACCION_ADICIONAR, sql, informacion, conexion);
                    #endregion auditoria
                }
                catch (Exception e)
                {
                    MensajeError = e.Message;
                }
            }

            if (!(String.IsNullOrEmpty(identificador))) return Convert.ToDecimal(identificador);
            else return 0;
        }
        public Boolean ActualizarNomEmpleadosAuditoria(Decimal ID_EMPLEADO,
            Decimal SALARIO,
            Decimal RIESGO,
            Decimal ID_ENTIDAD,
            String NUM_CUENTA,
            String SAL_INT,
            Decimal ID_PERFIL,
            String FORMA_PAGO,
            String ID_CIUDAD,
            Decimal ID_CENTRO_C,
            Decimal ID_SUB_C,
            Conexion conexion,
            String TIPO_CUENTA,
            DateTime FECHA_INICIO_PERIODO,
            String CHEQUE_REG)
        {
            Int32 cantidadRegistrosActualizados = 0;
            String sql = null;
            String informacion = null;
            Boolean ejecutar = true;

            tools _tools = new tools();

            sql = "usp_nom_empleados_actualizar_auditoria_V3 ";

            #region validaciones
            if (ID_EMPLEADO != 0)
            {
                sql += ID_EMPLEADO + ", ";
                informacion += "ID_EMPLEADO = '" + ID_EMPLEADO.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo ID_EMPLEADO no puede ser nulo\n";
                ejecutar = false;
            }

            if (SALARIO != 0)
            {
                sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(SALARIO) + ", ";
                informacion += "SALARIO = '" + _tools.convierteComaEnPuntoParaDecimalesEnSQL(SALARIO) + "', ";
            }
            else
            {
                sql += "0, ";
                informacion += "SALARIO = '0', ";
            }

            if (RIESGO != 0)
            {
                sql += RIESGO + ", ";
                informacion += "RIESGO = '" + RIESGO + "', ";
            }
            else
            {
                sql += "0, ";
                informacion += "RIESGO = '0', ";
            }

            if (ID_ENTIDAD != 0)
            {
                sql += ID_ENTIDAD + ", ";
                informacion += "ID_ENTIDAD = '" + ID_ENTIDAD.ToString() + "', ";
            }
            else
            {
                sql += "NULL, ";
                informacion += "ID_ENTIDAD = 'NULL', ";
            }

            if (String.IsNullOrEmpty(NUM_CUENTA) == false)
            {
                sql += "'" + NUM_CUENTA + "', ";
                informacion += "NUM_CUENTA = '" + NUM_CUENTA + "', ";
            }
            else
            {
                sql += "NULL, ";
                informacion += "NUM_CUENTA = 'NULL', ";
            }

            if (String.IsNullOrEmpty(SAL_INT) == false)
            {
                sql += "'" + SAL_INT + "', ";
                informacion += "SAL_INT = '" + SAL_INT + "', ";
            }
            else
            {
                MensajeError += "El campo SAL_INT no puede ser nulo\n";
                ejecutar = false;
            }

            if (ID_PERFIL != 0)
            {
                sql += ID_PERFIL + ", ";
                informacion += "ID_PERFIL = '" + ID_PERFIL + "', ";
            }
            else
            {
                MensajeError += "El campo ID_PERFIL no puede ser nulo\n";
                ejecutar = false;
            }

            if (String.IsNullOrEmpty(FORMA_PAGO) == false)
            {
                sql += "'" + FORMA_PAGO + "', ";
                informacion += "FORMA_PAGO = '" + FORMA_PAGO + "', ";
            }
            else
            {
                sql += "NULL, ";
                informacion += "FORMA_PAGO = 'NULL', ";
            }

            if (String.IsNullOrEmpty(ID_CIUDAD) == false)
            {
                sql += "'" + ID_CIUDAD + "', ";
                informacion += "ID_CIUDAD = '" + ID_CIUDAD + "', ";
            }
            else
            {
                sql += "NULL, ";
                informacion += "ID_CIUDAD = 'NULL', ";
            }

            if (ID_CENTRO_C != 0)
            {
                sql += ID_CENTRO_C + ", ";
                informacion += "ID_CENTRO_C = '" + ID_CENTRO_C + "', ";
            }
            else
            {
                sql += "NULL, ";
                informacion += "ID_CENTRO_C = 'NULL', ";
            }

            if (ID_SUB_C != 0)
            {
                sql += ID_SUB_C + ", ";
                informacion += "ID_SUB_C = '" + ID_SUB_C + "', ";
            }
            else
            {
                sql += "NULL, ";
                informacion += "ID_SUB_C = 'NULL', ";
            }

            sql += "'" + Usuario + "', ";
            informacion += "USU_MOD = '" + Usuario.ToString() + "', ";

            if (String.IsNullOrEmpty(TIPO_CUENTA) == false)
            {
                sql += "'" + TIPO_CUENTA + "', ";
                informacion += "TIPO_CUENTA = '" + TIPO_CUENTA + "', ";
            }
            else
            {
                sql += "NULL, ";
                informacion += "ID_CIUDAD = 'NULL', ";
            }

            if (!(String.IsNullOrEmpty(FECHA_INICIO_PERIODO.ToString())))
            {
                sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_INICIO_PERIODO) + "', ";
                informacion += "FECHA_INICIO_PERIODO = '" + FECHA_INICIO_PERIODO.ToString() + "', ";
            }
            else
            {
                sql += "NULL, ";
                informacion += "FECHA_INICIO_PERIODO = null, ";
            }

            if (String.IsNullOrEmpty(CHEQUE_REG) == false)
            {
                sql += "'" + CHEQUE_REG + "'";
                informacion += "CHEQUE_REG = '" + CHEQUE_REG.ToString() + "'";
            }
            else
            {
                sql += "NULL";
                informacion += "CHEQUE_REG = 'NULL'";
            }

            #endregion validaciones

            if (ejecutar)
            {
                try
                {
                    cantidadRegistrosActualizados = conexion.ExecuteNonQuery(sql);

                    #region auditoria
                    auditoria _auditoria = new auditoria(Empresa);
                    _auditoria.Adicionar(Usuario, tabla.NOM_EMPLEADOS, tabla.ACCION_ACTUALIZAR, sql, informacion, conexion);
                    #endregion auditoria
                }
                catch (Exception e)
                {
                    MensajeError = e.Message;
                }
            }

            if (cantidadRegistrosActualizados > 0) return true;
            else return false;
        }
        public Decimal Retirar_empleado(Decimal ID_EMPLEADO, DateTime FECHA_RETIRO, Int32 ID_PERIODO)
        {
            String sql = null;
            Decimal rowsRet = 0;
            String informacion = null;
            Boolean ejecutar = true;
            tools _tools = new tools();

            sql = "usp_nom_nomina_novedades_retirar_1 ";

            #region validaciones
            if (ID_EMPLEADO != 0)
            {
                sql += "'" + ID_EMPLEADO.ToString() + "' ";
                informacion += "ID_EMPLEADO= '" + ID_EMPLEADO.ToString() + ", ";
            }
            else
            {
                MensajeError = "El campo ID_EMPLEADO es requerido para la eliminacion.";
                ejecutar = false;
            }

            sql += ", '" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_RETIRO) + "', ";
            informacion += "FECHA_RETIRO = '" + FECHA_RETIRO.ToString() + "', ";

            if (ID_PERIODO != 0)
            {
                sql += "'" + ID_PERIODO.ToString() + "', ";
                informacion += "ID_PERIODO= '" + ID_EMPLEADO.ToString() + ", ";
            }
            else
            {
                MensajeError = "El campo ID_PERIODO es requerido para la eliminacion.";
                ejecutar = false;
            }

            sql += "'" + Usuario + "'";
            informacion += "USU_CRE = '" + Usuario.ToString() + "'";

            #endregion

            if (ejecutar)
            {
                Conexion conexion = new Conexion(Empresa);
                try
                {
                    rowsRet = conexion.ExecuteNonQuery(sql);

                }
                catch (Exception e)
                {
                    MensajeError = e.Message;
                }
                finally
                {
                    conexion.Desconectar();
                }
            }
            return rowsRet;
        }
        public Decimal AdicionarNuevaActaComite(DateTime FECHA_R,
            DateTime FECHA_ACTA,
            String TITULO,
            String TIPO_DOCUMENTO,
            Byte[] ARCHIVO,
            String ARCHIVO_EXTENSION,
            Decimal ARCHIVO_TAMANO,
            String ARCHIVO_TYPE,
            String ACTIVO)
        {
            Decimal ID_ACTA_COMITE = 0;
            String sql = null;
            String informacion = null;
            Boolean ejecutar = true;
            Boolean ejecutadoCorrectamente = true;

            tools _tools = new tools();

            sql = "usp_reg_comite_convivencia_adicionar_acta_comite ";

            #region validaciones

            sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_R) + "', ";
            informacion += "FECHA_R = '" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_R) + "', ";

            sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_ACTA) + "', ";
            informacion += "FECHA_ACTA = '" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_ACTA) + "', ";

            if (String.IsNullOrEmpty(TITULO) == false)
            {
                sql += "'" + TITULO + "', ";
                informacion += "TITULO = '" + TITULO + "', ";
            }
            else
            {
                sql += "null, ";
                informacion += "TITULO = 'null', ";
            }

            if (String.IsNullOrEmpty(TIPO_DOCUMENTO) == false)
            {
                sql += "'" + TIPO_DOCUMENTO + "', ";
                informacion += "TIPO_DOCUMENTO = '" + TIPO_DOCUMENTO + "', ";
            }
            else
            {
                MensajeError = "El campo TIPO_DOCUMENTO no puede ser vacio.";
                ejecutar = false;
            }

            sql += "'[DATOS_BINARIOS]', ";
            informacion += "ARCHIVO = '[DATOS_BINARIOS]', ";

            sql += "'" + ARCHIVO_EXTENSION + "', ";
            informacion += "ARCHIVO_EXTENSION = '" + ARCHIVO_EXTENSION + "', ";

            sql += ARCHIVO_TAMANO + ", ";
            informacion += "ARCHIVO_TAMANO = '" + ARCHIVO_TAMANO + "', ";

            sql += "'" + ARCHIVO_TYPE + "', ";
            informacion += "ARCHIVO_TYPE = '" + ARCHIVO_TYPE + "', ";

            sql += "'" + ACTIVO + "', ";
            informacion += "ACTIVO = '" + ACTIVO + "', ";

            sql += "'" + Usuario + "'";
            informacion += "USU_CRE = '" + Usuario.ToString() + "'";
            #endregion validaciones

            if (ejecutar)
            {
                Conexion conexion = new Conexion(Empresa);
                conexion.IniciarTransaccion();
                try
                {
                    ID_ACTA_COMITE = Convert.ToDecimal(conexion.ExecuteEscalarParaAdicionaNuevaActaComite(FECHA_R, FECHA_ACTA, TITULO, TIPO_DOCUMENTO, ARCHIVO, ARCHIVO_EXTENSION, ARCHIVO_TAMANO, ARCHIVO_TYPE, ACTIVO, Usuario));

                    if (ID_ACTA_COMITE <= 0)
                    {
                        conexion.DeshacerTransaccion();
                        MensajeError = "ERROR: Al intentar ingresar la nueva acta de comite.";
                        ejecutadoCorrectamente = false;
                    }
                    else
                    {
                        auditoria _auditoria = new auditoria(Empresa);
                        if (!(_auditoria.Adicionar(Usuario, tabla.REG_COMITE_CONVIVENCIA, tabla.ACCION_ADICIONAR, sql, informacion, conexion)))
                        {
                            conexion.DeshacerTransaccion();
                            MensajeError = "ERROR: Al intentar ingresar la auditoría para el registro de fallecidos.";
                            ejecutadoCorrectamente = false;
                        }
                        else
                        {
                            conexion.AceptarTransaccion();
                        }
                    }
                }
                catch (Exception e)
                {
                    conexion.DeshacerTransaccion();
                    MensajeError = e.Message;
                    ejecutadoCorrectamente = false;
                }
                finally
                {
                    conexion.Desconectar();
                }
            }
            else
            {
                ejecutadoCorrectamente = false;
            }

            if (ejecutadoCorrectamente)
            {
                return ID_ACTA_COMITE;
            }
            else
            {
                return 0;
            }
        }
        public Decimal AdicionarEvaluacion(String TIPO_EVALUACION,
            Decimal ID_EMPLEADO_EVALUADO,
            Decimal ID_EMPLEADO_EVALUADOR,
            DateTime FECHA_EVALUACION,
            Decimal PUNTAJE,
            String CALIFICACION,
            String FORTALEZAS,
            String OPORTUNIDADES_MEJORAS,
            String CURSOS_CAPACITACIONES)
        {
            tools _tools = new tools();

            String sql = null;
            Decimal idRecuperado = 0;
            String informacion = null;
            Boolean ejecutar = true;

            sql = "usp_gh_evaluaciones_adicionar ";

            if (String.IsNullOrEmpty(TIPO_EVALUACION) == false)
            {
                sql += "'" + TIPO_EVALUACION + "', ";
                informacion += "TIPO_EVALUACION = '" + TIPO_EVALUACION + "', ";
            }
            else
            {
                MensajeError += "El campo TIPO_EVALUACION no puede ser nulo\n";
                ejecutar = false;
            }

            if (ID_EMPLEADO_EVALUADO != 0)
            {
                sql += ID_EMPLEADO_EVALUADO + ", ";
                informacion += "ID_EMPLEADO_EVALUADO = '" + ID_EMPLEADO_EVALUADO + "', ";
            }
            else
            {
                MensajeError += "El campo ID_EMPLEADO_EVALUADO no puede ser nulo\n";
                ejecutar = false;
            }

            if (ID_EMPLEADO_EVALUADOR != 0)
            {
                sql += ID_EMPLEADO_EVALUADOR + ", ";
                informacion += "ID_EMPLEADO_EVALUADOR = '" + ID_EMPLEADO_EVALUADOR + "', ";
            }
            else
            {
                MensajeError += "El campo ID_EMPLEADO_EVALUADOR no puede ser nulo\n";
                ejecutar = false;
            }

            sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_EVALUACION) + "', ";
            informacion += "FECHA_EVALUACION = '" + FECHA_EVALUACION.ToShortDateString() + "', ";

            if (PUNTAJE != 0)
            {
                sql += PUNTAJE.ToString().Replace(',', '.') + ", ";
                informacion += "PUNTAJE = '" + PUNTAJE.ToString().Replace(',', '.') + "', ";
            }
            else
            {
                sql += "0, ";
                informacion += "PUNTAJE = '0', ";
            }

            if (String.IsNullOrEmpty(CALIFICACION) == false)
            {
                sql += "'" + CALIFICACION + "', ";
                informacion += "CALIFICACION = '" + CALIFICACION + "', ";
            }
            else
            {
                MensajeError += "El campo CALIFICACION no puede ser nulo\n";
                ejecutar = false;
            }

            if (String.IsNullOrEmpty(FORTALEZAS) == false)
            {
                sql += "'" + FORTALEZAS + "', ";
                informacion += "FORTALEZAS = '" + FORTALEZAS + "', ";
            }
            else
            {
                sql += "null, ";
                informacion += "FORTALEZAS = 'null', ";
            }

            if (String.IsNullOrEmpty(OPORTUNIDADES_MEJORAS) == false)
            {
                sql += "'" + OPORTUNIDADES_MEJORAS + "', ";
                informacion += "OPORTUNIDADES_MEJORAS = '" + OPORTUNIDADES_MEJORAS + "', ";
            }
            else
            {
                sql += "null, ";
                informacion += "OPORTUNIDADES_MEJORAS = 'null', ";
            }

            if (String.IsNullOrEmpty(CURSOS_CAPACITACIONES) == false)
            {
                sql += "'" + CURSOS_CAPACITACIONES + "', ";
                informacion += "CURSOS_CAPACITACIONES = '" + CURSOS_CAPACITACIONES + "', ";
            }
            else
            {
                sql += "null, ";
                informacion += "CURSOS_CAPACITACIONES = 'null', ";
            }

            sql += "'" + Usuario + "'";
            informacion += "USU_CRE = '" + Usuario.ToString() + "'";

            if (ejecutar)
            {
                Conexion conexion = new Conexion(Empresa);
                try
                {
                    idRecuperado = Convert.ToDecimal(conexion.ExecuteScalar(sql));

                    #region auditoria
                    auditoria _auditoria = new auditoria(Empresa);
                    _auditoria.Adicionar(Usuario, tabla.GH_EVALUACIONES, tabla.ACCION_ADICIONAR, sql, informacion, conexion);
                    #endregion auditoria
                }
                catch (Exception e)
                {
                    MensajeError = e.Message;
                    idRecuperado = 0;
                }
                finally
                {
                    conexion.Desconectar();
                }
            }

            return idRecuperado;
        }
        public Decimal AdicionarConRequerimientos(String TIPO_REQ,
            DateTime FECHA_REQUERIDA,
            int ID_EMPRESA,
            int CANTIDAD,
            Decimal SALARIO,
            String HORARIO,
            String CIUDAD_CONTRATO,
            String DURACION,
            String OBS_REQUERIMIENTO,
            String CIUDAD_REQ,
            Decimal REGISTRO_PERFIL,
            Decimal ID_SERVICIO_COMPLEMENTARIO,
            Decimal REGISTRO_ENVIO_CANDIDATOS,
            DateTime FECHA_REFERECNIA_SSISTEMA)
        {
            String sql = null;
            String idRecComFuentes = null;
            String informacion = null;
            Boolean ejecutar = true;

            tools _tools = new tools();

            sql = "usp_con_requerimientos_adicionar ";

            #region validaciones

            if (!(String.IsNullOrEmpty(TIPO_REQ)))
            {
                sql += " '" + TIPO_REQ + "' , ";
                informacion += "TIPO_REQ= '" + TIPO_REQ.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo TIPO_REQ no puede ser nulo\n";
                ejecutar = false;
            }

            if (!(String.IsNullOrEmpty(FECHA_REQUERIDA.ToString())))
            {
                sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_REQUERIDA) + "', ";
                informacion += "FECHA_REQUERIDA= '" + FECHA_REQUERIDA.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo FECHA_REQUERIDA no puede ser nulo\n";
                ejecutar = false;
            }

            if (ID_EMPRESA != 0)
            {
                sql += ID_EMPRESA + ", ";
                informacion += "ID_EMPRESA= '" + ID_EMPRESA.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo ID_EMPRESA no puede ser nulo\n";
                ejecutar = false;
            }

            if (CANTIDAD != 0)
            {
                sql += CANTIDAD + ", ";
                informacion += "CANTIDAD = '" + CANTIDAD.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo CANTIDAD no puede ser nulo\n";
                ejecutar = false;
            }

            if (SALARIO != 0)
            {
                sql += SALARIO.ToString().Replace(',', '.') + ", ";
                informacion += "SALARIO = '" + SALARIO.ToString().Replace(',', '.') + "', ";
            }
            else
            {
                MensajeError += "El campo SALARIO no puede ser nulo\n";
                ejecutar = false;
            }

            if (!(String.IsNullOrEmpty(HORARIO)))
            {
                sql += " '" + HORARIO + "' , ";
                informacion += "HORARIO = '" + HORARIO.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo HORARIO no puede ser nulo\n";
                ejecutar = false;
            }

            if (!(String.IsNullOrEmpty(CIUDAD_CONTRATO)))
            {
                sql += " '" + CIUDAD_CONTRATO + "' , ";
                informacion += "CIUDAD_CONTRATO = '" + CIUDAD_CONTRATO.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo CIUDAD_CONTRATO no puede ser nulo\n";
                ejecutar = false;
            }

            if (!(String.IsNullOrEmpty(DURACION)))
            {
                sql += " '" + DURACION + "' , ";
                informacion += "DURACION = '" + DURACION.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo DURACION no puede ser nulo\n";
                ejecutar = false;
            }

            if (!(String.IsNullOrEmpty(OBS_REQUERIMIENTO)))
            {
                sql += " '" + OBS_REQUERIMIENTO + "' , ";
                informacion += "OBS_REQUERIMIENTO = '" + OBS_REQUERIMIENTO.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo OBS_REQUERIMIENTO no puede ser nulo\n";
                ejecutar = false;
            }

            if (!(String.IsNullOrEmpty(CIUDAD_REQ)))
            {
                sql += " '" + CIUDAD_REQ + "' , ";
                informacion += "CIUDAD_REQ = '" + CIUDAD_REQ.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo CIUDAD_REQ no puede ser nulo\n";
                ejecutar = false;
            }

            sql += "'" + Usuario + "', ";
            informacion += "USU_CRE = '" + Usuario.ToString() + "', ";

            if (REGISTRO_PERFIL != 0)
            {
                sql += REGISTRO_PERFIL + ", ";
                informacion += "REGISTRO_PERFIL= '" + REGISTRO_PERFIL.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo REGISTRO_PERFIL no puede ser nulo\n";
                ejecutar = false;
            }

            if (ID_SERVICIO_COMPLEMENTARIO != 0)
            {
                sql += ID_SERVICIO_COMPLEMENTARIO + ", ";
                informacion += "ID_SERVICIO_COMPLEMENTARIO= '" + ID_SERVICIO_COMPLEMENTARIO.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo ID_SERVICIO_COMPLEMENTARIO no puede ser nulo\n";
                ejecutar = false;
            }

            if (REGISTRO_ENVIO_CANDIDATOS != 0)
            {
                sql += REGISTRO_ENVIO_CANDIDATOS + ", ";
                informacion += "REGISTRO_ENVIO_CANDIDATOS= '" + REGISTRO_ENVIO_CANDIDATOS.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo REGISTRO_ENVIO_CANDIDATOS no puede ser nulo\n";
                ejecutar = false;
            }

            if (FECHA_REFERECNIA_SSISTEMA == new DateTime())
            {
                sql += "NULL";
                informacion += "FECHA_REFERENCIA_SISTEMA = 'NULL'";
            }
            else
            {
                sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_REFERECNIA_SSISTEMA) + "'";
                informacion += "FECHA_REFERENCIA_SISTEMA = '" + FECHA_REFERECNIA_SSISTEMA.ToShortDateString() + "'";
            }

            #endregion validaciones

            if (ejecutar)
            {
                Conexion conexion = new Conexion(Empresa);
                try
                {
                    idRecComFuentes = conexion.ExecuteScalar(sql);

                    #region auditoria
                    auditoria _auditoria = new auditoria(Empresa);
                    _auditoria.Adicionar(Usuario, tabla.CON_REQUERIMIENTOS, tabla.ACCION_ADICIONAR, sql, informacion, conexion);
                    #endregion auditoria
                }
                catch (Exception e)
                {
                    MensajeError = e.Message;
                }
                finally
                {
                    conexion.Desconectar();
                }
            }

            if (!(String.IsNullOrEmpty(idRecComFuentes))) return Convert.ToDecimal(idRecComFuentes);
            else return 0;
        }
        public Boolean AdicionarRegistroDetalleActividad(Decimal ID_PROGRAMA,
            Decimal ID_DETALLE_GENERAL,
            Decimal ID_ACTIVIDAD,
            String RESUMEN_ACTIVIDAD,
            DateTime FECHA_ACTIVIDAD,
            String HORA_INICIO,
            String HORA_FIN,
            Decimal PRESUPUESTO_APROBADO,
            Int32 PERSONAL_CITADO,
            String ENCARGADO,
            String ID_CIUDAD,
            Conexion conexion)
        {
            tools _tools = new tools();

            String sql = null;
            String informacion = null;
            Boolean ejecutar = true;

            IdPrograma = ID_PROGRAMA;
            IdDetalleSubPrograma = 0;
            IdDetalleActividad = 0;

            sql = "usp_prog_detalle_actividades_adicionar ";

            if (ID_PROGRAMA != 0)
            {
                sql += ID_PROGRAMA + ", ";
                informacion += "ID_PROGRAMA = '" + ID_PROGRAMA + "', ";
            }
            else
            {
                MensajeError += "El campo ID_EMPRESA no puede ser nulo\n";
                ejecutar = false;
            }

            if (ID_DETALLE_GENERAL != 0)
            {
                sql += ID_DETALLE_GENERAL + ", ";
                informacion += "ID_DETALLE_GENERAL = '" + ID_DETALLE_GENERAL + "', ";
            }
            else
            {
                MensajeError += "El campo ID_DETALLE_GENERAL no puede ser nulo\n";
                ejecutar = false;
            }

            if (ID_ACTIVIDAD != 0)
            {
                sql += ID_ACTIVIDAD + ", ";
                informacion += "ID_ACTIVIDAD = '" + ID_ACTIVIDAD + "', ";
            }
            else
            {
                MensajeError += "El campo ID_ACTIVIDAD no puede ser nulo\n";
                ejecutar = false;
            }

            if (String.IsNullOrEmpty(RESUMEN_ACTIVIDAD) == false)
            {
                sql += "'" + RESUMEN_ACTIVIDAD + "', ";
                informacion += "RESUMEN_ACTIVIDAD = '" + RESUMEN_ACTIVIDAD + "', ";
            }
            else
            {
                MensajeError += "El campo RESUMEN_ACTIVIDAD no puede ser nulo\n";
                ejecutar = false;
            }

            sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_ACTIVIDAD) + "', ";
            informacion += "FECHA_ACTIVIDAD = '" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_ACTIVIDAD) + "', ";

            if (String.IsNullOrEmpty(HORA_INICIO) == false)
            {
                sql += "'" + HORA_INICIO + "', ";
                informacion += "HORA_INICIO = '" + HORA_INICIO + "', ";
            }
            else
            {
                MensajeError += "El campo HORA_INICIO no puede ser nulo\n";
                ejecutar = false;
            }

            if (String.IsNullOrEmpty(HORA_FIN) == false)
            {
                sql += "'" + HORA_FIN + "', ";
                informacion += "HORA_FIN = '" + HORA_FIN + "', ";
            }
            else
            {
                MensajeError += "El campo HORA_FIN no puede ser nulo\n";
                ejecutar = false;
            }

            sql += PRESUPUESTO_APROBADO.ToString().Replace(',', '.') + ", ";
            informacion += "PRESUPUESTO_APROBADO = '" + PRESUPUESTO_APROBADO.ToString().Replace(',', '.') + "', ";

            sql += PERSONAL_CITADO.ToString() + ", ";
            informacion += "PERSONAL_CITADO = '" + PERSONAL_CITADO.ToString() + "', ";

            sql += "'" + Usuario + "', ";
            informacion += "USU_CRE = '" + Usuario.ToString() + "', ";

            if (String.IsNullOrEmpty(ENCARGADO) == false)
            {
                sql += "'" + ENCARGADO + "', ";
                informacion += "ENCARGADO = '" + ENCARGADO + "', ";
            }
            else
            {
                MensajeError += "El campo ENCARGADO no puede ser nulo\n";
                ejecutar = false;
            }

            if (String.IsNullOrEmpty(ID_CIUDAD) == false)
            {
                sql += "'" + ID_CIUDAD + "'";
                informacion += "ID_CIUDAD = '" + ID_CIUDAD + "'";
            }
            else
            {
                MensajeError += "El campo ID_CIUDAD no puede ser nulo\n";
                ejecutar = false;
            }

            if (ejecutar)
            {
                try
                {
                    IdDetalleActividad = Convert.ToDecimal(conexion.ExecuteScalar(sql));

                    #region auditoria
                    auditoria _auditoria = new auditoria(Empresa);
                    _auditoria.Adicionar(Usuario, tabla.PROG_DETALLE_ACTIVIDADES, tabla.ACCION_ADICIONAR, sql, informacion, conexion);
                    #endregion auditoria
                }
                catch (Exception e)
                {
                    MensajeError = e.Message;
                    IdDetalleActividad = 0;
                }
            }

            if (IdDetalleActividad == 0)
            {
                return false;
            }
            else
            {
                return true;
            }
        }
        public Decimal AdicionarRegistroCompromisoEnActividad(Decimal ID_ACTIVIDAD_GENERA,
            String NOMBRE_ACTIVIDAD_GENERA,
            String TIPO_GENERA,
            String COMPROMISO,
            String USU_LOG_RESPONSABLE,
            DateTime FECHA_P,
            String OBSERVACIONES,
            String ESTADO,
            String ID_AREA,
            Conexion conexion)
        {
            tools _tools = new tools();

            String sql = null;
            String informacion = null;
            Boolean ejecutar = true;

            Decimal idMaestraCompromiso = 0;

            sql = "usp_prog_compromisos_adicionar ";

            if (ID_ACTIVIDAD_GENERA != 0)
            {
                sql += ID_ACTIVIDAD_GENERA + ", ";
                informacion += "ID_ACTIVIDAD_GENERA = '" + ID_ACTIVIDAD_GENERA + "', ";
            }
            else
            {
                MensajeError += "El campo ID_ACTIVIDAD_GENERA no puede ser nulo\n";
                ejecutar = false;
            }

            if (String.IsNullOrEmpty(NOMBRE_ACTIVIDAD_GENERA) == false)
            {
                sql += "'" + NOMBRE_ACTIVIDAD_GENERA + "', ";
                informacion += "NOMBRE_ACTIVIDAD_GENERA = '" + NOMBRE_ACTIVIDAD_GENERA + "', ";
            }
            else
            {
                MensajeError += "El campo NOMBRE_ACTIVIDAD_GENERA no puede ser nulo\n";
                ejecutar = false;
            }

            sql += "'" + TIPO_GENERA.ToString() + "', ";
            informacion += "TIPO_GENERA = '" + TIPO_GENERA.ToString() + "', ";

            if (String.IsNullOrEmpty(COMPROMISO) == false)
            {
                sql += "'" + COMPROMISO + "', ";
                informacion += "COMPROMISO = '" + COMPROMISO + "', ";
            }
            else
            {
                MensajeError += "El campo COMPROMISO no puede ser nulo\n";
                ejecutar = false;
            }

            if (String.IsNullOrEmpty(USU_LOG_RESPONSABLE) == false)
            {
                sql += "'" + USU_LOG_RESPONSABLE + "', ";
                informacion += "USU_LOG_RESPONSABLE = '" + USU_LOG_RESPONSABLE + "', ";
            }
            else
            {
                MensajeError += "El campo USU_LOG_RESPONSABLE no puede ser nulo\n";
                ejecutar = false;
            }

            sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_P) + "', ";
            informacion += "FECHA_P = '" + FECHA_P.ToShortDateString() + "', ";

            if (String.IsNullOrEmpty(OBSERVACIONES) == false)
            {
                sql += "'" + OBSERVACIONES + "', ";
                informacion += "OBSERVACIONES = '" + OBSERVACIONES + "', ";
            }
            else
            {
                MensajeError += "El campo OBSERVACIONES no puede ser nulo\n";
                ejecutar = false;
            }

            if (String.IsNullOrEmpty(ESTADO) == false)
            {
                sql += "'" + ESTADO + "', ";
                informacion += "ESTADO = '" + ESTADO + "', ";
            }
            else
            {
                MensajeError += "El campo ESTADO no puede ser nulo\n";
                ejecutar = false;
            }

            sql += "'" + Usuario + "', ";
            informacion += "USU_CRE = '" + Usuario.ToString() + "', ";

            if (String.IsNullOrEmpty(ID_AREA) == false)
            {
                sql += "'" + ID_AREA + "'";
                informacion += "ID_AREA = '" + ID_AREA + "'";
            }
            else
            {
                MensajeError += "El campo ID_AREA no puede ser nulo\n";
                ejecutar = false;
            }

            if (ejecutar)
            {
                try
                {
                    idMaestraCompromiso = Convert.ToDecimal(conexion.ExecuteScalar(sql));

                    #region auditoria
                    auditoria _auditoria = new auditoria(Empresa);
                    _auditoria.Adicionar(Usuario, tabla.PROG_MAESTRA_COMPROMISOS, tabla.ACCION_ADICIONAR, sql, informacion, conexion);
                    #endregion auditoria
                }
                catch (Exception e)
                {
                    MensajeError = e.Message;
                    idMaestraCompromiso = 0;
                }
            }

            return idMaestraCompromiso;
        }
        public Decimal AdicionarCorteInformeCliente(Decimal ID_PROGRAMA,
            DateTime FECHA_INICIAL,
            DateTime FECHA_FINAL,
            String CONCLUSIONES)
        {
            tools _tools = new tools();

            String sql = null;
            String informacion = null;
            Boolean ejecutar = true;

            Decimal ID_CORTE = 0;

            sql = "usp_prog_cortes_informes_clientes_adicionar_o_actualziar ";
            if (ID_PROGRAMA != 0)
            {
                sql += ID_PROGRAMA + ", ";
                informacion += "ID_PROGRAMA = '" + ID_PROGRAMA + "', ";
            }
            else
            {
                ejecutar = false;
                MensajeError = "El campo ID_PROGRAMA no puede ser vacio.";
            }

            sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_INICIAL) + "', ";
            informacion += "FECHA_INICIAL = '" + FECHA_INICIAL.ToShortDateString() + "', ";

            sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_FINAL) + "', ";
            informacion += "FECHA_FINAL = '" + FECHA_FINAL.ToShortDateString() + "', ";

            if (String.IsNullOrEmpty(CONCLUSIONES) == false)
            {
                sql += "'" + CONCLUSIONES + "', ";
                informacion += "CONCLUSIONES = '" + CONCLUSIONES + "', ";
            }
            else
            {
                ejecutar = false;
                MensajeError = "El campo CONCLUSIONES no puede ser vacio.";
            }

            sql += "'" + Usuario + "'";
            informacion += "USU_CRE = '" + Usuario.ToString() + "'";

            if (ejecutar)
            {
                Conexion conexion = new Conexion(Empresa);
                conexion.IniciarTransaccion();

                try
                {
                    ID_CORTE = Convert.ToDecimal(conexion.ExecuteScalar(sql));

                    #region auditoria
                    auditoria _auditoria = new auditoria(Empresa);
                    _auditoria.Adicionar(Usuario, tabla.PROG_CORTES_INFORMES_CLIENTES, tabla.ACCION_ADICIONAR, sql, informacion, conexion);
                    #endregion auditoria

                    conexion.AceptarTransaccion();
                }
                catch (Exception e)
                {
                    MensajeError = e.Message;
                    ID_CORTE = 0;
                    conexion.DeshacerTransaccion();
                }
                finally
                {
                    conexion.Desconectar();
                }
            }
            else
            {
                ID_CORTE = 0;
            }

            return ID_CORTE;
        }
        public DataTable ObtenerListaActividadesParaPDFInformeClientes(Decimal ID_PROGRAMA,
            Decimal ID_CORTE,
            DateTime FECHA_INICIAL,
            DateTime FECHA_FINAL)
        {
            tools _tools = new tools();

            Conexion conexion = new Conexion(Empresa);
            DataSet _dataSet = new DataSet();
            DataView _dataView = new DataView();
            DataTable _dataTable = new DataTable();
            String sql = null;
            Boolean ejecutar = true;

            sql = "RPT_PROGRAMAS_PDF_INFORME_CLIENTES ";
            if (ID_PROGRAMA != 0)
            {
                sql += ID_PROGRAMA + ", ";
            }
            else
            {
                ejecutar = false;
                MensajeError = "El campo ID_PROGRAMA no puede ser 0.";
            }

            if (ID_CORTE != 0)
            {
                sql += ID_CORTE + ", ";
            }
            else
            {
                ejecutar = false;
                MensajeError = "El campo ID_CORTE no puede ser 0.";
            }

            sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_INICIAL) + "', ";

            sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_FINAL) + "'";

            if (ejecutar)
            {
                try
                {
                    _dataSet = conexion.ExecuteReader(sql);
                    _dataView = _dataSet.Tables[0].DefaultView;
                    _dataTable = _dataView.Table;
                }
                catch (Exception e)
                {
                    MensajeError = e.Message;
                }
                finally
                {
                    conexion.Desconectar();
                }
            }

            return _dataTable;
        }
        public DataTable ObtenerDetalleActividadesPorFecha(DateTime fecha,
            Areas area,
            String encargado,
            String idEmpresa,
            String regional,
            String ciudad,
            String estado)
        {
            tools _tools = new tools();

            Conexion conexion = new Conexion(Empresa);
            DataSet _dataSet = new DataSet();
            DataView _dataView = new DataView();
            DataTable _dataTable = new DataTable();
            String sql = null;
            Boolean ejecutar = true;

            sql = "usp_prog_detalle_actividades_obtenerPorFecha ";

            sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(fecha) + "', '" + area.ToString() + "', ";
            sql += "'" + encargado + "', '" + idEmpresa + "', '" + regional + "', '" + ciudad + "', '" + estado + "', ";
            sql += "'" + Usuario + "'";

            if (ejecutar)
            {
                try
                {
                    _dataSet = conexion.ExecuteReader(sql);
                    _dataView = _dataSet.Tables[0].DefaultView;
                    _dataTable = _dataView.Table;
                }
                catch (Exception e)
                {
                    MensajeError = e.Message;
                }
                finally
                {
                    conexion.Desconectar();
                }
            }

            return _dataTable;
        }
        public DataTable ObtenerCorteinformeClientePorIdProgramaYPeriodo(Decimal ID_PROGRAMA, DateTime FECHA_INICIAL, DateTime FECHA_FINAL)
        {
            tools _tools = new tools();

            Conexion conexion = new Conexion(Empresa);
            DataSet _dataSet = new DataSet();
            DataView _dataView = new DataView();
            DataTable _dataTable = new DataTable();
            String sql = null;
            Boolean ejecutar = true;

            sql = "usp_prog_cortes_informes_clientes_obtenerPorIdProgramaYPeriodo ";

            if (ID_PROGRAMA != 0)
            {
                sql += ID_PROGRAMA + ", ";
            }
            else
            {
                ejecutar = false;
                MensajeError = "El campo ID_PROGRAMA no puede ser vacio.";
            }

            sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_INICIAL) + "', ";

            sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_FINAL) + "'";

            if (ejecutar)
            {
                try
                {
                    _dataSet = conexion.ExecuteReader(sql);
                    _dataView = _dataSet.Tables[0].DefaultView;
                    _dataTable = _dataView.Table;
                }
                catch (Exception e)
                {
                    MensajeError = e.Message;
                }
                finally
                {
                    conexion.Desconectar();
                }
            }

            return _dataTable;
        }
        public Decimal AdicionarRecComFuentes(Decimal ID_FUENTE, DateTime FECHA_R, String OBSERVACIONES)
        {
            String sql = null;
            String idRecComFuentes = null;
            String informacion = null;
            Boolean ejecutar = true;

            tools _tools = new tools();

            sql = "usp_rec_com_fuentes_adicionar ";

            #region validaciones

            if (ID_FUENTE != 0)
            {
                sql += ID_FUENTE + ", ";
                informacion += "ID_FUENTE= '" + ID_FUENTE.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo ID_FUENTE no puede ser nulo\n";
                ejecutar = false;
            }
            if (!(String.IsNullOrEmpty(FECHA_R.ToString())))
            {
                sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_R) + "', ";
                informacion += "FECHA_R= '" + FECHA_R.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo FECHA_R no puede ser nulo\n";
                ejecutar = false;
            }

            if (!(String.IsNullOrEmpty(OBSERVACIONES)))
            {
                sql += "'" + OBSERVACIONES + "', ";
                informacion += "OBSERVACIONES= '" + OBSERVACIONES.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo OBSERVACIONES no puede ser nulo\n";
                ejecutar = false;
            }

            sql += "'" + Usuario + "' ";
            informacion += "USU_CRE = '" + Usuario.ToString() + "' ";

            #endregion validaciones

            if (ejecutar)
            {
                Conexion conexion = new Conexion(Empresa);
                try
                {
                    idRecComFuentes = conexion.ExecuteScalar(sql);

                    #region auditoria
                    auditoria _auditoria = new auditoria(Empresa);
                    _auditoria.Adicionar(Usuario, tabla.REC_COM_FUENTES, tabla.ACCION_ADICIONAR, sql, informacion, conexion);
                    #endregion auditoria
                }
                catch (Exception e)
                {
                    MensajeError = e.Message;
                }
                finally
                {
                    conexion.Desconectar();
                }
            }

            if (!(String.IsNullOrEmpty(idRecComFuentes))) return Convert.ToDecimal(idRecComFuentes);
            else return 0;
        }
        public Decimal AdicionarConRegSeg(int ID_REQUERIMIENTO, DateTime FECHA_R, String ACCION, String COMENTARIOS)
        {
            String sql = null;
            String idRecComFuentes = null;
            String informacion = null;
            Boolean ejecutar = true;

            tools _tools = new tools();

            sql = "usp_con_req_seg_adicionar ";
            #region validaciones

            if (ID_REQUERIMIENTO != 0)
            {
                sql += ID_REQUERIMIENTO + ", ";
                informacion += "ID_REQUERIMIENTO= '" + ID_REQUERIMIENTO.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo ID_REQUERIMIENTO no puede ser nulo\n";
                ejecutar = false;
            }

            if (!(String.IsNullOrEmpty(FECHA_R.ToString())))
            {
                sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_R) + "', ";
                informacion += "FECHA_R= '" + FECHA_R.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo FECHA_R no puede ser nulo\n";
                ejecutar = false;
            }
            if (!(String.IsNullOrEmpty(ACCION)))
            {
                sql += "'" + ACCION + "', ";
                informacion += "ACCION= '" + ACCION.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo COMENTARIOS no puede ser nulo\n";
                ejecutar = false;
            }
            if (!(String.IsNullOrEmpty(COMENTARIOS)))
            {
                sql += "'" + COMENTARIOS + "', ";
                informacion += "COMENTARIOS= '" + COMENTARIOS.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo COMENTARIOS no puede ser nulo\n";
                ejecutar = false;
            }

            sql += "'" + Usuario + "' ";
            informacion += "USU_MOD = '" + Usuario.ToString() + "' ";

            #endregion validaciones

            if (ejecutar)
            {
                Conexion conexion = new Conexion(Empresa);
                try
                {
                    idRecComFuentes = conexion.ExecuteScalar(sql);

                    #region auditoria
                    auditoria _auditoria = new auditoria(Empresa);
                    _auditoria.Adicionar(Usuario, tabla.CON_REQ_SEG, tabla.ACCION_ADICIONAR, sql, informacion, conexion);
                    #endregion auditoria
                }
                catch (Exception e)
                {
                    MensajeError = e.Message;
                }
                finally
                {
                    conexion.Desconectar();
                }
            }

            if (!(String.IsNullOrEmpty(idRecComFuentes))) return Convert.ToDecimal(idRecComFuentes);
            else return 0;
        }
        public Boolean Actualizar(Decimal REGISTRO, Decimal ID_SOLICITUD, DateTime FECHA_R, String OBS_REG)
        {
            String sql = null;
            String informacion = null;
            Boolean ejecutar = true;
            Boolean ejecutadoCorrectamente = true;

            tools _tools = new tools();

            sql = "usp_reg_llamados_atencion_actualizar ";

            #region validaciones
            if (REGISTRO != 0)
            {
                sql += REGISTRO + ", ";
                informacion += "REGISTRO = " + REGISTRO + ", ";
            }
            else
            {
                MensajeError += "El campo REGISTRO no puede ser 0\n";
                ejecutar = false;
            }

            if (ID_SOLICITUD != 0)
            {
                sql += ID_SOLICITUD + ", ";
                informacion += "ID_SOLICITUD = " + ID_SOLICITUD + ", ";
            }
            else
            {
                MensajeError += "El campo ID_SOLICITUD no puede ser 0\n";
                ejecutar = false;
            }

            if (!(String.IsNullOrEmpty(FECHA_R.ToString())))
            {
                sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_R) + "', ";
                informacion += "FECHA_R = '" + FECHA_R.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo FECHA_R no puede ser nulo\n";
                ejecutar = false;
            }

            if (!(String.IsNullOrEmpty(OBS_REG)))
            {
                sql += "'" + OBS_REG + "', ";
                informacion += "OBS_REG = '" + OBS_REG + "', ";
            }
            else
            {
                MensajeError += "El campo OBS_REG no puede ser nulo\n";
                ejecutar = false;
            }

            sql += "'" + Usuario + "' ";
            informacion += "USU_CRE = '" + Usuario.ToString() + "' ";
            #endregion validaciones

            if (ejecutar)
            {
                Conexion conexion = new Conexion(Empresa);
                conexion.IniciarTransaccion();
                try
                {
                    #region adicionar entidad
                    if (conexion.ExecuteNonQuery(sql) == 0) ejecutadoCorrectamente = false;
                    #endregion adicionar entidad

                    #region auditoria
                    auditoria _auditoria = new auditoria(Empresa);
                    if (!(_auditoria.Adicionar(Usuario, tabla.REG_LLAMADOS_ATENCION, tabla.ACCION_ACTUALIZAR, sql, informacion, conexion))) ejecutadoCorrectamente = false;
                    #endregion auditoria

                    conexion.AceptarTransaccion();
                }
                catch (Exception e)
                {
                    conexion.DeshacerTransaccion();
                    MensajeError = e.Message;
                }
                finally
                {
                    conexion.Desconectar();
                }
            }

            if (ejecutadoCorrectamente) return true;
            else return false;
        }
        private Boolean ActualizarRegistroVEN_EMPRESAS(Decimal ID_EMPRESA
            , String ACTIVO
            , DateTime FCH_INGRESO
            , String NIT_EMPRESA
            , String ACT_ECO
            , String RAZ_SOCIAL
            , String DIR_EMP
            , String CIU_EMP
            , String TEL_EMP
            , String CUB_CIUDADES
            , String NOM_REP_LEGAL
            , String CC_REP_LEGAL
            , String TIPO_EMPRESA
            , String CIU_ORG_NEG
            , Int32 NUM_EMPLEADOS
            , String USU_MOD
            , String FAC_NAL
            , Decimal ID_ALIANZA
            , Int32 DIG_VER
            , String EMP_ESTADO
            , String EMP_EXC_IVA
            , String TEL_EMP1
            , String NUM_CELULAR
            , String ID_ACTIVIDAD
            , Decimal ID_GRUPO_EMPRESARIAL
            , String ID_CIUDAD_CC_REP_LEGAL
            , String ID_SERVICIO
            , String TIP_DOC_REP_LEGAL
            , Conexion conexion)
        {
            String sql = null;
            Boolean ejecutar = true;
            String informacion = null;

            tools _tools = new tools();

            Boolean verificador = true;

            sql = "usp_ven_empresas_actualizar ";

            #region validaciones
            if (ID_EMPRESA != 0)
            {
                sql += ID_EMPRESA + ", ";
                informacion += "ID_EMPRESA = " + ID_EMPRESA.ToString() + ", ";
            }
            else
            {
                MensajeError = "El campo ID EMPRESA no puede ser 0\n";
                ejecutar = false;
            }

            if (!(String.IsNullOrEmpty(ACTIVO)))
            {
                sql += "'" + ACTIVO + "', ";
                informacion += "ACTIVO = '" + ACTIVO.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo ACTIVO no puede ser nulo. \n";
                ejecutar = false;
            }

            if (!(String.IsNullOrEmpty(FCH_INGRESO.ToString())))
            {
                sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FCH_INGRESO) + "', ";
                informacion += "FCH_INGRESO = '" + _tools.obtenerStringConFormatoFechaSQLServer(FCH_INGRESO) + "', ";
            }
            else
            {
                MensajeError += "El campo FECHA DE INGRESO no puede ser nulo. \n";
                ejecutar = false;
            }

            if (!(String.IsNullOrEmpty(NIT_EMPRESA)))
            {
                sql += "'" + NIT_EMPRESA + "', ";
                informacion += "NIT_EMPRESA = '" + NIT_EMPRESA.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo NIT DE EMPRESA no puede ser nulo. \n";
                ejecutar = false;
            }

            if (!(String.IsNullOrEmpty(ACT_ECO)))
            {
                sql += "'" + ACT_ECO + "', ";
                informacion += "ACT_ECO = '" + ACT_ECO.ToString() + "', ";
            }
            else
            {
                sql += "null, ";
                informacion += "ACT_ECO = 'null', ";
            }

            if (!(String.IsNullOrEmpty(RAZ_SOCIAL)))
            {
                sql += "'" + RAZ_SOCIAL + "', ";
                informacion += "RAZ_SOCIAL = '" + RAZ_SOCIAL.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo RAZON SOCIAL no puede ser nulo. \n";
                ejecutar = false;
            }

            if (!(String.IsNullOrEmpty(DIR_EMP)))
            {
                sql += "'" + DIR_EMP + "', ";
                informacion += "DIR_EMP = '" + DIR_EMP.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo DIRECCION DE LA EMPRESA no puede ser nulo. \n";
                ejecutar = false;
            }

            if (!(String.IsNullOrEmpty(CIU_EMP)))
            {
                sql += "'" + CIU_EMP + "', ";
                informacion += "CIU_EMP = '" + CIU_EMP.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo CIUDAD DE LA EMPRESA no puede ser nulo. \n";
                ejecutar = false;
            }

            if (!(String.IsNullOrEmpty(TEL_EMP)))
            {
                sql += "'" + TEL_EMP + "', ";
                informacion += "TEL_EMP = '" + TEL_EMP.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo TELEFONO DE LA EMPRESA no puede ser nulo. \n";
                ejecutar = false;
            }

            if (!(String.IsNullOrEmpty(CUB_CIUDADES)))
            {
                sql += "'" + CUB_CIUDADES + "', ";
                informacion += "CUB_CIUDADES = '" + CUB_CIUDADES.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo CUBRIMIENTO CIUDADES no puede ser nulo. \n";
                ejecutar = false;
            }

            if (!(String.IsNullOrEmpty(NOM_REP_LEGAL)))
            {
                sql += "'" + NOM_REP_LEGAL + "', ";
                informacion += "NOM_REP_LEGAL = '" + NOM_REP_LEGAL.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo NOMBRE DEL REPRESENTANTE LEGAL no puede ser nulo. \n";
                ejecutar = false;
            }

            if (!(String.IsNullOrEmpty(CC_REP_LEGAL)))
            {
                sql += "'" + CC_REP_LEGAL + "', ";
                informacion += "CC_REP_LEGAL = '" + CC_REP_LEGAL.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo CIUDAD DEL REPRESENTANTE LEGAL no puede ser nulo. \n";
                ejecutar = false;
            }

            if (!(String.IsNullOrEmpty(TIPO_EMPRESA)))
            {
                sql += "'" + TIPO_EMPRESA + "', ";
                informacion += "TIPO_EMPRESA = '" + TIPO_EMPRESA.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo TIPO DE EMPRESA no puede ser nulo. \n";
                ejecutar = false;
            }

            if (!(String.IsNullOrEmpty(CIU_ORG_NEG)))
            {
                sql += "'" + CIU_ORG_NEG + "', ";
                informacion += "CIU_ORG_NEG = '" + CIU_ORG_NEG.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo CIUDAD ORIGEN DEL NEGOCIO no puede ser nulo. \n";
                ejecutar = false;
            }

            if (NUM_EMPLEADOS != 0)
            {
                sql += NUM_EMPLEADOS + ", ";
                informacion += "NUM_EMPLEADOS = " + NUM_EMPLEADOS.ToString() + ", ";
            }
            else
            {
                MensajeError += "El campo NUMERO DE EMPLEADOS no puede ser nulo. \n";
                ejecutar = false;
            }

            if (!(String.IsNullOrEmpty(USU_MOD)))
            {
                sql += "'" + USU_MOD + "', ";
                informacion += "USU_MOD = '" + USU_MOD.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo USUARIO no puede ser nulo. \n";
                ejecutar = false;
            }

            if (!(String.IsNullOrEmpty(FAC_NAL)))
            {
                sql += "'" + FAC_NAL + "', ";
                informacion += "FAC_NAL = '" + FAC_NAL.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo FACTURA NACIONAL no puede ser nulo. \n";
                ejecutar = false;
            }

            sql += ID_ALIANZA + ", ";
            informacion += "ID_ALIANZA = " + ID_ALIANZA.ToString() + ", ";

            if (DIG_VER != 0)
            {
                sql += DIG_VER + ", ";
                informacion += "DIG_VER = '" + DIG_VER.ToString() + "', ";
            }
            else
            {
                sql += "0, ";
                informacion += "DIG_VER = '0', ";
            }

            if (!(String.IsNullOrEmpty(EMP_ESTADO)))
            {
                sql += "'" + EMP_ESTADO + "', ";
                informacion += "EMP_ESTADO = '" + EMP_ESTADO.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo ESTADO DE LA EMPRESA no puede ser nulo. \n";
                ejecutar = false;
            }

            if (!(String.IsNullOrEmpty(EMP_EXC_IVA)))
            {
                sql += "'" + EMP_EXC_IVA + "', ";
                informacion += "EMP_EXC_IVA = '" + EMP_EXC_IVA.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo EXCENTO DE IVA no puede vacio. \n";
                ejecutar = false;
            }

            if (!(String.IsNullOrEmpty(TEL_EMP1)))
            {
                sql += "'" + TEL_EMP1 + "', ";
                informacion += "TEL_EMP1 = '" + TEL_EMP1.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo TELEFONO 1 DE LA EMPRESA no puede ser nulo. \n";
                ejecutar = false;
            }

            if (!(String.IsNullOrEmpty(NUM_CELULAR)))
            {
                sql += "'" + NUM_CELULAR + "', ";
                informacion += "NUM_CELULAR = '" + NUM_CELULAR.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo NUMERO DE CELULAR no puede ser vacio. \n";
                ejecutar = false;
            }

            if (!(String.IsNullOrEmpty(ID_ACTIVIDAD)))
            {
                sql += "'" + ID_ACTIVIDAD + "', ";
                informacion += "ID_ACTIVIDAD = '" + ID_ACTIVIDAD.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo ACTIVIDAD no puede ser nulo. \n";
                ejecutar = false;
            }

            sql += ID_GRUPO_EMPRESARIAL + ", ";
            informacion += "ID_GRUPO_EMPRESARIAL = " + ID_GRUPO_EMPRESARIAL.ToString() + ", ";

            if (String.IsNullOrEmpty(ID_CIUDAD_CC_REP_LEGAL) == false)
            {
                sql += "'" + ID_CIUDAD_CC_REP_LEGAL + "', ";
                informacion += "ID_CIUDAD_CC_REP_LEGAL = '" + ID_CIUDAD_CC_REP_LEGAL.ToString() + "', ";
            }
            else
            {
                sql += "null, ";
                informacion += "ID_CIUDAD_CC_REP_LEGAL = 'null', ";
            }

            if (!(String.IsNullOrEmpty(ID_SERVICIO)))
            {
                sql += "'" + ID_SERVICIO + "', ";
                informacion += "ID_SERVICIO = '" + ID_SERVICIO.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo SERVICIO no puede ser vacio. \n";
                ejecutar = false;
            }

            if (String.IsNullOrEmpty(TIP_DOC_REP_LEGAL) == false)
            {
                sql += "'" + TIP_DOC_REP_LEGAL + "'";
                informacion += "TIP_DOC_REP_LEGAL = '" + TIP_DOC_REP_LEGAL + "'";
            }
            else
            {
                MensajeError += "El campo TIP_DOC_REP_LEGAL no puede ser vacio. \n";
                ejecutar = false;
            }
            #endregion validaciones

            if (ejecutar == true)
            {
                try
                {
                    if (conexion.ExecuteNonQuery(sql) <= 0)
                    {
                        verificador = false;
                        MensajeError = "No se pudo realizar la actualización del cliente, error en UPDATE.";
                    }
                    else
                    {
                        #region auditoria
                        auditoria _auditoria = new auditoria(Empresa);
                        if (_auditoria.Adicionar(USU_MOD, tabla.VEN_EMPRESAS, tabla.ACCION_ACTUALIZAR.ToString(), sql, informacion, conexion) == false)
                        {
                            verificador = false;
                            MensajeError = _auditoria.MensajError;
                        }
                        #endregion auditoria
                    }
                }
                catch (Exception ex)
                {
                    verificador = false;
                    MensajeError = ex.Message;
                }
            }
            else
            {
                verificador = false;
            }

            return verificador;
        }
        public Decimal AdicionarconafiliacionfpensionesAuditoria(int ID_SOLICITUD, int ID_F_PENSIONES, DateTime FECHA_R, String OBSERVACIONES, String PENSIONADO, int ID_REQUERIMIENTO)
        {
            String sql = null;
            String identificador = null;
            String informacion = null;
            Boolean ejecutar = true;

            tools _tools = new tools();

            sql = "usp_con_afiliacion_f_pensiones_adicionar_auditoria ";

            #region validaciones
            if (ID_SOLICITUD != 0)
            {
                sql += ID_SOLICITUD + ", ";
                informacion += "ID_SOLICITUD= '" + ID_SOLICITUD.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo ID_SOLICITUD no puede ser nulo\n";
                ejecutar = false;
            }
            if (ID_F_PENSIONES != 0)
            {
                sql += ID_F_PENSIONES + ", ";
                informacion += "ID_F_PENSIONES= '" + ID_F_PENSIONES.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo ID_F_PENSIONES no puede ser nulo\n";
                ejecutar = false;
            }
            if (!(String.IsNullOrEmpty(FECHA_R.ToString())))
            {
                sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_R) + "', ";
                informacion += "FECHA_R= '" + FECHA_R.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo FECHA_R no puede ser nulo\n";
                ejecutar = false;
            }
            if (!(String.IsNullOrEmpty(OBSERVACIONES)))
            {
                sql += "'" + OBSERVACIONES + "', ";
                informacion += "OBSERVACIONES= '" + OBSERVACIONES.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo OBSERVACIONES no puede ser nulo\n";
                ejecutar = false;
            }
            if (!(String.IsNullOrEmpty(PENSIONADO)))
            {
                sql += "'" + PENSIONADO + "', ";
                informacion += "PENSIONADO= '" + PENSIONADO.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo PENSIONADO no puede ser nulo\n";
                ejecutar = false;
            }

            sql += "'" + Usuario + "', ";
            informacion += "USU_CRE= '" + Usuario.ToString() + "', ";

            if (ID_REQUERIMIENTO != 0)
            {
                sql += ID_REQUERIMIENTO;
                informacion += "ID_REQUERIMIENTO= '" + ID_REQUERIMIENTO.ToString() + "'";
            }
            else
            {
                MensajeError += "El campo ID_REQUERIMIENTO no puede ser nulo\n";
                ejecutar = false;
            }

            #endregion validaciones

            if (ejecutar)
            {
                Conexion conexion = new Conexion(Empresa);
                try
                {
                    identificador = conexion.ExecuteScalar(sql);

                    #region auditoria
                    auditoria _auditoria = new auditoria(Empresa);
                    _auditoria.Adicionar(Usuario, tabla.CON_AFILIACION_F_PENSIONES, tabla.ACCION_ADICIONAR, sql, informacion, conexion);
                    #endregion auditoria
                }
                catch (Exception e)
                {
                    MensajeError = e.Message;
                }
                finally
                {
                    conexion.Desconectar();
                }
            }

            if (!(String.IsNullOrEmpty(identificador))) return Convert.ToDecimal(identificador);
            else return 0;
        }
        public Boolean Actualizar(Decimal ID_EVALUACION,
            Decimal ID_EMPLEADO_EVALUADOR,
            DateTime FECHA_EVALUACION,
            Decimal PUNTAJE,
            String CALIFICACION,
            String FORTALEZAS,
            String OPORTUNIDAD_MEJORAS,
            String CURSOS_CAPACITACIONES)
        {
            Conexion conexion = new Conexion(Empresa);
            String sql = null;
            String informacion = null;
            Boolean ejecutar = true;
            Boolean ejecutadoCorrectamente = true;

            tools _tools = new tools();

            sql = "usp_gh_evaluaciones_actualizar ";

            #region validaciones

            if (ID_EVALUACION != 0)
            {
                sql += ID_EVALUACION + ", ";
                informacion += "ID_EVALUACION = '" + ID_EVALUACION + "', ";
            }
            else
            {
                MensajeError = "El campo ID_EVALUACION no puede ser vacio.";
                ejecutar = false;
            }

            if (ID_EMPLEADO_EVALUADOR != 0)
            {
                sql += ID_EMPLEADO_EVALUADOR + ", ";
                informacion += "ID_EMPLEADO_EVALUADOR = '" + ID_EMPLEADO_EVALUADOR + "', ";
            }
            else
            {
                MensajeError = "El campo ID_EMPLEADO_EVALUADOR no puede ser vacio.";
                ejecutar = false;
            }

            sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_EVALUACION) + "', ";
            informacion += "FECHA_EVALUACION = '" + FECHA_EVALUACION.ToShortDateString() + "', ";

            if (ID_EMPLEADO_EVALUADOR != 0)
            {
                sql += PUNTAJE.ToString().Replace(',', '.') + ", ";
                informacion += "PUNTAJE = '" + PUNTAJE.ToString().Replace(',', '.') + "', ";
            }
            else
            {
                sql += "0, ";
                informacion += "PUNTAJE = '0', ";
            }

            if (String.IsNullOrEmpty(CALIFICACION) == false)
            {
                sql += "'" + CALIFICACION + "', ";
                informacion += "CALIFICACION = '" + CALIFICACION + "', ";
            }
            else
            {
                MensajeError = "El campo CALIFICACION no puede ser vacio.";
                ejecutar = false;
            }

            if (String.IsNullOrEmpty(FORTALEZAS) == false)
            {
                sql += "'" + FORTALEZAS + "', ";
                informacion += "FORTALEZAS = '" + FORTALEZAS + "', ";
            }
            else
            {
                sql += "null, ";
                informacion += "FORTALEZAS = 'null', ";
            }

            if (String.IsNullOrEmpty(OPORTUNIDAD_MEJORAS) == false)
            {
                sql += "'" + OPORTUNIDAD_MEJORAS + "', ";
                informacion += "OPORTUNIDAD_MEJORAS = '" + OPORTUNIDAD_MEJORAS + "', ";
            }
            else
            {
                sql += "null, ";
                informacion += "OPORTUNIDAD_MEJORAS = 'null', ";
            }

            if (String.IsNullOrEmpty(CURSOS_CAPACITACIONES) == false)
            {
                sql += "'" + CURSOS_CAPACITACIONES + "', ";
                informacion += "CURSOS_CAPACITACIONES = '" + CURSOS_CAPACITACIONES + "', ";
            }
            else
            {
                sql += "null, ";
                informacion += "CURSOS_CAPACITACIONES = 'null', ";
            }

            sql += "'" + Usuario + "'";
            informacion += "USU_MOD = '" + Usuario.ToString() + "'";

            #endregion validaciones

            if (ejecutar)
            {
                try
                {
                    conexion.ExecuteNonQuery(sql);

                    auditoria _auditoria = new auditoria(Empresa);
                    _auditoria.Adicionar(Usuario, tabla.GH_EVALUACIONES, tabla.ACCION_ACTUALIZAR, sql, informacion, conexion);
                }
                catch (Exception e)
                {
                    MensajeError = e.Message;
                    ejecutadoCorrectamente = false;
                }
                finally
                {
                    conexion.Desconectar();
                }
            }
            else
            {
                ejecutadoCorrectamente = false;
            }

            return ejecutadoCorrectamente;
        }
        public Boolean Actualizarconafiliacionfpensiones(int REGISTRO, int ID_SOLICITUD, int ID_F_PENSIONES, DateTime FECHA_R, String OBSERVACIONES, String PENSIONADO, int ID_REQUERIMIENTO)
        {
            Int32 cantidadRegistrosActualizados = 0;
            String sql = null;
            String informacion = null;
            Boolean ejecutar = true;

            tools _tools = new tools();

            sql = "usp_con_afiliacion_f_pensiones_actualizar ";

            #region validaciones
            if (REGISTRO != 0)
            {
                sql += REGISTRO + ", ";
                informacion += "REGISTRO = '" + REGISTRO.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo REGISTRO no puede ser nulo\n";
                ejecutar = false;
            }
            if (ID_SOLICITUD != 0)
            {
                sql += ID_SOLICITUD + ", ";
                informacion += "ID_SOLICITUD= '" + ID_SOLICITUD.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo ID_SOLICITUD no puede ser nulo\n";
                ejecutar = false;
            }
            if (ID_F_PENSIONES != 0)
            {
                sql += ID_F_PENSIONES + ", ";
                informacion += "ID_F_PENSIONES= '" + ID_F_PENSIONES.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo ID_F_PENSIONES no puede ser nulo\n";
                ejecutar = false;
            }
            if (!(String.IsNullOrEmpty(FECHA_R.ToString())))
            {
                sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_R) + "', ";
                informacion += "FECHA_R= '" + FECHA_R.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo FECHA_R no puede ser nulo\n";
                ejecutar = false;
            }
            if (!(String.IsNullOrEmpty(OBSERVACIONES)))
            {
                sql += "'" + OBSERVACIONES + "', ";
                informacion += "OBSERVACIONES= '" + OBSERVACIONES.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo OBSERVACIONES no puede ser nulo\n";
                ejecutar = false;
            }
            if (!(String.IsNullOrEmpty(PENSIONADO)))
            {
                sql += "'" + PENSIONADO + "', ";
                informacion += "PENSIONADO= '" + PENSIONADO.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo PENSIONADO no puede ser nulo\n";
                ejecutar = false;
            }

            sql += "'" + Usuario + "', ";
            informacion += "USU_MOD = '" + Usuario.ToString() + "', ";

            if (ID_REQUERIMIENTO != 0)
            {
                sql += ID_REQUERIMIENTO;
                informacion += "ID_REQUERIMIENTO= '" + ID_REQUERIMIENTO.ToString() + "'";
            }
            else
            {
                MensajeError += "El campo ID_REQUERIMIENTO no puede ser nulo\n";
                ejecutar = false;
            }

            #endregion validaciones

            if (ejecutar)
            {
                Conexion conexion = new Conexion(Empresa);
                try
                {
                    cantidadRegistrosActualizados = conexion.ExecuteNonQuery(sql);
                    #region auditoria
                    auditoria _auditoria = new auditoria(Empresa);
                    _auditoria.Adicionar(Usuario, tabla.CON_AFILIACION_F_PENSIONES, tabla.ACCION_ACTUALIZAR, sql, informacion, conexion);
                    #endregion auditoria
                }
                catch (Exception e)
                {
                    MensajeError = e.Message;
                }
                finally
                {
                    conexion.Desconectar();
                }
            }

            if (cantidadRegistrosActualizados > 0) return true;
            else return false;
        }
        public Boolean Actualizar(Int32 REGISTRO, Decimal ID_EMPLEADO, Int32 ID_CONCEPTO, Decimal CANTIDAD, Decimal VALOR, DateTime FECHA)
        {
            Int32 cantidadRegistrosActualizados = 0;
            String sql = null;
            String informacion = null;
            Boolean ejecutar = true;
            tools _tools = new tools();

            sql = "usp_nom_nomina_novedades_actualizar ";

            #region validaciones
            if (REGISTRO != 0)
            {
                sql += "'" + REGISTRO.ToString() + "', ";
                informacion += "REGISTRO= '" + REGISTRO.ToString() + ", ";
            }
            else
            {
                MensajeError = "El campo REGISTRO es requerido para la consulta.";
                ejecutar = false;
            }
            if (ID_EMPLEADO != 0)
            {
                sql += "'" + ID_EMPLEADO.ToString() + "', ";
                informacion += "ID_EMPLEADO= '" + ID_EMPLEADO.ToString() + ", ";
            }
            else
            {
                MensajeError = "El campo ID_EMPLEADO es requerido para la consulta.";
                ejecutar = false;
            }
            if (ID_CONCEPTO != 0)
            {
                sql += "'" + ID_CONCEPTO.ToString() + "', ";
                informacion += "ID_CONCEPTO= '" + ID_CONCEPTO.ToString() + ", ";
            }
            else
            {
                MensajeError = "El campo ID_CONCEPTO es requerido para la consulta.";
                ejecutar = false;
            }
            if (CANTIDAD != 0)
            {
                sql += "'" + CANTIDAD.ToString() + "', ";
                informacion += "CANTIDAD= '" + CANTIDAD.ToString() + ", ";
            }
            else
            {
                MensajeError = "El campo CANTIDAD es requerido para la consulta.";
                ejecutar = false;
            }
            sql += "'" + VALOR.ToString() + "', ";
            informacion += "VALOR= '" + VALOR.ToString() + ", ";

            sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA) + "', ";
            informacion += "FECHA = '" + FECHA.ToString() + "', ";

            sql += "'" + Usuario + "' ";
            informacion += "USU_CRE = '" + Usuario.ToString() + "'";
            #endregion

            if (ejecutar)
            {
                Conexion conexion = new Conexion(Empresa);
                try
                {
                    cantidadRegistrosActualizados = conexion.ExecuteNonQuery(sql);
                    #region auditoria
                    auditoria _auditoria = new auditoria(Empresa);
                    _auditoria.Adicionar(Usuario, tabla.NOM_NOMINA_NOVEDADES, tabla.ACCION_ACTUALIZAR, sql, informacion, conexion);
                    #endregion auditoria
                }
                catch (Exception e)
                {
                    MensajeError = e.Message;
                }
                finally
                {
                    conexion.Desconectar();
                }
            }

            if (cantidadRegistrosActualizados > 0) return true;
            else return false;
        }
        public Decimal AdicionarAfiCajaC(Decimal ID_SOLICITUD,
            Decimal ID_CAJA_C,
            DateTime FECHA_R,
            String OBSERVACIONES,
            Decimal ID_REQUERIMIENTO,
            Conexion conexion,
            DateTime FECHA_RADICACION,
            String idCiudad)
        {
            String sql = null;
            String identificador = null;
            String informacion = null;
            Boolean ejecutar = true;

            tools _tools = new tools();

            sql = "usp_con_afiliacion_cajas_c_adicionar_auditoria_V2 ";

            #region validaciones
            if (ID_SOLICITUD != 0)
            {
                sql += ID_SOLICITUD + ", ";
                informacion += "ID_SOLICITUD = '" + ID_SOLICITUD.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo ID_SOLICITUD no puede ser nulo\n";
                ejecutar = false;
            }

            if (ID_CAJA_C != 0)
            {
                sql += ID_CAJA_C + ", ";
                informacion += "ID_CAJA_C = '" + ID_CAJA_C.ToString() + "', ";
            }
            else
            {
                sql += "0, ";
                informacion += "ID_CAJA_C = '0'";
            }

            sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_R) + "', ";
            informacion += "FECHA_R = '" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_R) + "', ";

            if (!(String.IsNullOrEmpty(OBSERVACIONES)))
            {
                sql += "'" + OBSERVACIONES + "', ";
                informacion += "OBSERVACIONES = '" + OBSERVACIONES.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo OBSERVACIONES no puede ser nulo\n";
                ejecutar = false;
            }

            sql += "'" + Usuario + "', ";
            informacion += "USU_CRE = '" + Usuario.ToString() + "', ";

            if (ID_REQUERIMIENTO != 0)
            {
                sql += ID_REQUERIMIENTO + ", ";
                informacion += "ID_REQUERIMIENTO = '" + ID_REQUERIMIENTO.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo ID_REQUERIMIENTO no puede ser nulo\n";
                ejecutar = false;
            }

            sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_RADICACION) + "', ";
            informacion += "FECHA_RADICACION = '" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_RADICACION) + "', ";

            if (String.IsNullOrEmpty(idCiudad) == false)
            {
                sql += "'" + idCiudad + "'";
                informacion += "ID_CIUDAD = '" + idCiudad + "'";
            }
            else
            {
                sql += "NULL";
                informacion += "ID_CIUDAD = 'NULL";
            }

            #endregion validaciones

            if (ejecutar)
            {
                try
                {
                    identificador = conexion.ExecuteScalar(sql);

                    #region auditoria
                    auditoria _auditoria = new auditoria(Empresa);
                    _auditoria.Adicionar(Usuario, tabla.CON_AFILIACION_CAJAS_C, tabla.ACCION_ADICIONAR, sql, informacion, conexion);
                    #endregion auditoria
                }
                catch (Exception e)
                {
                    MensajeError = e.Message;
                }
            }

            if (!(String.IsNullOrEmpty(identificador))) return Convert.ToDecimal(identificador);
            else return 0;
        }
        public DataTable ObtenerNomEmpleadoPorIDSolicitudYFechaIngreso(int idSolicitud, DateTime fchIngreso)
        {
            tools _tools = new tools();

            DataSet _dataSet = new DataSet();
            DataView _dataView = new DataView();
            DataTable _dataTable = new DataTable();
            String sql = null;
            Boolean ejecutar = true;

            sql = "usp_nom_empleados_obtener_contrato_por_id_solicitud_fch_ingreso ";

            if (idSolicitud != 0)
            {
                sql += idSolicitud + ", ";
            }
            else
            {
                MensajeError += "El campo idSolicitud no puede ser nulo\n";
                ejecutar = false;
            }

            sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(fchIngreso) + "'";

            if (ejecutar)
            {
                Conexion conexion = new Conexion(Empresa);
                try
                {
                    _dataSet = conexion.ExecuteReader(sql);
                    _dataView = _dataSet.Tables[0].DefaultView;
                    _dataTable = _dataView.Table;
                }
                catch (Exception e)
                {
                    MensajeError = e.Message;
                }
                finally
                {
                    conexion.Desconectar();
                }
            }

            return _dataTable;
        }
        public DataTable ObtenerRequisicionesPorFiltro(String RAZ_SOCIAL, String CUMPLIDO, String CANCELADO, String REGIONAL, String CIUDAD, String PSICOLOGO, String TIPO, DateTime FECHA_INICIO, DateTime FECHA_FINAL)
        {
            DataSet _dataSet = new DataSet();
            DataView _dataView = new DataView();
            DataTable _dataTable = new DataTable();
            String sql = null;
            String informacion = null;
            Boolean ejecutar = true;

            tools _tool = new tools();

            sql = "usp_con_requerimientos_obtener_por_filtros ";

            #region validaciones
            if (!(String.IsNullOrEmpty(RAZ_SOCIAL)))
            {
                sql += "'" + RAZ_SOCIAL + "',  ";
                informacion += "RAZ_SOCIAL = '" + RAZ_SOCIAL.ToString() + "', ";
            }
            else
            {
                sql += "null,  ";
                informacion += "RAZ_SOCIAL = 'null', ";
            }
            if (!(String.IsNullOrEmpty(CUMPLIDO)))
            {
                sql += "'" + CUMPLIDO + "',  ";
                informacion += "CUMPLIDO = '" + CUMPLIDO.ToString() + "', ";
            }
            else
            {
                sql += "null,  ";
                informacion += "CUMPLIDO = 'null', ";
            }
            if (!(String.IsNullOrEmpty(CANCELADO)))
            {
                sql += "'" + CANCELADO + "',  ";
                informacion += "CANCELADO = '" + CANCELADO.ToString() + "', ";
            }
            else
            {
                sql += "null,  ";
                informacion += "CANCELADO = 'null', ";
            }
            if (!(String.IsNullOrEmpty(REGIONAL)))
            {
                sql += "'" + REGIONAL + "',  ";
                informacion += "REGIONAL = '" + REGIONAL.ToString() + "', ";
            }
            else
            {
                sql += "null,  ";
                informacion += "REGIONAL = 'null', ";
            }
            if (!(String.IsNullOrEmpty(CIUDAD)))
            {
                sql += "'" + CIUDAD + "',  ";
                informacion += "CIUDAD = '" + CIUDAD.ToString() + "', ";
            }
            else
            {
                sql += "null,  ";
                informacion += "CIUDAD = 'null', ";
            }
            if (!(String.IsNullOrEmpty(PSICOLOGO)))
            {
                sql += "'" + PSICOLOGO + "',  ";
                informacion += "PSICOLOGO = '" + PSICOLOGO.ToString() + "', ";
            }
            else
            {
                sql += "null,  ";
                informacion += "PSICOLOGO = 'null', ";
            }
            if (!(String.IsNullOrEmpty(TIPO)))
            {
                sql += "'" + TIPO + "',  ";
                informacion += "TIPO = '" + TIPO.ToString() + "', ";
            }
            else
            {
                sql += "null,  ";
                informacion += "TIPO = 'null', ";
            }
            if (FECHA_INICIO == new DateTime())
            {
                sql += "null,  ";
                informacion += "FECHA_INICIO = 'null', ";

            }
            else
            {
                sql += "'" + _tool.obtenerStringConFormatoFechaSQLServer(FECHA_INICIO) + "',  ";
                informacion += "FECHA_INICIO = '" + FECHA_INICIO.ToString() + "', ";
            }
            if (FECHA_FINAL == new DateTime())
            {
                sql += "null  ";
                informacion += "FECHA_FINAL = 'null' ";
            }
            else
            {
                sql += "'" + _tool.obtenerStringConFormatoFechaSQLServer(FECHA_FINAL) + "'  ";
                informacion += "FECHA_FINAL = '" + FECHA_FINAL.ToString() + "' ";
            }
            #endregion

            if (ejecutar)
            {
                Conexion conexion = new Conexion(Empresa);
                try
                {
                    _dataSet = conexion.ExecuteReader(sql);
                    _dataView = _dataSet.Tables[0].DefaultView;
                    _dataTable = _dataView.Table;

                    #region auditoria
                    auditoria _auditoria = new auditoria(Empresa);
                    _auditoria.Adicionar(Usuario, tabla.CON_REQUERIMIENTOS + ", " + tabla.REG_SOLICITUDES_INGRESO + ", " + tabla.VEN_EMPRESAS + ", " + tabla.REC_OCUPACIONES, tabla.ACCION_CONSULTAR, sql, informacion, conexion);
                    #endregion auditoria
                }
                catch (Exception e)
                {
                    MensajeError = e.Message;
                }
                finally
                {
                    conexion.Desconectar();
                }
            }
            return _dataTable;
        }
        public Boolean ActualizarConRegContratosAuditoria(Decimal REGISTRO,
            String TIPO_CONTRATO,
            String PAGO_DIAS_PRODUCTIVIDAD,
            Decimal VALOR_NOMINA,
            Decimal VALOR_CONTRATO,
            DateTime FECHA_INICIO_PERIODO,
            DateTime FECHA_FIN_PERIODO,
            String PERIODO_PAGO,
            String CLASE_CONTRATO,
            String CONTROL_CONTRATO,
            Conexion conexion)
        {
            Int32 cantidadRegistrosActualizados = 0;
            String sql = null;
            String informacion = null;
            Boolean ejecutar = true;

            tools _tools = new tools();

            sql = "usp_con_reg_contratos_actualizar_auditoria_v3 ";

            #region validaciones
            if (REGISTRO != 0)
            {
                sql += REGISTRO + ", ";
                informacion += "REGISTRO = '" + REGISTRO.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo REGISTRO no puede ser nulo\n";
                ejecutar = false;
            }

            if (String.IsNullOrEmpty(TIPO_CONTRATO) == false)
            {
                sql += "'" + TIPO_CONTRATO + "', ";
                informacion += "TIPO_CONTRATO = '" + TIPO_CONTRATO + "', ";
            }
            else
            {
                MensajeError += "El campo TIPO_CONTRATO no puede ser nulo\n";
                ejecutar = false;
            }

            if (String.IsNullOrEmpty(PAGO_DIAS_PRODUCTIVIDAD) == false)
            {
                sql += "'" + PAGO_DIAS_PRODUCTIVIDAD + "', ";
                informacion += "PAGO_DIAS_PRODUCTIVIDAD = '" + PAGO_DIAS_PRODUCTIVIDAD + "', ";
            }
            else
            {
                MensajeError += "El campo PAGO_DIAS_PRODUCTIVIDAD no puede ser nulo\n";
                ejecutar = false;
            }

            if (VALOR_NOMINA != 0)
            {
                sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(VALOR_NOMINA) + ", ";
                informacion += "VALOR_NOMINA = '" + _tools.convierteComaEnPuntoParaDecimalesEnSQL(VALOR_NOMINA) + "', ";
            }
            else
            {
                sql += "NULL, ";
                informacion += "VALOR_NOMINA = 'NULL', ";
            }

            if (VALOR_CONTRATO != 0)
            {
                sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(VALOR_CONTRATO) + ", ";
                informacion += "VALOR_CONTRATO = '" + _tools.convierteComaEnPuntoParaDecimalesEnSQL(VALOR_CONTRATO) + "', ";
            }
            else
            {
                sql += "NULL, ";
                informacion += "VALOR_CONTRATO = 'NULL', ";
            }

            if (!string.IsNullOrEmpty(FECHA_INICIO_PERIODO.ToString()))
            {
                sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_INICIO_PERIODO) + "', ";
                informacion += "FECHA_INICIO_PERIODO = '" + FECHA_INICIO_PERIODO.ToString() + "', ";
            }
            else
            {
                sql += "NULL, ";
                informacion += "FECHA_INICIO_PERIODO = 'NULL', ";
            }

            if (!string.IsNullOrEmpty(FECHA_FIN_PERIODO.ToString()))
            {
                sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_FIN_PERIODO) + "', ";
                informacion += "FECHA_FIN_PERIODO = '" + FECHA_FIN_PERIODO.ToString() + "', ";
            }
            else
            {
                sql += "NULL, ";
                informacion += "FECHA_FIN_PERIODO = 'NULL', ";
            }

            sql += "'" + Usuario + "', ";
            informacion += "USU_MOD = '" + Usuario.ToString() + "', ";

            if (String.IsNullOrEmpty(PERIODO_PAGO) == false)
            {
                sql += "'" + PERIODO_PAGO + "', ";
                informacion += "PERIODO_PAGO = '" + PERIODO_PAGO.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo PERIODO_PAGO no puede ser nulo\n";
                ejecutar = false;
            }

            if (String.IsNullOrEmpty(CLASE_CONTRATO) == false)
            {
                sql += "'" + CLASE_CONTRATO + "', ";
                informacion += "CLASE_CONTRATO = '" + CLASE_CONTRATO + "', ";
            }
            else
            {
                MensajeError += "El campo CLASE_CONTRATO no puede ser nulo\n";
                ejecutar = false;
            }

            if (String.IsNullOrEmpty(CONTROL_CONTRATO) == false)
            {
                sql += "'" + CONTROL_CONTRATO + "'";
                informacion += "CONTROL_CONTRATO = '" + CONTROL_CONTRATO + "'";
            }
            else
            {
                MensajeError += "El campo CONTROL_CONTRATO no puede ser nulo\n";
                ejecutar = false;
            }

            #endregion validaciones

            if (ejecutar)
            {
                try
                {
                    cantidadRegistrosActualizados = conexion.ExecuteNonQuery(sql);

                    #region auditoria
                    auditoria _auditoria = new auditoria(Empresa);
                    _auditoria.Adicionar(Usuario, tabla.CON_REG_CONTRATOS, tabla.ACCION_ACTUALIZAR, sql, informacion, conexion);
                    #endregion auditoria
                }
                catch (Exception e)
                {
                    MensajeError = e.Message;
                }
            }

            if (cantidadRegistrosActualizados > 0) return true;
            else return false;
        }
        public Decimal AdicionarConAspEnviadosCliente(int ID_SOLICITUD, int ID_EMPRESA, int ID_REQUERIMIENTO, DateTime FECHA_R)
        {
            String sql = null;

            Int32 numregistrosIngresados = 0;

            String informacion = null;
            Boolean ejecutar = true;

            tools _tools = new tools();

            sql = "usp_con_asp_enviados_cliente_adicionar ";

            #region validaciones

            if (ID_SOLICITUD != 0)
            {
                sql += ID_SOLICITUD + ", ";
                informacion += "ID_SOLICITUD = '" + ID_SOLICITUD.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo ID_SOLICITUD no puede ser nulo\n";
                ejecutar = false;
            }
            if (ID_EMPRESA != 0)
            {
                sql += ID_EMPRESA + ", ";
                informacion += "ID_EMPRESA= '" + ID_EMPRESA.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo ID_EMPRESA no puede ser nulo\n";
                ejecutar = false;
            }
            if (ID_REQUERIMIENTO != 0)
            {
                sql += ID_REQUERIMIENTO + ", ";
                informacion += "ID_REQUERIMIENTO= '" + ID_REQUERIMIENTO.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo ID_REQUERIMIENTO no puede ser nulo\n";
                ejecutar = false;
            }

            if (!(String.IsNullOrEmpty(FECHA_R.ToString())))
            {
                sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_R) + "', ";
                informacion += "FECHA_R= '" + FECHA_R.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo FECHA_R no puede ser nulo\n";
                ejecutar = false;
            }

            sql += "'" + Usuario + "' ";
            informacion += "USU_CRE = '" + Usuario.ToString() + "' ";

            #endregion validaciones

            if (ejecutar)
            {
                Conexion conexion = new Conexion(Empresa);
                conexion.IniciarTransaccion();

                try
                {
                    numregistrosIngresados = Convert.ToInt32(conexion.ExecuteScalar(sql));

                    if (numregistrosIngresados <= 0)
                    {
                        conexion.DeshacerTransaccion();
                        numregistrosIngresados = 0;
                    }
                    else
                    {
                        #region auditoria
                        auditoria _auditoria = new auditoria(Empresa);
                        if (_auditoria.Adicionar(Usuario, tabla.CON_ASP_ENVIADOS_CLIENTE, tabla.ACCION_ADICIONAR, sql, informacion, conexion) == false)
                        {
                            conexion.DeshacerTransaccion();
                            numregistrosIngresados = 0;
                        }
                        #endregion auditoria
                    }

                    if (numregistrosIngresados > 0)
                    {
                        conexion.AceptarTransaccion();
                    }
                }
                catch (Exception e)
                {
                    MensajeError = e.Message;
                    numregistrosIngresados = 0;
                    conexion.DeshacerTransaccion();
                }
                finally
                {
                    conexion.Desconectar();
                }
            }
            else
            {
                numregistrosIngresados = 0;
            }

            return numregistrosIngresados;
        }
        public Boolean ActualizarConRegExamenesEmpleado(int REGISTRO,
            int ID_ORDEN,
            int ID_EXAMEN,
            Decimal COSTO,
            String VALIDADO,
            DateTime FECHA_EXAMEN)
        {
            Int32 cantidadRegistrosActualizados = 0;
            String sql = null;
            String informacion = null;
            Boolean ejecutar = true;

            tools _tools = new tools();

            sql = "USP_CON_REG_EXAMENES_EMPLEADO_ACTUALIZAR ";

            #region validaciones
            if (REGISTRO != 0)
            {
                sql += REGISTRO + ", ";
                informacion += "REGISTRO = '" + REGISTRO.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo REGISTRO no puede ser nulo\n";
                ejecutar = false;
            }
            if (ID_ORDEN != 0)
            {
                sql += ID_ORDEN + ", ";
                informacion += "ID_ORDEN = '" + ID_ORDEN.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo ID_ORDEN no puede ser nulo\n";
                ejecutar = false;
            }
            if (ID_EXAMEN != 0)
            {
                sql += ID_EXAMEN + ", ";
                informacion += "ID_EXAMEN = '" + ID_EXAMEN.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo ID_EXAMEN no puede ser nulo\n";
                ejecutar = false;
            }
            if (COSTO != 0)
            {
                sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(COSTO) + ", ";
                informacion += "COSTO = '" + COSTO.ToString() + "', ";
            }
            else
            {
                sql += "0, ";
                informacion += "COSTO = '0', ";
            }
            if (!(String.IsNullOrEmpty(VALIDADO)))
            {
                sql += "'" + VALIDADO + "', ";
                informacion += "VALIDADO = '" + VALIDADO.ToString() + "', ";
            }
            else
            {
                sql += "'N', ";
                informacion += "VALIDADO = 'N', ";
            }
            if (!(String.IsNullOrEmpty(FECHA_EXAMEN.ToString())))
            {
                sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_EXAMEN) + "', ";
                informacion += "FECHA_EXAMEN = '" + FECHA_EXAMEN.ToString() + "', ";
            }

            sql += "'" + Usuario + "' ";
            informacion += "USU_MOD= '" + Usuario.ToString() + "' ";

            #endregion validaciones

            if (ejecutar)
            {
                Conexion conexion = new Conexion(Empresa);
                try
                {
                    cantidadRegistrosActualizados = conexion.ExecuteNonQuery(sql);
                    #region auditoria
                    auditoria _auditoria = new auditoria(Empresa);
                    _auditoria.Adicionar(Usuario, tabla.CON_REG_EXAMENES_EMPLEADO, tabla.ACCION_ACTUALIZAR, sql, informacion, conexion);
                    #endregion auditoria
                }
                catch (Exception e)
                {
                    MensajeError = e.Message;
                }
                finally
                {
                    conexion.Desconectar();
                }
            }

            if (cantidadRegistrosActualizados > 0) return true;
            else return false;
        }
        public Boolean ActualizarConAspEnviadosCliente(int REGISTRO, int ID_SOLICITUD, int ID_EMPRESA, int ID_REQUERIMIENTO, DateTime FECHA_R)
        {
            Int32 cantidadRegistrosActualizados = 0;
            String sql = null;
            String informacion = null;
            Boolean ejecutar = true;

            tools _tools = new tools();

            sql = "usp_con_asp_enviados_cliente_actualizar ";

            #region validaciones
            if (REGISTRO != 0)
            {
                sql += REGISTRO + ", ";
                informacion += "REGISTRO= '" + REGISTRO.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo REGISTRO no puede ser nulo\n";
                ejecutar = false;
            }
            if (ID_SOLICITUD != 0)
            {
                sql += ID_SOLICITUD + ", ";
                informacion += "ID_SOLICITUD = '" + ID_SOLICITUD.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo ID_SOLICITUD no puede ser nulo\n";
                ejecutar = false;
            }
            if (ID_EMPRESA != 0)
            {
                sql += ID_EMPRESA + ", ";
                informacion += "ID_EMPRESA= '" + ID_EMPRESA.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo ID_EMPRESA no puede ser nulo\n";
                ejecutar = false;
            }
            if (ID_REQUERIMIENTO != 0)
            {
                sql += ID_REQUERIMIENTO + ", ";
                informacion += "ID_REQUERIMIENTO= '" + ID_REQUERIMIENTO.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo ID_REQUERIMIENTO no puede ser nulo\n";
                ejecutar = false;
            }

            if (!(String.IsNullOrEmpty(FECHA_R.ToString())))
            {
                sql += _tools.obtenerStringConFormatoFechaSQLServer(FECHA_R) + ", ";
                informacion += "FECHA_R= '" + FECHA_R.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo FECHA_R no puede ser nulo\n";
                ejecutar = false;
            }
            sql += "'" + Usuario + "' ";
            informacion += "USU_MOD = '" + Usuario.ToString() + "' ";

            #endregion validaciones

            if (ejecutar)
            {
                Conexion conexion = new Conexion(Empresa);
                try
                {
                    cantidadRegistrosActualizados = conexion.ExecuteNonQuery(sql);
                    #region auditoria
                    auditoria _auditoria = new auditoria(Empresa);
                    _auditoria.Adicionar(Usuario, tabla.CON_ASP_ENVIADOS_CLIENTE, tabla.ACCION_ACTUALIZAR, sql, informacion, conexion);
                    #endregion auditoria
                }
                catch (Exception e)
                {
                    MensajeError = e.Message;
                }
                finally
                {
                    conexion.Desconectar();
                }
            }

            if (cantidadRegistrosActualizados > 0) return true;
            else return false;
        }
        public Decimal AdicionarConRegExamenesEmpleado(int ID_ORDEN, int ID_EXAMEN, Decimal COSTO, String VALIDADO, DateTime FECHA_EXAMEN, Conexion conexion)
        {
            String sql = null;
            Decimal identificador = 0;
            String informacion = null;
            Boolean ejecutar = true;

            tools _tools = new tools();

            sql = "USP_CON_REG_EXAMENES_EMPLEADO_ADICIONAR ";

            #region validaciones
            if (ID_ORDEN != 0)
            {
                sql += ID_ORDEN + ", ";
                informacion += "ID_ORDEN = '" + ID_ORDEN.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo ID_ORDEN no puede ser nulo\n";
                ejecutar = false;
            }
            if (ID_EXAMEN != 0)
            {
                sql += ID_EXAMEN + ", ";
                informacion += "ID_EXAMEN = '" + ID_EXAMEN.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo ID_EXAMEN no puede ser nulo\n";
                ejecutar = false;
            }
            if (COSTO != 0)
            {
                sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(COSTO) + ", ";
                informacion += "COSTO = '" + COSTO.ToString() + "', ";
            }
            else
            {
                sql += "0, ";
                informacion += "COSTO = '0', ";
            }
            if (!(String.IsNullOrEmpty(VALIDADO)))
            {
                sql += "'" + VALIDADO + "', ";
                informacion += "VALIDADO = '" + VALIDADO.ToString() + "', ";
            }
            else
            {
                sql += "'N', ";
                informacion += "VALIDADO = 'N', ";
            }

            if (!(String.IsNullOrEmpty(FECHA_EXAMEN.ToString())))
            {
                sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_EXAMEN) + "', ";
                informacion += "FECHA_EXAMEN = '" + FECHA_EXAMEN.ToString() + "', ";
            }

            sql += "'" + Usuario + "' ";
            informacion += "USU_CRE= '" + Usuario.ToString() + "' ";
            #endregion validaciones

            if (ejecutar)
            {
                try
                {
                    identificador = Convert.ToDecimal(conexion.ExecuteScalar(sql));

                    #region auditoria
                    auditoria _auditoria = new auditoria(Empresa);
                    _auditoria.Adicionar(Usuario, tabla.CON_REG_EXAMENES_EMPLEADO, tabla.ACCION_ADICIONAR, sql, informacion, conexion);
                    #endregion auditoria
                }
                catch (Exception e)
                {
                    MensajeError = e.Message;
                    identificador = 0;
                }
            }

            return identificador;
        }
        public Decimal AdicionarRecComFuentes(Decimal ID_FUENTE, DateTime FECHA_R, String OBSERVACIONES)
        {
            String  sql             = null;
            String  idRecComFuentes = null;
            String  informacion     = null;
            Boolean ejecutar        = true;

            tools _tools = new tools();

            sql = "usp_rec_com_fuentes_adicionar ";

            #region validaciones

            if (ID_FUENTE != 0)
            {
                sql         += ID_FUENTE + ", ";
                informacion += "ID_FUENTE= '" + ID_FUENTE.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo ID_FUENTE no puede ser nulo\n";
                ejecutar      = false;
            }
            if (!(String.IsNullOrEmpty(FECHA_R.ToString())))
            {
                sql         += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_R) + "', ";
                informacion += "FECHA_R= '" + FECHA_R.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo FECHA_R no puede ser nulo\n";
                ejecutar      = false;
            }

            if (!(String.IsNullOrEmpty(OBSERVACIONES)))
            {
                sql         += "'" + OBSERVACIONES + "', ";
                informacion += "OBSERVACIONES= '" + OBSERVACIONES.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo OBSERVACIONES no puede ser nulo\n";
                ejecutar      = false;
            }

            sql         += "'" + Usuario + "' ";
            informacion += "USU_CRE = '" + Usuario.ToString() + "' ";

            #endregion validaciones

            if (ejecutar)
            {
                Conexion conexion = new Conexion(Empresa);
                try
                {
                    idRecComFuentes = conexion.ExecuteScalar(sql);

                    #region auditoria
                    auditoria _auditoria = new auditoria(Empresa);
                    _auditoria.Adicionar(Usuario, tabla.REC_COM_FUENTES, tabla.ACCION_ADICIONAR, sql, informacion, conexion);
                    #endregion auditoria
                }
                catch (Exception e)
                {
                    MensajeError = e.Message;
                }
                finally
                {
                    conexion.Desconectar();
                }
            }

            if (!(String.IsNullOrEmpty(idRecComFuentes)))
            {
                return(Convert.ToDecimal(idRecComFuentes));
            }
            else
            {
                return(0);
            }
        }