当前位置: 首页>>代码示例>>C#>>正文


C# LocalReport.SetParameters方法代码示例

本文整理汇总了C#中LocalReport.SetParameters方法的典型用法代码示例。如果您正苦于以下问题:C# LocalReport.SetParameters方法的具体用法?C# LocalReport.SetParameters怎么用?C# LocalReport.SetParameters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LocalReport的用法示例。


在下文中一共展示了LocalReport.SetParameters方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateReport

        public FileContentResult CreateReport(SqlReportType type, string reportName, string area, string datasetName,
            IEnumerable dataList, List<ReportParameter> myparams)
        {
            string mimeType;
            var report = new LocalReport();

            report.LoadReportDefinition(AssetResolver.GetEmbeddedResourceStream(reportName, area));
            report.SetParameters(myparams);
            var reportDataSource = new ReportDataSource(datasetName, dataList);
            report.DataSources.Add(reportDataSource);

            byte[] reportBytes = GenerateReport(type, report, out mimeType);
            return new FileContentResult(reportBytes, mimeType);
        }
开发者ID:Exclr8,项目名称:CloudCore,代码行数:14,代码来源:SQLReport.cs

示例2: SetParam

 public void SetParam ( ref LocalReport localReport , string strParam , string strValue )
 {
     ReportParameter Param = new ReportParameter ();
     Param.Name = strParam;
     Param.Values.Add ( strValue );
     localReport.SetParameters ( new ReportParameter [] { Param } );
 }
开发者ID:cheng521yun,项目名称:https---github.com-frontflag-FTMZ_CY,代码行数:7,代码来源:Report.cs

示例3: executeReport_click

        protected void executeReport_click(object sender, EventArgs e)
        {
            if (reportSelector.SelectedIndex == 9)
                executeReportInAppDomain_click(sender, e);
            else
            {
                LocalReport rpt = new LocalReport();
                rpt.EnableExternalImages = true;
                rpt.ReportPath = String.Concat(Path.GetDirectoryName(Request.PhysicalPath), "\\Reports\\", reportSelector.SelectedValue);
                string orientation = (rpt.GetDefaultPageSettings().IsLandscape) ? "landscape" : "portrait";
                StringReader formattedReport = Business.reportHelper.FormatReportForTerritory(rpt.ReportPath, orientation, cultureSelector.SelectedValue);
                rpt.LoadReportDefinition(formattedReport);

                // Add Data Source
                rpt.DataSources.Add(new ReportDataSource("InvoiceDataTable", dt));

                // Internationlisation: Add uiCulture and Translation Labels
                if (reportSelector.SelectedIndex >= 3)
                {
                    Dictionary<string, string> reportLabels = Reports.reportTranslation.translateInvoice(cultureSelector.SelectedValue);
                    ReportParameterCollection reportParams = new ReportParameterCollection();

                    reportParams.Add(new ReportParameter("uiCulture", cultureSelector.SelectedValue));
                    foreach (string key in reportLabels.Keys)
                        reportParams.Add(new ReportParameter(key, reportLabels[key]));

                    rpt.SetParameters(reportParams);
                }

                // Render To Browser
                renderPDFToBrowser(rpt.Render("PDF", Business.reportHelper.GetDeviceInfoFromReport(rpt, cultureSelector.SelectedValue, "PDF")));
            }
        }
开发者ID:taigum,项目名称:ssrs-non-native-functions,代码行数:33,代码来源:SalesInvoiceDemo.aspx.cs

示例4: Render

        public void Render(string reportDesign, ReportDataSource[] dataSources, string destFile, IEnumerable<ReportParameter> parameters = null)
        {
            var localReport = new LocalReport();

            using (var reportDesignStream = System.IO.File.OpenRead(reportDesign))
            {
                localReport.LoadReportDefinition(reportDesignStream);
            }
            localReport.EnableExternalImages = true;
            localReport.EnableHyperlinks = true;

            if (parameters != null)
            {
                localReport.SetParameters(parameters);
            }
            foreach (var reportDataSource in dataSources)
            {
                localReport.DataSources.Add(reportDataSource);
            }

            //Export to PDF
            string mimeType;
            string encoding;
            string fileNameExtension;
            string[] streams;
            Warning[] warnings;
            var content = localReport.Render("PDF", null, out mimeType, out encoding, out fileNameExtension, out streams, out warnings);

            System.IO.File.WriteAllBytes(destFile, content);
        }
开发者ID:MySmallfish,项目名称:Simple.ReDoc,代码行数:30,代码来源:HomeController.cs

示例5: PrintDataSource

 // Create a local report for Report.rdlc, load the data,
 //    export the report to an .emf file, and print it.
 public void PrintDataSource(DataTable dt, IEnumerable<ReportParameter> param, System.Drawing.Printing.PrinterSettings ps, ref System.IO.MemoryStream ReportDefinition)
 {
     LocalReport report = new LocalReport();
     this.ps = ps;
     //report.ReportPath = @"Examine.rdlc";
     ReportDefinition.Seek(0, SeekOrigin.Begin);
     report.LoadReportDefinition(ReportDefinition);
     report.DataSources.Add(new ReportDataSource("BossCom_RecordPatient", dt));
     report.SetParameters(param);
     Export(report);
     m_currentPageIndex = 0;
     Print();
 }
开发者ID:VinhNT,项目名称:MedicineCenter,代码行数:15,代码来源:ReportPrinter.cs

示例6: ReportPrintClass

        public ReportPrintClass(string _DataSourceName, DataTable _DataSourceValue, string _ReportPath, ReportParameter[] arrParams,double pagewidth,double pageheight, double leftmargin, double rightmargin, double topmargin, double bottommargin)
        {
            this.pageWidth = pagewidth;
            this.pageHeight = pageheight;
            this.leftMargin = leftmargin;
            this.rightMargin = rightmargin;
            this.topMargin = topmargin;
            this.bottomMargin = bottommargin;
            LocalReport report = new LocalReport();
            report.ReportPath = _ReportPath;

            report.DataSources.Add(new ReportDataSource(_DataSourceName, _DataSourceValue));
            report.SetParameters(arrParams);
            Export(report);
            m_currentPageIndex = 0;
        }
开发者ID:cveggalam,项目名称:Restaurant,代码行数:16,代码来源:ReportPrintClass.cs

示例7: Render

        public byte[] Render(ReportName reportName, IDictionary<string, object[]> dataSources, params ReportParameter[] parameters)
        {
            var localReport = new LocalReport();
            localReport.ReportEmbeddedResource = new ReportResourceResolver().ResolveResource(reportName);

            foreach (var dataSource in dataSources)
            {
                var reportDataSource = new ReportDataSource(dataSource.Key, dataSource.Value);
                localReport.DataSources.Add(reportDataSource);
            }

            if (parameters != null && parameters.Length > 0)
                localReport.SetParameters(parameters);

            var reportType = "PDF";

            var settings = localReport.GetDefaultPageSettings();

            var width = settings.IsLandscape ? settings.PaperSize.Height : settings.PaperSize.Width;
            var height = settings.IsLandscape ? settings.PaperSize.Width : settings.PaperSize.Height;

            var deviceInfo =
                "<DeviceInfo>" +
                "  <OutputFormat>PDF</OutputFormat>" +
                "  <PageWidth>" + width / 100.0m + "in</PageWidth>" +
                "  <PageHeight>" + height / 100.0m + "in</PageHeight>" +
                "  <MarginTop>" + settings.Margins.Top / 100.0m + "in</MarginTop>" +
                "  <MarginLeft>" + settings.Margins.Left / 100.0m + "in</MarginLeft>" +
                "  <MarginRight>" + settings.Margins.Right / 100.0m + "in</MarginRight>" +
                "  <MarginBottom>" + settings.Margins.Bottom / 100.0m + "in</MarginBottom>" +
                "</DeviceInfo>";

            string mimeType;
            string encoding;
            string fileNameExtension;
            Warning[] warnings;
            string[] streams;

            return localReport.Render(
                reportType,
                deviceInfo,
                out mimeType,
                out encoding,
                out fileNameExtension,
                out streams,
                out warnings);
        }
开发者ID:gregfiske,项目名称:ReportBuilder,代码行数:47,代码来源:PdfRenderer.cs

示例8: GenerateReportForCombo

        private byte[] GenerateReportForCombo(List<ComboBoxDTO> combos, rptProjectCwaIwpDTO rptInfo, string listTitle)
        {
            byte[] bytes = null;

            Microsoft.Reporting.WebForms.Warning[] warnings;
            string[] streamids;
            string mimeType;
            string encoding;
            string extension;
            string DeviceInfo = "<DeviceInfo>" +
                 "  <OutputFormat>JPEG</OutputFormat>" +
                 "  <EndPage>1</EndPage>" +
                 "  <PageWidth>8in</PageWidth>" +
                 "  <PageHeight>11in</PageHeight>" +
                 "  <MarginTop>0in</MarginTop>" +
                 "  <MarginLeft>0in</MarginLeft>" +
                 "  <MarginRight>0in</MarginRight>" +
                 "  <MarginBottom>0in</MarginBottom>" +
                 "</DeviceInfo>";

            List<ReportParameter> paramList = new List<ReportParameter>();

            //Default Parameter
            paramList = GetReportParams(rptInfo);
            //Defined Parameter For Combo
            paramList.Add(new ReportParameter("par_title", string.IsNullOrEmpty(listTitle) ? "" : listTitle)); //List Title

            if (combos == null || combos.Count <= 0)
                combos = new List<ComboBoxDTO>();

            LocalReport report = new LocalReport();

            report.ReportPath = @".\Prev\Resource\rdl\RPTAssembleList.rdl";
            report.EnableExternalImages = true;
            report.SetParameters(paramList);
            report.DataSources.Clear();
            //Material DataSource
            report.DataSources.Add(new ReportDataSource("rptCombobox", combos));

            bytes = report.Render("Image", DeviceInfo, out mimeType, out encoding, out extension, out streamids, out warnings);

            return bytes;
        }
开发者ID:paraneye,项目名称:WebService,代码行数:43,代码来源:Assemble.cs

示例9: GenerateReportForMaterial

        private byte[] GenerateReportForMaterial(List<FiwpmaterialDTO> fiwpmaterials, rptProjectCwaIwpDTO rptInfo)
        {
            byte[] bytes = null;

            Microsoft.Reporting.WebForms.Warning[] warnings;
            string[] streamids;
            string mimeType;
            string encoding;
            string extension;
            string DeviceInfo = "<DeviceInfo>" +
                 "  <OutputFormat>JPEG</OutputFormat>" +
                 "  <EndPage>1</EndPage>" +
                 "  <PageWidth>17in</PageWidth>" +
                 "  <PageHeight>11in</PageHeight>" +
                 "  <MarginTop>0in</MarginTop>" +
                 "  <MarginLeft>0in</MarginLeft>" +
                 "  <MarginRight>0in</MarginRight>" +
                 "  <MarginBottom>0in</MarginBottom>" +
                 "</DeviceInfo>";

            List<ReportParameter> paramList = new List<ReportParameter>();

            //Default Parameter
            paramList = GetReportParams(rptInfo);

            if (fiwpmaterials == null || fiwpmaterials.Count <= 0)
                fiwpmaterials = new List<FiwpmaterialDTO>();

            LocalReport report = new LocalReport();

            report.ReportPath = @".\Prev\Resource\rdl\RPTCreateFIWPP3.rdl";
            report.EnableExternalImages = true;
            report.SetParameters(paramList);
            report.DataSources.Clear();
            //Material DataSource
            report.DataSources.Add(new ReportDataSource("rptMaterial", fiwpmaterials));

            bytes = report.Render("Image", DeviceInfo, out mimeType, out encoding, out extension, out streamids, out warnings);

            return bytes;
        }
开发者ID:paraneye,项目名称:WebService,代码行数:41,代码来源:Assemble.cs

示例10: CreateReport


//.........这里部分代码省略.........
                DateTime dt1 = new DateTime(Int32.Parse(dataprimirii.Substring(6, 4)), Int32.Parse(dataprimirii.Substring(3, 2)), Int32.Parse(dataprimirii.Substring(0, 2)));
                DateTime dt2 = new DateTime(Int32.Parse(datapmax.Substring(6, 4)), Int32.Parse(datapmax.Substring(3, 2)), Int32.Parse(datapmax.Substring(0, 2)));
                if (DateTime.Compare(dt1, dt2) > 0)
                    datapmax = dataprimirii;
            }

        }
        if (datatmin != datatmax)
            datatesttitlu = datatmin + " - " + datatmax;
        if (datapmin != datapmax)
            dataprimtitlu = datapmin + " si " + datapmax;
        else
            dataprimtitlu = datapmin;

        rds.Value = mostre;

        report.DataSources.Clear();
        report.DataSources.Add(rds);

        report.ReportPath = "ReportFCB4.rdlc";
        report.Refresh();

        string client = DropDownList1.SelectedValue;

        // read fabrica
        SqlConnection cnn = new SqlConnection(ConfigurationManager.ConnectionStrings["fccl2ConnectionString"].ConnectionString);
        SqlCommand cmd = new SqlCommand();
        cmd.Connection = cnn;

        cmd.CommandText = "SELECT MostreTancuri.AdresaClient,MostreTancuri.NumeClient,MostreTancuri.Localitate,MostreTancuri.Judet,MostreTancuri.NrComanda "
     + "FROM MostreTancuri WHERE MostreTancuri.NumeClient='" + client + "'";

        cnn.Open();
        SqlDataReader reader = cmd.ExecuteReader();
        reader.Read();

        string fabricastrada = mostre[0].FabriciStrada;
        string fabricaoras = mostre[0].FabriciOras;
        string fabricajudet = mostre[0].FabriciJudet;
        string nrcomanda = mostre[0].NrComanda;

        reader.Close();
        cnn.Close();
        string nrb = dalReport.ReportNumber.ToString(); ;
        //set report parameters
        string laborator = ddlLaborator.Items[ddlLaborator.SelectedIndex].ToString();
        string responsabil = ddlResponsabil.Items[ddlResponsabil.SelectedIndex].ToString();

        ReportParameter pDatatestare = new ReportParameter("datatestare", datatesttitlu);
        ReportParameter pDataprimirii = new ReportParameter("dataprimirii", dataprimtitlu);
        ReportParameter pCombi = new ReportParameter("combi", combi);
        ReportParameter pDatab = new ReportParameter("datab", TextBox2.Text);
        ReportParameter pNrb = new ReportParameter("nrb", nrb);
        ReportParameter pFabricanume = new ReportParameter("fabricanume", client);
        ReportParameter pFabricastrada = new ReportParameter("fabricastrada", fabricastrada);
        ReportParameter pComanda = new ReportParameter("nrcomanda", nrcomanda);
        ReportParameter pFabricaoras = new ReportParameter("fabricaoras", fabricaoras);
        ReportParameter pFabricajudet = new ReportParameter("fabricajudet", fabricajudet);
        ReportParameter pLaborator = new ReportParameter("laborator", laborator);
        ReportParameter pResponsabil = new ReportParameter("responsabil", responsabil);
        ReportParameter pVersiune = new ReportParameter("Versiune", new SettingManager(StaticDataHelper.FCCLDbContext).GetValueByName("ReportFCB4"));

        ReportParameter[] p = { pDatatestare, pDataprimirii, pCombi, pDatab, pNrb, pFabricanume, pFabricastrada, pComanda, pFabricaoras, pFabricajudet, pLaborator, pResponsabil, pVersiune };
        report.SetParameters(p);

        file = report.Render("PDF", StaticData.DEVICE_INFO_PDF, out mimeType, out encoding, out fileExtension, out streams, out warnings);
        string httppath = StaticDataHelper.SettingsManager.CaleRapoarteHttp;
        string filepath = StaticDataHelper.SettingsManager.CaleRapoarte;

        string parse_client = replace_special_car(client);


        string raport_name = "RaportFCB" + datatestare.Replace("/", "_") + "_" + nrb + "_" + parse_client + ".pdf";
        string raport_excel = "RaportFCB" + datatestare.Replace("/", "_") + "_" + nrb + "_" + parse_client + ".xls";

        string path_raport_http = "http://" + Request.ServerVariables.Get("HTTP_HOST") + "/" + httppath;
        string pdf_link = path_raport_http + @"FCB/" + raport_name;
        string pdf_file = filepath + @"FCB/" + raport_name;
        // writefile

        string excel_link = path_raport_http + @"FCB/" + raport_excel;
        string excel_file = filepath + @"FCB/" + raport_excel;
        report.SetParameters(new ReportParameter("BkImage", ""));
        File.WriteAllBytes(pdf_file, file);
        dalReport.SampleCount = mostre.Count;
        dalReport.PageCount = PDFHelper.GetNumberOfPdfPages(pdf_file);
        rManager.Save(dalReport);
        ctx.SaveChanges();

        byte[] file_xls = report.Render("EXCEL", StaticData.DEVICE_INFO_XLS, out mimeType, out encoding, out fileExtension, out streams, out warnings);
        File.WriteAllBytes(excel_file, file_xls);

        pdflink.Visible = true;
        pdflink.NavigateUrl = pdf_link;
        pdflink.Text = raport_name;

        xlslink.Visible = true;
        xlslink.NavigateUrl = excel_link;
        xlslink.Text = raport_excel;
    }
开发者ID:veronica1981,项目名称:veronica,代码行数:101,代码来源:RaportFCB4.aspx.cs

示例11: PostScheduledTrainingReport

        private HttpResponseMessage PostScheduledTrainingReport(string exportFormat, string orderByField, string groupByField)
        {
            try
            {
                var data = reportObject.PostScheduledTrainingReport();

                var report = new LocalReport { ReportPath = @".\Reports\ScheduledTraining.rdlc" };
                report.DataSources.Add(
                  new ReportDataSource("DataSet1", data));
                var rp = new ReportParameter("OrderByField", orderByField);
                var gf = new ReportParameter("GroupByField", groupByField);
                report.SetParameters(rp);
                report.SetParameters(gf);
                return Export(report, exportFormat);
            }
            catch (Exception e)
            {
                Logger.Error(e);
                throw new Exception(e.Message);
            }
        }
开发者ID:Ruandv,项目名称:Training,代码行数:21,代码来源:ReportsController.cs

示例12: BindHostingSpaceBandwidthOverusageDetailsReport

		protected void BindHostingSpaceBandwidthOverusageDetailsReport(string reportName, LocalReport localReport)
		{
			// 1. Localize report
			localReport.DisplayName = reportName;
			localReport.LoadReportDefinition(
					ReportingServicesUtils.LoadReportFromFile(
						  GetReportFullPath(reportName)
						, reportName
						, this
					)
				);

			// 2. Update parameters
			//    Note: here we are always in Drill-through mode.
			localReport.SetParameters(localReport.OriginalParametersToDrillthrough);
			string hostingSpaceId = localReport.GetParameters()["HostingSpaceId"].Values[0];

			List<ReportParameter> parameters = new List<ReportParameter>();
			parameters.Add(
					new ReportParameter(
						  ParameterBandwidthStartDate
						, startDateCalendar.SelectedDate.ToString()
					)
				);
			parameters.Add(
					new ReportParameter(
						  ParameterBandwidthEndDate
						, endDateCalendar.SelectedDate.ToString()
					)
				);

			localReport.SetParameters(parameters);

			//3. Update data
			DataSet ds = ES.Services.Packages
						 .GetBandwidthOverusageDetailsReport(
							  PanelSecurity.SelectedUserId
							, int.Parse(hostingSpaceId)
							, startDateCalendar.SelectedDate
							, endDateCalendar.SelectedDate
						 );

			localReport.DataSources.Clear();

			TranslateStatusField(ds.Tables["HostingSpace"]);

			BindDataTableToReport(localReport, "OverusageReport_HostingSpace", ds.Tables["HostingSpace"]);
			BindDataTableToReport(localReport, "OverusageReport_BandwidthOverusage", ds.Tables["BandwidthOverusage"]);
			BindDataTableToReport(localReport, "OverusageReport_OverusageDetails", ds.Tables["OverusageDetails"]);

			localReport.Refresh();
		}
开发者ID:jordan49,项目名称:websitepanel,代码行数:52,代码来源:OverusageReport.ascx.cs

示例13: StartPrint

        //为打印报表准备数据
        public void StartPrint(string ReportName)
        {
            m_streams = new List<Stream>();
            LocalReport report = new LocalReport();

            //foreach (string ReportName in dataSourceList)
            //{
                switch (ReportName)
                {
                    case "Report1.rdlc":
                        {
                            var resultSet = FacilityBLL.getOrderDetail(2);
                            report.ReportEmbeddedResource = "Annon.Report.Report1.rdlc";
                            var ordersInfo = FacilityBLL.getOrderInfo(1);
                            ReportParameter rp = new ReportParameter("Latitute", "200m");
                            ReportParameter rpTag = new ReportParameter("CustomerName", "ordersInfo.Customer");
                            ReportParameter rpProjectName = new ReportParameter("ProjectName", ordersInfo.JobName);
                            ReportParameter rpProjectNo = new ReportParameter("ProjectNo", ordersInfo.JobNum);
                            ReportParameter rpSeller = new ReportParameter("AnnonContact", "ordersInfo.AAonCon");
                            ReportParameter rpOrderDate = new ReportParameter("DealDate", ordersInfo.Activity);
                            report.SetParameters(new ReportParameter[] { rp, rpTag, rpProjectName, rpProjectNo, rpSeller, rpOrderDate });
                            report.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("DataSet1", resultSet));
                        }
                        break;
                    case "Report2.rdlc":
                        {
                            var resultSet2 = FacilityBLL.getOrderDetail(2);
                            report.ReportEmbeddedResource = "Annon.Report.Report2.rdlc";
                            var ordersInfo = FacilityBLL.getOrderInfo(1);
                            ReportParameter rp = new ReportParameter("Latitute", "200m");
                            ReportParameter rpTag = new ReportParameter("CustomerName", "ordersInfo.Customer");
                            ReportParameter rpProjectName = new ReportParameter("ProjectName", ordersInfo.JobName);
                            ReportParameter rpProjectNo = new ReportParameter("ProjectNo", ordersInfo.JobNum);
                            ReportParameter rpSeller = new ReportParameter("AnnonContact", "ordersInfo.AAonCon");
                            ReportParameter rpOrderDate = new ReportParameter("DealDate", ordersInfo.Activity);
                            report.SetParameters(new ReportParameter[] { rp, rpTag, rpProjectName, rpProjectNo, rpSeller, rpOrderDate });
                            report.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("DataSet1", resultSet2));
                        }
                        break;
                    case "Report3.rdlc":
                        {

                            var resultSet = FacilityBLL.getFacility(1, 1, "model");
                            var resultSet1 = FacilityBLL.getFacility(1, 1, "feature");
                            var productDescription = FacilityBLL.getDescription(1);
                            var ordersInfo = FacilityBLL.getOrderInfo(1);

                            report.ReportEmbeddedResource = "Annon.Report.Report3.rdlc";
                            ReportParameter rp = new ReportParameter("ProductDescription", "6ERM-" + productDescription);
                            ReportParameter rpTag = new ReportParameter("AnnonContact", "Annon.contact");
                            ReportParameter rpProjectName = new ReportParameter("ProjectName", ordersInfo.JobName);
                            ReportParameter rpProjectNo = new ReportParameter("ProjectNo", ordersInfo.JobNum);
                            ReportParameter rpOrderDate = new ReportParameter("OrderDate", ordersInfo.Activity);
                            report.SetParameters(new ReportParameter[] { rp, rpTag, rpProjectName, rpProjectNo, rpOrderDate });
                            report.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("DataSet1", resultSet));
                            report.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("DataSet2", resultSet1));
                        }
                        break;
                    case "Report4.rdlc":
                        {
                            var resultSet = FacilityBLL.getFacility(1, 1, "model");
                            var resultSet1 = FacilityBLL.getFacility(1, 1, "feature");
                            var productDescription = FacilityBLL.getDescription(1);
                            var ordersInfo = FacilityBLL.getOrderInfo(1);

                            report.ReportEmbeddedResource = "Annon.Report.Report4.rdlc";
                            ReportParameter rp = new ReportParameter("ProductDescription", "6ERM-" + productDescription);
                            ReportParameter rpTag = new ReportParameter("Tag", "6ERM");
                            ReportParameter rpProjectName = new ReportParameter("ProjectName", ordersInfo.JobName);
                            ReportParameter rpProjectNo = new ReportParameter("ProjectNo", ordersInfo.JobNum);
                            ReportParameter rpSeller = new ReportParameter("Seller", "ordersInfo.AAonCon");
                            ReportParameter rpOrderDate = new ReportParameter("OrderDate", ordersInfo.Activity);
                            report.SetParameters(new ReportParameter[] { rp, rpTag, rpProjectName, rpProjectNo, rpSeller, rpOrderDate });
                            report.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("DataSet1", resultSet));
                            report.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("DataSet2", resultSet1));
                        }
                        break;
                    case "Report5.rdlc":
                        {
                            var resultSet = FacilityBLL.getOrderDetail(1);
                            report.ReportEmbeddedResource = "Annon.Report.Report5.rdlc";
                            report.SubreportProcessing += new SubreportProcessingEventHandler(LocalReport_SubreportProcessing);
                            report.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("DataSet1", resultSet));
                        }
                        break;
                }
                //将报表原始数据输出,并进行转换
                Export(report);
            //}
            m_currentPageIndex = 0;
            Print();
        }
开发者ID:Spritutu,项目名称:ntxx,代码行数:93,代码来源:PrintReport.cs

示例14: Report

        public ActionResult Report(string id, Int32? idventa)
        {
            LocalReport lr = new LocalReport();

            Int32 idVenta;
            string path = Path.Combine(Server.MapPath("~/Reportes"), "ComprobantePago.rdlc");
            if (System.IO.File.Exists(path))
            {
                if (idventa != null)
                {
                    idVenta = Int32.Parse(idventa.ToString());
                }
                else
                {
                    return View("ListarReservas");
                }

                lr.ReportPath = path;
            }
            else
            {
                return View("ListarReservas");
            }

            string reportType = id;
            string mimeType;
            string encoding;
            string fileNameExtension;

            string deviceInfo =

            "<DeviceInfo>" +
            "  <OutputFormat>" + id + "</OutputFormat>" +
            "  <PageWidth>16cm</PageWidth>" +
            "  <PageHeight>12cm</PageHeight>" +
            "  <MarginTop>0.5cm</MarginTop>" +
            "  <MarginLeft>0.5cm</MarginLeft>" +
            "  <MarginRight>0.5cm</MarginRight>" +
            "  <MarginBottom>0.5cm</MarginBottom>" +
            "</DeviceInfo>";

            Warning[] warnings;
            string[] streams;
            byte[] renderedBytes;

            List<DatosReportVentaComprobante> cm = new List<DatosReportVentaComprobante>();
            Venta pru = ventaService.ObtenerVentaPorId(idVenta);

            foreach (var item in pru.Reseras)
            {
                var datos = new DatosReportVentaComprobante
                {
                    DniRuc = item.Cliente.DniRuc,
                    Apellidos = item.Cliente.Nombre + " " + item.Cliente.Apellidos,
                    OrigenId = item.Horario.EstacionOrigen.Provincia,
                    DestinoId = item.Horario.EstacionDestino.Provincia,
                    Hora = item.Horario.HoraText,
                    Asiento = item.Asiento.ToString(),
                    Pago = item.Pago
                };

                cm.Add(datos);
            }

            ReportDataSource rd = new ReportDataSource("ComprobantePago", cm);
            lr.DataSources.Add(rd);

            ReportParameter[] parametros = new ReportParameter[7];

            parametros[0] = new ReportParameter("NroVenta", pru.NroVenta + "");
            parametros[1] = new ReportParameter("Nombre", pru.Cliente.Nombre + " " + pru.Cliente.Apellidos);
            parametros[2] = new ReportParameter("Fecha", pru.Fecha + "");
            parametros[3] = new ReportParameter("DniRuc", pru.Cliente.DniRuc + "");
            parametros[4] = new ReportParameter("Direccion", pru.Cliente.Direccion + "");
            parametros[5] = new ReportParameter("Telefono", pru.Cliente.Telefono + "");
            parametros[6] = new ReportParameter("Tipo", "Reserva");

            lr.SetParameters(parametros);

            renderedBytes = lr.Render(
                reportType,
                deviceInfo,
                out mimeType,
                out encoding,
                out fileNameExtension,
                out streams,
                out warnings);

            switch (id)
            {
                case "PDF":
                    return File(renderedBytes, mimeType);
                case "Excel":
                    return File(renderedBytes, mimeType, pru.NroVenta + ".xls");
                case "Word":
                    return File(renderedBytes, mimeType, pru.NroVenta + ".doc");
                case "Image":
                    return File(renderedBytes, mimeType, pru.NroVenta + ".png");
                default:
                    break;
//.........这里部分代码省略.........
开发者ID:bdhc93,项目名称:SystranHorizonte,代码行数:101,代码来源:ReservaController.cs

示例15: ProccessLocalReport

        private static LocalReport ProccessLocalReport(ReportTypeEnum reportTypeEnum, string reportPath, IEnumerable<ReportDataSource> reportDataSources,
                                                         List<ReportParameter> reportParameters, out string reportType, out string deviceInfo)
        {
            LocalReport lr = new LocalReport();

            if (!File.Exists(reportPath))
                throw new Exception("Report não encontrado!");

            lr.ReportPath = reportPath;

            foreach (var reportDataSource in reportDataSources)
                lr.DataSources.Add(reportDataSource);

            if (reportParameters.Any())
                lr.SetParameters(reportParameters);

            switch (reportTypeEnum)
            {
                case ReportTypeEnum.Pdf:
                    reportType = "PDF";
                    break;
                case ReportTypeEnum.Excel:
                    reportType = "Excel";
                    break;
                case ReportTypeEnum.Word:
                    reportType = "Word";
                    break;
                case ReportTypeEnum.Image:
                    reportType = "Image";
                    break;
                default:
                    throw new ArgumentOutOfRangeException("reportTypeEnum");
            }

            deviceInfo = "<DeviceInfo>" +
                         "  <OutputFormat>" + reportType + "</OutputFormat>" +
                         "  <PageWidth>8.5in</PageWidth>" +
                         "  <PageHeight>11in</PageHeight>" +
                         "  <MarginTop>0.5in</MarginTop>" +
                         "  <MarginLeft>1in</MarginLeft>" +
                         "  <MarginRight>1in</MarginRight>" +
                         "  <MarginBottom>0.5in</MarginBottom>" +
                         "</DeviceInfo>";

            return lr;
        }
开发者ID:RobsonROX,项目名称:Util,代码行数:46,代码来源:ReportGenerator.cs


注:本文中的LocalReport.SetParameters方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。