Ejemplo n.º 1
0
        public FormProducto() // Constructor
        {
            InitializeComponent();

            _productos = new ProductosBL(); // Inicializamos Variable
            productoBindingSource.DataSource = _productos.ObtenerProductos();

            _tiemposBL = new TiemposBL(); // Inicializamos Variable
            tiemposBLBindingSource.DataSource = _tiemposBL.ObtenerTiempo();

            _categoriasBL = new CategoriasBL();
            categoriasBLBindingSource.DataSource = _categoriasBL.ObtenerCategorias();
        }
        public FormReporteProducto()
        {
            InitializeComponent();

            /*     var _productoBL = new ProductosBL();
             *    var bindingSource = new BindingSource();
             *    bindingSource.DataSource = _productoBL.ObtenerProductos();
             *
             *
             *    var reporte = new CrystalReportProducto();
             *    reporte.SetDataSource(bindingSource);
             *
             *
             *    crystalReportViewer1.ReportSource = reporte;
             *    crystalReportViewer1.RefreshReport();*/


            var _productosBL  = new ProductosBL();
            var _categoriasBL = new CategoriasBL();
            var _tiemposBL    = new TiemposBL();

            var bindingSource1 = new BindingSource();

            bindingSource1.DataSource = _productosBL.ObtenerProductos();

            var bindingSource2 = new BindingSource();

            bindingSource2.DataSource = _categoriasBL.ObtenerCategorias();

            var bindingSource3 = new BindingSource();

            bindingSource3.DataSource = _tiemposBL.ObtenerTiempo();


            var reporte = new CrystalReportProducto();

            reporte.Database.Tables["Producto"].SetDataSource(bindingSource1);
            reporte.Database.Tables["Categoria"].SetDataSource(bindingSource2);
            reporte.Database.Tables["Tiempo"].SetDataSource(bindingSource3);

            crystalReportViewer1.ReportSource = reporte;
            crystalReportViewer1.RefreshReport();
        }