public String ActualizarFechaPeriodo(Decimal ID_EMPRESA, String PERIODOSPROCESO, DateTime FECHA)
        {
            Conexion conexion = new Conexion(Empresa);
            conexion.IniciarTransaccion();
            Boolean ejecutar = true;
            String sql = null;
            String informacion = null;
            String actualizado = "N";
            tools fecha = new tools();

            sql = "usp_actualizar_fecha_memorando ";

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

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

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

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

            if (ejecutar)
            {
                try
                {
                    conexion.ExecuteNonQuery(sql);
                    actualizado = "S";
                    #region auditoria
                    auditoria _auditoria = new auditoria(Empresa);
                    _auditoria.Adicionar(Usuario, tabla.NOM_PERIODO, tabla.ACCION_LIQUIDAR, sql, informacion, conexion);
                    #endregion auditoria
                    conexion.AceptarTransaccion();
                }
                catch (Exception e)
                {
                    MensajeError = e.Message;
                    conexion.DeshacerTransaccion();
                }
                finally
                {
                    conexion.Desconectar();
                }
            }
            return actualizado;
        }
Esempio n. 2
0
        public Boolean ActualizarSeccion(String ID_SECCION, String NOMBRE, String USU_MOD)
        {
            Int32 cantidadRegistrosActualizados = 0;
            String sql = null;
            String informacion = null;
            Boolean ejecutar = true;

            tools _tools = new tools();

            sql = "usp_ven_seccion_actualizar ";

            if (String.IsNullOrEmpty(ID_SECCION) == false)
            {
                sql += "'" + ID_SECCION + "', ";
                informacion += "ID_SECCION = '" + ID_SECCION + "', ";
            }
            else
            {
                MensajError = "El campo ID_DE LA SECCION no puede ser 0\n";
                ejecutar = false;
            }

            if (String.IsNullOrEmpty(NOMBRE) == false)
            {
                sql += "'" + NOMBRE + "'";
                informacion += "NOMBRE = '" + ID_SECCION + "'";
            }
            else
            {
                MensajError = "El campo NOMBRE DE LA SECCIÓN no puede ser 0\n";
                ejecutar = false;
            }

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

            if (cantidadRegistrosActualizados > 0) return true;
            else return false;
        }
Esempio n. 3
0
        public Boolean ActualizarAfpDeNomEmpleadosPorIdEmpleado(Decimal ID_EMPLEADO, Decimal ID_F_PENSIONES, Conexion conexion)
        {
            Int32 cantidadRegistrosActualizados = 0;
            String sql = null;
            String informacion = null;
            Boolean ejecutar = true;

            tools _tools = new tools();

            sql = "usp_nom_empleados_actualizar_afp_por_idEmpleado ";

            #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_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;
            }

            sql += "'" + Usuario + "'";
            informacion += "USU_MOD = '" + Usuario.ToString() + "'";
            #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 AdicionarConRegOrdenExamen(int ID_SOLICITUD, int ID_REQUERIMIENTO, Conexion conexion)
        {
            String sql = null;
            String identificador = null;
            String informacion = null;
            Boolean ejecutar = true;

            tools _tools = new tools();

            sql = "USP_CON_REG_ORDEN_EXAMEN_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_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 += "'" + Usuario + "' ";
            informacion += "USU_CRE= '" + Usuario.ToString() + "' ";
            #endregion validaciones

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

                    #region auditoria
                    auditoria _auditoria = new auditoria(Empresa);
                    _auditoria.Adicionar(Usuario, tabla.CON_REG_ORDEN_EXAMEN, 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 ActualizarEntraNominaConRegContratos(Decimal idEmpleado,
            Boolean entraNomina)
        {
            Int32 cantidadRegistrosActualizados = 0;
            String sql = null;
            String informacion = null;
            Boolean ejecutar = true;

            tools _tools = new tools();

            sql = "usp_con_reg_contratos_actualiza_entra_nomina_por_id_empleado ";

            sql += idEmpleado + ", ";

            if (entraNomina == true)
            {
                sql += "'true'";
            }
            else
            {
                sql += "'false'";
            }

            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_CONTRATOS, 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 ActualizarInformacionBasicaComercial(String PUESTO, String ACLARACION, Decimal ID_EMPRESA, String SiNo)
        {
            Conexion conexion = new Conexion(Empresa);
            DataSet _dataSet = new DataSet();
            Decimal REGISTRO_CONTRATO = 0;
            String sql = null;
            String informacion = null;
            Boolean ejecutar = true;

            tools _tools = new tools();

            sql = "usp_INFO_BASICA_COMERCIAL_ACTUALIZAR  ";

            if (ID_EMPRESA != 0)
            {
                sql += " '" + PUESTO + "', " + " '" + ACLARACION + "', '" + ID_EMPRESA + "', '" + SiNo + "'";
                informacion += "ID_EMPRESA = " + ID_EMPRESA.ToString() + ", ";
            }
            else
            {
                MensajeError = "El campo ID EMPRESA no puede ser 0.";
                ejecutar = false;
            }
            if (ejecutar)
            {
                try
                {
                    REGISTRO_CONTRATO = Convert.ToDecimal(conexion.ExecuteScalar(sql));
                    if (REGISTRO_CONTRATO <= 0)
                    {
                        MensajeError = "ERROR: Al intentar ingresar la información del contrato de servicio.";
                        REGISTRO_CONTRATO = 0;
                    }
                    else
                    {
                        MensajeError = "ERROR: Al intentar ingresar la auditoria del contrato de servicio.";
                    }
                }
                catch (Exception e)
                {
                    MensajeError = e.Message;
                    REGISTRO_CONTRATO = 0;
                }
            }
            return REGISTRO_CONTRATO;
        }
        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;
        }
Esempio n. 8
0
        public Boolean ActualizarFechaAvisoNenRContratos(Decimal REGISTRO,
            Conexion conexion)
        {
            Int32 cantidadRegistrosActualizados = 0;
            String sql = null;
            Boolean ejecutar = true;

            tools _tools = new tools();

            sql = "usp_ven_r_contratos_actualizar_fecha_aviso ";

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

            if (ejecutar)
            {
                try
                {
                    cantidadRegistrosActualizados = conexion.ExecuteNonQuery(sql);
                }
                catch (Exception e)
                {
                    MensajeError = e.Message;
                }
            }

            if (cantidadRegistrosActualizados > 0) return true;
            else return false;
        }
Esempio n. 9
0
        public Decimal AdicionarPresupuestoEmpresa(Decimal ID_EMPRESA,
            int ANNO,
            Decimal PRESUPUESTO,
            String OBSERVACIONES,
            Programa.Areas area,
            Decimal ID_PRES_GENERAL)
        {
            Decimal ID_PRESUPUESTO = 0;

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

            tools _tools = new tools();

            sql = "usp_prog_presupuestos_adicionar ";

            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 (ANNO != 0)
            {
                sql += ANNO + ", ";
                informacion += "ANNO = " + ANNO.ToString() + ", ";
            }
            else
            {
                MensajeError = "El campo ID EMPRESA no puede ser 0\n";
                ejecutar = false;
            }

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

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

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

            sql += "'" + Usuario + "', ";
            informacion += "USU_CRE = '" + Usuario + "', ";

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

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

                    auditoria _auditoria = new auditoria(Empresa);
                    _auditoria.Adicionar(Usuario, tabla.PROG_PRESUPUESTOS, tabla.ACCION_ADICIONAR, sql, informacion, conexion);
                }
                catch (Exception e)
                {
                    MensajeError = e.Message;
                    ID_PRESUPUESTO = 0;
                }
                finally
                {
                    conexion.Desconectar();
                }
            }

            return ID_PRESUPUESTO;
        }
        public Decimal AdicionarRecFuentes(String NOM_FUENTE,
                                           String DIR_FUENTE,
                                           String CIU_FUENTE,
                                           String TEL_FUENTE,
                                           String ENCARGADO,
                                           String CARGO_ENC,
                                           String OBS_FUENTE,
                                           String EMAIL_ENCARGADO)
        {
            String  sql          = null;
            String  idRecFuentes = null;
            String  informacion  = null;
            Boolean ejecutar     = true;

            tools _tools = new tools();

            sql = "usp_rec_fuentes_adicionar ";

            #region validaciones

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

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

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

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

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

            #endregion validaciones

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

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

            if (!(String.IsNullOrEmpty(idRecFuentes)))
            {
                return(Convert.ToDecimal(idRecFuentes));
            }
            else
            {
                return(0);
            }
        }
        public Decimal AdicionarAlmRegProdProv(Decimal ID_PRODUCTO,
            Decimal REGISTRO_PROVEEDOR,
            Conexion conexion)
        {
            String sql = null;
            String identificador = null;
            String informacion = null;
            Boolean ejecutar = true;

            tools _tools = new tools();

            sql = "USP_ALM_REG_PRODUCTOS_PROVEEDOR_ADICIONAR ";

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

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

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

            #endregion validaciones

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

                    #region auditoria
                    auditoria _auditoria = new auditoria(Empresa);
                    _auditoria.Adicionar(Usuario, tabla.ALM_REG_PRODUCTO_PROVEEDOR, 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 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 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 Info_basica_existe(String PUESTO, Decimal ID_EMPRESA)
        {
            Conexion conexion = new Conexion(Empresa);
            DataSet _dataSet = new DataSet();
            Decimal REGISTRO_CONTRATO = 0;
            String sql = null;
            String informacion = null;
            Boolean ejecutar = true;

            tools _tools = new tools();

            sql = "usp_INFO_BASICA_COMERCIAL_CUENTA  ";

            if (ID_EMPRESA != 0)
            {
                sql += " '" + PUESTO + "', " + " '" + ID_EMPRESA + "'";
                informacion += "ID_EMPRESA = " + ID_EMPRESA.ToString() + ", ";
            }
            else
            {
                MensajeError = "El campo ID EMPRESA no puede ser 0.";
                ejecutar = false;
            }
            if (ejecutar)
            {
                try
                {
                    REGISTRO_CONTRATO = Convert.ToDecimal(conexion.ExecuteScalar(sql));
                }
                catch (Exception e)
                {
                    MensajeError = e.Message;
                }
            }
            return REGISTRO_CONTRATO;
        }
Esempio n. 15
0
        public Boolean Adicionar(String ID_ACTIVIDAD,
                                 String ID_CLASE,
                                 String NOMBRE,
                                 String USU_CRE)
        {
            String  sql         = null;
            String  informacion = null;
            Boolean ejecutar    = true;

            Boolean verificador = true;

            tools _tools = new tools();

            sql         = "usp_ven_actividad_adicionar ";
            informacion = sql;

            if (String.IsNullOrEmpty(ID_ACTIVIDAD) == false)
            {
                sql         += "'" + ID_ACTIVIDAD + "', ";
                informacion += "ID_ACTIVIDAD = '" + ID_ACTIVIDAD + "', ";
            }
            else
            {
                MensajError = "ERROR: El campo ID DE ACTIVIDAD no puede ser vacio.";
                ejecutar    = false;
            }

            if (String.IsNullOrEmpty(ID_CLASE) == false)
            {
                sql         += "'" + ID_CLASE + "', ";
                informacion += "ID_CLASE = '" + ID_CLASE + "', ";
            }
            else
            {
                MensajError = "ERROR: El campo ID DE CLASE no puede ser vacio.";
                ejecutar    = false;
            }

            if (String.IsNullOrEmpty(NOMBRE) == false)
            {
                sql         += "'" + NOMBRE + "'";
                informacion += "NOMBRE = '" + NOMBRE + "'";
            }
            else
            {
                MensajError = "ERROR: El campo NOMBRE no puede ser vacio.";
                ejecutar    = false;
            }

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

                    auditoria _auditoria = new auditoria(Empresa);
                    if (_auditoria.Adicionar(USU_CRE, tabla.VEN_ACTIVIDAD, tabla.ACCION_ADICIONAR, sql, informacion, conexion) == false)
                    {
                        MensajError = "ERROR: Al intentar ingresar la auditoria de la división.";
                        verificador = false;
                    }
                }
                catch (Exception e)
                {
                    MensajError = e.Message;
                    verificador = false;
                }
                finally
                {
                    conexion.Desconectar();
                }
            }
            else
            {
                verificador = false;
            }

            return(verificador);
        }
Esempio n. 16
0
        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 AdicionarRecOcupacionesFuente(Decimal ID_FUENTE, Decimal ID_OCUPACION, String OBSERVACIONES, String LLAVE)
        {
            String  sql = null;
            String  idRecOcupacionesFuente = null;
            String  informacion            = null;
            Boolean ejecutar = true;

            tools _tools = new tools();

            sql = "usp_rec_ocupaciones_fuente_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 (ID_OCUPACION != 0)
            {
                sql         += ID_OCUPACION + ", ";
                informacion += "ID_OCUPACION = '" + ID_OCUPACION.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo ID_OCUPACION 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(LLAVE)))
            {
                sql         += "'" + LLAVE + "', ";
                informacion += "LLAVE = '" + LLAVE.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo LLAVE no puede ser nulo\n";
                ejecutar      = false;
            }

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

            #endregion validaciones

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

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

            if (!(String.IsNullOrEmpty(idRecOcupacionesFuente)))
            {
                return(Convert.ToDecimal(idRecOcupacionesFuente));
            }
            else
            {
                return(0);
            }
        }
Esempio n. 18
0
        public Boolean ActualizarAcoset(Decimal REGISTRO, String APELLIDOS, String NOMBRES, String TIP_DOC_IDENTIDAD, String NUM_DOC_IDENTIDAD, String OBS_ACOSET, String ENTIDAD_REPORTA, Boolean ACTIVO, String MOTIVO_ESTADO)
        {
            Int32   cantidadRegistrosActualizados = 0;
            String  sql         = null;
            String  informacion = null;
            Boolean ejecutar    = true;

            tools _tools = new tools();

            sql = "usp_reg_acoset_actualizar ";

            #region validaciones

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


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

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

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

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

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

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

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

            if (ACTIVO == true)
            {
                sql         += "'True', ";
                informacion += "ACTIVO = 'True', ";
            }
            else
            {
                sql         += "'False', ";
                informacion += "ACTIVO = 'False', ";
            }

            if (!(String.IsNullOrEmpty(MOTIVO_ESTADO)))
            {
                sql         += "'" + MOTIVO_ESTADO + "'";
                informacion += "MOTIVO_ESTADO = '" + MOTIVO_ESTADO + "'";
            }
            else
            {
                sql         += "null";
                informacion += "MOTIVO_ESTADO = 'NULL'";
            }
            #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.REG_ACOSET, 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);
            }
        }
Esempio n. 19
0
        public Decimal AdicionarRegAcoset(String APELLIDOS, String NOMBRES, String TIP_DOC_IDENTIDAD, String NUM_DOC_IDENTIDAD, String OBS_ACOSET, String ENTIDAD_REPORTA, Conexion conexion)
        {
            String  sql         = null;
            String  idRegAcoset = null;
            String  informacion = null;
            Boolean ejecutar    = true;

            tools _tools = new tools();

            sql = "usp_reg_acoset_adicionar ";

            #region validaciones

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

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

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

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

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

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

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

            #endregion validaciones

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

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

            if (!(String.IsNullOrEmpty(idRegAcoset)))
            {
                return(Convert.ToDecimal(idRegAcoset));
            }
            else
            {
                return(0);
            }
        }
Esempio n. 20
0
        public Decimal AdicionarPresupuestoGeneral(Int32 ANIO,
            Programa.Areas ID_AREA,
            Decimal MONTO,
            String DESCRIPCION)
        {
            Decimal ID_PRES_GEN = 0;

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

            tools _tools = new tools();

            sql = "usp_prog_presupuestos_generales_adicionar ";

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

            sql += "'" + ID_AREA.ToString() + "', ";

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

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

            sql += "'" + Usuario + "'";
            informacion += "USU_CRE = '" + Usuario + "'";

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

                    auditoria _auditoria = new auditoria(Empresa);
                    _auditoria.Adicionar(Usuario, tabla.PROG_PRESUPUESTOS_GENERALES, tabla.ACCION_ADICIONAR, sql, informacion, conexion);
                }
                catch (Exception e)
                {
                    MensajeError = e.Message;
                    ID_PRES_GEN = 0;
                }
                finally
                {
                    conexion.Desconectar();
                }
            }

            return ID_PRES_GEN;
        }
Esempio n. 21
0
        public Decimal Adicionar(Decimal ID_EMPLEADO, Int32 ID_CONCEPTO, Int32 ID_PERIODO, Decimal CANTIDAD, Decimal VALOR, String ORIGEN, String ESTADO, Conexion conexion)
        {
            String sql = null;
            String idRecuperado = null;
            String informacion = null;
            Boolean ejecutar = true;
            tools _tools = new tools();

            sql = "usp_nom_nomina_novedades_adicionar ";

            #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 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 (ID_PERIODO != 0)
            {
                sql += "'" + ID_PERIODO.ToString() + "', ";
                informacion += "ID_PERIODO= '" + ID_PERIODO.ToString() + ", ";
            }
            else
            {
                MensajeError = "El campo ID_PERIODO es requerido para la consulta.";
                ejecutar = false;
            }

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

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

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

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

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

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

            if (!(String.IsNullOrEmpty(idRecuperado))) return Convert.ToDecimal(idRecuperado);
            else return 0;
        }
Esempio n. 22
0
        public Boolean ActualizarPresupuesto(Decimal ID_PRESUPUESTO,
            Decimal PRESUPUESTO,
            String OBSERVACIONES)
        {
            Conexion conexion = new Conexion(Empresa);
            String sql = null;
            String informacion = null;
            Boolean ejecutar = true;
            Boolean ejecutadoCorrectamente = true;

            tools _tools = new tools();

            sql = "usp_prog_presupuestos_actualizar ";

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

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

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

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

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

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

            if (ejecutadoCorrectamente)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
Esempio n. 23
0
        public Boolean ActualizarActividad(String ID_ACTIVIDAD, String NOMBRE, String USU_MOD)
        {
            Int32   cantidadRegistrosActualizados = 0;
            String  sql         = null;
            String  informacion = null;
            Boolean ejecutar    = true;

            tools _tools = new tools();

            sql = "usp_ven_actividad_actualizar ";


            if (String.IsNullOrEmpty(ID_ACTIVIDAD) == false)
            {
                sql         += "'" + ID_ACTIVIDAD + "', ";
                informacion += "ID_ACTIVIDAD = '" + ID_ACTIVIDAD + "', ";
            }
            else
            {
                MensajError = "El campo ID_DE LA ACTIVIDAD no puede ser 0\n";
                ejecutar    = false;
            }

            if (String.IsNullOrEmpty(NOMBRE) == false)
            {
                sql         += "'" + NOMBRE + "'";
                informacion += "NOMBRE = '" + NOMBRE + "'";
            }
            else
            {
                MensajError = "El campo NOMBRE DE LA CLASE no puede ser 0\n";
                ejecutar    = false;
            }

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

            if (cantidadRegistrosActualizados > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 24
0
        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 Boolean ActualizarConRegContratosImpresos(int REGISTRO, String CONTRATO_IMPRESO, String CLAUSULAS_IMPRESO)
        {
            Int32 cantidadRegistrosActualizados = 0;
            String sql = null;
            String informacion = null;
            Boolean ejecutar = true;

            tools _tools = new tools();

            sql = "usp_con_reg_contratos_actualizar_impresion ";

            #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(CONTRATO_IMPRESO) == false)
            {
                sql += "'" + CONTRATO_IMPRESO + "', ";
                informacion += "CONTRATO_IMPRESO = '" + CONTRATO_IMPRESO + "', ";
            }
            else
            {
                sql += "NULL, ";
                informacion += "CONTRATO_IMPRESO = NULL, ";
            }

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

            #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_CONTRATOS, 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;
        }
Esempio n. 26
0
        public Decimal Adicionar(Decimal ID_EMPLEADO, Int32 ID_CONCEPTO, Int32 ID_PERIODO, Decimal CANTIDAD, Decimal VALOR, String ORIGEN, String ESTADO, DateTime FECHA, Conexion conexion)
        {
            Decimal id = 0;
            String sql = null;
            String informacion = null;
            Boolean ejecutar = true;
            tools _tools = new tools();

            sql = "usp_nom_nomina_novedades_adicionar ";

            #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 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 (ID_PERIODO != 0)
            {
                sql += "'" + ID_PERIODO.ToString() + "', ";
                informacion += "ID_PERIODO= '" + ID_PERIODO.ToString() + ", ";
            }
            else
            {
                MensajeError = "El campo ID_PERIODO es requerido para la consulta.";
                ejecutar = false;
            }
            sql += "'" + _tools.convierteComaEnPuntoParaDecimalesEnSQL(CANTIDAD).ToString() + "', ";
            informacion += "CANTIDAD= '" + _tools.convierteComaEnPuntoParaDecimalesEnSQL(CANTIDAD).ToString() + ", ";
            sql += "'" + _tools.convierteComaEnPuntoParaDecimalesEnSQL(VALOR).ToString() + "', ";
            informacion += "VALOR= '" + _tools.convierteComaEnPuntoParaDecimalesEnSQL(VALOR).ToString() + ", ";

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

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

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

                    #region auditoria
                    auditoria _auditoria = new auditoria(Empresa);
                    _auditoria.Adicionar(Usuario, tabla.NOM_NOMINA_NOVEDADES, tabla.ACCION_ELIMINAR, sql, informacion, conexion);
                    #endregion auditoria
                }
                catch (Exception e)
                {
                    MensajeError = e.Message;
                    id = 0;
                }
            }
            return id;
        }
        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 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 ActualizarRecOcupacionesFuentes(int REGISTRO, int ID_FUENTE, int ID_OCUPACION, String OBSERVACIONES, String LLAVE)
        {
            Int32   cantidadRegistrosActualizados = 0;
            String  sql         = null;
            String  informacion = null;
            Boolean ejecutar    = true;

            tools _tools = new tools();

            sql = "usp_rec_ocupaciones_fuente_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_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 (ID_OCUPACION != 0)
            {
                sql         += ID_OCUPACION + ", ";
                informacion += "ID_OCUPACION = '" + ID_OCUPACION.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo ID_OCUPACION 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(LLAVE)))
            {
                sql         += "'" + LLAVE + "', ";
                informacion += "LLAVE = '" + LLAVE.ToString() + "', ";
            }
            else
            {
                MensajeError += "El campo LLAVE 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.REC_OCUPACIONES_FUENTE, 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 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 Decimal AdicionarMotivo(Programa.Areas idArea,
            String motivo,
            String tipo,
            Boolean activo,
            Conexion conexion)
        {
            String sql = null;
            String identificador = null;
            String informacion = null;
            Boolean ejecutar = true;

            tools _tools = new tools();

            sql = "usp_prog_motivos_cancelacion_reprogramacion_adicionar ";
            #region validaciones

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

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

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

            if (activo == true)
            {
                sql += "'True', ";
                informacion += "ACTIVO = 'True', ";
            }
            else
            {
                sql += "'False', ";
                informacion += "ACTIVO = 'False', ";
            }

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

            #endregion validaciones

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

                    #region auditoria
                    auditoria _auditoria = new auditoria(Empresa);
                    _auditoria.Adicionar(Usuario, tabla.PROG_MOTIVOS_CANCELACION_REPROGRAMACION, 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 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 Boolean Actualizar(Decimal ID_ENTIDAD,
            String NOMBRE,
            String DESCRIPCION,
            Boolean ACTIVO)
        {
            Conexion conexion = new Conexion(Empresa);
            String sql = null;
            String informacion = null;
            Boolean ejecutar = true;
            Boolean ejecutadoCorrectamente = true;

            tools _tools = new tools();

            sql = "usp_prog_entidades_colaboradoras_actualizar ";

            #region validaciones

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

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

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

            if (ACTIVO == true)
            {
                sql += "'True', ";
            }
            else
            {
                sql += "'False', ";
            }

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

            #endregion validaciones

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

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

            return ejecutadoCorrectamente;
        }
        public Int32 Adicionar(Decimal REGISTRO, Decimal ID_CONCEPTO, String PORCENTAJE, Conexion conexion)
        {
            String sql = null;
            String informacion = null;
            Boolean ejecutar = true;
            String id = null;

            tools _tools = new tools();

            sql = "usp_ven_d_nomina_incapacidades_adicionar ";

            #region validaciones

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

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

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

            #endregion validaciones

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

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

            if (!(String.IsNullOrEmpty(id))) return Convert.ToInt32(id);
            else return 0;
        }
        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 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;
            }
        }
Esempio n. 37
0
        public Boolean ActualizarPresupuestoGeneral(Decimal ID_PRES_GEN,
            Decimal MONTO,
            String DESCRIPCION)
        {
            Conexion conexion = new Conexion(Empresa);
            conexion.IniciarTransaccion();

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

            int numRegistrosAfectados = 0;

            tools _tools = new tools();

            sql = "usp_prog_presupuestos_generales_actualizar ";

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

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

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

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

            #endregion validaciones

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

                    if (numRegistrosAfectados <= 0)
                    {
                        conexion.DeshacerTransaccion();
                        numRegistrosAfectados = 0;
                        ejecutadoCorrectamente = false;
                    }
                    else
                    {
                        auditoria _auditoria = new auditoria(Empresa);

                        if (_auditoria.Adicionar(Usuario, tabla.PROG_PRESUPUESTOS_GENERALES, tabla.ACCION_ACTUALIZAR, sql, informacion, conexion) == false)
                        {
                            conexion.DeshacerTransaccion();
                            numRegistrosAfectados = 0;
                            ejecutadoCorrectamente = false;
                        }
                    }

                    if (ejecutadoCorrectamente == true)
                    {
                        conexion.AceptarTransaccion();
                    }
                }
                catch (Exception e)
                {
                    conexion.DeshacerTransaccion();
                    MensajeError = e.Message;
                    ejecutadoCorrectamente = false;
                    numRegistrosAfectados = 0;
                }
                finally
                {
                    conexion.Desconectar();
                }
            }
            else
            {
                ejecutadoCorrectamente = false;
                numRegistrosAfectados = 0;
            }

            if (ejecutadoCorrectamente)
            {
                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 Boolean ActualizarRecFuentes(Decimal ID_FUENTE,
                                            String NOM_FUENTE,
                                            String DIR_FUENTE,
                                            String CIU_FUENTE,
                                            String TEL_FUENTE,
                                            String ENCARGADO,
                                            String CARGO_ENC,
                                            String OBS_FUENTE,
                                            String EMAIL_ENCARGADO)
        {
            Int32   cantidadRegistrosActualizados = 0;
            String  sql         = null;
            String  informacion = null;
            Boolean ejecutar    = true;

            tools _tools = new tools();

            sql = "usp_rec_fuentes_actualizar ";

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

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

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

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

            if (!(String.IsNullOrEmpty(EMAIL_ENCARGADO)))
            {
                sql         += "'" + EMAIL_ENCARGADO + "'";
                informacion += "EMAIL_ENCARGADO = '" + EMAIL_ENCARGADO.ToString() + "'";
            }
            else
            {
                MensajeError += "El campo EMAIL_ENCARGADO 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.REC_FUENTES, 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);
            }
        }