protected void btnViewXML_Click(object sender, EventArgs e) { string sessionDoc = Session["SCHEMA_FILE_NAME"].ToString(); XmlCreator xmlCreator = null; Guid docGuid = Guid.NewGuid(); bool useOuter = true; if (sessionDoc.StartsWith("Schema_Box_Ship_Label")) { xmlCreator = new BoxLabelXmlCreator(); xmlCreator.LoadData(txtInternalID.Text.Trim() + "/" + lblselect.Text.ToString()); //xmlCreator.LoadData(txtInternalID.Text.Trim()); } else if (sessionDoc.StartsWith("Schema_Pallet_Label_TypeA")) { xmlCreator = new PalletAXmlCreator(); xmlCreator.LoadData(txtInternalID.Text.Trim() + "/" + lblselect.Text.ToString()); } else if (sessionDoc.StartsWith("Schema_Pallet_Label_TypeB")) { xmlCreator = new PalletBXmlCreator(); xmlCreator.LoadData(txtInternalID.Text.Trim() + "/" + lblselect.Text.ToString()); } else if (sessionDoc.StartsWith("Schema_Pack_List")) { useOuter = false; xmlCreator = new PackListXmlCreator(); xmlCreator.LoadData(txtInternalID.Text.Trim()); } else if (sessionDoc.StartsWith("Schema_Waybill")) { //xmlCreator = new WayBillXmlCreator(); xmlCreator = new WayBill_AdditionXMLCreat_new(); xmlCreator.LoadData(txtInternalID.Text.Trim()); } /*if (!sessionDoc.StartsWith("Pallet Ship Label")) { string docType = Session["DOC"].ToString().Split("-".ToCharArray())[0]; switch (docType) { case "Box Ship Label": xmlCreator = new BoxLabelXmlCreator(); break; case "Pack List": useOuter = false; xmlCreator = new PackListXmlCreator(); break; case "Waybill": xmlCreator = new WayBillXmlCreator(); break; } } else { if (sessionDoc == "Pallet Ship Label- Pack ID Single") { xmlCreator = new PalletAXmlCreator(); } else { xmlCreator = new PalletBXmlCreator(); } }*/ //xmlCreator.LoadData(txtInternalID.Text.Trim()); string docName = ConfigurationManager.AppSettings["FilePath"] + @"\" + docGuid.ToString() + ".xml"; //string docName = Server.MapPath(@"~\Output\" + docGuid.ToString() + ".xml"); xmlCreator.WriteXml(docName, useOuter); string url = ConfigurationManager.AppSettings["FileSite"] + docGuid.ToString() + ".xml"; //Response.Redirect(@"~\Output\" + docGuid.ToString() + ".xml"); OpenWindows(url,"XML"); }
string OutputToPDF(string cmd) { logger.Debug("OutputToPDF begin"); string sessionDoc = Session["SCHEMA_FILE_NAME"].ToString(); XmlCreator xmlCreator = null; Guid docGuid = Guid.NewGuid(); bool useOuter = true; if (sessionDoc.StartsWith("Schema_Box_Ship_Label")) { //xmlCreator = new BoxLabelXmlCreator(); xmlCreator.LoadData(txtInternalID.Text.Trim()); xmlCreator.LoadData(txtInternalID.Text.Trim() + "/" + lblselect.Text.ToString()); } else if (sessionDoc.StartsWith("Schema_Pallet_Label_TypeA")) { xmlCreator = new PalletAXmlCreator(); xmlCreator.LoadData(txtInternalID.Text.Trim() + "/" + lblselect.Text.ToString()); } else if (sessionDoc.StartsWith("Schema_Pallet_Label_TypeB")) { xmlCreator = new PalletBXmlCreator(); xmlCreator.LoadData(txtInternalID.Text.Trim() + "/" + lblselect.Text.ToString()); } else if (sessionDoc.StartsWith("Schema_Pack_List")) { useOuter = false; xmlCreator = new PackListXmlCreator(); xmlCreator.LoadData(txtInternalID.Text.Trim()); } else if (sessionDoc.StartsWith("Schema_Waybill")) { //xmlCreator = new WayBillXmlCreator(); xmlCreator = new WayBill_AdditionXMLCreat_new(); xmlCreator.LoadData(txtInternalID.Text.Trim()); } string docName = ConfigurationManager.AppSettings["FilePath"] + @"\" + docGuid.ToString() + ".xml"; //string docName = Server.MapPath(@"~\Output\" + docGuid.ToString() + ".xml"); xmlCreator.WriteXml(docName, useOuter); /* string fopPath = ConfigurationManager.AppSettings["FOPPath"]; FOPWrap.FOP.GeneratePDF( fopPath, docName, Server.MapPath(@"~\XSL\" + Session["XSL"].ToString()), ConfigurationManager.AppSettings["FilePath"] + @"\" + docGuid.ToString()+".pdf"); //Server.MapPath(@"~\Output\" + docGuid.ToString() + ".pdf")); //return @"~\Output\" + docGuid.ToString() + ".pdf"; */ logger.Debug("OutputToPDF InvokeFOP begin xslFile=" + Server.MapPath(@"~\XSL\" + Session["XSL"].ToString()) + " , xmlFile=" + docName + " , pdfFile=" + ConfigurationManager.AppSettings["FilePath"] + @"\" + docGuid.ToString() + ".pdf"); using (localhost.EDITS c = new localhost.EDITS()) { string errmsg = ""; bool result = c.GenPDF(Server.MapPath(@"~\XSL\" + Session["XSL"].ToString()), docName, ConfigurationManager.AppSettings["FilePath"] + @"\" + docGuid.ToString() + ".pdf", ref errmsg); } logger.Debug("OutputToPDF InvokeFOP end"); logger.Debug("OutputToPDF end"); if (cmd=="ViewPDF") return ConfigurationManager.AppSettings["FileSite"] + docGuid.ToString() + ".pdf"; else return ConfigurationManager.AppSettings["FilePath"] + @"\" + docGuid.ToString() +".pdf"; }
string OutputToPDF(string cmd) { string sessionDoc = Session["SCHEMA_FILE_NAME"].ToString(); XmlCreator xmlCreator = null; Guid docGuid = Guid.NewGuid(); bool useOuter = true; if (sessionDoc.StartsWith("Schema_Box_Ship_Label")) { //xmlCreator = new BoxLabelXmlCreator(); xmlCreator.LoadData(txtInternalID.Text.Trim()); xmlCreator.LoadData(txtInternalID.Text.Trim() + "/" + lblselect.Text.ToString()); } else if (sessionDoc.StartsWith("Schema_Pallet_Label_TypeA")) { xmlCreator = new PalletAXmlCreator(); xmlCreator.LoadData(txtInternalID.Text.Trim() + "/" + lblselect.Text.ToString()); } else if (sessionDoc.StartsWith("Schema_Pallet_Label_TypeB")) { xmlCreator = new PalletBXmlCreator(); xmlCreator.LoadData(txtInternalID.Text.Trim() + "/" + lblselect.Text.ToString()); } else if (sessionDoc.StartsWith("Schema_Pack_List")) { useOuter = false; xmlCreator = new PackListXmlCreator(); xmlCreator.LoadData(txtInternalID.Text.Trim()); } else if (sessionDoc.StartsWith("Schema_Waybill")) { //xmlCreator = new WayBillXmlCreator(); xmlCreator = new WayBill_AdditionXMLCreat_new(); xmlCreator.LoadData(txtInternalID.Text.Trim()); } string docName = ConfigurationManager.AppSettings["FilePath"] + @"\" + docGuid.ToString() + ".xml"; //string docName = Server.MapPath(@"~\Output\" + docGuid.ToString() + ".xml"); xmlCreator.WriteXml(docName, useOuter); string fopPath = ConfigurationManager.AppSettings["FOPPath"]; FOPWrap.FOP.GeneratePDF( fopPath, docName, Server.MapPath(@"~\XSL\" + Session["XSL"].ToString()), ConfigurationManager.AppSettings["FilePath"] + @"\" + docGuid.ToString()+".pdf"); //Server.MapPath(@"~\Output\" + docGuid.ToString() + ".pdf")); //return @"~\Output\" + docGuid.ToString() + ".pdf"; if (cmd=="ViewPDF") return ConfigurationManager.AppSettings["FileSite"] + docGuid.ToString() + ".pdf"; else return ConfigurationManager.AppSettings["FilePath"] + @"\" + docGuid.ToString() +".pdf"; }