protected void Page_Load(object sender, EventArgs e) { if (null != Request.Params["id"]) { int fileId = Convert.ToInt32(Request.Params["id"]); SFileBB fileBB = new SFileBB(); SFileData fileData = new SFileData(); try { fileData = fileBB.GetModel(fileId); if (fileData == null) { this.ClientScript.RegisterStartupScript(this.GetType(), "close", "alert('文件不存在,可能已被删除!');window.close();", true); return; } string pathName = fileData.absolutPath + fileData.sysFileNm; FileInfo file = new FileInfo(pathName); if (file.Exists) { this.OutPutFile(pathName, fileData.preFileNm); this.ClientScript.RegisterStartupScript(this.GetType(), "close", "window.close();", true); } else { this.ClientScript.RegisterStartupScript(this.GetType(), "close", "alert('文件不存在,可能已被删除!');window.close();", true); } } catch (Exception ex) { this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",1);", true); return; } finally { fileBB.Dispose(); } } }
/// <summary> /// 展示数据 /// </summary> /// <param name="id">记录Id</param> private void ShowInfo(int id) { LCustTagBB custTagBB = new LCustTagBB(); vLCustTagData model = new vLCustTagData(); SFileBB fileBB = new SFileBB(); try { model = custTagBB.GetVModel(id); this.hidCustNo.Value = model.custNo; this.hidMaterialNo.Value = model.materialNo; this.bigSQL.Text = model.bigTagSql; this.smallSQL.Text = model.smallTagSql; SFileData smdtata = fileBB.GetModel(model.smallTagFileId); if (smdtata != null) { this.smallfileNm.InnerHtml = "<a href='" + smdtata.absolutPath + smdtata.preFileNm + "' >" + smdtata.preFileNm + "</a>"; } SFileData bgdata = fileBB.GetModel(model.bigTagFileId); if (bgdata != null) { this.bigfileNm.InnerHtml = "<a href='" + bgdata.absolutPath + bgdata.preFileNm + "' >" + bgdata.preFileNm + "</a>"; } this.custNm.Text = model.custNm; this.materialNm.Text = model.materialDesc; this.bigTagFileId.Value = model.bigTagFileId.ToString(); this.smallTagFileId.Value = model.smallTagFileId.ToString(); this.tbEachPrintBigTagNum.Text = model.eachPrintBigTagNum.ToString(); this.tbEachPrintSmallTagNum.Text = model.eachPrintSmallTagNum.ToString(); this.tbUnit.Text = model.unit; this.tbUnits.Text = model.units; } finally { custTagBB.Dispose(); fileBB.Dispose(); } }