Ejemplo n.º 1
0
        private void GenerateReport()
        {
            ReportBLL          cls           = new ReportBLL();
            ICallDetail        callDetail    = new CallDetailEntity();
            LocalReportManager reportManager = new LocalReportManager(rptViewer, "CustomerListWithLoc", ConfigurationManager.AppSettings["ReportNamespace"].ToString(), ConfigurationManager.AppSettings["ReportPath"].ToString());
            string             rptName       = "CustomerListWithLoc.rdlc";

            BuildEntity(callDetail);
            IEnumerable <ICallDetail> lst = cls.GetCustomerListWithLoc(callDetail, _userId);

            rptViewer.Reset();
            rptViewer.LocalReport.Dispose();
            rptViewer.LocalReport.DataSources.Clear();
            rptViewer.LocalReport.ReportPath = this.Server.MapPath(this.Request.ApplicationPath) + ConfigurationManager.AppSettings["ReportPath"].ToString() + "/" + rptName;
            rptViewer.LocalReport.DataSources.Add(new ReportDataSource("ReportDataSet", lst));
            rptViewer.LocalReport.SetParameters(new ReportParameter("CompanyName", Convert.ToString(ConfigurationManager.AppSettings["CompanyName"])));

            if (txtArea.Text != ResourceManager.GetStringWithoutName("ERR00016"))
            {
                rptViewer.LocalReport.SetParameters(new ReportParameter("AreaName", txtArea.Text));
            }
            else
            {
                rptViewer.LocalReport.SetParameters(new ReportParameter("AreaName", txtArea.Text));
            }

            rptViewer.LocalReport.SetParameters(new ReportParameter("Location", ddlLoc.SelectedItem.Text));
            rptViewer.LocalReport.SetParameters(new ReportParameter("SalesPerson", ddlSales.SelectedItem.Text));
            rptViewer.LocalReport.Refresh();
        }