protected void gvList_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "PDF") { List <VAN_OA.Model.EFrom.tb_QuotePrice> list = qpSer.GetListArray(string.Format(" tb_QuotePrice.Id=") + e.CommandArgument); if (list.Count > 0) { string url = System.Web.HttpContext.Current.Request.MapPath("PDFConverter/") + list[0].QuoteNo + ".pdf"; if (System.IO.File.Exists(url)) { try { down1(list[0].QuoteNo + ".pdf", url); return; } catch (Exception) { } } else { Session["PDFId"] = e.CommandArgument; url = string.Format("WPPrintPDF.aspx"); Page.RegisterStartupScript("ServiceManHistoryButtonClick", "<script>window.open('WPPrintPDF.aspx');</script>"); } } } }
protected void gvList_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Copy") { Session["POUrl"] = "~/ReportForms/MyWFQuotePriceList.aspx"; base.Response.Redirect("~/EFrom/WFQuotePrice.aspx?Copy=1&Id=" + e.CommandArgument); } if (e.CommandName == "PDF") { List <VAN_OA.Model.EFrom.tb_QuotePrice> list = qpSer.GetListArray(string.Format(" tb_QuotePrice.Id=") + e.CommandArgument); if (list.Count > 0) { string url = System.Web.HttpContext.Current.Request.MapPath("PDFConverter/") + list[0].QuoteNo + "-pdf.rar"; if (System.IO.File.Exists(url)) { try { convertWord(url); //down1( list[0].QuoteNo + "-pdf.zip",url); return; } catch (Exception) { } } else { Session["PDFId"] = e.CommandArgument; url = string.Format("WPPrintPDF.aspx"); Page.RegisterStartupScript("ServiceManHistoryButtonClick", "<script>window.open('WPPrintPDF.aspx?type=pdf');</script>"); } } } if (e.CommandName == "Word") { List <VAN_OA.Model.EFrom.tb_QuotePrice> list = qpSer.GetListArray(string.Format(" tb_QuotePrice.Id=") + e.CommandArgument); if (list.Count > 0) { string url = System.Web.HttpContext.Current.Request.MapPath("PDFConverter/") + list[0].QuoteNo + "-word.rar"; if (System.IO.File.Exists(url)) { try { convertWord(url); //down1(list[0].QuoteNo + "-word.zip", url); return; } catch (Exception) { } } else { Session["PDFId"] = e.CommandArgument; url = string.Format("WPPrintPDF.aspx"); Page.RegisterStartupScript("ServiceManHistoryButtonClick", "<script>window.open('WPPrintPDF.aspx?type=word');</script>"); } } } }