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; } }
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 DataTable ObtenerPorNombre(String NOMBRE) { Conexion conexion = new Conexion(Empresa); DataSet _dataSet = new DataSet(); DataView _dataView = new DataView(); DataTable _dataTable = new DataTable(); String sql = null; String informacion = null; Boolean ejecutar = true; sql = "usp_con_ent_afp_obtenerPorNombre "; if (!(String.IsNullOrEmpty(NOMBRE))) { sql += "'" + NOMBRE + "'"; informacion += "NOMBRE = '" + NOMBRE + "'"; } else { MensajeError += "El campo NOMBRE no puede ser nulo. \n"; ejecutar = false; } if (ejecutar) { try { _dataSet = conexion.ExecuteReader(sql); _dataView = _dataSet.Tables[0].DefaultView; _dataTable = _dataView.Table; #region auditoria auditoria _auditoria = new auditoria(Empresa); _auditoria.Adicionar(Usuario, tabla.CON_ENT_F_PENSIONES, tabla.ACCION_CONSULTAR.ToString(), sql, informacion, conexion); #endregion auditoria } catch (Exception e) { MensajeError = e.Message; } finally { conexion.Desconectar(); } } return _dataTable; }
public DataTable ObtenerConRegExamenesEmpleadoPorRegistro(int REGISTRO) { DataSet _dataSet = new DataSet(); DataView _dataView = new DataView(); DataTable _dataTable = new DataTable(); String sql = null; String informacion = null; Boolean ejecutar = true; sql = "USP_CON_REG_EXAMENES_EMPLEADO_OBTENER_POR_REGISTRO "; if (REGISTRO != 0) { sql += REGISTRO; informacion += "REGISTRO = '" + REGISTRO.ToString() + "'"; } else { MensajeError += "El campo REGISTRO no puede ser nulo\n"; ejecutar = false; } if (ejecutar) { Conexion conexion = new Conexion(Empresa); try { _dataSet = conexion.ExecuteReader(sql); _dataView = _dataSet.Tables[0].DefaultView; _dataTable = _dataView.Table; #region auditoria auditoria _auditoria = new auditoria(Empresa); _auditoria.Adicionar(Usuario, tabla.CON_REG_EXAMENES_EMPLEADO, tabla.ACCION_CONSULTAR, sql, informacion, conexion); #endregion auditoria } catch (Exception e) { MensajeError = e.Message; } finally { conexion.Desconectar(); } } return _dataTable; }
public Boolean ActualizarConRegExamenesEmpleadoConArchivo(Decimal REGISTRO, Decimal ID_ORDEN, Decimal ID_EXAMEN, Decimal COSTO, String VALIDADO, DateTime FECHA_EXAMEN, byte[] ARCHIVO_EXAMEN, String ARCHIVO_EXTENSION, Decimal ARCHIVO_TAMANO, String ARCHIVO_TYPE, Conexion conexion) { String informacion = null; Boolean ejecutar = true; Int32 registro = 0; tools _tools = new tools(); String sql = "USP_CON_REG_EXAMENES_EMPLEADO_ACTUALIZAR "; #region validaciones if (REGISTRO != 0) { sql += REGISTRO + ", "; informacion += "REGISTRO = '" + REGISTRO.ToString() + "', "; } else { MensajeError += "El campo REGISTRO no puede ser nulo\n"; ejecutar = false; } if (ID_ORDEN != 0) { sql += ID_ORDEN + ", "; informacion += "ID_ORDEN = '" + ID_ORDEN.ToString() + "', "; } else { MensajeError += "El campo ID_ORDEN no puede ser nulo\n"; ejecutar = false; } if (ID_EXAMEN != 0) { sql += ID_EXAMEN + ", "; informacion += "ID_EXAMEN = '" + ID_EXAMEN.ToString() + "', "; } else { MensajeError += "El campo ID_EXAMEN no puede ser nulo\n"; ejecutar = false; } if (COSTO != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(COSTO) + ", "; informacion += "COSTO = '" + COSTO.ToString() + "', "; } else { sql += "0, "; informacion += "COSTO = '0', "; } if (!(String.IsNullOrEmpty(VALIDADO))) { sql += "'" + VALIDADO + "', "; informacion += "VALIDADO = '" + VALIDADO.ToString() + "', "; } else { sql += "'N', "; informacion += "VALIDADO = 'N', "; } if (!(String.IsNullOrEmpty(FECHA_EXAMEN.ToString()))) { sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_EXAMEN) + "', "; informacion += "FECHA_EXAMEN = '" + FECHA_EXAMEN.ToString() + "', "; } sql += "'" + Usuario + "' "; informacion += "USU_MOD = '" + Usuario.ToString() + "' "; #endregion validaciones if (ejecutar) { try { registro = conexion.ExecuteNonQueryParaActualizarConRegExamenesEmpleadoConArchivo(REGISTRO, ID_ORDEN, ID_EXAMEN, COSTO, VALIDADO, FECHA_EXAMEN, Usuario, ARCHIVO_EXAMEN, ARCHIVO_EXTENSION, ARCHIVO_TAMANO, ARCHIVO_TYPE); if (registro == 0) { return false; } else { #region auditoria auditoria _auditoria = new auditoria(Empresa); _auditoria.Adicionar(Usuario, tabla.CON_REG_EXAMENES_EMPLEADO, tabla.ACCION_ACTUALIZAR, sql, informacion, conexion); #endregion auditoria return true; } } catch (Exception e) { MensajeError = e.Message; return false; } } else { return false; } }
public 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 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 EliminarNovedadPorOrigen(Decimal ID_PERIODO, String ORIGEN, Decimal ID_EMPRESA, String PERIODOSPROCESO, String TIPOPERIODO) { String sql = null; Decimal rowsDeleted = 0; String informacion = null; Boolean ejecutar = true; sql = "usp_nom_nomina_novedades_eliminar_por_origen "; #region validaciones sql += "'" + ID_PERIODO.ToString() + "', "; informacion += "ID_PERIODO= '" + ID_PERIODO.ToString() + ", "; if (!(String.IsNullOrEmpty(ORIGEN))) { sql += "'" + ORIGEN + "', "; informacion += "ORIGEN = '" + ORIGEN.ToString() + "'"; } else { MensajeError += "El campo ORIGEN es requerido para la eliminacion."; ejecutar = false; } sql += "'" + ID_EMPRESA.ToString() + "', "; informacion += "ID_EMPRESA= '" + ID_EMPRESA.ToString() + ", "; sql += "'" + PERIODOSPROCESO.ToString() + "', "; sql += "'" + TIPOPERIODO + "'"; informacion += "PERIODOSPROCESO= '" + PERIODOSPROCESO.ToString() + ", "; informacion += "USU_MOD = '" + Usuario.ToString() + "'"; #endregion if (ejecutar) { Conexion conexion = new Conexion(Empresa); try { rowsDeleted = conexion.ExecuteNonQuery(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; } finally { conexion.Desconectar(); } } return rowsDeleted; }
public DataTable ObtenerContratoEmpleadoPorRegistro(Int32 REGISTRO) { Conexion conexion = new Conexion(Empresa); DataSet _dataSet = new DataSet(); DataView _dataView = new DataView(); DataTable _dataTable = new DataTable(); String sql = null; String informacion = null; Boolean ejecutar = true; sql = "usp_obtener_contrato_empleado_por_registro_contrato "; if (REGISTRO > 0) { sql += REGISTRO.ToString() + ""; informacion += "REGISTRO = " + REGISTRO + ""; } else { MensajeError += "El campo REGISTRO no puede ser nulo ni cero. \n"; ejecutar = false; } if (ejecutar) { try { _dataSet = conexion.ExecuteReader(sql); _dataView = _dataSet.Tables[0].DefaultView; _dataTable = _dataView.Table; #region auditoria auditoria _auditoria = new auditoria(Empresa); _auditoria.Adicionar(Usuario, tabla.CON_REG_CONTRATOS, tabla.ACCION_CONSULTAR.ToString(), sql, informacion, conexion); #endregion auditoria } catch (Exception e) { MensajeError = e.Message; } finally { conexion.Desconectar(); } } return _dataTable; }
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 EliminarNovedadPorId(Int32 REGISTRO) { String sql = null; Decimal rowsDeleted = 0; String informacion = null; Boolean ejecutar = true; sql = "usp_nom_nomina_novedades_eliminar "; #region validaciones if (REGISTRO != 0) { sql += "'" + REGISTRO.ToString() + "' "; informacion += "REGISTRO= '" + REGISTRO.ToString() + ", "; } else { MensajeError = "El campo REGISTRO es requerido para la eliminacion."; ejecutar = false; } informacion += "USU_MOD = '" + Usuario.ToString() + "'"; #endregion if (ejecutar) { Conexion conexion = new Conexion(Empresa); try { rowsDeleted = conexion.ExecuteNonQuery(sql); if (rowsDeleted > 0) { #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; } finally { conexion.Desconectar(); } } return rowsDeleted; }
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; }
public Boolean Actualizar(Int32 REGISTRO, String ESTADO) { Int32 cantidadRegistrosActualizados = 0; String sql = null; String informacion = null; Boolean ejecutar = true; sql = "usp_nom_nomina_novedades_actualizar_estado "; #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 (!(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_MOD = '" + 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_ANULAR, sql, informacion, conexion); #endregion auditoria } catch (Exception e) { MensajeError = e.Message; } finally { conexion.Desconectar(); } } if (cantidadRegistrosActualizados > 0) return true; else return false; }
public Boolean Actualizar(Int32 REGISTRO, Decimal ID_EMPLEADO, Int32 ID_CONCEPTO, Decimal CANTIDAD, Decimal VALOR, DateTime FECHA) { Int32 cantidadRegistrosActualizados = 0; String sql = null; String informacion = null; Boolean ejecutar = true; tools _tools = new tools(); sql = "usp_nom_nomina_novedades_actualizar "; #region validaciones if (REGISTRO != 0) { sql += "'" + REGISTRO.ToString() + "', "; informacion += "REGISTRO= '" + REGISTRO.ToString() + ", "; } else { MensajeError = "El campo REGISTRO es requerido para la consulta."; ejecutar = false; } if (ID_EMPLEADO != 0) { sql += "'" + ID_EMPLEADO.ToString() + "', "; informacion += "ID_EMPLEADO= '" + ID_EMPLEADO.ToString() + ", "; } else { MensajeError = "El campo ID_EMPLEADO es requerido para la consulta."; ejecutar = false; } if (ID_CONCEPTO != 0) { sql += "'" + ID_CONCEPTO.ToString() + "', "; informacion += "ID_CONCEPTO= '" + ID_CONCEPTO.ToString() + ", "; } else { MensajeError = "El campo ID_CONCEPTO es requerido para la consulta."; ejecutar = false; } if (CANTIDAD != 0) { sql += "'" + CANTIDAD.ToString() + "', "; informacion += "CANTIDAD= '" + CANTIDAD.ToString() + ", "; } else { MensajeError = "El campo CANTIDAD es requerido para la consulta."; ejecutar = false; } sql += "'" + VALOR.ToString() + "', "; informacion += "VALOR= '" + VALOR.ToString() + ", "; sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA) + "', "; informacion += "FECHA = '" + FECHA.ToString() + "', "; sql += "'" + Usuario + "' "; informacion += "USU_CRE = '" + Usuario.ToString() + "'"; #endregion if (ejecutar) { Conexion conexion = new Conexion(Empresa); try { cantidadRegistrosActualizados = conexion.ExecuteNonQuery(sql); #region auditoria auditoria _auditoria = new auditoria(Empresa); _auditoria.Adicionar(Usuario, tabla.NOM_NOMINA_NOVEDADES, tabla.ACCION_ACTUALIZAR, sql, informacion, conexion); #endregion auditoria } catch (Exception e) { MensajeError = e.Message; } finally { conexion.Desconectar(); } } if (cantidadRegistrosActualizados > 0) return true; else return false; }
public DataTable ObtenerPorNumIdentificacionTodos(String NUM_DOC_IDENTIDAD) { Conexion conexion = new Conexion(Empresa); DataSet _dataSet = new DataSet(); DataView _dataView = new DataView(); DataTable _dataTable = new DataTable(); String sql = null; String informacion = null; Boolean ejecutar = true; sql = "usp_con_reg_contratos_Obtener_contrato_por_num_id "; if (!(String.IsNullOrEmpty(NUM_DOC_IDENTIDAD))) { sql += "'" + NUM_DOC_IDENTIDAD + "'"; informacion += "NUM_DOC_IDENTIDAD = '" + NUM_DOC_IDENTIDAD + "'"; } else { MensajeError += "El campo NUM_DOC_IDENTIDAD no puede ser nulo. \n"; ejecutar = false; } if (ejecutar) { try { _dataSet = conexion.ExecuteReader(sql); _dataView = _dataSet.Tables[0].DefaultView; _dataTable = _dataView.Table; #region auditoria auditoria _auditoria = new auditoria(Empresa); _auditoria.Adicionar(Usuario, tabla.CON_REG_CONTRATOS, tabla.ACCION_CONSULTAR.ToString(), sql, informacion, conexion); #endregion auditoria } catch (Exception e) { MensajeError = e.Message; } finally { conexion.Desconectar(); } } return _dataTable; }
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 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 DataTable ObtenerTodas() { Conexion conexion = new Conexion(Empresa); DataSet _dataSet = new DataSet(); DataView _dataView = new DataView(); DataTable _dataTable = new DataTable(); String sql = null; String informacion = null; sql = "usp_par_unidad_reporte_obtenerTodos "; try { _dataSet = conexion.ExecuteReader(sql); _dataView = _dataSet.Tables[0].DefaultView; _dataTable = _dataView.Table; #region auditoria auditoria _auditoria = new auditoria(Empresa); _auditoria.Adicionar(Usuario, tabla.PAR_SEGURIDAD_SOCIAL, tabla.ACCION_CONSULTAR.ToString(), sql, informacion, conexion); #endregion auditoria } catch (Exception e) { MensajeError = e.Message; } finally { conexion.Desconectar(); } return _dataTable; }
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 Actualizar(int ID_UNIDAD_REPORTE, String DESCRIPCION, String DESC_ABREV, Boolean ACTIVO) { String sql = null; String informacion = null; Boolean ejecutar = true; Boolean ejecutadoCorrectamente = true; sql = "usp_par_unidad_reporte_actualizar "; #region validaciones if (ID_UNIDAD_REPORTE != 0) { sql += ID_UNIDAD_REPORTE + ", "; informacion += "ID_UNIDAD_REPORTE = " + ID_UNIDAD_REPORTE + ", "; } else { MensajeError += "El campo ID_UNIDAD_REPORTE no puede ser 0\n"; ejecutar = false; } 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 actualizar if (conexion.ExecuteNonQuery(sql) == 0) ejecutadoCorrectamente = false; #endregion actualizar #region auditoria auditoria _auditoria = new auditoria(Empresa); if (!(_auditoria.Adicionar(Usuario, tabla.PAR_UNIDAD_REPORTE, tabla.ACCION_ACTUALIZAR, sql, informacion, conexion))) ejecutadoCorrectamente = false; #endregion auditoria conexion.AceptarTransaccion(); } catch (Exception e) { conexion.DeshacerTransaccion(); MensajeError = e.Message; ejecutadoCorrectamente = false; } finally { conexion.Desconectar(); } } else ejecutadoCorrectamente = false; if (ejecutadoCorrectamente) return true; else return false; }
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 DataTable ObtenerDatosNuevoContrato(int ID_REQUERIMIENTO, int ID_SOLICITUD) { DataSet _dataSet = new DataSet(); DataView _dataView = new DataView(); DataTable _dataTable = new DataTable(); String sql = null; String informacion = null; Boolean ejecutar = true; sql = "usp_obtener_datos_nuevo_contrato "; 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 (ejecutar) { Conexion conexion = new Conexion(Empresa); try { _dataSet = conexion.ExecuteReader(sql); _dataView = _dataSet.Tables[0].DefaultView; _dataTable = _dataView.Table; #region auditoria auditoria _auditoria = new auditoria(Empresa); _auditoria.Adicionar(Usuario, tabla.CON_REQUERIMIENTOS + ", " + tabla.REG_SOLICITUDES_INGRESO, tabla.ACCION_CONSULTAR, sql, informacion, conexion); #endregion auditoria } catch (Exception e) { MensajeError = e.Message; } finally { conexion.Desconectar(); } } return _dataTable; }
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 DataTable ObtenerInfoParaImprimirContrato(Decimal REGISTRO_CONTRATO) { DataSet _dataSet = new DataSet(); DataView _dataView = new DataView(); DataTable _dataTable = new DataTable(); String sql = null; String informacion = null; Boolean ejecutar = true; sql = "usp_con_reg_contratos_ObtenerInfo_para_imprimir_contrato "; if (REGISTRO_CONTRATO != 0) { sql += REGISTRO_CONTRATO; informacion += "REGISTRO_CONTRATO = '" + REGISTRO_CONTRATO.ToString() + "'"; } else { MensajeError += "El campo REGISTRO_CONTRATO no puede ser nulo\n"; ejecutar = false; } if (ejecutar) { Conexion conexion = new Conexion(Empresa); try { _dataSet = conexion.ExecuteReader(sql); _dataView = _dataSet.Tables[0].DefaultView; _dataTable = _dataView.Table; #region auditoria auditoria _auditoria = new auditoria(Empresa); _auditoria.Adicionar(Usuario, tabla.CON_REG_CONTRATOS, tabla.ACCION_CONSULTAR, sql, informacion, conexion); #endregion auditoria } catch (Exception e) { MensajeError = e.Message; } finally { conexion.Desconectar(); } } return _dataTable; }
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 DataTable ObtenerInformacionContratoPorIdSolicitudIdREquerimiento(Decimal ID_SOLICITUD, Decimal ID_REQUERIMIENTO) { DataSet _dataSet = new DataSet(); DataView _dataView = new DataView(); DataTable _dataTable = new DataTable(); String sql = null; String informacion = null; Boolean ejecutar = true; sql = "usp_con_reg_contratos_obtener_datos_unificados_contrato "; 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; } if (ejecutar) { Conexion conexion = new Conexion(Empresa); try { _dataSet = conexion.ExecuteReader(sql); _dataView = _dataSet.Tables[0].DefaultView; _dataTable = _dataView.Table; #region auditoria auditoria _auditoria = new auditoria(Empresa); _auditoria.Adicionar(Usuario, tabla.CON_REG_CONTRATOS, tabla.ACCION_CONSULTAR, sql, informacion, conexion); #endregion auditoria } catch (Exception e) { MensajeError = e.Message; } finally { conexion.Desconectar(); } } return _dataTable; }
public DataTable ObtenerAlmRegProductosProveedorPorProductoCiudad(int ID_PRODUCTO, String ID_CIUDAD) { DataSet _dataSet = new DataSet(); DataView _dataView = new DataView(); DataTable _dataTable = new DataTable(); String sql = null; String informacion = null; Boolean ejecutar = true; sql = "USP_ALM_REG_PRODUCTOS_PROVEEDOR_OBTENER_PROVEEDORES_POR_EXAMEN "; 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 (!(String.IsNullOrEmpty(ID_CIUDAD))) { sql += "'" + ID_CIUDAD + "' "; informacion += "ID_CIUDAD = '" + ID_CIUDAD.ToString() + "'"; } else { MensajeError += "El campo ID_CIUDAD no puede ser nulo\n"; ejecutar = false; } if (ejecutar) { Conexion conexion = new Conexion(Empresa); try { _dataSet = conexion.ExecuteReader(sql); _dataView = _dataSet.Tables[0].DefaultView; _dataTable = _dataView.Table; #region auditoria auditoria _auditoria = new auditoria(Empresa); _auditoria.Adicionar(Usuario, tabla.ALM_REG_PRODUCTO_PROVEEDOR, tabla.ACCION_CONSULTAR, sql, informacion, conexion); #endregion auditoria } catch (Exception e) { MensajeError = e.Message; } finally { conexion.Desconectar(); } } return _dataTable; }
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; }
public Boolean Actualizar(Decimal ID_AFP, String NIT, String DIG_VER, String COD_ENTIDAD, String NOM_ENTIDAD, String DIR_ENTIDAD, String TEL_ENTIDAD, String CONTACTO, String CARGO, bool ESTADO) { String sql = null; String informacion = null; Boolean ejecutar = true; Boolean ejecutadoCorrectamente = true; sql = "usp_con_ent_afp_actualizar "; #region validaciones if (ID_AFP != 0) { sql += ID_AFP + ", "; informacion += "ID_AFP = '" + ID_AFP + "', "; } else { MensajeError += "El campo ID_AFP no puede ser 0\n"; ejecutar = false; } 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() + "', "; if (ESTADO) sql += "'S'"; else sql += "'N'"; #endregion validaciones if (ejecutar) { Conexion conexion = new Conexion(Empresa); conexion.IniciarTransaccion(); try { #region adicionar entidad if (conexion.ExecuteNonQuery(sql) == 0) ejecutadoCorrectamente = false; #endregion adicionar entidad #region auditoria auditoria _auditoria = new auditoria(Empresa); if (!(_auditoria.Adicionar(Usuario, tabla.CON_ENT_F_PENSIONES, tabla.ACCION_ACTUALIZAR, sql, informacion, conexion))) ejecutadoCorrectamente = false; #endregion auditoria conexion.AceptarTransaccion(); } catch (Exception e) { conexion.DeshacerTransaccion(); MensajeError = e.Message; } finally { conexion.Desconectar(); } } if (ejecutadoCorrectamente) return true; else return false; }
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; }