public DataTable ObtenerSeguimientoAccidentePorEstado(EstadosAccidente estado)
        {
            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_seguimiento_accidentes_obtenerPorEstado ";

            sql += "'" + estado.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 Boolean FinalizarRegistroProgSeguimientoAccidentes(Decimal ID_ACCIDENTE,
            String OBSERVACIONES_FINALIZACION,
            EstadosAccidente estado)
        {
            String sql = null;
            String informacion = null;
            Boolean ejecutar = true;
            Boolean ejecutadoCorrectamente = true;

            tools _tools = new tools();

            sql = "usp_prog_seguimiento_accidentes_finalizar ";

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

            if (String.IsNullOrEmpty(OBSERVACIONES_FINALIZACION) == false)
            {
                sql += "'" + OBSERVACIONES_FINALIZACION + "', ";
                informacion += "OBSERVACIONES_FINALIZACION = '" + OBSERVACIONES_FINALIZACION + "', ";
            }
            else
            {
                sql += "null, ";
                informacion += "OBSERVACIONES_FINALIZACION = 'null', ";
            }

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

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

            #endregion validaciones

            if (ejecutar)
            {
                Conexion conexion = new Conexion(Empresa);

                try
                {
                    conexion.ExecuteNonQuery(sql);

                    auditoria _auditoria = new auditoria(Empresa);
                    _auditoria.Adicionar(Usuario, tabla.PROG_SEGUIMIENTO_ACCIDENTES, 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 AdicionarRegistroProgSeguimientoAccidentes(Decimal ID_SOLICITUD,
            Decimal ID_EMPLEADO,
            DateTime FCH_REGISTRO,
            DateTime FCH_ACCIDENTE,
            String HORA_ACCIDENTE,
            DateTime FCH_TOPE_INVESTIGACION,
            String NRO_SINIESTRO,
            String DIA_SEMANA,
            String JORNADA,
            String DSC_ACCIDENTE,
            EstadosAccidente ESTADO)
        {
            tools _tools = new tools();

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

            Decimal ID_ACCIDENTE = 0;

            sql = "usp_prog_seguimiento_accidentes_adicionar ";

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

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

            if (FCH_REGISTRO != new DateTime())
            {
                sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FCH_REGISTRO) + "', ";
                informacion += "FCH_REGISTRO = '" + FCH_REGISTRO.ToShortDateString() + "', ";
            }
            else
            {
                sql += "null, ";
                informacion += "FCH_REGISTRO = 'null', ";
            }

            if (FCH_ACCIDENTE != new DateTime())
            {
                sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FCH_ACCIDENTE) + "', ";
                informacion += "FCH_ACCIDENTE = '" + FCH_ACCIDENTE.ToShortDateString() + "', ";
            }
            else
            {
                sql += "null, ";
                informacion += "FCH_ACCIDENTE = 'null', ";
            }

            if (String.IsNullOrEmpty(HORA_ACCIDENTE) == false)
            {
                sql += "'" + HORA_ACCIDENTE + "', ";
                informacion += "HORA_ACCIDENTE = '" + HORA_ACCIDENTE + "', ";
            }
            else
            {
                sql += "null, ";
                informacion += "HORA_ACCIDENTE = 'null', ";
            }

            if (FCH_TOPE_INVESTIGACION != new DateTime())
            {
                sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FCH_TOPE_INVESTIGACION) + "', ";
                informacion += "FCH_TOPE_INVESTIGACION = '" + FCH_TOPE_INVESTIGACION.ToShortDateString() + "', ";
            }
            else
            {
                sql += "null, ";
                informacion += "FCH_TOPE_INVESTIGACION = 'null', ";
            }

            if (String.IsNullOrEmpty(NRO_SINIESTRO) == false)
            {
                sql += "'" + NRO_SINIESTRO + "', ";
                informacion += "NRO_SINIESTRO = '" + NRO_SINIESTRO + "', ";
            }
            else
            {
                sql += "null, ";
                informacion += "NRO_SINIESTRO = 'null', ";
            }

            if (String.IsNullOrEmpty(DIA_SEMANA) == false)
            {
                sql += "'" + DIA_SEMANA + "', ";
                informacion += "DIA_SEMANA = '" + DIA_SEMANA + "', ";
            }
            else
            {
                sql += "null, ";
                informacion += "DIA_SEMANA = 'null', ";
            }

            if (String.IsNullOrEmpty(JORNADA) == false)
            {
                sql += "'" + JORNADA + "', ";
                informacion += "JORNADA = '" + JORNADA + "', ";
            }
            else
            {
                sql += "null, ";
                informacion += "JORNADA = 'null', ";
            }

            if (String.IsNullOrEmpty(DSC_ACCIDENTE) == false)
            {
                sql += "'" + DSC_ACCIDENTE + "', ";
                informacion += "DSC_ACCIDENTE = '" + DSC_ACCIDENTE + "', ";
            }
            else
            {
                sql += "null, ";
                informacion += "DSC_ACCIDENTE = 'null', ";
            }

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

            sql += "'" + ESTADO.ToString() + "'";
            informacion += "ESTADO = '" + ESTADO.ToString() + "'";

            if (ejecutar)
            {
                Conexion conexion = new Conexion(Empresa);

                try
                {

                    ID_ACCIDENTE = Convert.ToDecimal(conexion.ExecuteScalar(sql));

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

            return ID_ACCIDENTE;
        }
        public DataTable ObtenerSeguimientoAccidentePorEstado(EstadosAccidente estado)
        {
            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_seguimiento_accidentes_obtenerPorEstado ";

            sql += "'" + estado.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 AdicionarRegistroProgSeguimientoAccidentes(Decimal ID_SOLICITUD,
                                                                  Decimal ID_EMPLEADO,
                                                                  DateTime FCH_REGISTRO,
                                                                  DateTime FCH_ACCIDENTE,
                                                                  String HORA_ACCIDENTE,
                                                                  DateTime FCH_TOPE_INVESTIGACION,
                                                                  String NRO_SINIESTRO,
                                                                  String DIA_SEMANA,
                                                                  String JORNADA,
                                                                  String DSC_ACCIDENTE,
                                                                  EstadosAccidente ESTADO)
        {
            tools _tools = new tools();

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

            Decimal ID_ACCIDENTE = 0;

            sql = "usp_prog_seguimiento_accidentes_adicionar ";

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

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

            if (FCH_REGISTRO != new DateTime())
            {
                sql         += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FCH_REGISTRO) + "', ";
                informacion += "FCH_REGISTRO = '" + FCH_REGISTRO.ToShortDateString() + "', ";
            }
            else
            {
                sql         += "null, ";
                informacion += "FCH_REGISTRO = 'null', ";
            }

            if (FCH_ACCIDENTE != new DateTime())
            {
                sql         += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FCH_ACCIDENTE) + "', ";
                informacion += "FCH_ACCIDENTE = '" + FCH_ACCIDENTE.ToShortDateString() + "', ";
            }
            else
            {
                sql         += "null, ";
                informacion += "FCH_ACCIDENTE = 'null', ";
            }

            if (String.IsNullOrEmpty(HORA_ACCIDENTE) == false)
            {
                sql         += "'" + HORA_ACCIDENTE + "', ";
                informacion += "HORA_ACCIDENTE = '" + HORA_ACCIDENTE + "', ";
            }
            else
            {
                sql         += "null, ";
                informacion += "HORA_ACCIDENTE = 'null', ";
            }

            if (FCH_TOPE_INVESTIGACION != new DateTime())
            {
                sql         += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FCH_TOPE_INVESTIGACION) + "', ";
                informacion += "FCH_TOPE_INVESTIGACION = '" + FCH_TOPE_INVESTIGACION.ToShortDateString() + "', ";
            }
            else
            {
                sql         += "null, ";
                informacion += "FCH_TOPE_INVESTIGACION = 'null', ";
            }

            if (String.IsNullOrEmpty(NRO_SINIESTRO) == false)
            {
                sql         += "'" + NRO_SINIESTRO + "', ";
                informacion += "NRO_SINIESTRO = '" + NRO_SINIESTRO + "', ";
            }
            else
            {
                sql         += "null, ";
                informacion += "NRO_SINIESTRO = 'null', ";
            }

            if (String.IsNullOrEmpty(DIA_SEMANA) == false)
            {
                sql         += "'" + DIA_SEMANA + "', ";
                informacion += "DIA_SEMANA = '" + DIA_SEMANA + "', ";
            }
            else
            {
                sql         += "null, ";
                informacion += "DIA_SEMANA = 'null', ";
            }

            if (String.IsNullOrEmpty(JORNADA) == false)
            {
                sql         += "'" + JORNADA + "', ";
                informacion += "JORNADA = '" + JORNADA + "', ";
            }
            else
            {
                sql         += "null, ";
                informacion += "JORNADA = 'null', ";
            }

            if (String.IsNullOrEmpty(DSC_ACCIDENTE) == false)
            {
                sql         += "'" + DSC_ACCIDENTE + "', ";
                informacion += "DSC_ACCIDENTE = '" + DSC_ACCIDENTE + "', ";
            }
            else
            {
                sql         += "null, ";
                informacion += "DSC_ACCIDENTE = 'null', ";
            }

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

            sql         += "'" + ESTADO.ToString() + "'";
            informacion += "ESTADO = '" + ESTADO.ToString() + "'";

            if (ejecutar)
            {
                Conexion conexion = new Conexion(Empresa);

                try
                {
                    ID_ACCIDENTE = Convert.ToDecimal(conexion.ExecuteScalar(sql));

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

            return(ID_ACCIDENTE);
        }
        public Boolean FinalizarRegistroProgSeguimientoAccidentes(Decimal ID_ACCIDENTE,
                                                                  String OBSERVACIONES_FINALIZACION,
                                                                  EstadosAccidente estado)
        {
            String  sql                    = null;
            String  informacion            = null;
            Boolean ejecutar               = true;
            Boolean ejecutadoCorrectamente = true;

            tools _tools = new tools();

            sql = "usp_prog_seguimiento_accidentes_finalizar ";

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

            if (String.IsNullOrEmpty(OBSERVACIONES_FINALIZACION) == false)
            {
                sql         += "'" + OBSERVACIONES_FINALIZACION + "', ";
                informacion += "OBSERVACIONES_FINALIZACION = '" + OBSERVACIONES_FINALIZACION + "', ";
            }
            else
            {
                sql         += "null, ";
                informacion += "OBSERVACIONES_FINALIZACION = 'null', ";
            }

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

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

            #endregion validaciones

            if (ejecutar)
            {
                Conexion conexion = new Conexion(Empresa);

                try
                {
                    conexion.ExecuteNonQuery(sql);

                    auditoria _auditoria = new auditoria(Empresa);
                    _auditoria.Adicionar(Usuario, tabla.PROG_SEGUIMIENTO_ACCIDENTES, 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);
            }
        }