public List <ReporteModulo> obtenerAllReporteMdl()
        {
            List <ReporteModulo> reporteMdlList = new List <ReporteModulo>();
            ModuloControl        moduloControl  = new ModuloControl();
            ReporteControl       reporteControl = new ReporteControl();

            try
            {
                String sComando = String.Format("SELECT ID_REPORTE, ID_MODULO, ESTADO " +
                                                "FROM TBL_RPT_MDL " +
                                                "WHERE ESTADO <> 0; ");

                OdbcDataReader reader = transaccion.ConsultarDatos(sComando);

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

            return(reporteMdlList);
        }
        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);
        }
Ejemplo n.º 3
0
 private void llenarTbpDato(ReporteModulo reporteMdl)
 {
     deshabilitarCampos();
     Cmb_Reporte.SelectedItem = Cmb_Reporte.Items[reporteMdl.REPORTE.REPORTE];
     Cmb_Modulo.SelectedItem  = Cmb_Modulo.Items[reporteMdl.MODULO.MODULO];
     Txt_Estado.Text          = reporteMdl.ESTADO.ToString();
 }
Ejemplo n.º 4
0
        private void Btn_Guardar_Click(object sender, EventArgs e)
        {
            deshabilitarBotones();
            this.reporteMdl       = llenarReporteMdl();
            this.propiedadReporte = llenarPropiedadRpt();
            sentencia s            = new sentencia(usuario);
            Dialogo   dialogo      = new Dialogo();
            bool      confirmacion = dialogo.dialogoSiNo("Confirmacion", "Desea guardar?");

            if (confirmacion)
            {
                if (this.accion == "nuevo")
                {
                    reporteMdlControl.insertarReporteMdl(this.reporteMdl);
                    propiedadReporteControl.insertarPropiedadReporteSinApp(this.propiedadReporte);
                }
                else if (this.accion == "modificar")
                {
                    reporteMdlControl.actualizarReporteMdl(this.reporteMdl);
                }

                iniciazliarTbpConsulta();
                Tbc_RptMdl.SelectedTab = Tbp_Consulta;
                this.reporteMdl        = new ReporteModulo();
                llenarDgv();
                s.insertarBitacora(usuario, "Guardar reporte modulo", "Tbl_Modulo");
            }
        }
Ejemplo n.º 5
0
        /*
         * Programacion botones.
         */

        private void Btn_Nuevo_Click(object sender, EventArgs e)
        {
            iniciazliarTbpConsulta();
            this.reporteMdl        = new ReporteModulo();
            Tbc_RptMdl.SelectedTab = Tbp_Datos;
            this.accion            = "nuevo";
        }
Ejemplo n.º 6
0
 private void Btn_Cancelar_Click(object sender, EventArgs e)
 {
     deshabilitarBotones();
     iniciazliarTbpConsulta();
     Tbc_RptMdl.SelectedTab = Tbp_Consulta;
     this.reporteMdl        = new ReporteModulo();
     llenarDgv();
 }
Ejemplo n.º 7
0
        private void Btn_Modificar_Click(object sender, EventArgs e)
        {
            habilitarCampos();
            this.reporteMdl = llenarReporteMdl();
            this.accion     = "modificar";
            sentencia s = new sentencia(usuario);

            s.insertarBitacora(usuario, "Modificacion reporte modulo", "Tbl_Modulo");
        }
Ejemplo n.º 8
0
        private ReporteModulo llenarReporteMdl()
        {
            ReporteModulo reporteMdlTmp = new ReporteModulo();

            reporteMdlTmp.REPORTE = (Reporte)Cmb_Reporte.SelectedItem;
            reporteMdlTmp.MODULO  = (Modulo)Cmb_Modulo.SelectedItem;
            reporteMdlTmp.ESTADO  = int.Parse(Txt_Estado.Text);

            return(reporteMdlTmp);
        }
Ejemplo n.º 9
0
        /*
         * Seleccionar registro.
         */

        private void Dgv_Consulta_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            int    fila      = Dgv_Consulta.CurrentCell.RowIndex;
            String codigoApp = Dgv_Consulta.Rows[fila].Cells[1].Value.ToString();
            String codigoMdl = Dgv_Consulta.Rows[fila].Cells[2].Value.ToString();

            this.reporteMdl = reporteMdlControl.obtenerReporteMdl(Int32.Parse(codigoMdl));
            llenarTbpDato(this.reporteMdl);
            Tbc_RptMdl.SelectedTab = Tbp_Datos;
        }
Ejemplo n.º 10
0
        /*
         * Programacion botones.
         */

        private void Btn_Nuevo_Click(object sender, EventArgs e)
        {
            habilitarBotones();
            iniciazliarTbpConsulta();
            this.reporteMdl        = new ReporteModulo();
            Tbc_RptMdl.SelectedTab = Tbp_Datos;
            this.accion            = "nuevo";
            sentencia s = new sentencia(usuario);

            s.insertarBitacora(usuario, "Creacion reporte modulo", "Tbl_Modulo");
        }
Ejemplo n.º 11
0
        private void llenarTbpDato(ReporteModulo reporteMdl)
        {
            deshabilitarCampos();

            Cmb_Reporte.Text         = reporteMdl.REPORTE.NOMBRE;
            Cmb_Reporte.SelectedText = Cmb_Reporte.Text;

            Cmb_Modulo.Text         = reporteMdl.MODULO.NOMBRE;
            Cmb_Modulo.SelectedText = Cmb_Modulo.Text;

            Txt_Estado.Text = reporteMdl.ESTADO.ToString();
        }
        public void insertarReporteMdl(ReporteModulo reporteMdl)
        {
            try
            {
                String sComando = String.Format("INSERT INTO TBL_RPT_MDL VALUES ({0}, {1}, {2}); ",
                                                reporteMdl.REPORTE.REPORTE.ToString(), reporteMdl.MODULO.MODULO.ToString(), reporteMdl.ESTADO.ToString());

                this.transaccion.insertarDatos(sComando);
            }
            catch (OdbcException ex)
            {
                MessageBox.Show(ex.ToString(), "Error al asociar reporte a modulo.");
            }
        }
Ejemplo n.º 13
0
        private void Btn_Borrar_Click(object sender, EventArgs e)
        {
            this.accion = null;
            Dialogo dialogo      = new Dialogo();
            bool    confirmacion = dialogo.dialogoSiNo("Confirmacion", "Desea eliminar?");

            if (confirmacion)
            {
                reporteMdlControl.eliminarReporteMdl(this.reporteMdl.MODULO.MODULO);
                this.reporteMdl = new ReporteModulo();

                iniciazliarTbpConsulta();
                Tbc_RptMdl.SelectedTab = Tbp_Consulta;
                llenarDgv();
            }
        }
        public void actualizarReporteMdl(ReporteModulo reporteMdl)
        {
            try
            {
                String sComando = String.Format("UPDATE TBL_RPT_MDL " +
                                                "SET PK_id_reporte = {0}, ESTADO = {2} " +
                                                "WHERE PK_id_Modulo = {1}; ",
                                                reporteMdl.REPORTE.REPORTE.ToString(), reporteMdl.MODULO.MODULO.ToString(), reporteMdl.ESTADO.ToString());

                this.transaccion.insertarDatos(sComando);
            }
            catch (OdbcException ex)
            {
                MessageBox.Show(ex.ToString(), "Error al actualizar reporte modulo.");
            }
        }
Ejemplo n.º 15
0
        private void Btn_Guardar_Click(object sender, EventArgs e)
        {
            this.reporteMdl = llenarReporteMdl();

            Dialogo dialogo      = new Dialogo();
            bool    confirmacion = dialogo.dialogoSiNo("Confirmacion", "Desea guardar?");

            if (confirmacion)
            {
                if (this.accion == "nuevo")
                {
                    reporteMdlControl.insertarReporteMdl(this.reporteMdl);
                }
                else if (this.accion == "modificar")
                {
                    reporteMdlControl.actualizarReporteMdl(this.reporteMdl);
                }
            }
        }
Ejemplo n.º 16
0
        private void Btn_Borrar_Click(object sender, EventArgs e)
        {
            deshabilitarBotones();
            this.propiedadReporte   = llenarPropiedadRpt();
            propiedadReporte.ESTADO = 0;
            this.accion             = null;
            Dialogo dialogo      = new Dialogo();
            bool    confirmacion = dialogo.dialogoSiNo("Confirmacion", "Desea eliminar?");

            if (confirmacion)
            {
                propiedadReporteControl.modificarPropiedadReporteSinApp(propiedadReporte);
                reporteMdlControl.eliminarReporteMdl(this.reporteMdl.MODULO.MODULO, this.reporteMdl.REPORTE.REPORTE);
                this.reporteMdl = new ReporteModulo();

                iniciazliarTbpConsulta();
                Tbc_RptMdl.SelectedTab = Tbp_Consulta;
                llenarDgv();
            }
        }
Ejemplo n.º 17
0
        public void imprimirReporteModulo(int Reporte, string usuario, int Modulo)
        {
            PropiedadReporteControl propiedadReporteControl = new PropiedadReporteControl();
            PropiedadReporte        propiedadReporte        =
                propiedadReporteControl.obtenerPropiedadPorUsuarioModulo(Reporte, usuario, Modulo);

            ReporteModuloControl reporteMdlControl = new ReporteModuloControl();

            try
            {
                ReporteModulo reporteMdl = reporteMdlControl.obtenerReporteMdl(Modulo, Reporte);
                Reporte       rpt        = reporteMdl.REPORTE;

                string           pathFile = rpt.CONFIGURACION.RUTA + rpt.NOMBRE_ARCHIVO;
                Frm_VistaReporte frmVistaRpt;
                switch (propiedadReporte.IMPRIMIR)
                {
                case 0:
                    frmVistaRpt = new Frm_VistaReporte(pathFile, 0);
                    frmVistaRpt.Show();
                    break;

                case 1:
                    frmVistaRpt = new Frm_VistaReporte(pathFile, 1);
                    //frmVistaRpt.Show();
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString() + "Error en impresion, no se pudo obtener reporte.");
            }
        }
Ejemplo n.º 18
0
 private void Btn_Modificar_Click(object sender, EventArgs e)
 {
     habilitarCampos();
     this.reporteMdl = llenarReporteMdl();
     this.accion     = "modificar";
 }