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 String EliminarMemorando(String PERIODOS_MEMOS) { Conexion conexion = new Conexion(Empresa); Boolean ejecutar = true; String sql = null; sql = "usp_eliminar_memorando "; #region validaciones if (!(String.IsNullOrEmpty(PERIODOS_MEMOS))) { sql += "'" + PERIODOS_MEMOS.ToString() + "' "; } else { MensajeError = "El campo PERIODOS_MEMOS es requerido para la consulta."; ejecutar = false; } #endregion if (ejecutar == true) { try { conexion.ExecuteScalar(sql); } catch (Exception e) { MensajeError = e.Message; } finally { conexion.Desconectar(); } } return "S"; }
public Decimal Adicionar(Decimal ID_EMPLEADO, Int32 ID_CONCEPTO, Int32 ID_PERIODO, String CANTIDAD, String VALOR, String ORIGEN, String ESTADO, String ID_CIUDAD, Decimal ID_CENTRO_C, Decimal ID_SUB_C, String CAMBIO_UBICACION) { 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.Replace(',', '.') + ", "; sql += VALOR.Replace(',', '.') + ", "; 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 += "'" + ID_CIUDAD.ToString() + "', "; informacion += "ID_CIUDAD = '" + ID_CIUDAD.ToString() + "', "; sql += "'" + ID_CENTRO_C + "', "; informacion += "ID_CENTRO_C = '" + ID_CENTRO_C.ToString() + "', "; sql += "'" + ID_SUB_C + "', "; informacion += "ID_SUB_C = '" + ID_SUB_C.ToString() + "', "; sql += "'" + CAMBIO_UBICACION + "', "; informacion += "CAMBIO_UBICACION = '" + CAMBIO_UBICACION.ToString() + "', "; sql += "'" + Usuario + "' "; informacion += "USU_CRE = '" + Usuario.ToString() + "'"; #endregion if (ejecutar) { Conexion conexion = new Conexion(Empresa); try { idRecuperado = conexion.ExecuteScalar(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; } finally { conexion.Desconectar(); } } if (!(String.IsNullOrEmpty(idRecuperado))) return Convert.ToDecimal(idRecuperado); else return 0; }
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 String ValideNomina(Int32 ID_PERIODO, Decimal ID_EMPLEADO) { String sql = null; String Validado = ""; Boolean ejecutar = false; sql = "usp_validar_empleado_reliquidar "; #region validaciones if (ID_PERIODO != 0) { sql += "'" + ID_PERIODO.ToString() + "' "; } else { MensajeError = "El campo ID_PERIODO es requerido para la eliminacion."; ejecutar = false; } if (ID_EMPLEADO != 0) { sql += "'" + ID_EMPLEADO.ToString() + "' "; } else { MensajeError = "El campo ID_EMPLEADO es requerido para la eliminacion."; ejecutar = false; } #endregion if (ejecutar) { Conexion conexion = new Conexion(Empresa); try { Validado = conexion.ExecuteScalar(sql); } catch (Exception e) { MensajeError = e.Message; } finally { conexion.Desconectar(); } } return Validado; }
public Decimal ObtenerAlmRegProductosProveedorPorProductoProveedor(int ID_PRODUCTO, int ID_PROVEEDOR) { String sql = null; String informacion = null; Boolean ejecutar = true; String identificador = null; sql = "USP_ALM_REG_PRODUCTOS_PROVEEDOR_OBTENER_REGISTRO_POR_PRODUCTO_PROVEEDOR "; if (ID_PRODUCTO != 0) { sql += ID_PRODUCTO + ", "; informacion += "ID_PRODUCTO = '" + ID_PRODUCTO.ToString() + "'"; } else { MensajeError += "El campo ID_PRODUCTO no puede ser nulo\n"; ejecutar = false; } if (ID_PROVEEDOR != 0) { sql += ID_PROVEEDOR + " "; informacion += "ID_PROVEEDOR = '" + ID_PROVEEDOR.ToString() + "'"; } else { MensajeError += "El campo ID_PROVEEDOR no puede ser nulo\n"; ejecutar = false; } if (ejecutar) { Conexion conexion = new Conexion(Empresa); try { identificador = conexion.ExecuteScalar(sql); #region auditoria auditoria _auditoria = new auditoria(Empresa); _auditoria.Adicionar(Usuario, tabla.ALM_REG_PRODUCTO_PROVEEDOR, tabla.ACCION_CONSULTAR, sql, informacion, conexion); #endregion auditoria } catch (Exception e) { MensajeError = e.Message; } finally { conexion.Desconectar(); } } if (!(String.IsNullOrEmpty(identificador))) return Convert.ToDecimal(identificador); else return 0; }
public Decimal AdicionarConRegExamenesEmpleado(int ID_ORDEN, int ID_EXAMEN, Decimal COSTO, String VALIDADO, DateTime FECHA_EXAMEN, Conexion conexion) { String sql = null; Decimal identificador = 0; String informacion = null; Boolean ejecutar = true; tools _tools = new tools(); sql = "USP_CON_REG_EXAMENES_EMPLEADO_ADICIONAR "; #region validaciones if (ID_ORDEN != 0) { sql += ID_ORDEN + ", "; informacion += "ID_ORDEN = '" + ID_ORDEN.ToString() + "', "; } else { MensajeError += "El campo ID_ORDEN no puede ser nulo\n"; ejecutar = false; } if (ID_EXAMEN != 0) { sql += ID_EXAMEN + ", "; informacion += "ID_EXAMEN = '" + ID_EXAMEN.ToString() + "', "; } else { MensajeError += "El campo ID_EXAMEN no puede ser nulo\n"; ejecutar = false; } if (COSTO != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(COSTO) + ", "; informacion += "COSTO = '" + COSTO.ToString() + "', "; } else { sql += "0, "; informacion += "COSTO = '0', "; } if (!(String.IsNullOrEmpty(VALIDADO))) { sql += "'" + VALIDADO + "', "; informacion += "VALIDADO = '" + VALIDADO.ToString() + "', "; } else { sql += "'N', "; informacion += "VALIDADO = 'N', "; } if (!(String.IsNullOrEmpty(FECHA_EXAMEN.ToString()))) { sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_EXAMEN) + "', "; informacion += "FECHA_EXAMEN = '" + FECHA_EXAMEN.ToString() + "', "; } sql += "'" + Usuario + "' "; informacion += "USU_CRE= '" + Usuario.ToString() + "' "; #endregion validaciones if (ejecutar) { try { identificador = Convert.ToDecimal(conexion.ExecuteScalar(sql)); #region auditoria auditoria _auditoria = new auditoria(Empresa); _auditoria.Adicionar(Usuario, tabla.CON_REG_EXAMENES_EMPLEADO, tabla.ACCION_ADICIONAR, sql, informacion, conexion); #endregion auditoria } catch (Exception e) { MensajeError = e.Message; identificador = 0; } } return identificador; }
public Decimal 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; }
public Int32 GrabarRegistrosTempCesantias(Decimal ID_EMPRESA, Int32 ID_EMPLEADO, Decimal DEVENGADO, Decimal SALARIO, Decimal VALOR_CESANTIAS, Decimal VALOR_INTERESES, Int32 CONTROL) { Conexion conexion = new Conexion(Empresa); Boolean ejecutar = true; String sql = null; Int32 _grabado = 0; sql = "usp_grabar_registros_temporales_cesantias "; #region validaciones if (ID_EMPRESA > 0) { sql += ID_EMPRESA.ToString() + ", "; } else { MensajeError = "El campo ID_EMPRESA es requerido para la consulta."; ejecutar = false; } if (ID_EMPLEADO > 0) { sql += ID_EMPLEADO.ToString() + ", "; } else { MensajeError = "El campo ID_EMPLEADO es requerido para la consulta."; ejecutar = false; } if (DEVENGADO > 0) { sql += DEVENGADO.ToString() + ", "; } else { MensajeError = "El campo DEVENGADO es requerido para la consulta."; ejecutar = false; } if (SALARIO > 0) { sql += SALARIO.ToString() + ", "; } else { MensajeError = "El campo SALARIO es requerido para la consulta."; ejecutar = false; } if (VALOR_CESANTIAS > 0) { sql += VALOR_CESANTIAS.ToString() + ", "; } else { MensajeError = "El campo VALOR_CESANTIAS es requerido para la consulta."; ejecutar = false; } if (VALOR_INTERESES > 0) { sql += VALOR_INTERESES.ToString() + ", "; } else { MensajeError = "El campo VALOR_INTERESES es requerido para la consulta."; ejecutar = false; } if (CONTROL > 0) { sql += CONTROL.ToString() + ", "; } else { MensajeError = "El campo CONTROL es requerido para la consulta."; ejecutar = false; } if (!(String.IsNullOrEmpty(Usuario))) { sql += "'" + Usuario.ToString() + "'"; } else { MensajeError = "El campo Usuario es requerido para la consulta."; ejecutar = false; } #endregion if (ejecutar) { try { _grabado = Convert.ToInt32(conexion.ExecuteScalar(sql)); } catch (Exception e) { MensajeError = e.Message; conexion.DeshacerTransaccion(); } finally { conexion.Desconectar(); } } return _grabado; }
public Boolean EliminarAlivio(Int32 ID_ALIVIO_TRIBUTARIO) { Conexion conexion = new Conexion(Empresa); Boolean _eliminado = false; Int32 _eliminados = 0; String sql = null; Boolean ejecutar = true; sql = "usp_alivios_tributarios_eliminar "; #region validaciones if (ID_ALIVIO_TRIBUTARIO > 0) { sql += ID_ALIVIO_TRIBUTARIO.ToString() + ""; } else { MensajeError = "El campo ID_ALIVIO_TRIBUTARIO es requerido para la consulta."; ejecutar = false; } #endregion if (ejecutar == true) { try { _eliminados = Convert.ToInt32(conexion.ExecuteScalar(sql)); if (_eliminados > 0) _eliminado = true; } catch (Exception e) { MensajeError = e.Message; } finally { conexion.Desconectar(); } } return _eliminado; }
public Decimal ObtenerValorSalud(Int32 ALIVIO, Int32 ID_EMPLEADO, Int32 ANIO) { Conexion conexion = new Conexion(Empresa); Decimal ValorSalud = 0; String sql = null; Boolean ejecutar = true; sql = "usp_alivios_calcular_salud "; #region validaciones if (ALIVIO > 0) { sql += ALIVIO.ToString() + ", "; } else { MensajeError = "El campo ALIVIO es requerido para la consulta."; ejecutar = false; } if (ID_EMPLEADO > 0) { sql += ID_EMPLEADO.ToString() + ", "; } else { MensajeError = "El campo ID_EMPLEADO es requerido para la consulta."; ejecutar = false; } if (ANIO > 0) { sql += ANIO.ToString() + ""; } else { MensajeError = "El campo AÑO es requerido para la consulta."; ejecutar = false; } #endregion if (ejecutar == true) { try { ValorSalud = Convert.ToDecimal(conexion.ExecuteScalar(sql)); } catch (Exception e) { MensajeError = e.Message; } finally { conexion.Desconectar(); } } return ValorSalud; }
public Boolean GrabarRegistrosDefCesantias(Decimal ID_EMPRESA, Int32 PERIODO, String FECHA, String TIPO_PAGO, Int32 ID_CONCEPTO_CESANTIAS, Int32 ID_CONCEPTO_INTERESES, Int32 CONTROL) { Conexion conexion = new Conexion(Empresa); conexion.IniciarTransaccion(); Boolean ejecutar = true; String sql = null; String informacion = null; Boolean grabado = false; sql = "usp_grabar_cesantias_definitiva "; #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 += PERIODO.ToString() + ", "; sql += "'" + FECHA.ToString() + "', "; sql += "'" + TIPO_PAGO.ToString() + "', "; sql += ID_CONCEPTO_CESANTIAS.ToString() + ", "; sql += ID_CONCEPTO_INTERESES.ToString() + ", "; sql += CONTROL.ToString() + ", "; if (!(String.IsNullOrEmpty(Usuario))) { sql += "'" + Usuario.ToString() + "'"; informacion += "USU_CRE = '" + Usuario.ToString() + "'"; } else { MensajeError = "El campo Usuario es requerido para la consulta."; ejecutar = false; } #endregion if (ejecutar) { try { grabado = Convert.ToBoolean(conexion.ExecuteScalar(sql)); if (grabado == true) { #region auditoria #endregion auditoria conexion.AceptarTransaccion(); } else conexion.DeshacerTransaccion(); } catch (Exception e) { MensajeError = e.Message; conexion.DeshacerTransaccion(); } finally { conexion.Desconectar(); } } return grabado; }
public Decimal Adicionar(String NOMBRE, String DESCRIPCION, Programa.Areas ID_AREA) { String sql = null; Decimal idRecuperado = 0; String informacion = null; Boolean ejecutar = true; sql = "usp_prog_entidades_colaboradoras_adicionar "; if (String.IsNullOrEmpty(NOMBRE) == false) { sql += "'" + NOMBRE + "', "; informacion += "NOMBRE = '" + NOMBRE + "', "; } else { MensajeError += "El campo NOMBRE no puede ser nulo\n"; ejecutar = false; } if (String.IsNullOrEmpty(DESCRIPCION) == false) { sql += "'" + DESCRIPCION + "', "; informacion += "DESCRIPCION = '" + DESCRIPCION + "', "; } else { MensajeError += "El campo DESCRIPCION no puede ser nulo\n"; ejecutar = false; } sql += "'" + ID_AREA.ToString() + "', "; informacion += "AREA = '" + ID_AREA.ToString() + "', "; sql += "'" + Usuario + "'"; informacion += "USU_CRE = '" + Usuario.ToString() + "'"; if (ejecutar) { Conexion conexion = new Conexion(Empresa); try { idRecuperado = Convert.ToDecimal(conexion.ExecuteScalar(sql)); #region auditoria auditoria _auditoria = new auditoria(Empresa); _auditoria.Adicionar(Usuario, tabla.PROG_ENTIDADES_COLABORADORAS, tabla.ACCION_ADICIONAR, sql, informacion, conexion); #endregion auditoria } catch (Exception e) { MensajeError = e.Message; idRecuperado = 0; } finally { conexion.Desconectar(); } } return idRecuperado; }
public Int32 TraerPeriodMemoCesantias(Decimal ID_EMPRESA) { Conexion conexion = new Conexion(Empresa); Boolean ejecutar = true; String sql = null; Int32 _periodo = 0; sql = "usp_obtener_periodo_memorando_para_cesantias "; #region validaciones if (ID_EMPRESA > 0) { sql += ID_EMPRESA.ToString() + ""; } else { MensajeError = "El campo ID_EMPRESA es requerido para la consulta."; ejecutar = false; } #endregion if (ejecutar) { try { _periodo = Convert.ToInt32(conexion.ExecuteScalar(sql)); } catch (Exception e) { MensajeError = e.Message; conexion.DeshacerTransaccion(); } finally { conexion.Desconectar(); } } return _periodo; }
public Int32 ObtenerLiquidacionesCesantias(Decimal ID_EMPRESA, String FECHA) { Conexion conexion = new Conexion(Empresa); Boolean ejecutar = true; String sql = null; Int32 _grabado = 0; sql = "usp_buscar_liquidacion_cesantias "; #region validaciones if (ID_EMPRESA > 0) { sql += ID_EMPRESA.ToString() + ", "; } else { MensajeError = "El campo ID_EMPRESA es requerido para la consulta."; ejecutar = false; } sql += "'" + FECHA.ToString() + "'"; #endregion if (ejecutar) { try { _grabado = Convert.ToInt32(conexion.ExecuteScalar(sql)); } catch (Exception e) { MensajeError = e.Message; conexion.DeshacerTransaccion(); } finally { conexion.Desconectar(); } } return _grabado; }
public String ObtenerEmpresaCesantias(Decimal ID_EMPRESA) { Conexion conexion = new Conexion(Empresa); conexion.IniciarTransaccion(); Boolean ejecutar = true; String sql = null; String _empresa = ""; sql = "usp_traer_empresa "; #region validaciones if (ID_EMPRESA > 0) { sql += ID_EMPRESA.ToString() + ""; } else { MensajeError = "El campo ID_EMPRESA es requerido para la consulta."; ejecutar = false; } #endregion if (ejecutar) { try { _empresa = conexion.ExecuteScalar(sql); } catch (Exception e) { MensajeError = e.Message; conexion.DeshacerTransaccion(); } finally { conexion.Desconectar(); } } return _empresa; }
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 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 Decimal Adicionar(String DESCRIPCION, String DESC_ABREV, Boolean ACTIVO) { String sql = null; String ID = null; String informacion = null; Boolean ejecutar = true; Boolean ejecutadoCorrectamente = true; sql = "usp_par_unidad_reporte_adicionar "; #region validaciones if (!(String.IsNullOrEmpty(DESCRIPCION))) { sql += "'" + DESCRIPCION + "', "; informacion += "DESCRIPCION = '" + DESCRIPCION + "', "; } else { MensajeError += "El campo DESCRIPCION no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(DESC_ABREV))) { sql += "'" + DESC_ABREV + "', "; informacion += "DESC_ABREV = '" + DESC_ABREV + "', "; } else { MensajeError += "El campo DESC_ABREV no puede ser nulo\n"; ejecutar = false; } informacion += "ACTIVO = '" + ACTIVO + "' "; if (ACTIVO) sql += "1,"; else sql += "0,"; sql += "'" + Usuario + "' "; informacion += "USU_CRE = '" + Usuario.ToString() + "' "; #endregion validaciones if (ejecutar) { Conexion conexion = new Conexion(Empresa); conexion.IniciarTransaccion(); try { #region adicionar ID = conexion.ExecuteScalar(sql); #endregion adicionar #region auditoria auditoria _auditoria = new auditoria(Empresa); if (!(_auditoria.Adicionar(Usuario, tabla.PAR_UNIDAD_REPORTE, tabla.ACCION_ADICIONAR, sql, informacion, conexion))) ejecutadoCorrectamente = false; #endregion auditoria conexion.AceptarTransaccion(); } catch (Exception e) { conexion.DeshacerTransaccion(); MensajeError = e.Message; } finally { conexion.Desconectar(); } } if (!(String.IsNullOrEmpty(ID))) return Convert.ToDecimal(ID); else return 0; }
public Boolean Eliminar(Decimal REGISTRO, Conexion conexion) { String sql = null; Boolean ejecutar = true; sql = "usp_ven_d_nomina_incapacidades_delete "; #region validaciones if (REGISTRO != 0) { sql += REGISTRO; } else { MensajeError += "El campo REGISTRO no puede ser nulo\n"; ejecutar = false; } #endregion validaciones if (ejecutar) { try { conexion.ExecuteScalar(sql); } catch (Exception e) { MensajeError = e.Message; } } if ((String.IsNullOrEmpty(MensajeError))) return true; else return false; }
public Boolean ActualizarAlivio(Int32 ID_ALIVIO_TRIBUTARIO, Int32 ID_PAR_ALIVIO_TRIBUTARIO, Int32 ID_EMPLEADO, Decimal VALOR, Decimal PORCENTAJE, Int32 AÑO_GRAVABLE, String ACTIVO) { Conexion conexion = new Conexion(Empresa); Boolean _actualizado = false; Int32 _actualizados = 0; String sql = null; Boolean ejecutar = true; sql = "usp_alivios_tributarios_actualizar "; #region validaciones if (ID_ALIVIO_TRIBUTARIO > 0) { sql += ID_ALIVIO_TRIBUTARIO.ToString() + ", "; } else { MensajeError = "El campo ID_ALIVIO_TRIBUTARIO es requerido para la consulta."; ejecutar = false; } if (ID_PAR_ALIVIO_TRIBUTARIO > 0) { sql += ID_PAR_ALIVIO_TRIBUTARIO.ToString() + ", "; } else { MensajeError = "El campo ID_PAR_ALIVIO_TRIBUTARIO es requerido para la consulta."; ejecutar = false; } if (ID_EMPLEADO > 0) { sql += ID_EMPLEADO.ToString() + ", "; } else { MensajeError = "El campo ID_EMPLEADO es requerido para la consulta."; ejecutar = false; } sql += VALOR.ToString().Replace(',', '.') + ", "; sql += PORCENTAJE.ToString().Replace(',', '.') + ", "; sql += AÑO_GRAVABLE.ToString() + ", "; sql += "'" + ACTIVO + "', "; if (!(String.IsNullOrEmpty(Usuario))) { sql += "'" + Usuario.ToString() + "'"; } else { MensajeError = "El campo USUARIO es requerido para la consulta."; ejecutar = false; } #endregion if (ejecutar == true) { try { _actualizados = Convert.ToInt32(conexion.ExecuteScalar(sql)); if (_actualizados > 0) _actualizado = true; } catch (Exception e) { MensajeError = e.Message; } finally { conexion.Desconectar(); } } return _actualizado; }
public Decimal Adicionar(String DESCRIPCION, Decimal PORCENTAJE, String COD_CONTABLE) { String sql = null; String ID = null; String informacion = null; Boolean ejecutar = true; Boolean ejecutadoCorrectamente = true; sql = "usp_par_seguridad_social_adicionar "; #region validaciones if (!(String.IsNullOrEmpty(DESCRIPCION))) { sql += "'" + DESCRIPCION + "', "; informacion += "DESCRIPCION = '" + DESCRIPCION + "', "; } else { MensajeError += "El campo DESCRIPCION no puede ser nulo\n"; ejecutar = false; } if (PORCENTAJE != 0) { sql += "'" + PORCENTAJE + "', "; informacion += "PORCENTAJE = '" + PORCENTAJE + "', "; } else { MensajeError += "El campo PORCENTAJE no puede ser cero\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(COD_CONTABLE))) { sql += "'" + COD_CONTABLE + "', "; informacion += "COD_CONTABLE = '" + COD_CONTABLE + "', "; } else { MensajeError += "El campo COD_CONTABLE no puede ser nulo\n"; ejecutar = false; } sql += "'" + Usuario + "' "; informacion += "USU_CRE = '" + Usuario.ToString() + "' "; #endregion validaciones if (ejecutar) { Conexion conexion = new Conexion(Empresa); conexion.IniciarTransaccion(); try { #region adicionar ID = conexion.ExecuteScalar(sql); #endregion adicionar #region auditoria auditoria _auditoria = new auditoria(Empresa); if (!(_auditoria.Adicionar(Usuario, tabla.PAR_SEGURIDAD_SOCIAL, tabla.ACCION_ADICIONAR, sql, informacion, conexion))) ejecutadoCorrectamente = false; #endregion auditoria conexion.AceptarTransaccion(); } catch (Exception e) { conexion.DeshacerTransaccion(); MensajeError = e.Message; } finally { conexion.Desconectar(); } } if (!(String.IsNullOrEmpty(ID))) return Convert.ToDecimal(ID); else return 0; }
public String ElaborarContrato(int id_requerimiento, int id_solicitud, int id_empresa, int id_centro_Costo, int id_sub_cc, String ciudad, int ID_SERVICIO_RESPECTIVO, int servicio, int id_ARP, int id_caja_c, int id_EPS, int id_Pensiones, Decimal riesgo, String pensionado, String Clase_Contrato, String Tipo_Contrato, String Tipo_Pago, DateTime fecha_Inicia, DateTime fecha_termina, String sal_int, Decimal Salario, String vigente, String activo, String liquidado, String pago_Liquidacion, int id_entidad, String Num_Cuenta, String Forma_pago, 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 tipo_Cuenta, string descripcion_salario, decimal idPerfil) { String datosG = ""; int id_perfil = 0; Conexion conexion = new Conexion(Empresa); conexion.IniciarTransaccion(); try { requisicion _req = new requisicion(Empresa, Usuario); DataTable tablaReq = _req.ObtenerComRequerimientoPorIdRequerimiento(Convert.ToDecimal(id_requerimiento), conexion); DataRow filaReq = tablaReq.Rows[0]; id_perfil = Convert.ToInt32(filaReq["REGISTRO_PERFIL"].ToString()); usuario _empleado = new usuario(Empresa); radicacionHojasDeVida _sol = new radicacionHojasDeVida(Empresa, Usuario); Decimal idEmpleado = _empleado.AdicionarNomEmpleados(0, id_solicitud, id_empresa, id_centro_Costo, id_sub_cc, fecha_Inicia, Salario, pensionado, activo, liquidado, riesgo, id_ARP, id_caja_c, id_EPS, id_Pensiones, "C", id_entidad, Num_Cuenta, sal_int, ciudad, id_perfil, tipo_Cuenta, descripcion_salario, Forma_pago, conexion); if (idEmpleado <= 0) { _mensaje_error = "\n El empleado no fue creado, " + _empleado.MensajeError; conexion.DeshacerTransaccion(); } else { registroContrato _contrato = new registroContrato(Empresa, Usuario); Decimal id_Contrato = 0; /* revisado por cambio en riesgo */ id_Contrato = _contrato.AdicionarConRegContratos(Convert.ToInt32(idEmpleado), id_requerimiento, id_solicitud, id_centro_Costo, id_sub_cc, Clase_Contrato, fecha_Inicia, fecha_termina, vigente, pago_Liquidacion, sal_int, Tipo_Contrato, ID_SERVICIO_RESPECTIVO, ciudad, servicio, conexion, PAGO_DIAS_PRODUCTIVIDAD, SENA_PRODICTIVO, SENA_ELECTIVO, PRACTICANTE_UNIVERSITARIO, VALOR_NOMINA, VALOR_CONTRATO, FECHA_INICIO_PERIODO, FECHA_FIN_PERIODO, Periodo_Pago); if (String.IsNullOrEmpty(_contrato.MensajeError)) { _empleado.ActualizarNomEmpleados(Convert.ToInt32(idEmpleado), Convert.ToInt32(id_Contrato), id_solicitud, id_empresa, id_centro_Costo, id_sub_cc, fecha_Inicia, Salario, pensionado, activo, liquidado, riesgo, id_ARP, id_caja_c, id_EPS, id_Pensiones, "C", id_entidad, Num_Cuenta, sal_int, ciudad, id_perfil, Forma_pago, conexion); if (String.IsNullOrEmpty(_empleado.MensajeError)) { if (_sol.ActualizarEstadoProcesoRegSolicitudesIngreso(id_requerimiento, id_solicitud, "CONTRATADO", Usuario, conexion)) { if (_sol.ActualizarEstadoRegSolicitudesIngreso(id_requerimiento, id_solicitud, "CONTRATADO", conexion)) { datosG = id_Contrato + "," + idEmpleado; try { conexion.ExecuteNonQuery("usp_ESC_CRT_ENTREGAS_SC_adicionar " + idEmpleado + ", '" + Usuario + "'"); conexion.ExecuteNonQuery("usp_empleado_clausulas_contratar " + idEmpleado + ", " + idPerfil + ", '" + Usuario + "'"); Int32 requerimientoActualizado = Convert.ToInt32(conexion.ExecuteScalar("usp_comprobar_cierre_requisicion_por_sistema " + id_requerimiento.ToString() + ", '" + Usuario + "'")); if (requerimientoActualizado <= 0) { conexion.DeshacerTransaccion(); MensajeError = "El empleado no fue creado, Ocurrio un error al momento de determinar si la requisición debe ser cuplida por sistema."; } else { conexion.AceptarTransaccion(); } } catch { _mensaje_error += "\n No fue posible registrar los servicios complementarios o clausulas para el perfil contratado " + _sol.MensajeError; conexion.AceptarTransaccion(); } } else { _mensaje_error += "\n No fue posible actualizar el estado de la solicitud: " + _sol.MensajeError; conexion.DeshacerTransaccion(); } } else { _mensaje_error += "\n No fue posible actualizar el estado del proceso de la soliciutd: " + _sol.MensajeError; conexion.DeshacerTransaccion(); } } else { _mensaje_error += "\n Se presentó el siguiente error en la actualización del empleado: " + _empleado.MensajeError; conexion.DeshacerTransaccion(); } } else { _mensaje_error += "\n Se presentó el siguiente error en la creación del contrato: " + _contrato.MensajeError; conexion.DeshacerTransaccion(); } } } catch (Exception e) { MensajeError = e.Message; conexion.DeshacerTransaccion(); } finally { conexion.Desconectar(); } return datosG; }
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 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 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; }
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 Int32 ObtenerRegistroContratoNovedadesPorCedula(Decimal ID_EMPRESA, String CEDULA) { String sql = null; Int32 Registro = 0; Boolean ejecutar = true; sql = "usp_retorna_registro_ultimo_contrato_activo_desde_cedula "; #region validaciones if (ID_EMPRESA != 0) { sql += ID_EMPRESA.ToString() + ", "; } else { MensajeError = "El campo ID_EMPRESA es requerido para la consulta."; ejecutar = false; } if (!(String.IsNullOrEmpty(CEDULA))) { sql += "'" + CEDULA.ToString() + "'"; } else { MensajeError = "El campo CEDULA es requerido para la consulta."; ejecutar = false; } #endregion if (ejecutar) { Conexion conexion = new Conexion(Empresa); try { Registro = Convert.ToInt32(conexion.ExecuteScalar(sql)); } catch (Exception e) { MensajeError = e.Message; } finally { conexion.Desconectar(); } } return Registro; }
public Decimal Adicionar(String NIT, String DIG_VER, String COD_ENTIDAD, String NOM_ENTIDAD, String DIR_ENTIDAD, String TEL_ENTIDAD, String CONTACTO, String CARGO) { String sql = null; String ID = null; String informacion = null; Boolean ejecutar = true; Boolean ejecutadoCorrectamente = true; sql = "usp_con_ent_afp_adicionar "; #region validaciones if (!(String.IsNullOrEmpty(NIT))) { sql += "'" + NIT + "', "; informacion += "NIT = '" + NIT + "', "; } else { MensajeError += "El campo NIT no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(DIG_VER))) { sql += "'" + DIG_VER + "', "; informacion += "DIG_VER = '" + DIG_VER + "', "; } else { MensajeError += "El campo DIGITO DE VERIFICACION no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(COD_ENTIDAD))) { sql += "'" + COD_ENTIDAD + "', "; informacion += "COD_ENTIDAD = '" + COD_ENTIDAD + "', "; } else { MensajeError += "El campo CODIGO DE ENTIDAD no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(NOM_ENTIDAD))) { sql += "'" + NOM_ENTIDAD + "', "; informacion += "NOM_ENTIDAD = '" + NOM_ENTIDAD + "', "; } else { MensajeError += "El campo NOMBRE DE ENTIDAD no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(DIR_ENTIDAD))) { sql += "'" + DIR_ENTIDAD + "', "; informacion += "DIR_ENTIDAD = '" + DIR_ENTIDAD + "', "; } else { MensajeError += "El campo DIRECCION DE ENTIDAD no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(TEL_ENTIDAD))) { sql += "'" + TEL_ENTIDAD + "', "; informacion += "TEL_ENTIDAD = '" + TEL_ENTIDAD + "', "; } else { MensajeError += "El campo TELEFONO DE ENTIDAD no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(CONTACTO))) { sql += "'" + CONTACTO + "', "; informacion += "CONTACTO = '" + CONTACTO + "', "; } else { MensajeError += "El campo CONTACTO no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(CARGO))) { sql += "'" + CARGO + "', "; informacion += "CARGO = '" + CARGO + "', "; } else { MensajeError += "El campo CARGO no puede ser nulo\n"; ejecutar = false; } sql += "'" + Usuario + "' "; informacion += "USU_CRE = '" + Usuario.ToString() + "' "; #endregion validaciones if (ejecutar) { Conexion conexion = new Conexion(Empresa); conexion.IniciarTransaccion(); try { #region adicionar entidad ID = conexion.ExecuteScalar(sql); #endregion adicionar entidad #region auditoria auditoria _auditoria = new auditoria(Empresa); if (!(_auditoria.Adicionar(Usuario, tabla.CON_ENT_F_PENSIONES, tabla.ACCION_ADICIONAR, sql, informacion, conexion))) ejecutadoCorrectamente = false; #endregion auditoria conexion.AceptarTransaccion(); } catch (Exception e) { conexion.DeshacerTransaccion(); MensajeError = e.Message; } finally { conexion.Desconectar(); } } if (ejecutadoCorrectamente) return Convert.ToDecimal(ID); else return 0; }
public String ObtenertextDrop(Int32 REGISTRO) { String sql = null; String textDrop = ""; Boolean ejecutar = true; sql = "usp_retorna_text_drp "; #region validaciones if (REGISTRO != 0) { sql += REGISTRO.ToString() + ""; } else { MensajeError = "El campo REGISTRO es requerido para la consulta."; ejecutar = false; } #endregion if (ejecutar) { Conexion conexion = new Conexion(Empresa); try { textDrop = conexion.ExecuteScalar(sql); } catch (Exception e) { MensajeError = e.Message; } finally { conexion.Desconectar(); } } return textDrop; }