public Decimal ActualizarAuditoriaContratosPorSeccionYEstadoProceso(Decimal ID_EMPLEADO, String TABLA_AUDITADA, Decimal ID_AUDITADO, Boolean ACTUALIZAR_ESTADO_PROCESO, Decimal ID_SOLICITUD, String ESTADO_PROCESO) { Decimal ID_AUDITORIA = 0; Conexion conexion = new Conexion(Empresa); conexion.IniciarTransaccion(); try { ID_AUDITORIA = AdicionarAuditoriaContratos(ID_EMPLEADO, TABLA_AUDITADA, ID_AUDITADO, DateTime.Now, conexion); if (ID_AUDITORIA <= 0) { conexion.DeshacerTransaccion(); ID_AUDITORIA = 0; } else { if (ACTUALIZAR_ESTADO_PROCESO == true) { radicacionHojasDeVida _radicacionHojasDeVida = new radicacionHojasDeVida(Empresa, Usuario); if (_radicacionHojasDeVida.ActualizarEstadoProcesoRegSolicitudesIngresoAuditoria(ID_SOLICITUD, ESTADO_PROCESO, conexion) == false) { conexion.DeshacerTransaccion(); MensajeError = _radicacionHojasDeVida.MensajeError; ID_AUDITORIA = 0; } else { conexion.AceptarTransaccion(); } } else { conexion.AceptarTransaccion(); } } } catch (Exception ex) { MensajeError = ex.Message; conexion.DeshacerTransaccion(); ID_AUDITORIA = 0; } finally { conexion.Desconectar(); } return ID_AUDITORIA; }
public Boolean ActualizarContratoDesdeAuditoria(Decimal ID_CONTRATO, Decimal ID_EMPLEADO, Decimal RIESGO, String TIPO_CONTRATO, Decimal ID_PERFIL, Decimal ID_SUB_C, Decimal ID_CENTRO_C, String ID_CIUDAD, String PAGO_DIAS_PRODUCTIVIDAD, Decimal VALOR_NOMINA, Decimal VALOR_CONTRATO, Decimal SALARIO, String SAL_INT, String FORMA_PAGO, Decimal ID_ENTIDAD, String NUM_CUENTA, Decimal ID_SOLICITUD, Boolean ACTUALIZAR_ESTADO_PROCESO, String TIPO_CUENTA, DateTime FECHA_INICIO_PERIODO, DateTime FECHA_FIN_PERIODO, String PERIODO_PAGO, String CLASE_CONTRATO, String CONTROL_CONTRATO, String CHEQUE_REG) { Boolean verificador = true; Conexion conexion = new Conexion(Empresa); conexion.IniciarTransaccion(); DataTable tablaResultadoNomina = new DataTable(); try { tablaResultadoNomina = ComprobarRestriccionNomina(ID_EMPLEADO, ID_CIUDAD, ID_CENTRO_C, ID_SUB_C, conexion); if (tablaResultadoNomina.Rows.Count <= 0) { conexion.DeshacerTransaccion(); verificador = false; MensajeError = "No se puedieron determinar las restriciones de nomina. No se pudo actualizar la información del contrato del trabajador seleccionado."; } else { DataRow filaRestriccionesNomina = tablaResultadoNomina.Rows[0]; if (filaRestriccionesNomina["valorResultado"].ToString().ToUpper() == "ERROR") { conexion.DeshacerTransaccion(); verificador = false; MensajeError = filaRestriccionesNomina["descripcionResultado"].ToString(); } else { if (ActualizarConRegContratosAuditoria(ID_CONTRATO, TIPO_CONTRATO, PAGO_DIAS_PRODUCTIVIDAD, VALOR_NOMINA, VALOR_CONTRATO, FECHA_INICIO_PERIODO, FECHA_FIN_PERIODO, PERIODO_PAGO, CLASE_CONTRATO, CONTROL_CONTRATO, conexion) == false) { conexion.DeshacerTransaccion(); verificador = false; } else { if (ActualizarNomEmpleadosAuditoria(ID_EMPLEADO, SALARIO, RIESGO, ID_ENTIDAD, NUM_CUENTA, SAL_INT, ID_PERFIL, FORMA_PAGO, ID_CIUDAD, ID_CENTRO_C, ID_SUB_C, conexion, TIPO_CUENTA, FECHA_INICIO_PERIODO, CHEQUE_REG) == false) { conexion.DeshacerTransaccion(); verificador = false; } else { auditoriaContratos _auditoriaContratos = new auditoriaContratos(Empresa, Usuario); Decimal ID_AUDITORIA = _auditoriaContratos.AdicionarAuditoriaContratos(ID_EMPLEADO, tabla.CON_REG_CONTRATOS, ID_CONTRATO, DateTime.Now, conexion); if (ID_AUDITORIA <= 0) { conexion.DeshacerTransaccion(); MensajeError = _auditoriaContratos.MensajeError; verificador = false; } else { if (ACTUALIZAR_ESTADO_PROCESO == true) { radicacionHojasDeVida _radicacionHojasDeVida = new radicacionHojasDeVida(Empresa, Usuario); if (_radicacionHojasDeVida.ActualizarEstadoProcesoRegSolicitudesIngresoAuditoria(ID_SOLICITUD, tabla.VAR_ESTADO_PROCESO_CONTRATO, conexion) == false) { conexion.DeshacerTransaccion(); MensajeError = _radicacionHojasDeVida.MensajeError; verificador = false; } else { conexion.AceptarTransaccion(); } } else { conexion.AceptarTransaccion(); } } } } } } } catch (Exception ex) { MensajeError = ex.Message; verificador = false; } finally { conexion.Desconectar(); } return verificador; }
public Decimal AdicionarconafiliacionfpensionesAuditoria(Decimal ID_SOLICITUD , Decimal ID_F_PENSIONES , DateTime FECHA_R , String OBSERVACIONES , String PENSIONADO , Decimal ID_REQUERIMIENTO , String TIPO_PENSIONADO , String NUMERO_RESOLUCION_TRAMITE , Decimal ID_EMPLEADO , Boolean ACTUALIZAR_ESTADO_PROCESO , DateTime FECHA_RADICACION , Decimal ID_CONTRATO , String ENTIDAD_ARCHIVO_RADICACION , Byte[] ARCHIVO_RADICACION , Int32 ARCHIVO_RADICACION_TAMANO , String ARCHIVO_RADICACION_EXTENSION , String ARCHIVO_RADICACION_TYPE) { Decimal ID_AFILIACION = 0; Decimal ID_AUDITORIA = 0; Conexion conexion = new Conexion(Empresa); conexion.IniciarTransaccion(); Boolean verificador = true; try { ID_AFILIACION = AdicionarAfiFondoPensiones(ID_SOLICITUD, ID_F_PENSIONES, FECHA_R, OBSERVACIONES, PENSIONADO, ID_REQUERIMIENTO, TIPO_PENSIONADO, NUMERO_RESOLUCION_TRAMITE, conexion, FECHA_RADICACION); if (ID_AFILIACION <= 0) { conexion.DeshacerTransaccion(); ID_AFILIACION = 0; verificador = false; } else { if (ActualizarAfpDeNomEmpleadosPorIdEmpleado(ID_EMPLEADO, ID_AFILIACION, conexion) == false) { conexion.DeshacerTransaccion(); ID_AFILIACION = 0; verificador = false; } else { auditoriaContratos _auditoriaContratos = new auditoriaContratos(Empresa, Usuario); ID_AUDITORIA = _auditoriaContratos.AdicionarAuditoriaContratos(ID_EMPLEADO, tabla.CON_AFILIACION_F_PENSIONES, ID_AFILIACION, DateTime.Now, conexion); if (ID_AUDITORIA <= 0) { conexion.DeshacerTransaccion(); MensajeError = _auditoriaContratos.MensajeError; ID_AFILIACION = 0; verificador = false; } else { if (ARCHIVO_RADICACION != null) { if (conexion.ExecuteEscalarParaAdicionarDocsAfiliacion(ID_CONTRATO, ENTIDAD_ARCHIVO_RADICACION, ARCHIVO_RADICACION, ARCHIVO_RADICACION_EXTENSION, ARCHIVO_RADICACION_TAMANO, ARCHIVO_RADICACION_TYPE, Usuario) == null) { conexion.DeshacerTransaccion(); MensajeError = "Ocurrio un error al momento de adicionar el documento de radicación de la afiliación."; ID_AFILIACION = 0; verificador = false; } } if (verificador == true) { if (ACTUALIZAR_ESTADO_PROCESO == true) { radicacionHojasDeVida _radicacionHojasDeVida = new radicacionHojasDeVida(Empresa, Usuario); if (_radicacionHojasDeVida.ActualizarEstadoProcesoRegSolicitudesIngresoAuditoria(ID_SOLICITUD, tabla.VAR_ESTADO_PROCESO_CON_AFILIACION_FONDO, conexion) == false) { conexion.DeshacerTransaccion(); MensajeError = _radicacionHojasDeVida.MensajeError; ID_AFILIACION = 0; verificador = false; } } if (verificador == true) { conexion.AceptarTransaccion(); } } } } } } catch (Exception ex) { MensajeError = ex.Message; conexion.DeshacerTransaccion(); ID_AFILIACION = 0; verificador = false; } finally { conexion.Desconectar(); } return ID_AFILIACION; }
public Decimal ActualizarConceptosFijosEmpleado(Decimal ID_EMPLEADO, List<ConceptosNominaEmpleado> listaConceptos, Boolean ACTUALIZAR_ESTADO_PROCESO, Decimal ID_SOLICITUD) { Boolean ejecutar = true; if (ID_EMPLEADO == 0) { MensajeError = "El campo ID_EMPLEADO no puede ser 0\n"; ejecutar = false; } if (ejecutar) { Conexion conexion = new Conexion(Empresa); conexion.IniciarTransaccion(); try { DataTable tablaConceptosActuales = ObtenerNomConceptosEmpleadosPorIdEmpleadoConceptosFijos(Convert.ToInt32(ID_EMPLEADO)); foreach (DataRow fila in tablaConceptosActuales.Rows) { ejecutar = true; foreach (ConceptosNominaEmpleado filaDeLaLista in listaConceptos) { if (filaDeLaLista.REGISTRO == Convert.ToDecimal(fila["REGISTRO"])) { ejecutar = false; break; } } if (ejecutar == true) { if (desactivarConceptosFijoDeEmpleado(Convert.ToDecimal(fila["REGISTRO"]), conexion) == false) { conexion.DeshacerTransaccion(); return 0; } } } foreach (ConceptosNominaEmpleado filaDeLaLista in listaConceptos) { if (filaDeLaLista.REGISTRO == 0) { if (AdicionarConceptoFijoAEmpleado(ID_EMPLEADO, filaDeLaLista.ID_CONCEPTO, filaDeLaLista.CAN_PRE, filaDeLaLista.VAL_PRE, filaDeLaLista.LIQ_Q_1, filaDeLaLista.LIQ_Q_2, filaDeLaLista.LIQ_Q_3, filaDeLaLista.LIQ_Q_4, filaDeLaLista.ID_CLAUSULA, conexion) == 0) { conexion.DeshacerTransaccion(); return 0; } } } auditoriaContratos _auditoriaContratos = new auditoriaContratos(Empresa, Usuario); Decimal ID_AUDITORIA = _auditoriaContratos.AdicionarAuditoriaContratos(ID_EMPLEADO, tabla.NOM_CONCEPTOS_EMPLEADO, 1, DateTime.Now, conexion); if (ID_AUDITORIA <= 0) { conexion.DeshacerTransaccion(); MensajeError = _auditoriaContratos.MensajeError; return 0; } if (ACTUALIZAR_ESTADO_PROCESO == true) { radicacionHojasDeVida _radicacionHojasDeVida = new radicacionHojasDeVida(Empresa, Usuario); if (_radicacionHojasDeVida.ActualizarEstadoProcesoRegSolicitudesIngresoAuditoria(ID_SOLICITUD, tabla.VAR_ESTADO_PROCESO_CONCEPTOS_FIJOS, conexion) == false) { conexion.DeshacerTransaccion(); MensajeError = _radicacionHojasDeVida.MensajeError; return 0; } } conexion.AceptarTransaccion(); return 1; } catch { conexion.DeshacerTransaccion(); return 0; } finally { conexion.Desconectar(); } } else { return 0; } }