public void ProcessRequest(HttpContext context) { string pn = CommonLogic.QueryStringCanBeDangerousContent("xmlpackage"); Customer ThisCustomer = ((InterpriseSuiteEcommercePrincipal)context.User).ThisCustomer; try { using (XmlPackage2 p = new XmlPackage2(pn, ThisCustomer, ThisCustomer.SkinID, "", XmlPackageParam.FromString(""), "", true)) { if (!p.AllowEngine) { context.Response.Write("This XmlPackage is not allowed to be run from the engine. Set the package element's allowengine attribute to true to enable this package to run."); } else { if (p.HttpHeaders != null) { foreach (XmlNode xn in p.HttpHeaders) { string headername = xn.Attributes["headername"].InnerText; string headervalue = xn.Attributes["headervalue"].InnerText; context.Response.AddHeader(headername, headervalue); } } string output = p.TransformString(); context.Response.AddHeader("Content-Length", output.Length.ToString()); context.Response.Write(output); } } } catch (Exception ex) { context.Response.Write(ex.Message + "<br/><br/>"); Exception iex = ex.InnerException; while (iex != null) { context.Response.Write(ex.Message + "<br/><br/>"); iex = iex.InnerException; } } }
private String SendTestNewOrderNotification() { try { String newOrderSubject = String.Format(AppLogic.GetString("common.cs.5", 1, thisUserAccount.LocaleSetting), AppLogic.AppConfig("StoreName")); String PackageName = AppLogic.AppConfig("XmlPackage.NewOrderAdminNotification"); using (XmlPackage2 p = new XmlPackage2(PackageName, null, 1, String.Empty, XmlPackageParam.FromString("ordernumber=" + _testSalesOrderCode))) { String newOrderNotification = p.TransformString(); String SendToList = AppLogic.AppConfig("GotOrderEMailTo").ToString().Replace(",", ";"); if (SendToList.IndexOf(';') != -1) { foreach (String s in SendToList.Split(';')) { AppLogic.SendMail(newOrderSubject, newOrderNotification + AppLogic.AppConfig("MailFooter"), true, AppLogic.AppConfig("GotOrderEMailFrom"), AppLogic.AppConfig("GotOrderEMailFromName"), s.Trim(), s.Trim(), String.Empty, AppLogic.MailServer(), true); } } else { AppLogic.SendMail(newOrderSubject, newOrderNotification + AppLogic.AppConfig("MailFooter"), true, AppLogic.AppConfig("GotOrderEMailFrom"), AppLogic.AppConfig("GotOrderEMailFromName"), SendToList, SendToList, String.Empty, AppLogic.MailServer(), true); } } } catch (Exception e) { int MailMe_PwdLen = AppLogic.AppConfig("MailMe_Pwd").ToString().Length; int MailMe_UserLen = AppLogic.AppConfig("MailMe_User").ToString().Length; String errMsg = String.Empty; if (e.Message.ToString().IndexOf("AUTHENTICATION", StringComparison.InvariantCultureIgnoreCase) != -1 || e.Message.ToString().IndexOf("OBJECT REFERENCE", StringComparison.InvariantCultureIgnoreCase) != -1 || e.Message.ToString().IndexOf("NO SUCH USER HERE", StringComparison.InvariantCultureIgnoreCase) != -1) { if (MailMe_UserLen == 0 && MailMe_PwdLen == 0) { errMsg = AppLogic.GetString("mailingtest.aspx.4", 1, thisUserAccount.LocaleSetting) + "<br/> �" + AppLogic.GetString("mailingtest.aspx.7", 1, thisUserAccount.LocaleSetting) + "<br/> �" + AppLogic.GetString("mailingtest.aspx.6", 1, thisUserAccount.LocaleSetting); } else if (MailMe_UserLen == 0) { errMsg = AppLogic.GetString("mailingtest.aspx.4", 1, thisUserAccount.LocaleSetting) + "<br/> �" + AppLogic.GetString("mailingtest.aspx.7", 1, thisUserAccount.LocaleSetting); } else if (MailMe_PwdLen == 0) { errMsg = AppLogic.GetString("mailingtest.aspx.4", 1, thisUserAccount.LocaleSetting) + "<br/> �" + AppLogic.GetString("mailingtest.aspx.6", 1, thisUserAccount.LocaleSetting); } else { errMsg = AppLogic.GetString("mailingtest.aspx.4", 1, thisUserAccount.LocaleSetting) + "<br/> �" + AppLogic.GetString("mailingtest.aspx.9", 1, thisUserAccount.LocaleSetting); } if (errMsg.Length != 0) { return(errMsg); } } return(AppLogic.GetString("mailingtest.aspx.4", 1, thisUserAccount.LocaleSetting) + "<br/> �" + e.Message.ToString()); } return(AppLogic.GetString("mailingtest.aspx.2", 1, thisUserAccount.LocaleSetting)); }