예제 #1
0
        public Reporte obtenerReporte(int reporte)
        {
            Reporte reporteTmp = new Reporte();
            ConfiguracionRptControl confiControl = new ConfiguracionRptControl();

            try
            {
                String sComando = String.Format("SELECT PK_id_reporte , PK_id_configuracion , NOMBRE, ESTADO, nombre_archivo " +
                                                "FROM TBL_REPORTE " +
                                                "WHERE PK_id_reporte  = {0} " +
                                                " AND ESTADO <> 0; ",
                                                reporte);

                OdbcDataReader reader = transaccion.ConsultarDatos(sComando);

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        reporteTmp.REPORTE        = reader.GetInt32(0);
                        reporteTmp.CONFIGURACION  = confiControl.obtenerConfiguracionRpt(reader.GetInt32(1));
                        reporteTmp.NOMBRE         = reader.GetString(2);
                        reporteTmp.ESTADO         = reader.GetInt32(3);
                        reporteTmp.NOMBRE_ARCHIVO = reader.GetString(4);
                    }
                }
            }
            catch (OdbcException ex)
            {
                MessageBox.Show(ex.ToString(), "Error al obtener reporte");
                return(null);
            }

            return(reporteTmp);
        }
예제 #2
0
        public int obtenerUltimoId()
        {
            List <Reporte>          reporteList  = new List <Reporte>();
            ConfiguracionRptControl confiControl = new ConfiguracionRptControl();
            int rpt = 0;

            try
            {
                String sComando = String.Format("SELECT PK_id_reporte  FROM TBL_REPORTE; ");

                OdbcDataReader reader = transaccion.ConsultarDatos(sComando);

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        rpt = reader.GetInt32(0);
                    }
                }
            }
            catch (OdbcException ex)
            {
                MessageBox.Show(ex.ToString(), "Error al obtener reporte");
                return(1);
            }

            return(rpt);
        }