public ReporteModulo obtenerReporteMdl(int modulo, int reporte)
        {
            ReporteModulo  reporteMdlTmp  = new ReporteModulo();
            ModuloControl  moduloControl  = new ModuloControl();
            ReporteControl reporteControl = new ReporteControl();

            try
            {
                String sComando = String.Format("SELECT PK_id_reporte, PK_id_Modulo, ESTADO " +
                                                "FROM TBL_RPT_MDL " +
                                                "WHERE PK_id_Modulo = {0} " +
                                                " AND PK_id_reporte = {1} " +
                                                " AND ESTADO <> 0; ",
                                                modulo.ToString(), reporte.ToString());

                OdbcDataReader reader = transaccion.ConsultarDatos(sComando);

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        reporteMdlTmp.REPORTE = reporteControl.obtenerReporte(reader.GetInt32(0));
                        reporteMdlTmp.MODULO  = moduloControl.obtenerModulo(reader.GetInt32(1));
                        reporteMdlTmp.ESTADO  = reader.GetInt32(2);
                    }
                }
            }
            catch (OdbcException ex)
            {
                MessageBox.Show(ex.ToString(), "Error al obtener reporte modulo.");
                return(null);
            }

            return(reporteMdlTmp);
        }
        public List <Aplicacion> obtenerAllAplicacionByMdl(int modulo)
        {
            List <Aplicacion> aplicacionList = new List <Aplicacion>();
            ModuloControl     moduloControl  = new ModuloControl();

            try
            {
                String sComando = String.Format("SELECT PK_ID_APLICACION, PK_ID_MODULO, NOMBRE_APLICACION, " +
                                                "DESCRIPCION_APLICACION, ESTADO_APLICACION " +
                                                "FROM TBL_APLICACION " +
                                                "WHERE PK_ID_MODULO = {0} " +
                                                "AND ESTADO_APLICACION <> 0; ",
                                                modulo.ToString());

                OdbcDataReader reader = transaccion.ConsultarDatos(sComando);

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        Aplicacion aplicacionTmp = new Aplicacion();
                        aplicacionTmp.APLICACION  = reader.GetInt32(0);
                        aplicacionTmp.MODULO      = moduloControl.obtenerModulo(reader.GetInt32(1));
                        aplicacionTmp.NOMBRE      = reader.GetString(2);
                        aplicacionTmp.DESCRIPCION = reader.IsDBNull(3) ? " " : reader.GetString(3);
                        aplicacionTmp.ESTADO      = reader.GetInt32(4);
                        aplicacionList.Add(aplicacionTmp);
                    }
                }
            }
            catch (OdbcException ex)
            {
                MessageBox.Show(ex.ToString(), "Error al obtener lista de aplicacion.");
                return(null);
            }

            return(aplicacionList);
        }
        public PropiedadReporte obtenerPropiedadPorUsuarioModulo(int reporte, string usuario, int modulo)
        {
            PropiedadReporte  propiedad  = new PropiedadReporte();
            ReporteControl    rpt        = new ReporteControl();
            AplicacionControl app        = new AplicacionControl();
            ModuloControl     mdl        = new ModuloControl();
            UsuarioControl    usuControl = new UsuarioControl();

            try
            {
                String sComando = String.Format("SELECT PK_id_reporte, PK_id_usuario,  PK_id_modulo, imprimir, estado FROM Tbl_Propiedad_Rpt " +
                                                "WHERE PK_id_reporte={0} AND PK_id_usuario = '{1}' AND PK_id_modulo = {3} AND estado <> 0;",
                                                reporte, usuario, "", modulo);

                OdbcDataReader reader = transaccion.ConsultarDatos(sComando);

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        propiedad.REPORTE  = rpt.obtenerReporte(reader.GetInt32(0));
                        propiedad.USUARIO  = usuControl.SetUsuario(reader.GetString(1));
                        propiedad.MODULO   = mdl.obtenerModulo(modulo);
                        propiedad.IMPRIMIR = reader.GetInt32(3);
                        propiedad.ESTADO   = reader.GetInt32(4);
                    }
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString(), "Error al insertar configuracion para PROPIEDADES.");
            }
            return(propiedad);
        }
        public List <PropiedadReporte> obtenerAllPropiedad()
        {
            List <PropiedadReporte> propiedadList = new List <PropiedadReporte>();
            ReporteControl          rpt           = new ReporteControl();
            Usuario           usu        = new Usuario();
            AplicacionControl app        = new AplicacionControl();
            ModuloControl     mdl        = new ModuloControl();
            UsuarioControl    usuControl = new UsuarioControl();

            try
            {
                String sComando = String.Format("SELECT PK_id_reporte, PK_id_usuario, PK_id_aplicacion, " +
                                                "PK_id_modulo, imprimir, estado FROM Tbl_Propiedad_Rpt;");

                OdbcDataReader reader = transaccion.ConsultarDatos(sComando);

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        PropiedadReporte propiedadTmp = new PropiedadReporte();
                        propiedadTmp.REPORTE    = rpt.obtenerReporte(reader.GetInt32(0));
                        propiedadTmp.USUARIO    = usuControl.SetUsuario(reader.GetString(1));
                        propiedadTmp.APLICACION = reader.IsDBNull(2) ? null : app.obtenerAplicacion(reader.GetInt32(2), reader.GetInt32(3));
                        propiedadTmp.MODULO     = mdl.obtenerModulo(reader.GetInt32(3));
                        propiedadTmp.IMPRIMIR   = reader.GetInt32(4);
                        propiedadTmp.ESTADO     = reader.GetInt32(5);
                        propiedadList.Add(propiedadTmp);
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString(), "Error al insertar configuracion para PROPIEDADES.");
            }
            return(propiedadList);
        }
        public List <ReporteAplicacion> obtenerAllReporteApp()
        {
            List <ReporteAplicacion> reporteAppList    = new List <ReporteAplicacion>();
            ReporteControl           reporteControl    = new ReporteControl();
            ModuloControl            moduloControl     = new ModuloControl();
            AplicacionControl        aplicacionControl = new AplicacionControl();

            try
            {
                String sComando = String.Format("SELECT PK_id_reporte , PK_id_aplicacion, PK_id_MODULO, ESTADO " +
                                                "FROM TBL_RPT_APP " +
                                                "WHERE ESTADO <> 0; ");

                OdbcDataReader reader = transaccion.ConsultarDatos(sComando);

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        ReporteAplicacion reporteAppTmp = new ReporteAplicacion();
                        reporteAppTmp.REPORTE    = reporteControl.obtenerReporte(reader.GetInt32(0));
                        reporteAppTmp.MODULO     = moduloControl.obtenerModulo(reader.GetInt32(2));
                        reporteAppTmp.APLICACION = aplicacionControl.obtenerAplicacion(reader.GetInt32(1),
                                                                                       reporteAppTmp.MODULO.MODULO);
                        reporteAppTmp.ESTADO = int.Parse(reader.GetString(3));
                        reporteAppList.Add(reporteAppTmp);
                    }
                }
            }
            catch (OdbcException ex)
            {
                MessageBox.Show(ex.ToString(), "Error al obtener reporte aplicacion.");
                return(null);
            }

            return(reporteAppList);
        }
        public PropiedadReporte obtenerPropiedadPorUsuarioAplicacion(string usuario, int aplicacion, int modulo)
        {
            PropiedadReporte  propiedad  = new PropiedadReporte();
            ReporteControl    rpt        = new ReporteControl();
            Usuario           usu        = new Usuario();
            AplicacionControl app        = new AplicacionControl();
            ModuloControl     mdl        = new ModuloControl();
            UsuarioControl    usuControl = new UsuarioControl();

            try
            {
                String sComando = String.Format("SELECT * FROM Tbl_Propiedad_Rpt " +
                                                "WHERE PK_id_usuario = '{0}' AND PK_id_aplicacion = {1} AND PK_id_modulo = {2} AND estado <> 0;",
                                                usuario, aplicacion, modulo);

                OdbcDataReader reader = transaccion.ConsultarDatos(sComando);

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        propiedad.REPORTE    = rpt.obtenerReporte(reader.GetInt32(0));
                        propiedad.USUARIO    = usuControl.SetUsuario(reader.GetString(1));
                        propiedad.APLICACION = reader.IsDBNull(2) ? null : app.obtenerAplicacion(reader.GetInt32(2), reader.GetInt32(3));
                        propiedad.MODULO     = mdl.obtenerModulo(reader.GetInt32(3));
                        propiedad.IMPRIMIR   = reader.GetInt32(4);
                        propiedad.ESTADO     = reader.GetInt32(5);
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString(), "Error al insertar configuracion para PROPIEDADES.");
            }
            return(propiedad);
        }