public void ProcessRequest(HttpContext context) { string pn = XMLPackage; Customer ThisCustomer = ((AspDotNetStorefrontPrincipal)context.User).ThisCustomer; try { using (XmlPackage2 p = new XmlPackage2(pn, ThisCustomer, ThisCustomer.SkinID, "", "", "", 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); } } StringBuilder output = new StringBuilder(10000); if (p.RequiresParser) { Parser ps = new Parser(ThisCustomer.SkinID, ThisCustomer); output.Append(ps.ReplaceTokens(p.TransformString())); } else { output.Append(p.TransformString()); } context.Response.AddHeader("Content-Length", output.Length.ToString()); context.Response.Write(output); } } } catch (Exception ex) { context.Response.Write(context.Server.HtmlEncode(ex.Message) + ""); Exception iex = ex.InnerException; while (iex != null) { context.Response.Write(context.Server.HtmlEncode(ex.Message) + ""); iex = iex.InnerException; } } }
private String SendTestNewOrderNotification(Int32 storeId) { if (AppLogic.AppConfigBool("TurnOffStoreAdminEMailNotifications")) { return(AppLogic.GetString("mailingtest.aspx.5", SkinID, LocaleSetting)); } try { String newOrderSubject = String.Format(AppLogic.GetString("common.cs.5", SkinID, LocaleSetting), AppLogic.AppConfig("StoreName", storeId, true)); String PackageName = AppLogic.AppConfig("XmlPackage.NewOrderAdminNotification"); XmlPackage2 p = new XmlPackage2(PackageName, null, SkinID, String.Empty, "ordernumber=999999"); 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", storeId, true), true, AppLogic.AppConfig("GotOrderEMailFrom", storeId, true), AppLogic.AppConfig("GotOrderEMailFromName", storeId, true), s.Trim(), s.Trim(), String.Empty, AppLogic.MailServer()); } } else { AppLogic.SendMail(newOrderSubject, newOrderNotification + AppLogic.AppConfig("MailFooter", storeId, true), true, AppLogic.AppConfig("GotOrderEMailFrom", storeId, true), AppLogic.AppConfig("GotOrderEMailFromName", storeId, true), SendToList, SendToList, String.Empty, AppLogic.MailServer()); } } catch (Exception exception) { return(GenerateExceptionMessage(exception, storeId)); } return(AppLogic.GetString("mailingtest.aspx.2", SkinID, LocaleSetting)); }
private void SendNow() { bool isSendCopy = ctrlGiftRegistryShareForm.IsSendMeCopy; var emails = ctrlGiftRegistryShareForm.GetEmailAddresses(); string subject = ctrlGiftRegistryShareForm.Subject; if (emails.Count() == 0) { DisplayError(new List <string>() { AppLogic.GetString("editgiftregistry.error.20", ThisCustomer.SkinID, ThisCustomer.LocaleSetting) }); return; } //decode since we will not going to save it to the database. string htmlMessage = ctrlGiftRegistryShareForm.HtmlMessage.ToHtmlDecode(); var param = new XElement(DomainConstants.XML_ROOT_NAME); param.Add(new XElement("MAIL_SUBJECT", subject)); param.Add(new XElement("MAIL_BODY", htmlMessage)); //param.Add(new XElement("REGISTRY_LINK", )); var package = new XmlPackage2("notification.emailgiftregistry.xml.config", param); string html = package.TransformString(); string[] emailacctinfo = InterpriseHelper.GetStoreEmailAccountInfo(); try { foreach (var email in emails) { AppLogic.SendMailRequest(subject, htmlMessage, true, emailacctinfo[0], emailacctinfo[1], email, email, string.Empty); } //MailSerder.SendMail(subject, "*****@*****.**", html, SkinID); if (isSendCopy) { AppLogic.SendMailRequest(subject, htmlMessage, true, emailacctinfo[0], emailacctinfo[1], ThisCustomer.EMail, ThisCustomer.FullName, string.Empty); //MailSerder.SendMail(subject, ThisCustomer.EMail, html, SkinID); } ctrlGiftRegistryShareForm.ClearTextBox(); DisplayError(new List <string>() { AppLogic.GetString("editgiftregistry.aspx.45", ThisCustomer.SkinID, ThisCustomer.LocaleSetting) }); } catch (Exception) { DisplayError(new List <string>() { AppLogic.GetString("editgiftregistry.error.19", ThisCustomer.SkinID, ThisCustomer.LocaleSetting) }); } }
private void InitPatchInformation() { //Load version xmlpackages ArrayList xmlPackages = LocalReadAdminXmlPackages("versioninfo"); StringBuilder sb = new StringBuilder(); bool VersionFileFound = false; foreach (String s in xmlPackages) { VersionFileFound = true; XmlPackage2 p = new XmlPackage2(s, null, SkinID); sb.Append(p.TransformString()); } if (VersionFileFound) { litPatchInfo.Text = sb.ToString(); pnlPatchInfo.Visible = true; } }
private String SendTestShippedEmail(Int32 storeId) { if (!AppLogic.AppConfigBool("SendShippedEMailToCustomer")) { return(AppLogic.GetString("mailingtest.aspx.11", SkinID, LocaleSetting)); } try { String SubjectReceipt = String.Format(AppLogic.GetString("common.cs.2", SkinID, LocaleSetting), AppLogic.AppConfig("StoreName", storeId, true)); String PackageName = AppLogic.AppConfig("XmlPackage.OrderShipped"); XmlPackage2 p = new XmlPackage2(PackageName, null, SkinID, String.Empty, "ordernumber=999999"); String receiptBody = p.TransformString(); AppLogic.SendMail(SubjectReceipt, receiptBody + AppLogic.AppConfig("MailFooter"), true, AppLogic.AppConfig("ReceiptEMailFrom", storeId, true), AppLogic.AppConfig("ReceiptEMailFromName", storeId, true), ThisCustomer.EMail, String.Empty, String.Empty, AppLogic.MailServer()); } catch (Exception exception) { return(GenerateExceptionMessage(exception, storeId)); } return(AppLogic.GetString("mailingtest.aspx.10", SkinID, LocaleSetting)); }
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; } } }
static public void GetLiveRates() { String PN = AppLogic.AppConfig("Localization.CurrencyFeedXmlPackage"); if (PN.Length != 0) { try { using (XmlPackage2 p = new XmlPackage2(PN)) { m_LastRatesResponseXml = p.XmlDataDocument.InnerXml; m_LastRatesTransformedXml = p.TransformString(); if (m_LastRatesTransformedXml.Length != 0) { // update master db table: XmlDocument d = new XmlDocument(); d.LoadXml(m_LastRatesTransformedXml); foreach (XmlNode n in d.SelectNodes("//currency")) { String CurrencyCode = XmlCommon.XmlAttribute(n, "code"); String rate = XmlCommon.XmlAttribute(n, "rate"); DB.ExecuteSQL("update Currency set ExchangeRate=" + rate + ", WasLiveRate=1, LastUpdated=getdate() where CurrencyCode=" + DB.SQuote(CurrencyCode)); } } } FlushCache(); // flush anyway for safety } catch (Exception ex) { try { AppLogic.SendMail(AppLogic.AppConfig("StoreName") + " Currency.GetLiveRates Failure", "Occurred at: " + Localization.ToNativeDateTimeString(System.DateTime.Now) + CommonLogic.GetExceptionDetail(ex, ""), false, AppLogic.AppConfig("MailMe_FromAddress"), AppLogic.AppConfig("MailMe_FromName"), AppLogic.AppConfig("MailMe_ToAddress"), AppLogic.AppConfig("MailMe_ToName"), String.Empty, AppLogic.MailServer()); } catch { } } } }
public HierarchicalTableMgr(String TableName, String NodeName, String IDColumnName, String GUIDColumnName, String NameColumnName, String XmlPackageName, int CacheMinutes, int SetInitialContextToNodeID, bool OnlyPublishedEntitiesAndObjects, int StoreID) { m_TableName = TableName; m_NodeName = NodeName; m_IDColumnName = IDColumnName; m_GUIDColumnName = GUIDColumnName; m_NameColumnName = NameColumnName; m_CacheName = String.Format("HTM_{0}_{1}_{2}_{3}_{4}_{5}_{6}_{7}_{8}", TableName, NodeName, IDColumnName, GUIDColumnName, NameColumnName, XmlPackageName, OnlyPublishedEntitiesAndObjects.ToString(), AppLogic.IsAdminSite.ToString(), StoreID.ToString()); m_XmlPackageName = XmlPackageName; m_OnlyPublishedEntitiesAndObjects = OnlyPublishedEntitiesAndObjects; if (m_XmlDoc == null) { String RTParams = "EntityName=" + TableName + "&PublishedOnly=" + CommonLogic.IIF(m_OnlyPublishedEntitiesAndObjects, "1", "0"); if (StoreID > 0) { RTParams += "&FilterByStore=true&CurrentStoreID=" + StoreID.ToString(); } using (XmlPackage2 p = new XmlPackage2(m_XmlPackageName, null, 1, String.Empty, RTParams, String.Empty, false)) { m_FinalXml = p.TransformString(); m_DataSetXml = XmlCommon.XmlDecode(p.XmlSystemData); m_XmlDoc = new XmlDocument(); if (m_FinalXml.Length != 0) { using (StringReader sr = new StringReader(m_FinalXml)) { using (XmlReader xr = XmlReader.Create(sr)) { m_XmlDoc.Load(xr); } } } } } m_NumRootLevelNodes = m_XmlDoc.SelectSingleNode("/root").ChildNodes.Count; }
protected void Page_Load(object sender, EventArgs e) { m_DesignMode = (HttpContext.Current == null); if (m_DesignMode) { if (PackageName.Length != 0) { Contents.Text = "XmlPackage: " + PackageName; } else { Contents.Text = "XmlPackage"; } } else { try { int SkinID = 1; if (ThisCustomer != null) { SkinID = ThisCustomer.SkinID; } m_P = new XmlPackage2(PackageName, ThisCustomer, SkinID, String.Empty, RuntimeParams, String.Empty, true); Contents.Text = m_P.TransformString(); m_SectionTitle = m_P.SectionTitle; m_SETitle = m_P.SETitle; m_SEKeywords = m_P.SEKeywords; m_SEDescription = m_P.SEDescription; m_SENoScript = m_P.SENoScript; } catch (Exception ex) { Contents.Text = CommonLogic.GetExceptionDetail(ex, "<br/>"); } if (Page != null) { if (m_SectionTitle.Length != 0) { Page.SectionTitle = m_SectionTitle; } if (m_SETitle.Length != 0) { Page.SETitle = m_SETitle; } if (m_SEKeywords.Length != 0) { Page.SEKeywords = m_SEKeywords; } if (m_SEDescription.Length != 0) { Page.SEDescription = m_SEDescription; } if (m_SENoScript.Length != 0) { Page.SENoScript = m_SENoScript; } } if (m_P != null && (AppLogic.AppConfigBool("XmlPackage.DumpTransform") || m_P.IsDebug)) { Panel1.Visible = true; Debug1.Text = "<br/><div><b>" + m_P.URL + "</b><br/><textarea READONLY style=\"width: 100%\" rows=\"50\">" + XmlCommon.PrettyPrintXml(m_P.PackageDocument.InnerXml) + "</textarea></div>"; Debug2.Text = "<div><b>" + PackageName + "_store.runtime.xml</b><br/><textarea READONLY cols=\"80\" rows=\"50\">" + CommonLogic.ReadFile(CommonLogic.IIF(AppLogic.IsAdminSite, "../", "") + "images/" + PackageName + "_" + CommonLogic.IIF(AppLogic.IsAdminSite, "admin", "store") + ".runtime.xml", true) + "</textarea></div>"; Debug3.Text = "<div><b>" + PackageName + "_store.xfrm.xml</b><br/><textarea READONLY cols=\"80\" rows=\"50\">" + CommonLogic.ReadFile(CommonLogic.IIF(AppLogic.IsAdminSite, "../", "") + "images/" + PackageName + "_" + CommonLogic.IIF(AppLogic.IsAdminSite, "admin", "store") + ".xfrm.xml", true) + "</textarea></div>"; } else { Panel1.Visible = false; } } }
private SkinBase m_SkinBase = null; // if not null, this control will set the page metatags to the results from the XmlPackage, IF those xmlpackage results are not "empty strings" protected void Page_Load(object sender, EventArgs e) { m_DesignMode = (HttpContext.Current == null); if (m_DesignMode) { if (PackageName.Length != 0) { Contents.Text = "XmlPackage: " + PackageName; } else { Contents.Text = "XmlPackage"; } } else { try { List <XmlPackageParam> runtimeParams = AppLogic.MakeXmlPackageParamsFromString(RuntimeParams); m_P = new XmlPackage2(PackageName, ThisCustomer, ThisCustomer.SkinID, String.Empty, runtimeParams, String.Empty, true); if (!m_P.AllowEngine && this.Page.Request.Url.AbsoluteUri.IndexOf("engine.aspx") != -1) { throw new Exception("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."); } Contents.Text = m_P.TransformString(); m_SectionTitle = m_P.SectionTitle; m_SETitle = m_P.SETitle; m_SEKeywords = m_P.SEKeywords; m_SEDescription = m_P.SEDescription; m_SENoScript = m_P.SENoScript; } catch (Exception ex) { Contents.Text = CommonLogic.GetExceptionDetail(ex, "<br/>"); } if (Page != null && m_AllowSEPropogation) { if (m_SectionTitle.Length != 0) { Page.SectionTitle = m_SectionTitle; } if (m_SETitle.Length != 0) { Page.SETitle = m_SETitle; } if (m_SEKeywords.Length != 0) { Page.SEKeywords = m_SEKeywords; } if (m_SEDescription.Length != 0) { Page.SEDescription = m_SEDescription; } if (m_SENoScript.Length != 0) { Page.SENoScript = m_SENoScript; } } if (m_P != null && (AppLogic.AppConfigBool("XmlPackage.DumpTransform") || m_P.IsDebug)) { Panel1.Visible = true; Debug1.Text = "<br/><div><b>" + m_P.URL + "</b><br/><textarea READONLY style=\"width: 100%\" rows=\"50\">" + XmlCommon.PrettyPrintXml(m_P.PackageDocument.InnerXml) + "</textarea></div>"; Debug2.Text = "<div><b>" + PackageName + "_store.runtime.xml</b><br/><textarea READONLY cols=\"80\" rows=\"50\">images/" + PackageName + "_store.runtime.xml" + "</textarea></div>"; Debug3.Text = "<div><b>" + PackageName + "_store.xfrm.xml</b><br/><textarea READONLY cols=\"80\" rows=\"50\">images/" + PackageName + "_store.xfrm.xml" + "</textarea></div>"; } else { Panel1.Visible = false; } } }
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)); }
protected void btnRequestNewPassword_Click(object sender, EventArgs e) { string FromEMail = AppLogic.AppConfig("MailMe_FromAddress"); string EMail = CommonLogic.IIF(CommonLogic.FormCanBeDangerousContent("txtEMailRemind").Length > 0, CommonLogic.FormCanBeDangerousContent("txtEMailRemind"), CommonLogic.FormCanBeDangerousContent("txtEMail")); ltError.Text = "Email: " + EMail; Customer c = new Customer(null, EMail, false, false, true); if (!c.IsRegistered) { ltError.Text = "<font color=\"#FF0000\"><b>" + AppLogic.GetString("signin.aspx.admin.1", c.SkinID, c.LocaleSetting) + "</b></font>"; } else if (AppLogic.MailServer().Length == 0 || AppLogic.MailServer() == AppLogic.ro_TBD) { ltError.Text = "<font color=\"#FF0000\"><b>" + AppLogic.GetString("signin.aspx.admin.2", c.SkinID, c.LocaleSetting) + "</b></font>"; } else { Password p = new Password(); bool SendWasOk = false; try { String PackageName = AppLogic.AppConfig("XmlPackage.LostPassword"); XmlPackage2 pkg = new XmlPackage2(PackageName, c, c.SkinID, String.Empty, "newpwd=" + p.ClearPassword.Replace("&", "*") + "&thiscustomerid=" + c.CustomerID.ToString()); String MsgBody = pkg.TransformString(); AppLogic.SendMail(AppLogic.AppConfig("StoreName") + " " + AppLogic.GetString("lostpassword.aspx.6", c.SkinID, c.LocaleSetting), MsgBody, true, FromEMail, FromEMail, EMail, EMail, "", AppLogic.MailServer()); SendWasOk = true; object lockeduntil = DateTime.Now.AddMinutes(-1); c.UpdateCustomer( /*CustomerLevelID*/ null, /*EMail*/ null, /*SaltedAndHashedPassword*/ p.SaltedPassword, /*SaltKey*/ p.Salt, /*DateOfBirth*/ null, /*Gender*/ null, /*FirstName*/ null, /*LastName*/ null, /*Notes*/ null, /*SkinID*/ null, /*Phone*/ null, /*AffiliateID*/ null, /*Referrer*/ null, /*CouponCode*/ null, /*OkToEmail*/ null, /*IsAdmin*/ null, /*BillingEqualsShipping*/ null, /*LastIPAddress*/ null, /*OrderNotes*/ null, /*SubscriptionExpiresOn*/ null, /*RTShipRequest*/ null, /*RTShipResponse*/ null, /*OrderOptions*/ null, /*LocaleSetting*/ null, /*MicroPayBalance*/ null, /*RecurringShippingMethodID*/ null, /*RecurringShippingMethod*/ null, /*BillingAddressID*/ null, /*ShippingAddressID*/ null, /*GiftRegistryGUID*/ null, /*GiftRegistryIsAnonymous*/ null, /*GiftRegistryAllowSearchByOthers*/ null, /*GiftRegistryNickName*/ null, /*GiftRegistryHideShippingAddresses*/ null, /*CODCompanyCheckAllowed*/ null, /*CODNet30Allowed*/ null, /*ExtensionData*/ null, /*FinalizationData*/ null, /*Deleted*/ null, /*Over13Checked*/ null, /*CurrencySetting*/ null, /*VATSetting*/ null, /*VATRegistrationID*/ null, /*StoreCCInDB*/ null, /*IsRegistered*/ null, /*LockedUntil*/ lockeduntil, /*AdminCanViewCC*/ null, /*BadLogin*/ -1, /*Active*/ null, /*PwdChangeRequired*/ 1, /*RegisterDate*/ null, /*StoreId*/ null ); } catch { } if (!SendWasOk) { ltError.Text = "<font color=\"#FF0000\"><b>" + AppLogic.GetString("lostpassword.aspx.3", c.SkinID, c.LocaleSetting) + "</b></font>"; } else { ltError.Text = "<font color=\"#F0FA9F\"><b>" + AppLogic.GetString("lostpassword.aspx.2", c.SkinID, c.LocaleSetting) + "</b></font>"; } } }