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 DataTable ObtenerEntidadPorId(Decimal ID_ENTIDAD, Programa.Areas AREA) { Conexion conexion = new Conexion(Empresa); DataSet _dataSet = new DataSet(); DataView _dataView = new DataView(); DataTable _dataTable = new DataTable(); String sql = null; Boolean ejecutar = true; sql = "usp_prog_entidades_colaboradoras_obtenerPorId "; if (ID_ENTIDAD != 0) { sql += ID_ENTIDAD + ", "; } else { ejecutar = false; } sql += "'" + AREA.ToString() + "'"; if (ejecutar) { try { _dataSet = conexion.ExecuteReader(sql); _dataView = _dataSet.Tables[0].DefaultView; _dataTable = _dataView.Table; } catch (Exception e) { MensajeError = e.Message; } finally { conexion.Desconectar(); } } return _dataTable; }
public DataTable ObtenerTodasEntidadesPorAreaYEstado(Programa.Areas area, Boolean ACTIVO) { Conexion conexion = new Conexion(Empresa); DataSet _dataSet = new DataSet(); DataView _dataView = new DataView(); DataTable _dataTable = new DataTable(); String sql = null; Boolean ejecutar = true; sql = "usp_prog_entidades_colaboradoras_obtenerPorAreaYEstado "; sql += "'" + area.ToString() + "', "; if (ACTIVO == true) { sql += "'True'"; } else { sql += "'False'"; } if (ejecutar) { try { _dataSet = conexion.ExecuteReader(sql); _dataView = _dataSet.Tables[0].DefaultView; _dataTable = _dataView.Table; } catch (Exception e) { MensajeError = e.Message; } finally { conexion.Desconectar(); } } return _dataTable; }
public Decimal 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 DataTable ObtenerEntidadesPorNombre(String NOMBRE, Programa.Areas AREA) { Conexion conexion = new Conexion(Empresa); DataSet _dataSet = new DataSet(); DataView _dataView = new DataView(); DataTable _dataTable = new DataTable(); String sql = null; Boolean ejecutar = true; sql = "usp_prog_entidades_colaboradoras_obtenerPorNombre "; if (String.IsNullOrEmpty(NOMBRE) == false) { sql += "'" + NOMBRE + "', "; } else { ejecutar = false; } sql += "'" + AREA.ToString() + "'"; if (ejecutar) { try { _dataSet = conexion.ExecuteReader(sql); _dataView = _dataSet.Tables[0].DefaultView; _dataTable = _dataView.Table; } catch (Exception e) { MensajeError = e.Message; } finally { conexion.Desconectar(); } } return _dataTable; }
public DataTable ObtenerPresupuestoAsiganadoEjecutadoParaEmpresaAñoMesArea(Int32 ANIO, Decimal ID_EMPRESA, Programa.Areas ID_AREA, Int32 MES) { Conexion conexion = new Conexion(Empresa); DataSet _dataSet = new DataSet(); DataView _dataView = new DataView(); DataTable _dataTable = new DataTable(); String sql = null; Boolean ejecutar = true; sql = "usp_prog_detalle_actividades_ObtenerInfoPresupuesto_PorAnioEmpresaAreaMes "; if (ANIO != 0) { sql += ANIO + ", "; } else { ejecutar = false; MensajeError = "El campo ANIO no puede ser nulo."; } if (ID_EMPRESA != 0) { sql += ID_EMPRESA + ", "; } else { ejecutar = false; MensajeError = "El campo ID_EMPRESA no puede ser nulo."; } sql += "'" + ID_AREA.ToString() + "', "; if (MES != 0) { sql += MES; } else { ejecutar = false; MensajeError = "El campo MES no puede ser nulo."; } if (ejecutar) { try { _dataSet = conexion.ExecuteReader(sql); _dataView = _dataSet.Tables[0].DefaultView; _dataTable = _dataView.Table; } catch (Exception e) { MensajeError = e.Message; } finally { conexion.Desconectar(); } } return _dataTable; }
public Boolean ActualizarSeguimientoCasoSevero(Decimal ID_ACCIDENTE, String RIESGO_GENERADOR, String TIPO_ACCIDENTE, String TIPO_LESION, String PARTE_CUERPO, String AGENTE_LESION, String MECANISMO_LESION, String SITIO, String COND_INSEGURA, String ACTO_INSEGURO, String FACTORES_TRABAJO, String FACTORES_PERSONALES, Decimal ID_INCAPACIDAD, List<DetalleSeguimientoAccidente> listaDetallesSeguimiento, String NOMBRE_ACCIDENTE, Programa.Areas ID_AREA, List<FactorCausaAccidente> listaFactores) { Boolean correcto = true; Conexion conexion = new Conexion(Empresa); conexion.IniciarTransaccion(); try { if (ActualizarRegistroProgSeguimientoAccidentes(ID_ACCIDENTE, RIESGO_GENERADOR, TIPO_ACCIDENTE, TIPO_LESION, PARTE_CUERPO, AGENTE_LESION, MECANISMO_LESION, SITIO, COND_INSEGURA, ACTO_INSEGURO, FACTORES_TRABAJO, FACTORES_PERSONALES, ID_INCAPACIDAD, conexion) == false) { correcto = false; conexion.DeshacerTransaccion(); } else { Programa _prog = new Programa(Empresa, Usuario); foreach (DetalleSeguimientoAccidente detalleAccidente in listaDetallesSeguimiento) { if (detalleAccidente.GENERA_COMPROMISO == true) { detalleAccidente.ID_COMPROMISO_GENERADO = _prog.AdicionarRegistroCompromisoEnActividad(ID_ACCIDENTE, NOMBRE_ACCIDENTE, Programa.TiposGeneraCompromiso.ACCIDENTE.ToString(), detalleAccidente.SEGUIMIENTO, detalleAccidente.ENCARGADO_COMPROMISO, detalleAccidente.FECHA_COMPROMISO, detalleAccidente.OBSERVACIONES, MaestraCompromiso.EstadosCompromiso.ABIERTO.ToString(), ID_AREA.ToString(), conexion); if (detalleAccidente.ID_COMPROMISO_GENERADO <= 0) { conexion.DeshacerTransaccion(); correcto = false; MensajeError = _prog.MensajeError; break; } } else { detalleAccidente.ID_COMPROMISO_GENERADO = 0; } if (correcto == true) { Decimal ID_DETALLE_SEGUIMIENTO = AdicionarRegistroProgDetSegAccidente(ID_ACCIDENTE, detalleAccidente.FECHA_SEGUIMIENTO, detalleAccidente.SEGUIMIENTO, detalleAccidente.GENERA_COMPROMISO, detalleAccidente.ID_COMPROMISO_GENERADO, conexion); if (ID_DETALLE_SEGUIMIENTO <= 0) { conexion.DeshacerTransaccion(); correcto = false; ID_ACCIDENTE = 0; break; } } } if (correcto == true) { String IDS_CAUSAS = ""; foreach (FactorCausaAccidente factor in listaFactores) { Decimal ID_RELACION = AdicionarFactorAUnAccidente(ID_ACCIDENTE, factor.ID_CAUSA, factor.VALOR_ITEM, conexion); if (String.IsNullOrEmpty(IDS_CAUSAS) == true) { IDS_CAUSAS = factor.ID_CAUSA.ToString(); } else { IDS_CAUSAS += "," + factor.ID_CAUSA.ToString(); } if (ID_RELACION <= 0) { conexion.DeshacerTransaccion(); correcto = false; ID_ACCIDENTE = 0; break; } } if (correcto == true) { if (DesactivarFactoresRelacionadosConAccidente(ID_ACCIDENTE, IDS_CAUSAS, conexion) == false) { conexion.DeshacerTransaccion(); correcto = false; ID_ACCIDENTE = 0; } } } } if (correcto == true) { conexion.AceptarTransaccion(); } } catch (Exception ex) { conexion.DeshacerTransaccion(); MensajeError = ex.Message; correcto = false; } finally { conexion.Desconectar(); } return correcto; }
public DataTable ObtenerActividadesProgramadasParaUnMesAñoEmpresaYAreaEspecificos(Decimal ID_EMPRESA, Int32 ANIO, Int32 MES, Programa.Areas ID_AREA) { Conexion conexion = new Conexion(Empresa); DataSet _dataSet = new DataSet(); DataView _dataView = new DataView(); DataTable _dataTable = new DataTable(); String sql = null; Boolean ejecutar = true; sql = "usp_prog_detalle_actividads_obtenerPorAnioMesEmpresaArea "; if (ID_EMPRESA != 0) { sql += ID_EMPRESA + ", "; } else { ejecutar = false; MensajeError = "El Campo ID_EMPRESA no puede ser vacio."; } if (ANIO != 0) { sql += ANIO + ", "; } else { ejecutar = false; MensajeError = "El Campo ANIO no puede ser vacio."; } if (MES != 0) { sql += MES + ", "; } else { ejecutar = false; MensajeError = "El Campo MES no puede ser vacio."; } sql += "'" + ID_AREA.ToString() + "', "; sql += "'" + Usuario + "'"; if (ejecutar) { try { _dataSet = conexion.ExecuteReader(sql); _dataView = _dataSet.Tables[0].DefaultView; _dataTable = _dataView.Table; } catch (Exception e) { MensajeError = e.Message; } finally { conexion.Desconectar(); } } _dataTable.Columns.Add("TRIMESTRE"); for (int i = 0; i < _dataTable.Rows.Count; i++) { DataRow _fila = _dataTable.Rows[i]; DateTime _fecha = Convert.ToDateTime(_fila["FECHA_ACTIVIDAD"]); if ((_fecha.Month >= 1) && (_fecha.Month <= 3)) { _fila["TRIMESTRE"] = "Trimestre 1"; } else { if ((_fecha.Month >= 4) && (_fecha.Month <= 6)) { _fila["TRIMESTRE"] = "Trimestre 2"; } else { if ((_fecha.Month >= 7) && (_fecha.Month <= 9)) { _fila["TRIMESTRE"] = "Trimestre 3"; } else { _fila["TRIMESTRE"] = "Trimestre 4"; } } } _dataTable.AcceptChanges(); } return _dataTable; }
public DataTable ObtenerArchivoAdjuntoPorTipoYDetalle(Decimal ID_DETALLE, Programa.TiposArchivo tipoArchivo) { Conexion conexion = new Conexion(Empresa); DataSet _dataSet = new DataSet(); DataView _dataView = new DataView(); DataTable _dataTable = new DataTable(); String sql = null; Boolean ejecutar = true; sql = "usp_prog_archivos_adjuntos_actividades_obtenerPorIdDetalleYTipoArchivo "; sql += ID_DETALLE + ", "; sql += "'" + tipoArchivo.ToString() + "'"; if (ejecutar) { try { _dataSet = conexion.ExecuteReader(sql); _dataView = _dataSet.Tables[0].DefaultView; _dataTable = _dataView.Table; } catch (Exception e) { MensajeError = e.Message; } finally { conexion.Desconectar(); } } return _dataTable; }
public DataTable ListarTiposActividad(Programa.Areas area) { Conexion conexion = new Conexion(IdEmpresa); DataTable dataTable = new DataTable(); string sql = null; sql = "select ID_TIPO_ACTIVIDAD as id, NOMBRE from PROG_TIPOS_ACTIVIDAD WHERE ID_AREA = '" + area.ToString() + "' AND ACTIVA = 'True' ORDER BY NOMBRE"; try { DataSet _dataSet = conexion.ExecuteReader(sql); dataTable = _dataSet.Tables[0].DefaultView.Table; } catch (Exception e) { throw new Exception(e.Message); } finally { conexion.Desconectar(); } return dataTable; }
public DataTable ListarTiposCancelacion(Programa.Areas area) { Conexion conexion = new Conexion(IdEmpresa); DataTable dataTable = new DataTable(); string sql = null; sql = "select ID_MOTIVO as id, MOTIVO as NOMBRE from PROG_MOTIVOS_CANCELACION_REPROGRAMACION WHERE ID_AREA = '" + area.ToString() + "' AND TIPO = 'CANCELACION' AND ACTIVO = 'True' ORDER BY NOMBRE"; try { DataSet _dataSet = conexion.ExecuteReader(sql); dataTable = _dataSet.Tables[0].DefaultView.Table; } catch (Exception e) { throw new Exception(e.Message); } finally { conexion.Desconectar(); } return dataTable; }
public DataTable ListarEspecialistasActividades(Programa.Areas area) { Conexion conexion = new Conexion(IdEmpresa); DataTable dataTable = new DataTable(); string sql = null; sql = "select USU.USU_LOG as id, CASE WHEN USU.USU_TIPO = 'PLANTA' THEN USU.NOMBRES + ' ' + USU.APELLIDOS ELSE USU.NOMBRES_EXTERNO + ' ' + USU.APELLIDOS_EXTERNO END as NOMBRE from PROG_DETALLE_ACTIVIDADES DET_ACT INNER JOIN PROG_MAESTRA_PROGRAMAS PROG ON PROG.ID_PROGRAMA = DET_ACT.ID_PROGRAMA INNER JOIN View_INFORMACION_USUARIOS_SISTEMA USU ON USU.USU_LOG = DET_ACT.ENCARGADO WHERE PROG.ID_AREA = '" + area.ToString() + "' GROUP BY USU.USU_LOG, USU.USU_TIPO, USU.NOMBRES, USU.APELLIDOS, USU.NOMBRES_EXTERNO, USU.APELLIDOS_EXTERNO order by NOMBRE"; try { DataSet _dataSet = conexion.ExecuteReader(sql); dataTable = _dataSet.Tables[0].DefaultView.Table; } catch (Exception e) { throw new Exception(e.Message); } finally { conexion.Desconectar(); } return dataTable; }
public DataTable ListarAniosPresupuestados(Programa.Areas area) { Conexion conexion = new Conexion(IdEmpresa); DataTable dataTable = new DataTable(); string sql = null; sql = "select ANNO AS nombre, ANNO AS id FROM PROG_PRESUPUESTOS PRES WHERE PRES.ID_AREA = '" + area.ToString() + "' GROUP BY ANNO ORDER BY ANNO DESC"; try { DataSet _dataSet = conexion.ExecuteReader(sql); dataTable = _dataSet.Tables[0].DefaultView.Table; } catch (Exception e) { throw new Exception(e.Message); } finally { conexion.Desconectar(); } return dataTable; }
public Decimal AdicionarTipoActividad(Programa.Areas idArea, String nombre, Boolean activa, String secicones_habilitadas, Conexion conexion) { String sql = null; String identificador = null; String informacion = null; Boolean ejecutar = true; tools _tools = new tools(); sql = "usp_prog_tipos_actividad_adicionar "; #region validaciones sql += "'" + idArea.ToString() + "', "; informacion += "ID_AREA = '" + idArea.ToString() + "', "; if (String.IsNullOrEmpty(nombre) == false) { sql += "'" + nombre + "', "; informacion += "NOMBRE = '" + nombre + "', "; } else { MensajeError += "El campo NOMBRE no puede ser nulo\n"; ejecutar = false; } if (activa == true) { sql += "'True', "; informacion += "ACTIVA = 'True', "; } else { sql += "'False', "; informacion += "ACTIVA = 'False', "; } if (String.IsNullOrEmpty(secicones_habilitadas) == false) { sql += "'" + secicones_habilitadas + "', "; informacion += "SECCIONES_HABILITADAS = '" + secicones_habilitadas + "', "; } else { MensajeError += "El campo SECCIONES_HABILITADAS 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.PROG_TIPOS_ACTIVIDAD, 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 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 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 DataTable ObtenerHistoricoPresupuestosPorEmpresaYArea(Decimal ID_EMPRESA, Programa.Areas area) { Conexion conexion = new Conexion(Empresa); DataSet _dataSet = new DataSet(); DataView _dataView = new DataView(); DataTable _dataTable = new DataTable(); String sql = null; Boolean ejecutar = true; sql = "usp_prog_presupuestos_obtenerPorIdEmpresa "; if (ID_EMPRESA != 0) { sql += ID_EMPRESA + ", "; } else { MensajeError += "El campo ID_EMPRESA no puede ser nulo. \n"; ejecutar = false; } sql += "'" + area.ToString() + "'"; if (ejecutar) { try { _dataSet = conexion.ExecuteReader(sql); _dataView = _dataSet.Tables[0].DefaultView; _dataTable = _dataView.Table; } catch (Exception e) { MensajeError = e.Message; } finally { conexion.Desconectar(); } } return _dataTable; }
public DataTable ObtenerMotivosActProgCompPorAreaYTipo(Programa.Areas area, String tipo) { Conexion conexion = new Conexion(Empresa); DataSet _dataSet = new DataSet(); DataView _dataView = new DataView(); DataTable _dataTable = new DataTable(); String sql = null; Boolean ejecutar = true; sql = "usp_prog_motivos_cancelacion_reprogramacion_obtenerPorAreaYTipo "; sql += "'" + area.ToString() + "', '" + tipo.ToString() + "'"; if (ejecutar) { try { _dataSet = conexion.ExecuteReader(sql); _dataView = _dataSet.Tables[0].DefaultView; _dataTable = _dataView.Table; } catch (Exception e) { MensajeError = e.Message; } finally { conexion.Desconectar(); } } return _dataTable; }
public DataTable ObtenerPresupuestosGeneralesArea(Programa.Areas area) { Conexion conexion = new Conexion(Empresa); DataSet _dataSet = new DataSet(); DataView _dataView = new DataView(); DataTable _dataTable = new DataTable(); String sql = null; Boolean ejecutar = true; sql = "usp_prog_presupuestos_generales_obtenerPorArea "; sql += "'" + area.ToString() + "'"; if (ejecutar) { try { _dataSet = conexion.ExecuteReader(sql); _dataView = _dataSet.Tables[0].DefaultView; _dataTable = _dataView.Table; } catch (Exception e) { MensajeError = e.Message; } finally { conexion.Desconectar(); } } return _dataTable; }
public Decimal AdicionarSeguimientoCasoSevero(Decimal ID_EMPLEADO, String COND_FACT, String ORIGEN, String DESCRIPCION_ACCIDENTE, String PRONOSTICO, String OBS_PRONOSTICO, Boolean CALIFICADO, String OBS_CALIFICADO, Boolean PCL, String OBS_PCL, Boolean APELO_PCL, String OBS_APELO_PCL, Boolean LABORANDO, String OBS_LABORANDO, Boolean REUBICADO, Boolean REUBICADO_ORD_JUD, String OBS_REUBICADO, Boolean REABILITADO, String OBS_REABILITADO, Boolean INCAPACITADO, String OBS_INCAPACITADO, String ACTITUD, EstadosCaso ESTADO_CASO, Decimal ID_SOLICITUD, List<DetalleSeguimientoCasoSevero> listaDetallesSeguimiento, String NOMBRE_CASO_SEVERO, Programa.Areas ID_AREA, List<RecomendacionCasoSevero> listaRecomendaciones, List<DiagnosticoCasoSevero> listaDiagnosticosAdicionales) { Boolean correcto = true; Decimal ID_MAESTRA_CASO_SEVERO = 0; Conexion conexion = new Conexion(Empresa); conexion.IniciarTransaccion(); try { ID_MAESTRA_CASO_SEVERO = AdicionarRegistroProgSeguimientoCasosSeveros(ID_EMPLEADO, COND_FACT, ORIGEN, DESCRIPCION_ACCIDENTE, PRONOSTICO, OBS_PRONOSTICO, CALIFICADO, OBS_CALIFICADO, PCL, OBS_PCL, APELO_PCL, OBS_APELO_PCL, LABORANDO, OBS_LABORANDO, REUBICADO, REUBICADO_ORD_JUD, OBS_REUBICADO, REABILITADO, OBS_REABILITADO, INCAPACITADO, OBS_INCAPACITADO, false, new DateTime(), new DateTime(), null, ACTITUD, ESTADO_CASO, ID_SOLICITUD, conexion); if (ID_MAESTRA_CASO_SEVERO <= 0) { conexion.DeshacerTransaccion(); correcto = false; ID_MAESTRA_CASO_SEVERO = 0; } else { Programa _prog = new Programa(Empresa, Usuario); foreach (DetalleSeguimientoCasoSevero detalleCaso in listaDetallesSeguimiento) { if (detalleCaso.GENERA_COMPROMISO == true) { detalleCaso.ID_COMPROMISO_GENERADO = _prog.AdicionarRegistroCompromisoEnActividad(ID_MAESTRA_CASO_SEVERO, NOMBRE_CASO_SEVERO, Programa.TiposGeneraCompromiso.CASOSEVERO.ToString(), detalleCaso.SEGUIMIENTO, detalleCaso.ENCARGADO_COMPROMISO, detalleCaso.FECHA_COMPROMISO, detalleCaso.OBSERVACIONES, MaestraCompromiso.EstadosCompromiso.ABIERTO.ToString(), ID_AREA.ToString(), conexion); if (detalleCaso.ID_COMPROMISO_GENERADO <= 0) { conexion.DeshacerTransaccion(); correcto = false; ID_MAESTRA_CASO_SEVERO = 0; MensajeError = _prog.MensajeError; break; } } else { detalleCaso.ID_COMPROMISO_GENERADO = 0; } if (correcto == true) { Decimal ID_DETALLE_SEGUIMIENTO = AdicionarRegistroProgDetSegCasoSevero(ID_MAESTRA_CASO_SEVERO, detalleCaso.FECHA_SEGUIMIENTO, detalleCaso.SEGUIMIENTO, detalleCaso.GENERA_COMPROMISO, detalleCaso.ID_COMPROMISO_GENERADO, conexion); if (ID_DETALLE_SEGUIMIENTO <= 0) { conexion.DeshacerTransaccion(); correcto = false; ID_MAESTRA_CASO_SEVERO = 0; break; } } } if (correcto == true) { foreach (RecomendacionCasoSevero recomendacion in listaRecomendaciones) { if (recomendacion.ID_RECOMENDACION == 0) { decimal ID_RECOMENDACICON = AdicionarRegistroProgRecomendacionesCasoSevero(ID_MAESTRA_CASO_SEVERO, recomendacion.RECOMENDACION, recomendacion.FCH_RECOM_DESDE, recomendacion.FCH_RECOM_HASTA, recomendacion.TIPO_ENTIDAD_EMITE, recomendacion.ID_ENTIDAD_EMITE, conexion); if (ID_RECOMENDACICON <= 0) { conexion.DeshacerTransaccion(); correcto = false; ID_MAESTRA_CASO_SEVERO = 0; break; } } } } if (correcto == true) { foreach (DiagnosticoCasoSevero diagnostico in listaDiagnosticosAdicionales) { if (diagnostico.ID_DIAGNOSTICO == 0) { decimal ID_DIAGNOSTICO = AdicionarRegistroProgDiagnosticosAdicionalesCasoSevero(ID_MAESTRA_CASO_SEVERO, diagnostico.REGISTRO_DIAGNOSTICO, diagnostico.DSC_DIAG, diagnostico.CLASE_DIAGNOSTICO, conexion); if (ID_DIAGNOSTICO <= 0) { conexion.DeshacerTransaccion(); correcto = false; ID_MAESTRA_CASO_SEVERO = 0; break; } } } } } if (correcto == true) { conexion.AceptarTransaccion(); } } catch (Exception ex) { correcto = false; conexion.DeshacerTransaccion(); MensajeError = ex.Message; ID_MAESTRA_CASO_SEVERO = 0; } finally { conexion.Desconectar(); } return ID_MAESTRA_CASO_SEVERO; }