예제 #1
0
        private async void btnGenRep_Click_1(object sender, EventArgs e)
        {
            if (!isProcessing)
            {
                try
                {
                    isProcessing = true;
                    fechaInicio  = dtpFechaReservaI.Value.Date;
                    fechaFin     = dtpFechaReservaF.Value.Date;

                    List <ReservaObra> listaReservaObra;

                    using (IServiceTeatro servicio = Contenedor.current.Resolve <IServiceTeatro>())
                    {
                        listaReservaObra = await servicio.ReporteReservaObraAsync(fechaInicio, fechaFin);
                    }

                    rptcro.ProcessingMode = ProcessingMode.Local;

                    rptcro.LocalReport.DataSources.Clear();

                    ReportDataSource Reporte = new ReportDataSource("DataSet1", listaReservaObra);

                    rptcro.LocalReport.DataSources.Add(Reporte);

                    //reportViewer1.LocalReport.ReportEmbeddedResource = "MadScienceGUI.reportPago.rdlc";

                    List <ReportParameter> parametros = new List <ReportParameter>();
                    parametros.Add(new ReportParameter("FechaIni", "" + fechaInicio));
                    parametros.Add(new ReportParameter("FechaFin", "" + fechaFin));
                    //Añado parametros al reportviewer
                    this.rptcro.LocalReport.SetParameters(parametros);
                    rptcro.RefreshReport();

                    rptcro.Focus();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Ocurrió un error: " + ex.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("El reporte esta procesando", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }