/// <summary> /// 初始化 /// </summary> private void Initialize() { string prNo = this.CurrentID; DataTable table = new DataTable(); using (PurProvider purProvider = new PurProvider()) { if (CurrentSource == "maintain") { var pur = purProvider.GetPRDetail(prNo); if (pur == null) { //this.ShowWarningMessage("请购单号码有误!"); //return; Response.Write("请购单号码有误!"); Response.End(); return; } string prType = pur["prhtyp"].ToString().Trim(); if (string.IsNullOrWhiteSpace(prType)) { Response.Write("请购单号码有误!"); Response.End(); return; } this.PrType = prType; //请购数据源 table = purProvider.GetPRMainPrint(this.PrType, prNo); } else if (CurrentSource == "print") { table = purProvider.GetPROrderPrint(this.PrType, this.PrNoFrom, this.PrNoTo, this.VenNo); } } string report = "RLPUR.Web.Pur" + this.PrType + ".rdlc"; Viewer.LocalReport.ReportEmbeddedResource = report; Viewer.LocalReport.DataSources.Clear(); Viewer.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", table)); }