/// <summary> /// 绑定列表 /// </summary> private void BindList() { using (PurProvider purProvider = new PurProvider()) { string prNo = PRNo.Text.Trim(); if (prNo.Length > 0) { var pur = purProvider.GetPRDetail(prNo); if (pur != null) { ORDNO.Text = pur["PRHSORD"].ToString(); DRAWNO.Text = pur["PRHMNO"].ToString(); PRType.Text = pur["prhpgm"].ToString(); PRStatus.Text = pur["PRHSTAT"].ToString(); DataTable table; if (ORDNO.Text.Trim().Length > 0) //非材料请购 { table = purProvider.GetPRDetailNotMat(prNo); } else //材料请购 { table = purProvider.GetPRDetailMat(prNo); } List.DataSource = table; List.DataBind(); PostButton.Enabled = true; } else { this.Initialize(); List.DataSource = null; List.DataBind(); } } else { this.Initialize(); List.DataSource = null; List.DataBind(); } } }
/// <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)); }