protected override void OnInit(EventArgs e) { LoadThisKitData(); if (this.KitData == null) { Response.Redirect(SE.MakeDriverLink("ProductNotFound")); } if (KitData.HasFileUploadGroup) { string key = string.Empty; if (this.IsPostBack) { key = GetTempFileStub(); } else { key = Guid.NewGuid().ToString().Substring(0, 7); GenerateTempFileStub(key); } this.KitData.TempFileStub = key; } DetermineIfOrderable(); BindData(); if (this.KitData.HasCartMapping) { SetupCartLineItemDefaults(); } if (!this.IsPostBack) { ProductID = CommonLogic.QueryStringUSInt("ProductID"); CategoryID = CommonLogic.QueryStringUSInt("CategoryID"); SectionID = CommonLogic.QueryStringUSInt("SectionID"); ManufacturerID = CommonLogic.QueryStringUSInt("ManufacturerID"); DistributorID = CommonLogic.QueryStringUSInt("DistributorID"); GenreID = CommonLogic.QueryStringUSInt("GenreID"); VectorID = CommonLogic.QueryStringUSInt("VectorID"); SetupProductDefaults(); RenderXmlPackageHeader(); RenderXmlPackageFooter(); } if (this.KitData.RestrictedQuantities != null) { txtQuantity.Visible = false; foreach (int i in this.KitData.RestrictedQuantities) { ddQuantity.Items.Add(new ListItem(i.ToString(), i.ToString())); } ddQuantity.Visible = true; } base.OnInit(e); }
protected override void RenderContents(System.Web.UI.HtmlTextWriter writer) { String salesOrderCode = CommonLogic.QueryStringCanBeDangerousContent("so"); if (!ThisCustomer.OwnsThisOrder(salesOrderCode)) { Response.Redirect(SE.MakeDriverLink("ordernotfound")); } if (salesOrderCode == String.Empty) { writer.Write("<p>" + String.Format(AppLogic.GetString("reorder.aspx.2", SkinID, ThisCustomer.LocaleSetting), "account.aspx") + "</p>"); } String StatusMsg = String.Empty; if (InterpriseHelper.ReOrderToCart(salesOrderCode, ThisCustomer, base.EntityHelpers, ref StatusMsg)) { Response.Redirect(String.Format("shoppingcart.aspx{0}", StatusMsg)); } else { Response.Write("<p>There were some errors in trying to create the order.</p>"); Response.Write("<p>Error: " + StatusMsg + "</p>"); Response.Write("<p>" + String.Format(AppLogic.GetString("reorder.aspx.2", SkinID, ThisCustomer.LocaleSetting), "shoppingcart.aspx", AppLogic.GetString("AppConfig.CartPrompt", SkinID, ThisCustomer.LocaleSetting)) + "</p>"); } }
protected void Page_Load(object sender, EventArgs e) { ProductID = CommonLogic.QueryStringUSInt("ProductID"); if (AppLogic.AppConfigBool("GoNonSecureAgain")) { GoNonSecureAgain(); } // DOS attack prevention: if (AppLogic.OnLiveServer() && (Request.UrlReferrer == null || Request.UrlReferrer.Authority != Request.Url.Authority)) { Response.Redirect(SE.MakeDriverLink("EmailError")); } if (ProductID == 0) { HttpContext.Current.Response.StatusCode = 404; HttpContext.Current.Server.Transfer("pagenotfound.aspx"); } if (AppLogic.ProductHasBeenDeleted(ProductID)) { HttpContext.Current.Response.StatusCode = 404; HttpContext.Current.Server.Transfer("pagenotfound.aspx"); } EmailProduct ep = (EmailProduct)LoadControl("~/Controls/EmailProduct.ascx"); ep.ProductID = ProductID; pnlContent.Controls.Add(ep); }
protected void Page_Load(object sender, System.EventArgs e) { Customer ThisCustomer = Customer.Current; this.Title = AppLogic.GetString("AppConfig.AffiliateProgramName", ThisCustomer.SkinID, ThisCustomer.LocaleSetting) + " Signout"; Profile.LATAffiliateID = string.Empty; lblSignoutSuccess.Text = AppLogic.GetString("AppConfig.AffiliateProgramName", ThisCustomer.SkinID, ThisCustomer.LocaleSetting) + " sign-out complete, please wait..."; Response.AddHeader("REFRESH", "1; URL=" + SE.MakeDriverLink("affiliate")); }
protected void Page_Load(object sender, System.EventArgs e) { Response.CacheControl = "private"; Response.Expires = 0; Response.AddHeader("pragma", "no-cache"); SkinBase.RequireSecurePage(); int OrderNumber = CommonLogic.QueryStringUSInt("OrderNumber"); int OrderCustomerID = Order.GetOrderCustomerID(OrderNumber); Customer ThisCustomer = ((AspDotNetStorefrontPrincipal)Context.User).ThisCustomer;// who is logged in now viewing this page: // currently viewing user must be logged in to view receipts: if (!ThisCustomer.IsRegistered) { Response.Redirect("signin.aspx?returnurl=receipt.aspx?" + Server.UrlEncode(CommonLogic.ServerVariables("QUERY_STRING"))); } // are we allowed to view? // if currently logged in user is not the one who owns the order, and this is not an admin user who is logged in, reject the view: if (ThisCustomer.CustomerID != OrderCustomerID && !ThisCustomer.IsAdminUser) { Response.Redirect(SE.MakeDriverLink("ordernotfound")); } //For multi store checking //Determine if customer is allowed to view orders from other store. if (!ThisCustomer.IsAdminUser && AppLogic.StoreID() != AppLogic.GetOrdersStoreID(OrderNumber) && AppLogic.GlobalConfigBool("AllowCustomerFiltering") == true) { Response.Redirect(SE.MakeDriverLink("ordernotfound")); } Order o = new Order(OrderNumber, ThisCustomer.LocaleSetting); if (o.PaymentMethod != null && o.PaymentMethod.ToLower() == GatewayCheckoutByAmazon.CheckoutByAmazon.CBA_Gateway_Identifier.ToLower()) { GatewayCheckoutByAmazon.CheckoutByAmazon checkoutByAmazon = new GatewayCheckoutByAmazon.CheckoutByAmazon(); Response.Write(checkoutByAmazon.RenderOrderDetailWidget(o.OrderNumber)); } else { Response.Write(o.Receipt(ThisCustomer, false)); } }
private String LoadChildren() { StringBuilder sbChildList = new StringBuilder(); foreach (int child in Children) { Topic t = new Topic(child); sbChildList.Append("<p align=\"left\">"); sbChildList.Append("   <img border=\"0\" src=\"" + AppLogic.LocateImageURL("App_Themes/skin_" + m_SkinBase.SkinID.ToString() + "/images/redarrow.gif", m_SkinBase.ThisCustomer.LocaleSetting) + "\"></img> "); sbChildList.Append("<a href=\"" + SE.MakeDriverLink(XmlCommon.GetLocaleEntry(t.TopicName, m_SkinBase.ThisCustomer.LocaleSetting, true)) + "\">"); sbChildList.Append(XmlCommon.GetLocaleEntry(t.SectionTitle, m_SkinBase.ThisCustomer.LocaleSetting, true)); sbChildList.Append("</a>"); sbChildList.Append("</p>"); } return(sbChildList.ToString()); }
protected void Page_Load(object sender, EventArgs e) { Response.CacheControl = "private"; Response.Expires = 0; Response.AddHeader("pragma", "no-cache"); SkinBase.RequireSecurePage(); Customer thisCustomer = Customer.Current; bool blnShowReceipt = false; //get the values from the querystring string strSalesOrderCodeFromQueryString = CommonLogic.QueryStringCanBeDangerousContent("OrderNumber"); string strCustGuidFromQueryString = CommonLogic.QueryStringCanBeDangerousContent("CustomerGUID"); if (thisCustomer.IsNotRegistered) { //unregistered customers will have values stored in the cookie, get the values and compare to the querystring string strOrderNumberFromCookie = CommonLogic.CookieCanBeDangerousContent("OrderNumber", true); string strCustGuidFromCookie = CommonLogic.CookieCanBeDangerousContent("ContactGUID", true); //show the receipt only if both the order number and guid match blnShowReceipt = strCustGuidFromQueryString.Equals(strCustGuidFromCookie, StringComparison.InvariantCultureIgnoreCase) && strSalesOrderCodeFromQueryString.Equals(strOrderNumberFromCookie, StringComparison.InvariantCultureIgnoreCase); } else { //make sure that this customer owns this order to view if (thisCustomer.OwnsThisOrder(strSalesOrderCodeFromQueryString)) { blnShowReceipt = true; } } //show the receipt if it's appropriate to do so if (blnShowReceipt && !string.IsNullOrEmpty(strSalesOrderCodeFromQueryString)) { ViewerReport.Report = InterpriseHelper.CreateReport(strSalesOrderCodeFromQueryString); } else { Response.Redirect(SE.MakeDriverLink("ordernotfound")); } }
/// <summary> /// Load topic from a database to a list /// </summary> private void LoadTopics() { // load topics using (SqlConnection con = new SqlConnection(DB.GetDBConn())) { con.Open(); using (IDataReader rs = DB.GetRS("SELECT Name, Title FROM Topic with (NOLOCK) WHERE ShowInSiteMap = 1 and skinid =" + ThisCustomer.SkinID, con)) { while (rs.Read()) { string name = DB.RSFieldByLocale(rs, "Name", ThisCustomer.LocaleSetting); string description = string.Empty; string title = DB.RSFieldByLocale(rs, "Title", ThisCustomer.LocaleSetting); string url = SE.MakeDriverLink(name); _resources.Add(new MobileResource(name, url, description, title)); } } } }
protected void Page_Load(object sender, System.EventArgs e) { // currently viewing user must be logged in to view receipts: if (!ThisCustomer.IsRegistered) { Response.Redirect("signin.aspx?returnurl=reorder.aspx?" + Server.UrlEncode(CommonLogic.ServerVariables("QUERY_STRING"))); } this.Title = AppLogic.GetString("reorder.aspx.1", ThisCustomer.SkinID, ThisCustomer.LocaleSetting); int OrderNumber = CommonLogic.QueryStringUSInt("OrderNumber"); // are we allowed to view? // if currently logged in user is not the one who owns the order, and this is not an admin user who is logged in, reject the reorder: if (ThisCustomer.CustomerID != Order.GetOrderCustomerID(OrderNumber) && !ThisCustomer.IsAdminUser) { Response.Redirect(SE.MakeDriverLink("ordernotfound")); } StringBuilder output = new StringBuilder(); if (OrderNumber == 0) { output.Append("<p>" + String.Format(AppLogic.GetString("reorder.aspx.2", ThisCustomer.SkinID, ThisCustomer.LocaleSetting), "account.aspx") + "</p>"); } String StatusMsg = String.Empty; if (Order.BuildReOrder(null, ThisCustomer, OrderNumber, out StatusMsg)) { CalculateFundsForReOrder(); Response.Redirect("shoppingcart.aspx"); } else { output.Append("<p>" + AppLogic.GetString("reorder.aspx.6", ThisCustomer.SkinID, ThisCustomer.LocaleSetting) + "</p>"); output.Append("<p>Error: " + StatusMsg + "</p>"); output.Append("<p>" + String.Format(AppLogic.GetString("reorder.aspx.2", ThisCustomer.SkinID, ThisCustomer.LocaleSetting), "JWMyAccount.aspx", AppLogic.GetString("AppConfig.CartPrompt", ThisCustomer.SkinID, ThisCustomer.LocaleSetting)) + "</p>"); } litOutput.Text = output.ToString(); }
protected override void OnInit(EventArgs e) { int CustomerID = ThisCustomer.CustomerID; int OrderNumber = CommonLogic.QueryStringUSInt("OrderNumber"); StringBuilder output = new StringBuilder(); if (CustomerID != 0 && OrderNumber != 0) { Order ord = new Order(OrderNumber, ThisCustomer.LocaleSetting); if (ThisCustomer.CustomerID != ord.CustomerID) { Response.Redirect(SE.MakeDriverLink("ordernotfound")); } if (ThisCustomer.ThisCustomerSession["3DSecure.LookupResult"].Length > 0) { DB.ExecuteSQL("update orders set CardinalLookupResult=" + DB.SQuote(ThisCustomer.ThisCustomerSession["3DSecure.LookupResult"]) + " where OrderNumber=" + OrderNumber.ToString()); } ThisCustomer.ThisCustomerSession.Clear(); String ReceiptURL = "receipt.aspx?ordernumber=" + OrderNumber.ToString() + "&customerid=" + CustomerID.ToString(); bool orderexists; using (SqlConnection conn = DB.dbConn()) { conn.Open(); using (IDataReader rs = DB.GetRS("select * from dbo.orders where customerid=" + CustomerID.ToString() + " and ordernumber=" + OrderNumber.ToString(), conn)) { orderexists = rs.Read(); } } if (orderexists) { String PM = AppLogic.CleanPaymentMethod(ord.PaymentMethod); String StoreName = AppLogic.AppConfig("StoreName"); bool UseLiveTransactions = AppLogic.AppConfigBool("UseLiveTransactions"); if (!ord.AlreadyConfirmed) { // check to see if this was an "admin edit order" and if so, cleanup the old order, as it was being replaced by this new order: int EditingOrderNumber = base.EditingOrderImpersonation; if (base.IsInImpersonation && EditingOrderNumber != 0) { Order editedOrder = new Order(EditingOrderNumber, Localization.GetDefaultLocale()); if (!editedOrder.HasBeenEdited && editedOrder.TransactionState == AppLogic.ro_TXStateAuthorized || editedOrder.TransactionState == AppLogic.ro_TXStateCaptured) { editedOrder.EditedOn = System.DateTime.Now; editedOrder.RelatedOrderNumber = OrderNumber; // try void first, or refund if that doesn't work if (Gateway.OrderManagement_DoVoid(editedOrder, Localization.GetDefaultLocale()) != AppLogic.ro_OK) { Gateway.OrderManagement_DoFullRefund(editedOrder, Localization.GetDefaultLocale(), "Order Was Edited, New Order #: " + OrderNumber.ToString()); } } base.AdminImpersonatingCustomer.ThisCustomerSession.ClearVal("IGD_EDITINGORDER"); } DB.ExecuteSQL("update Customer set OrderOptions=NULL, OrderNotes=NULL, FinalizationData=NULL where CustomerID=" + CustomerID.ToString()); AppLogic.SendOrderEMail(ThisCustomer, OrderNumber, false, PM, true, base.EntityHelpers, base.GetParser); } String XmlPackageName = AppLogic.AppConfig("XmlPackage.OrderConfirmationPage"); if (XmlPackageName.Length == 0) { XmlPackageName = "page.orderconfirmation.xml.config"; } if (XmlPackageName.Length != 0) { output.Append(AppLogic.RunXmlPackage(XmlPackageName, base.GetParser, ThisCustomer, SkinID, String.Empty, "OrderNumber=" + OrderNumber.ToString(), true, true)); } if (!ord.AlreadyConfirmed) { if (AppLogic.ProductIsMLExpress() == false && AppLogic.AppConfigBool("IncludeGoogleTrackingCode")) { Topic GoogleTrackingCode = new Topic("GoogleTrackingCode"); if (GoogleTrackingCode.Contents.Length != 0) { output.Append(GoogleTrackingCode.Contents.Replace("(!ORDERTOTAL!)", Localization.CurrencyStringForGatewayWithoutExchangeRate(ord.Total(true))).Replace("(!ORDERNUMBER!)", OrderNumber.ToString()).Replace("(!CUSTOMERID!)", ThisCustomer.CustomerID.ToString())); } } if (AppLogic.AppConfigBool("IncludeOvertureTrackingCode")) { Topic OvertureTrackingCode = new Topic("OvertureTrackingCode"); if (OvertureTrackingCode.Contents.Length != 0) { output.Append(OvertureTrackingCode.Contents.Replace("(!ORDERTOTAL!)", Localization.CurrencyStringForGatewayWithoutExchangeRate(ord.Total(true))).Replace("(!ORDERNUMBER!)", OrderNumber.ToString()).Replace("(!CUSTOMERID!)", ThisCustomer.CustomerID.ToString())); } } Topic GeneralTrackingCode = new Topic("ConfirmationTracking"); if (GeneralTrackingCode.Contents.Length != 0) { output.Append(GeneralTrackingCode.Contents.Replace("(!ORDERTOTAL!)", Localization.CurrencyStringForGatewayWithoutExchangeRate(ord.Total(true))).Replace("(!ORDERNUMBER!)", OrderNumber.ToString()).Replace("(!CUSTOMERID!)", ThisCustomer.CustomerID.ToString())); } if (AppLogic.ProductIsMLExpress() == false && AppLogic.AppConfigBool("Google.EcomOrderTrackingEnabled")) { output.Append(MobileGetGoogleEComTrackingV2(ThisCustomer, true)); } } DB.ExecuteSQL("Update Orders set AlreadyConfirmed=1 where OrderNumber=" + OrderNumber.ToString()); } else { output.Append("<div align=\"center\">"); output.Append("<br/><br/><br/><br/><br/>"); output.Append(AppLogic.GetString("orderconfirmation.aspx.19", SkinID, ThisCustomer.LocaleSetting)); output.Append("<br/><br/><br/><br/><br/>"); output.Append("</div>"); } } else { output.Append("<p><b>Error: Invalid Customer ID or Invalid Order Number</b></p>"); } if (!ThisCustomer.IsRegistered || AppLogic.AppConfigBool("ForceSignoutOnOrderCompletion")) { if (AppLogic.AppConfigBool("SiteDisclaimerRequired")) { Profile.SiteDisclaimerAccepted = string.Empty; } //V3_9 Kill the Authentication ticket. Session.Clear(); Session.Abandon(); FormsAuthentication.SignOut(); ThisCustomer.Logout(); } litOutput.Text = output.ToString(); base.OnInit(e); }
private void Page_Load(object sender, System.EventArgs e) { Response.CacheControl = "private"; Response.Expires = -1; Response.AddHeader("pragma", "no-cache"); Customer ThisCustomer = AppLogic.GetCurrentCustomer(); if (ThisCustomer == null) { //Response.Redirect("t-phoneordertimeout.aspx"); Response.Redirect(SE.MakeDriverLink("phoneordertimeout")); } ThisCustomer.RequireCustomerRecord(); //=====================================================================================\n"); //= Easy Connect - Cardinal Commerce (http://www.cardinalcommerce.com)\n"); //= ecauth.aspx\n"); //=\n"); //= Usage\n"); //= Form used to POST the payer authentication request to the Card Issuer Servers.\n"); //= The Card Issuer Servers will in turn display the payer authentication window\n"); //= to the consumer within this location.\n"); //=\n"); //= Note that the form field names below are case sensitive. For additional information\n"); //= please see the integration documentation.\n"); //=\n"); //=====================================================================================\n"); Response.Cache.SetAllowResponseInBrowserHistory(false); int CustomerID = ThisCustomer.CustomerID; if (ThisCustomer.ThisCustomerSession["Cardinal.ACSURL"].Length == 0) { Response.Write("<HTML>\n"); Response.Write("<BODY>\n"); Response.Write("<center>" + AppLogic.GetString("cardinalecheckauth.aspx.1", 1, Localization.GetDefaultLocale()) + "</center>\n"); Response.Write("</BODY>\n"); Response.Write("</HTML>\n"); } else { Response.Write("<HTML>\n"); Response.Write("<BODY onLoad=\"document.frmLaunchACS.submit();\">\n"); Response.Write("<BODY>\n"); Response.Write("<center>\n"); //=====================================================================================\n"); // The Inline Authentication window must be a minimum of 410 pixel width by\n"); // 400 pixel height.\n"); //=====================================================================================\n"); Response.Write("<FORM name=\"frmLaunchACS\" method=\"Post\" action=\"" + ThisCustomer.ThisCustomerSession["Cardinal.ACSURL"] + "\">\n"); Response.Write("<noscript>\n"); Response.Write(" <br/><br/>\n"); Response.Write(" <center>\n"); Response.Write(" <font color=\"red\">\n"); Response.Write(" <h1>"+ AppLogic.GetString("cardinalecheckauth.aspx.2", 1, Localization.GetDefaultLocale()) + "</h1>\n"); Response.Write(" <h2>"+ AppLogic.GetString("cardinalecheckauth.aspx.3", 1, Localization.GetDefaultLocale()) + "<br/></h2>\n"); Response.Write(" <h3>"+ AppLogic.GetString("cardinalecheckauth.aspx.4", 1, Localization.GetDefaultLocale()) + "</h3>\n"); Response.Write(" </font>\n"); Response.Write(" <input type=\"submit\" value=\""+ AppLogic.GetString("cardinalecheckauth.aspx.5", 1, Localization.GetDefaultLocale()) + "\">\n"); Response.Write(" </center>\n"); Response.Write("</noscript>\n"); Response.Write("<input type=hidden name=\"PaReq\" value=\"" + ThisCustomer.ThisCustomerSession["Cardinal.Payload"] + "\">\n"); Response.Write("<input type=hidden name=\"TermUrl\" value=\"" + AppLogic.GetStoreHTTPLocation(true) + "cardinalecheck_process.aspx" + "\">\n"); Response.Write("<input type=hidden name=\"MD\" value=\"None\">\n"); Response.Write("</FORM>\n"); Response.Write("</center>\n"); Response.Write("</BODY>\n"); Response.Write("</HTML>\n"); } }
protected override void RenderContents(System.Web.UI.HtmlTextWriter writer) { String CustomerID = ThisCustomer.CustomerCode; String OrderNumber = CommonLogic.QueryStringCanBeDangerousContent("OrderNumber", true); bool isvalid = false; decimal orderTotal = Decimal.Zero; decimal freightRate = Decimal.Zero; decimal freightTaxRate = Decimal.Zero; decimal taxRate = Decimal.Zero; //don't allow the customer any further if they dont own this order. foreach (string salesOrderToCheck in OrderNumber.Split(',')) { if (ThisCustomer.IsUnregisteredAnonymous || !ThisCustomer.OwnsThisOrder(salesOrderToCheck)) { Response.Redirect(SE.MakeDriverLink("ordernotfound")); } } //Assign anonymous id as customer id for report generation. if (!ThisCustomer.IsRegistered && OrderNumber != "") { ThisCustomer.EMail = ThisCustomer.GetAnonEmail(); ThisCustomer.CustomerCode = ThisCustomer.AnonymousCustomerCode; CustomerID = ThisCustomer.CustomerCode; } // ---------------------------------------------------------------------------------------- // WRITE OUT ANY HEADER CHECKOUT SEQUENCE GRAPHIC: // ---------------------------------------------------------------------------------------- writer.Write("<div align=\"center\">"); writer.Write("<img src=\"" + AppLogic.LocateImageURL("skins/skin_" + SkinID.ToString() + "/images/step_6.gif") + "\" width=\"550\" height=\"54\" border=\"0\" >\n"); writer.Write("</div>"); if (CustomerID != String.Empty && OrderNumber != String.Empty) { String multiOrderNumber = DB.SQuote(OrderNumber); multiOrderNumber = "(" + multiOrderNumber.Replace(",", "','") + ")"; bool hasFailedTransaction = false; hasFailedTransaction = DB.GetSqlN(string.Format("SELECT COUNT(*) AS N FROM CustomerSalesOrder with (NOLOCK) WHERE SalesOrderCode IN {0} AND IsVoided = 1", multiOrderNumber)) > 0; using (SqlConnection con = DB.NewSqlConnection()) { con.Open(); using (IDataReader rs = DB.GetRSFormat(con, "select SUM(TotalRate) AS TotalRate, SUM(FreightRate) AS FreightRate, SUM(TaxRate) AS TaxRate FROM CustomerSalesOrder with (NOLOCK) where BillToCode=" + DB.SQuote(CustomerID) + " and SalesOrderCode IN" + multiOrderNumber)) { if (rs.Read()) { orderTotal = rs.ToRSFieldDecimal("TotalRate"); freightRate = rs.ToRSFieldDecimal("FreightRate"); taxRate = rs.ToRSFieldDecimal("TaxRate"); isvalid = true; } } } if (isvalid) { String PM = AppLogic.CleanPaymentMethod(ThisCustomer.PaymentMethod); bool AlreadyConfirmed = false; String StoreName = AppLogic.AppConfig("StoreName"); bool UseLiveTransactions = AppLogic.AppConfigBool("UseLiveTransactions"); InterpriseShoppingCart cart = new InterpriseShoppingCart(base.EntityHelpers, SkinID, ThisCustomer, CartTypeEnum.ShoppingCart, String.Empty, false, true); bool multipleAttachment = false; if (multiOrderNumber.IndexOf(',') != -1) { multipleAttachment = true; } //Send mail. foreach (string salesOrderToEmail in OrderNumber.Split(',')) { if (ThisCustomer.PaymentTermCode.ToUpper() != "REQUEST QUOTE" && ThisCustomer.PaymentTermCode.ToUpper() != "PURCHASE ORDER") { AppLogic.SendOrderEMail(ThisCustomer, cart, salesOrderToEmail, false, PM, true, multipleAttachment); } else { //This will only send email to admin. AppLogic.SendOrderEMail(ThisCustomer, cart, salesOrderToEmail, false, PM, multipleAttachment); } } String XmlPackageName = AppLogic.AppConfig("XmlPackage.OrderConfirmationPage"); if (XmlPackageName.Length == 0) { XmlPackageName = "page.orderconfirmation.xml.config"; } if (XmlPackageName.Length != 0) { string[] salesOrderCodes = OrderNumber.Split(','); for (int ctr = 0; ctr < salesOrderCodes.Length; ctr++) { string salesOrderCode = salesOrderCodes[ctr]; List <XmlPackageParam> runtimeParams = new List <XmlPackageParam>(); if (ctr == 0) { runtimeParams.Add(new XmlPackageParam("IncludeHeader", true.ToString().ToLowerInvariant())); } else { runtimeParams.Add(new XmlPackageParam("IncludeHeader", false.ToString().ToLowerInvariant())); } string salesOrderStage = string.Empty; using (SqlConnection con = DB.NewSqlConnection()) { con.Open(); using (IDataReader rs = DB.GetRSFormat(con, "SELECT Stage from CustomerSalesOrderWorkFlowView where salesOrderCode=" + DB.SQuote(salesOrderCode))) { if (rs.Read()) { salesOrderStage = DB.RSField(rs, "Stage"); } } } runtimeParams.Add(new XmlPackageParam("OrderNumber", salesOrderCode)); runtimeParams.Add(new XmlPackageParam("SalesOrderStage", salesOrderStage)); if (ThisCustomer.PaymentTermCode.ToUpper() == "REQUEST QUOTE") { runtimeParams.Add(new XmlPackageParam("PaymentMethod", "REQUESTQUOTE")); } else if (ThisCustomer.PaymentTermCode.ToUpper() == "PURCHASE ORDER") { runtimeParams.Add(new XmlPackageParam("PaymentMethod", "PURCHASEORDER")); } else { runtimeParams.Add(new XmlPackageParam("PaymentMethod", ThisCustomer.PaymentMethod)); } runtimeParams.Add(new XmlPackageParam("Email", ThisCustomer.EMail)); if (ctr + 1 == salesOrderCodes.Length) { runtimeParams.Add(new XmlPackageParam("IncludeFooter", true.ToString().ToLowerInvariant())); runtimeParams.Add(new XmlPackageParam("WriteFailedTransaction", hasFailedTransaction.ToString().ToLowerInvariant())); } else { runtimeParams.Add(new XmlPackageParam("IncludeFooter", false.ToString().ToLowerInvariant())); } writer.Write(AppLogic.RunXmlPackage(XmlPackageName, base.GetParser, ThisCustomer, SkinID, String.Empty, runtimeParams, true, true)); } } #region Conversion if (!AlreadyConfirmed) { #region Google Analytics if (AppLogic.AppConfigBool("GoogleAnalytics.ConversionTracking")) { ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), DB.GetNewGUID(), AppLogic.GAEcommerceTracking(ThisCustomer), false); } // Google AdWords conversion trackng code (added 7-10-14) { writer.Write("<!-- Google Code for Sales Conversion Page --> <script type='text/javascript'> "); writer.Write("/* <![CDATA[ */ "); writer.Write("var google_conversion_id = 986485184; "); writer.Write("var google_conversion_language = 'en'; "); writer.Write("var google_conversion_format = '2'; "); writer.Write("var google_conversion_color = 'ffffff'; "); writer.Write("var google_conversion_label = 'u53nCIDh8woQwKOy1gM'; var google_conversion_value = 1.00; var google_remarketing_only = false; "); writer.Write("/* ]]> */ "); writer.Write("</script> "); writer.Write("<script type='text/javascript' "); writer.Write("src='//www.googleadservices.com/pagead/conversion.js'> "); writer.Write("</script> "); writer.Write("<noscript> "); writer.Write("<div style='display:inline;''> "); writer.Write("<img height='1' width='1' style='border-style:none;' alt='' "); writer.Write("src='//www.googleadservices.com/pagead/conversion/986485184/?value=1.00&label=u53nCIDh8woQwKOy1gM&guid=ON&script=0'/> "); writer.Write("</div> "); writer.Write("</noscript> "); } #endregion #region Buy Safe string buySafeSealHash = AppLogic.AppConfig("BuySafe.SealHash"); bool registerBuySafeScript = AppLogic.AppConfigBool("BuySafe.Enabled") && !buySafeSealHash.IsNullOrEmptyTrimmed() && !ThisCustomer.EMail.IsNullOrEmptyTrimmed(); if (registerBuySafeScript) { var buySAFEGuaranteed = new StringBuilder(); buySAFEGuaranteed.Append("<span id='BuySafeGuaranteeSpan'></span>"); buySAFEGuaranteed.Append("<script src='//seal.buysafe.com/private/rollover/rollover.js'></script>"); buySAFEGuaranteed.Append("<script type='text/javascript'>"); buySAFEGuaranteed.Append(" if(window.buySAFE && buySAFE.Loaded){ "); buySAFEGuaranteed.AppendFormat(" buySAFE.Hash = '{0}'; ", buySafeSealHash); buySAFEGuaranteed.AppendFormat(" buySAFE.Guarantee.order = '{0}'; ", OrderNumber); buySAFEGuaranteed.AppendFormat(" buySAFE.Guarantee.subtotal = {0}; ", orderTotal); buySAFEGuaranteed.AppendFormat(" buySAFE.Guarantee.email = '{0}'; ", ThisCustomer.EMail); buySAFEGuaranteed.Append(" WriteBuySafeGuarantee('JavaScript'); "); buySAFEGuaranteed.Append(" }"); buySAFEGuaranteed.Append("</script>"); ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), DB.GetNewGUID(), buySAFEGuaranteed.ToString(), false); } #endregion #region Bing Ads string bingAdsTrackingScript = AppLogic.GetBingAdsTrackingScript(AppLogic.BING_ADS_TYPE_CONVERSION, freightRate, taxRate, orderTotal); if (!bingAdsTrackingScript.IsNullOrEmptyTrimmed()) { ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), DB.GetNewGUID(), bingAdsTrackingScript, false); } #endregion } #endregion } else { writer.Write("<div align=\"center\">"); writer.Write("<br/><br/><br/><br/><br/>"); writer.Write(AppLogic.GetString("orderconfirmation.aspx.15", SkinID, ThisCustomer.LocaleSetting)); writer.Write("<br/><br/><br/><br/><br/>"); writer.Write("</div>"); } } else { writer.Write("<p><b>Error: Invalid Customer ID or Invalid Order Number</b></p>"); } if (!ThisCustomer.IsRegistered || AppLogic.AppConfigBool("ForceSignoutOnOrderCompletion")) { //Setting cookie values for anonymous receipts. We should look into a more secure way to do this, but for now //it's better than what we had. AppLogic.SetSessionCookie("ContactGUID", ThisCustomer.ContactGUID.ToString()); AppLogic.SetSessionCookie("OrderNumber", CommonLogic.QueryStringCanBeDangerousContent("OrderNumber", true)); if (AppLogic.AppConfigBool("SiteDisclaimerRequired")) { AppLogic.SetSessionCookie("SiteDisclaimerAccepted", String.Empty); } //V3_9 Kill the Authentication ticket. Session.Clear(); Session.Abandon(); ThisCustomer.ThisCustomerSession.Clear(); FormsAuthentication.SignOut(); } }
protected void Page_Load(object sender, EventArgs e) { productID = CommonLogic.QueryStringUSInt("productId"); ItemCode = InterpriseHelper.GetInventoryItemCode(productID); EntityHelper CategoryHelper = AppLogic.LookupHelper(base.EntityHelpers, "Category"); EntityHelper SectionHelper = AppLogic.LookupHelper(base.EntityHelpers, "Department"); EntityHelper ManufacturerHelper = AppLogic.LookupHelper(base.EntityHelpers, "Manufacturer"); CategoryID = CommonLogic.QueryStringCanBeDangerousContent("CategoryID"); DepartmentID = CommonLogic.QueryStringCanBeDangerousContent("DepartmentID"); ManufacturerID = CommonLogic.QueryStringCanBeDangerousContent("ManufacturerID"); String SourceEntity = "Category"; String SourceEntityID = String.Empty; if (AppLogic.AppConfigBool("GoNonSecureAgain")) { SkinBase.GoNonSecureAgain(); } // DOS attack prevention: if (AppLogic.OnLiveServer() && (Request.UrlReferrer == null || Request.UrlReferrer.Authority != Request.Url.Authority)) { Response.Redirect(SE.MakeDriverLink("EmailError")); } if (ItemCode == String.Empty) { Response.Redirect("default.aspx"); } if (AppLogic.ProductHasBeenDeleted(productID)) { Response.Redirect(SE.MakeDriverLink("ProductNotFound")); } using (SqlConnection con = DB.NewSqlConnection()) { con.Open(); using (IDataReader rs = DB.GetRSFormat(con, "SELECT * FROM EcommerceViewProduct with (NOLOCK) " + " WHERE Counter=" + productID + " AND ShortString=" + DB.SQuote(ThisCustomer.LocaleSetting) + " AND WebSiteCode=" + DB.SQuote(InterpriseHelper.ConfigInstance.WebSiteCode))) { if (!rs.Read()) { Response.Redirect("default.aspx"); } SEName = SE.MungeName(DB.RSField(rs, "SEName")); if (DB.RSField(rs, "ItemDescription").ToString() != String.Empty) { ProductName = DB.RSField(rs, "ItemDescription"); } else { ProductName = DB.RSField(rs, "ItemName"); } RequiresReg = DB.RSFieldBool(rs, "RequiresRegistration"); ProductDescription = DB.RSField(rs, "ItemDescription"); if (AppLogic.ReplaceImageURLFromAssetMgr) { ProductDescription = ProductDescription.Replace("../images", "images"); } String FileDescription = new ProductDescriptionFile(ItemCode, ThisCustomer.LocaleSetting, SkinID).Contents; if (FileDescription.Length != 0) { ProductDescription += "<div align=\"left\">" + FileDescription + "</div>"; } } } if (Convert.ToInt32(CategoryID) == 0) { // no category passed in, pick first one that this product is mapped to: String tmpS = CategoryHelper.GetObjectEntities(ItemCode, false); if (tmpS.Length != 0) { String[] catIDs = tmpS.Split(','); CategoryID = Convert.ToString(Localization.ParseUSInt(catIDs[0])); } } string CategoryName = CommonLogic.IIF(CategoryHelper.GetEntityField(CategoryID, "Description", ThisCustomer.LocaleSetting) != String.Empty, CategoryHelper.GetEntityField(CategoryID, "Description", ThisCustomer.LocaleSetting), CategoryHelper.GetEntityName(CategoryID, ThisCustomer.LocaleSetting)); string SectionName = CommonLogic.IIF(SectionHelper.GetEntityField(DepartmentID, "Description", ThisCustomer.LocaleSetting) != String.Empty, SectionHelper.GetEntityField(DepartmentID, "Description", ThisCustomer.LocaleSetting), SectionHelper.GetEntityName(DepartmentID, ThisCustomer.LocaleSetting)); string ManufacturerName = CommonLogic.IIF(ManufacturerHelper.GetEntityField(ManufacturerID, "Description", ThisCustomer.LocaleSetting) != String.Empty, ManufacturerHelper.GetEntityField(ManufacturerID, "Description", ThisCustomer.LocaleSetting), ManufacturerHelper.GetEntityName(ManufacturerID, ThisCustomer.LocaleSetting)); SourceEntity = CommonLogic.CookieCanBeDangerousContent("LastViewedEntityName", true); String SourceEntityInstanceName = CommonLogic.CookieCanBeDangerousContent("LastViewedEntityInstanceName", true); SourceEntityID = CommonLogic.CookieCanBeDangerousContent("LastViewedEntityInstanceID", true); // validate that source entity id is actually valid for this product: if (SourceEntityID.Length != 0) { ArrayList alE = EntityHelper.GetProductEntityList(ItemCode, SourceEntity); if (alE.IndexOf(Localization.ParseNativeInt(SourceEntityID)) == -1) { SourceEntityID = String.Empty; } } if (SourceEntityID.Length != 0) { PickupBreadCrumb(ref SourceEntity, ref SourceEntityInstanceName, ref SourceEntityID, false); } else { PickupBreadCrumb(ref SourceEntity, ref SourceEntityInstanceName, ref SourceEntityID, true); } SectionTitle += "<span class=\"SectionTitleText\">"; SectionTitle += ProductName; SectionTitle += "</span>"; reqToAddress.ErrorMessage = AppLogic.GetString("emailproduct.aspx.13", SkinID, ThisCustomer.LocaleSetting, true); regexToAddress.ErrorMessage = AppLogic.GetString("emailproduct.aspx.14", SkinID, ThisCustomer.LocaleSetting, true); reqFromAddress.ErrorMessage = AppLogic.GetString("emailproduct.aspx.16", SkinID, ThisCustomer.LocaleSetting, true); regexFromAddress.ErrorMessage = AppLogic.GetString("emailproduct.aspx.17", SkinID, ThisCustomer.LocaleSetting, true); if (!this.IsPostBack) { InitializePageContent(); } }
protected override void OnPreInit(EventArgs e) { if (HttpContext.Current != null) { m_ThisCustomer = ((AspDotNetStorefrontPrincipal)Context.User).ThisCustomer; int StoreID = AppLogic.StoreID(); m_SkinID = AppLogic.GetStoreSkinID(StoreID); //TODO: review this if (CommonLogic.IsInteger(HttpContext.Current.Profile.GetPropertyValue("SkinID").ToString())) { int skinFromProfile = int.Parse(HttpContext.Current.Profile.GetPropertyValue("SkinID").ToString()); if (skinFromProfile > 0) { m_SkinID = skinFromProfile; } } else if (AppLogic.AppConfig("Signin.SkinMaster").EqualsIgnoreCase("session")) { m_SkinID = m_ThisCustomer.DBSkinID; } if (CommonLogic.QueryStringUSInt("skinid") > 0) { m_SkinID = CommonLogic.QueryStringUSInt("skinid"); } if (CommonLogic.QueryStringUSInt("affiliateid") > 0) { HttpContext.Current.Profile.SetPropertyValue("AffiliateID", CommonLogic.QueryStringUSInt("affiliateid").ToString()); } if (HttpContext.Current.Request.UrlReferrer != null && HttpContext.Current.Request.UrlReferrer.Authority != HttpContext.Current.Request.Url.Authority) { HttpContext.Current.Profile.SetPropertyValue("Referrer", HttpContext.Current.Request.UrlReferrer.ToString()); } if (AppLogic.ProductIsMLExpress() == false && AppLogic.AppConfigBool("GoogleCheckout.ShowOnCartPage")) { String s = (String)HttpContext.Current.Cache.Get("GCCallbackLoadCheck"); if (s == null) { String notused = CommonLogic.AspHTTP(AppLogic.GetStoreHTTPLocation(false) + "gccallback.aspx?loadcheck=1", 10); HttpContext.Current.Cache.Insert("GCCallbackLoadCheck", "true", null, System.DateTime.Now.AddMinutes(5), TimeSpan.Zero); } } // don't fire disclaimer logic on admin pages if (!AppLogic.IsAdminSite && CommonLogic.QueryStringCanBeDangerousContent("ReturnURL").IndexOf(AppLogic.AppConfig("AdminDir")) == -1 && (AppLogic.AppConfigBool("SiteDisclaimerRequired") && CommonLogic.CookieCanBeDangerousContent("SiteDisclaimerAccepted", true).Length == 0)) { String ThisPageURL = CommonLogic.GetThisPageName(true) + "?" + CommonLogic.ServerVariables("QUERY_STRING"); Response.Redirect("disclaimer.aspx?returnURL=" + Server.UrlEncode(ThisPageURL)); } bool IGDQueryClear = false; m_IGD = CommonLogic.QueryStringCanBeDangerousContent("IGD").Trim(); if (m_IGD.Length == 0 && CommonLogic.ServerVariables("QUERY_STRING").IndexOf("IGD=") != -1) { m_IGD = String.Empty; // there was IGD={blank} in the query string, so forcefully clear IGD! IGDQueryClear = true; } bool IsStartOfImpersonation = m_IGD.Length != 0; // the url invocation starts the impersonation only! if (!IGDQueryClear && m_IGD.Length == 0) { if (m_ThisCustomer.IsAdminUser) { // pull out the impersonation IGD from the customer session, if any m_IGD = m_ThisCustomer.ThisCustomerSession["IGD"]; } } if (IGDQueryClear) { // forcefully clear any IGD for this customer, just to be safe! m_ThisCustomer.ThisCustomerSession["IGD"] = ""; m_ThisCustomer.ThisCustomerSession["IGD_EDITINGORDER"] = ""; } Customer PhoneCustomer = null; if (m_IGD.Length != 0) { if (m_ThisCustomer.IsAdminUser) { try { Guid IGD = new Guid(m_IGD); PhoneCustomer = new Customer(IGD); PhoneCustomer.IsImpersonated = true; } catch { m_ThisCustomer.ThisCustomerSession["IGD"] = ""; m_ThisCustomer.ThisCustomerSession["IGD_EDITINGORDER"] = ""; m_IGD = string.Empty; } } if (PhoneCustomer != null && PhoneCustomer.HasCustomerRecord) { int ImpersonationTimeoutInMinutes = AppLogic.AppConfigUSInt("ImpersonationTimeoutInMinutes"); if (ImpersonationTimeoutInMinutes == 0) { ImpersonationTimeoutInMinutes = 20; } if (PhoneCustomer.ThisCustomerSession.LastActivity >= DateTime.Now.AddMinutes(-ImpersonationTimeoutInMinutes)) { m_ThisCustomer.ThisCustomerSession["IGD"] = IGD; m_AdminCustomer = m_ThisCustomer; // save the owning admin user doing the impersonation here m_ThisCustomer = PhoneCustomer; // build the impersonation customer the phone order customer bool IsAdmin = CommonLogic.ApplicationBool("IsAdminSite"); if (!HttpContext.Current.Items.Contains("IsBeingImpersonated")) { HttpContext.Current.Items.Add("IsBeingImpersonated", "true"); } } else { if (HttpContext.Current.Items.Contains("IsBeingImpersonated")) { HttpContext.Current.Items["IsBeingImpersonated"] = "false"; } m_ThisCustomer.ThisCustomerSession["IGD"] = ""; m_ThisCustomer.ThisCustomerSession["IGD_EDITINGORDER"] = ""; m_IGD = string.Empty; //Response.Redirect("t-phoneordertimeout.aspx"); Response.Redirect(SE.MakeDriverLink("phoneordertimeout")); } } } Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(Localization.GetDefaultLocale()); Thread.CurrentThread.CurrentUICulture = new CultureInfo(ThisCustomer.LocaleSetting); m_Parser = new Parser(m_EntityHelpers, m_SkinID, m_ThisCustomer); m_TemplateName = GetTemplateName(); #region Vortx Mobile Modification if (!AppLogic.IsAdminSite) { m_ThisCustomer = MobileRedirectController.SkinBaseHook(SkinID, ThisCustomer); SkinID = ThisCustomer.SkinID; if (SkinID == Vortx.Data.Config.MobilePlatform.SkinId && MobileHelper.isMobile()) { m_TemplateName = "template.master"; } } #endregion String SkinDirectory = String.Empty; String PageTheme = String.Empty; SkinDirectory = "Skin_" + this.SkinID.ToString(); PageTheme = "Skin_" + this.SkinID.ToString(); if (!m_TemplateName.EndsWith(".master", StringComparison.OrdinalIgnoreCase)) { m_TemplateName = m_TemplateName + ".master"; } this.MasterPageFile = "~/App_Templates/" + SkinDirectory + "/" + m_TemplateName; this.Theme = PageTheme; if (!CommonLogic.FileExists(this.MasterPageFile)) { this.SkinID = AppLogic.DefaultSkinID(); m_TemplateName = "template.master"; SkinDirectory = "Skin_" + this.SkinID.ToString(); PageTheme = "Skin_" + this.SkinID.ToString(); this.MasterPageFile = "~/App_Templates/" + SkinDirectory + "/" + m_TemplateName; this.Theme = PageTheme; } HttpContext.Current.Profile.SetPropertyValue("SkinID", this.SkinID.ToString()); if (ThisCustomer.SkinID != this.SkinID) { ThisCustomer.SkinID = this.SkinID; ThisCustomer.UpdateCustomer(new SqlParameter[] { new SqlParameter("SkinID", this.SkinID) }); } } base.OnPreInit(e); }
private SkinBase m_SkinBase = null; // if not null, this control will set the page metatags to the results from the Topic, IF those Topic results are not "empty strings" protected void Page_Load(object sender, EventArgs e) { m_DesignMode = (HttpContext.Current == null); if (m_DesignMode) { if (TopicName.Length != 0) { Contents.Text = "Topic: " + TopicName; } else { Contents.Text = "Topic"; } } else { try { if (Page != null) { m_T = new Topic(TopicName.Replace("-", " "), ThisCustomer.LocaleSetting, ThisCustomer.SkinID, Page.GetParser); m_SkinID = ThisCustomer.SkinID; m_LocaleSetting = ThisCustomer.LocaleSetting; } else { m_LocaleSetting = Localization.WebConfigLocale; m_T = new Topic(TopicName.Replace("-", " "), m_LocaleSetting, m_SkinID, null); } if (m_T.ShowOnWeb == false && (Request.Url.LocalPath.Contains("driver.aspx") || Request.Url.LocalPath.Contains("driver2.aspx"))) { //If topic does not exists redirect to 404 error page. HttpContext.Current.Response.Redirect("~/t-error404.aspx"); } StringBuilder tmpS = new StringBuilder(4096); string password = string.Empty; if (m_T.Password.Length != 0) { password = InterpriseHelper.TopicPassword(m_T.TopicID, m_LocaleSetting); } string xpdd = m_SkinBase.ThisCustomer.ThisCustomerSession["Topic" + XmlCommon.GetLocaleEntry(m_T.TopicName, m_SkinBase.ThisCustomer.LocaleSetting, true)]; if (EnforcePassword && m_T.Password.Length != 0 && xpdd != password) { string Url = string.Empty; bool isDriverEquals = "driver.aspx".Equals(CommonLogic.GetThisPageName(false), StringComparison.InvariantCultureIgnoreCase); Url = CommonLogic.IIF(isDriverEquals, SE.MakeDriverLink(m_T.TopicName), SE.MakeDriver2Link(m_T.TopicName)); tmpS.Append("<form method=\"POST\" action=\"" + Url + "\">\n"); tmpS.Append("<p><b>"); tmpS.Append(AppLogic.GetString("driver.aspx.1", m_SkinID, m_LocaleSetting)); tmpS.Append("</b></p>\n"); tmpS.Append("<p>"); tmpS.Append(AppLogic.GetString("driver.aspx.2", m_SkinID, m_LocaleSetting)); tmpS.Append(" <input type=\"password\" name=\"Password\" size=\"20\" maxlength=\"100\" TextMode=\"Password\"><input type=\"submit\" value=\""); tmpS.Append(AppLogic.GetString("driver.aspx.4", m_SkinID, m_LocaleSetting)); tmpS.Append("\" name=\"B1\"></p>\n"); tmpS.Append("</form>\n"); } else { if (EnforceDisclaimer && m_T.RequiresDisclaimer && CommonLogic.CookieCanBeDangerousContent("SiteDisclaimerAccepted", true).Length == 0) { string ThisPageURL = CommonLogic.GetThisPageName(true) + "?" + CommonLogic.ServerVariables("QUERY_STRING"); Response.Redirect("disclaimer.aspx?returnURL=" + Server.UrlEncode(ThisPageURL)); } if (EnforceSubscription && m_T.RequiresSubscription && ThisCustomer.SubscriptionExpiresOn < System.DateTime.Now) { tmpS.Append("<p><b>" + AppLogic.GetString("driver.aspx.3", m_SkinID, m_LocaleSetting) + "</b></p>"); } else { tmpS.Append("<!-- READ FROM "); tmpS.Append(CommonLogic.IIF(m_T.FromDB, "DB", "FILE: " + m_T.FN)); tmpS.Append(" -->"); tmpS.Append(m_T.Contents); tmpS.Append("<!-- END OF "); tmpS.Append(CommonLogic.IIF(m_T.FromDB, "DB", "FILE: " + m_T.FN)); tmpS.Append(" -->"); } } Contents.Text = tmpS.ToString(); } catch (Exception ex) { Contents.Text = CommonLogic.GetExceptionDetail(ex, "<br/>"); } if (Page != null && m_AllowSEPropogation) { if (m_T.SectionTitle.Length != 0) { Page.SectionTitle = m_T.SectionTitle; } if (m_T.SETitle.Length != 0) { Page.SETitle = m_T.SETitle; } if (m_T.SEKeywords.Length != 0) { Page.SEKeywords = m_T.SEKeywords; } if (m_T.SEDescription.Length != 0) { Page.SEDescription = m_T.SEDescription; } if (m_T.SENoScript.Length != 0) { Page.SENoScript = m_T.SENoScript; } } } }
protected void Page_Load(object sender, System.EventArgs e) { Response.ContentType = "text/xml"; Response.ContentEncoding = new System.Text.UTF8Encoding(); Response.Write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); int SkinID = 1; // not sure what to do about this...google can't invoke different skins easily String StoreLoc = AppLogic.GetStoreHTTPLocation(false); Response.Write("<urlset xmlns=\"" + AppLogic.AppConfig("GoogleSiteMap.Xmlns") + "\">"); if (AppLogic.AppConfigBool("SiteMap.ShowTopics")) { // DB Topics: StringBuilder sql = new StringBuilder(2500); sql.Append("select wtl.[Name], wtl.Title, wtl.TopicID "); sql.Append("from EcommerceTopicLanguage wtl with (NOLOCK) "); sql.Append("inner join EcommerceTopic wt with (NOLOCK) on wt.TopicID=wtl.TopicID and wtl.WebSiteCode = wt.WebSiteCode "); sql.AppendFormat("where wtl.WebsiteCode={0} and wtl.LanguageCode={1} and ", DB.SQuote(InterpriseHelper.ConfigInstance.WebSiteCode), DB.SQuote(Customer.Current.LanguageCode)); sql.AppendFormat("wt.ShowInSiteMap=1 and (wt.SkinID IS NULL or wt.SkinID=0 or wt.SkinID={0})", SkinID.ToString()); DataSet ds = DB.GetDS(sql.ToString(), AppLogic.CachingOn, System.DateTime.Now.AddMinutes(AppLogic.CacheDurationMinutes())); foreach (DataRow row in ds.Tables[0].Rows) { Response.Write("<url>"); Response.Write("<loc>" + XmlCommon.XmlEncode(StoreLoc + SE.MakeDriverLink(DB.RowFieldByLocale(row, "Name", Localization.WebConfigLocale))) + "</loc> "); Response.Write("<changefreq>" + AppLogic.AppConfig("GoogleSiteMap.TopicChangeFreq") + "</changefreq> "); Response.Write("<priority>" + AppLogic.AppConfig("GoogleSiteMap.TopicPriority") + "</priority> "); Response.Write("</url>"); } ds.Dispose(); // File Topics: // create an array to hold the list of files ArrayList fArray = new ArrayList(); // get information about our initial directory String SFP = CommonLogic.SafeMapPath("skins/skin_" + SkinID.ToString() + "/template.htm").Replace("template.htm", ""); DirectoryInfo dirInfo = new DirectoryInfo(SFP); // retrieve array of files & subdirectories FileSystemInfo[] myDir = dirInfo.GetFileSystemInfos(); for (int i = 0; i < myDir.Length; i++) { // check the file attributes // if a subdirectory, add it to the sArray // otherwise, add it to the fArray if (((Convert.ToUInt32(myDir[i].Attributes) & Convert.ToUInt32(FileAttributes.Directory)) > 0)) { } else { bool skipit = false; if (!myDir[i].FullName.EndsWith("HTM", StringComparison.InvariantCultureIgnoreCase) || (myDir[i].FullName.IndexOf("TEMPLATE", StringComparison.InvariantCultureIgnoreCase) != -1) || (myDir[i].FullName.IndexOf("AFFILIATE_", StringComparison.InvariantCultureIgnoreCase) != -1) || (myDir[i].FullName.IndexOf(AppLogic.ro_PMMicropay, StringComparison.InvariantCultureIgnoreCase) != -1)) { skipit = true; } if (!skipit) { fArray.Add(Path.GetFileName(myDir[i].FullName)); } } } if (fArray.Count != 0) { // sort the files alphabetically fArray.Sort(0, fArray.Count, null); for (int i = 0; i < fArray.Count; i++) { Response.Write("<url>"); Response.Write("<loc>" + StoreLoc + SE.MakeDriverLink(fArray[i].ToString().Replace(".htm", "")) + "</loc> "); Response.Write("<changefreq>" + AppLogic.AppConfig("GoogleSiteMap.TopicChangeFreq") + "</changefreq> "); Response.Write("<priority>" + AppLogic.AppConfig("GoogleSiteMap.TopicPriority") + "</priority> "); Response.Write("</url>"); } } } Response.Write("</urlset>"); }
protected override void RenderContents(System.Web.UI.HtmlTextWriter writer) { string CustomerID = ThisCustomer.CustomerCode; string OrderNumber = CommonLogic.QueryStringCanBeDangerousContent("OrderNumber", true); bool isvalid = false; decimal ordertotal = decimal.Zero; //don't allow the customer any further if they dont own this order. foreach (string salesOrderToCheck in OrderNumber.Split(',')) { if (ThisCustomer.IsUnregisteredAnonymous || !ThisCustomer.OwnsThisOrder(salesOrderToCheck)) { Response.Redirect(SE.MakeDriverLink("ordernotfound")); } } //Assign anonymous id as customer id for report generation. if (!ThisCustomer.IsRegistered && OrderNumber != "") { ThisCustomer.EMail = ThisCustomer.GetAnonEmail(); ThisCustomer.CustomerCode = ThisCustomer.AnonymousCustomerCode; CustomerID = ThisCustomer.CustomerCode; } // WRITE OUT ANY HEADER CHECKOUT SEQUENCE GRAPHIC: if (CustomerID != string.Empty && OrderNumber != string.Empty) { string multiOrderNumber = DB.SQuote(OrderNumber); multiOrderNumber = "(" + multiOrderNumber.Replace(",", "','") + ")"; bool hasFailedTransaction = false; hasFailedTransaction = DB.GetSqlN(string.Format("SELECT COUNT(*) AS N FROM CustomerSalesOrder with (NOLOCK) WHERE SalesOrderCode IN {0} AND IsVoided = 1", multiOrderNumber)) > 0; using (var con = DB.NewSqlConnection()) { con.Open(); using (var rs = DB.GetRSFormat(con, "select SUM(TotalRate)AS TotalRate from CustomerSalesOrder with (NOLOCK) where BillToCode=" + DB.SQuote(CustomerID) + " and SalesOrderCode IN" + multiOrderNumber)) { if (rs.Read()) { ordertotal = DB.RSFieldDecimal(rs, "TotalRate"); isvalid = true; } } } if (isvalid) { string PM = AppLogic.CleanPaymentMethod(ThisCustomer.PaymentMethod); bool AlreadyConfirmed = false; string StoreName = AppLogic.AppConfig("StoreName"); bool UseLiveTransactions = AppLogic.AppConfigBool("UseLiveTransactions"); var cart = new InterpriseShoppingCart(base.EntityHelpers, SkinID, ThisCustomer, CartTypeEnum.ShoppingCart, String.Empty, false, true); bool multipleAttachment = false; if (multiOrderNumber.IndexOf(',') != -1) { multipleAttachment = true; } //Send mail. foreach (string salesOrderToEmail in OrderNumber.Split(',')) { if (ThisCustomer.PaymentTermCode.ToUpper() != "REQUEST QUOTE" && ThisCustomer.PaymentTermCode.ToUpper() != "PURCHASE ORDER") { AppLogic.SendOrderEMail(ThisCustomer, cart, salesOrderToEmail, false, PM, true, multipleAttachment); } else { AppLogic.SendOrderEMail(ThisCustomer, cart, salesOrderToEmail, false, PM, multipleAttachment); } } string XmlPackageName = AppLogic.AppConfig("XmlPackage.OrderConfirmationPage"); if (XmlPackageName.Length == 0) { XmlPackageName = "orderconfirmation.xml.config"; } if (XmlPackageName.Length != 0) { string[] salesOrderCodes = OrderNumber.Split(','); for (int ctr = 0; ctr < salesOrderCodes.Length; ctr++) { string salesOrderCode = salesOrderCodes[ctr]; var runtimeParams = new List <XmlPackageParam>(); if (ctr == 0) { runtimeParams.Add(new XmlPackageParam("IncludeHeader", true.ToString().ToLowerInvariant())); } else { runtimeParams.Add(new XmlPackageParam("IncludeHeader", false.ToString().ToLowerInvariant())); } string salesOrderStage = string.Empty; using (var con = DB.NewSqlConnection()) { con.Open(); using (var rs = DB.GetRSFormat(con, "SELECT Stage from CustomerSalesOrderWorkFlowView where salesOrderCode=" + DB.SQuote(salesOrderCode))) { if (rs.Read()) { salesOrderStage = DB.RSField(rs, "Stage"); } } } runtimeParams.Add(new XmlPackageParam("OrderNumber", salesOrderCode)); runtimeParams.Add(new XmlPackageParam("SalesOrderStage", salesOrderStage)); if (ThisCustomer.PaymentTermCode.ToUpper() == "REQUEST QUOTE") { runtimeParams.Add(new XmlPackageParam("PaymentMethod", "REQUESTQUOTE")); } else if (ThisCustomer.PaymentTermCode.ToUpper() == "PURCHASE ORDER") { runtimeParams.Add(new XmlPackageParam("PaymentMethod", "PURCHASEORDER")); } else { runtimeParams.Add(new XmlPackageParam("PaymentMethod", ThisCustomer.PaymentMethod)); } runtimeParams.Add(new XmlPackageParam("Email", ThisCustomer.EMail)); if (ctr + 1 == salesOrderCodes.Length) { runtimeParams.Add(new XmlPackageParam("IncludeFooter", true.ToString().ToLowerInvariant())); runtimeParams.Add(new XmlPackageParam("WriteFailedTransaction", hasFailedTransaction.ToString().ToLowerInvariant())); } else { runtimeParams.Add(new XmlPackageParam("IncludeFooter", false.ToString().ToLowerInvariant())); } writer.Write(AppLogic.RunXmlPackage(XmlPackageName, base.GetParser, ThisCustomer, SkinID, String.Empty, runtimeParams, true, true)); } } if (!AlreadyConfirmed && AppLogic.AppConfigBool("GoogleAnalytics.ConversionTracking")) { string test = AppLogic.GAEcommerceTracking(ThisCustomer); ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), DB.GetNewGUID(), test, false); } } else { writer.Write("<div align=\"center\">"); writer.Write("<br/><br/><br/><br/><br/>"); writer.Write(AppLogic.GetString("orderconfirmation.aspx.15", SkinID, ThisCustomer.LocaleSetting)); writer.Write("<br/><br/><br/><br/><br/>"); writer.Write("</div>"); } } else { writer.Write("<p><b>Error: Invalid Customer ID or Invalid Order Number</b></p>"); } if (!ThisCustomer.IsRegistered || AppLogic.AppConfigBool("ForceSignoutOnOrderCompletion")) { //Setting cookie values for anonymous receipts. We should look into a more secure way to do this, but for now //it's better than what we had. AppLogic.SetSessionCookie("ContactGUID", ThisCustomer.ContactGUID.ToString()); AppLogic.SetSessionCookie("OrderNumber", CommonLogic.QueryStringCanBeDangerousContent("OrderNumber", true)); if (AppLogic.AppConfigBool("SiteDisclaimerRequired")) { AppLogic.SetSessionCookie("SiteDisclaimerAccepted", String.Empty); } //V3_9 Kill the Authentication ticket. Session.Clear(); Session.Abandon(); ThisCustomer.ThisCustomerSession.Clear(); FormsAuthentication.SignOut(); } }
private void loadTree(int selectedTopic) { List <Store> storeList = Store.GetStoreList(); Dictionary <int, String> storeNames = new Dictionary <int, string>(); foreach (Store s in storeList) { storeNames.Add(s.StoreID, s.Name); } try { treeMain.Nodes.Clear(); fileTreeMain.Nodes.Clear(); //DATABASE TOPICS List <SqlParameter> spa = new List <SqlParameter>(); spa.Add(new SqlParameter("@Published", ddPublished.SelectedValue)); spa.Add(new SqlParameter("@StoreId", ddStores.SelectedValue)); String sql = String.Empty; sql = "select * from Topic with (NOLOCK) where deleted=0"; if (ddPublished.SelectedValue != "Both") { sql += " AND Published = @Published"; } if (!chkShowAllTopics.Checked) { sql += " And IsFrequent = 1 "; } if (Store.StoreCount > 1 && ddStores.SelectedValue != "0") { sql += " And StoreId = @StoreId"; } sql += " order by Name ASC "; using (SqlConnection conn = new SqlConnection(DB.GetDBConn())) { conn.Open(); using (IDataReader rs = DB.GetRS(sql, spa.ToArray(), conn)) { while (rs.Read()) { string name = string.Empty; name = DB.RSFieldByLocale(rs, "Name", ThisCustomer.LocaleSetting); int StoreID = DB.RSFieldInt(rs, "StoreID"); TreeNode myNode = new TreeNode(); myNode.Text = CommonLogic.IIF(name.Equals(string.Empty), "[Not Set for this Locale]", name); if (Store.StoreCount > 1) { if (StoreID == 0) { myNode.Text += " (All Stores)"; } else if (storeNames.ContainsKey(StoreID)) { myNode.Text += " (" + storeNames[StoreID] + ")"; } else { myNode.Text += " (" + StoreID.ToString() + ")"; } } int tid = DB.RSFieldInt(rs, "TopicID"); myNode.Value = tid.ToString(); myNode.ImageUrl = AppLogic.LocateImageURL("~/App_Themes/Admin_Default/images/icons/dot.gif"); myNode.Selected = tid == selectedTopic; treeMain.Nodes.Add(myNode); } } } // FILE BASED TOPICS: string appdir = HttpContext.Current.Request.PhysicalApplicationPath; string rootUrl = Path.Combine(appdir, string.Format("Topics\\")); ArrayList fArray = new ArrayList(); //Skin specific first foreach (String skinId in AppLogic.FindAllSkins().Split(',')) { string skinUrl = Path.Combine(appdir, string.Format("App_Templates\\Skin_{0}\\Topics", skinId)); //See if there are any files there DirectoryInfo dirInfo = new DirectoryInfo(skinUrl); if (dirInfo != null) { FileSystemInfo[] myDir = dirInfo.GetFileSystemInfos(); for (int i = 0; i < myDir.Length; i++) { // check the file attributes, skip subdirs: if (!((Convert.ToUInt32(myDir[i].Attributes) & Convert.ToUInt32(FileAttributes.Directory)) > 0)) { if (myDir[i].FullName.EndsWith("htm", StringComparison.InvariantCultureIgnoreCase) || myDir[i].FullName.EndsWith("html", StringComparison.InvariantCultureIgnoreCase)) { string filenameWithoutExtension = myDir[i].FullName.Substring(0, myDir[i].FullName.IndexOf(".htm")); fArray.Add(Path.GetFileName(filenameWithoutExtension)); } } } if (fArray.Count != 0) { // sort the files alphabetically fArray.Sort(0, fArray.Count, null); for (int i = 0; i < fArray.Count; i++) { TreeNode myNode = new TreeNode(); myNode.Value = SE.MakeDriverLink(XmlCommon.GetLocaleEntry(fArray[i].ToString(), ThisCustomer.LocaleSetting, true)); myNode.Text = string.Format("<a target='_blank' href='../{0}'>{1} (Skin {2})</a>", myNode.Value, fArray[i].ToString(), skinId); myNode.ImageUrl = AppLogic.LocateImageURL("~/App_Themes/Admin_Default/images/icons/dot.gif"); fileTreeMain.Nodes.Add(myNode); } } fArray.Clear(); } } //Root folder //See if there are any files there DirectoryInfo rootDirInfo = new DirectoryInfo(rootUrl); if (rootDirInfo != null) { FileSystemInfo[] rootFiles = rootDirInfo.GetFileSystemInfos(); for (int i = 0; i < rootFiles.Length; i++) { // check the file attributes, skip subdirs: if (!((Convert.ToUInt32(rootFiles[i].Attributes) & Convert.ToUInt32(FileAttributes.Directory)) > 0)) { if (rootFiles[i].FullName.EndsWith("htm", StringComparison.InvariantCultureIgnoreCase) || rootFiles[i].FullName.EndsWith("html", StringComparison.InvariantCultureIgnoreCase)) { string filenameWithoutExtension = rootFiles[i].FullName.Substring(0, rootFiles[i].FullName.IndexOf(".htm")); fArray.Add(Path.GetFileName(filenameWithoutExtension)); } } } if (fArray.Count != 0) { // sort the files alphabetically fArray.Sort(0, fArray.Count, null); for (int i = 0; i < fArray.Count; i++) { TreeNode myNode = new TreeNode(); myNode.Value = SE.MakeDriverLink(XmlCommon.GetLocaleEntry(fArray[i].ToString(), ThisCustomer.LocaleSetting, true)); myNode.Text = string.Format("<a target='_blank' href='../{0}'>{1} (All skins)</a>", myNode.Value, fArray[i].ToString()); myNode.ImageUrl = AppLogic.LocateImageURL("~/App_Themes/Admin_Default/images/icons/dot.gif"); fileTreeMain.Nodes.Add(myNode); } } } } catch (Exception ex) { resetError(ex.ToString(), true); } }
protected void Page_Load(object sender, System.EventArgs e) { Response.CacheControl = "private"; Response.Expires = 0; Response.AddHeader("pragma", "no-cache"); int skinID = int.Parse(CommonLogic.IIF(CommonLogic.IsInteger(Profile.SkinID.ToString()), Profile.SkinID.ToString(), "0")); if (skinID <= 0) { skinID = ThisCustomer.SkinID; } if (this.IsAddToPackPostBack) { HandleAddToPack(); return; } //Response.Write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"); //Response.Write("<html>\n"); //Response.Write("<head>\n"); //Response.Write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n"); //Response.Write("<title>Product Browser</title>\n"); //Response.Write("<link rel=\"stylesheet\" href=\"~/App_Themes/Skin_" + skinID.ToString() + "/style.css\" type=\"text/css\">\n"); //Response.Write("<script type=\"text/javascript\" src=\"jscripts/formValidate.js\"></script>\n"); //Response.Write("<script type=\"text/javascript\" src=\"jscripts/core.js\"></script>\n"); //Response.Write("</head>\n"); //Response.Write("<body class=\"ProductBrowserBody\" bottommargin=\"0\" leftmargin=\"0\" marginheight=\"0\" marginwidth=\"0\" rightmargin=\"0\" topmargin=\"0\" bgcolor=\"#FFFFFF\">\n"); //Response.Write("<!-- PAGE INVOCATION: '%INVOCATION%' -->\n"); StringBuilder output = new StringBuilder(); int PackID = CommonLogic.QueryStringUSInt("PackID"); int ProductID = CommonLogic.QueryStringUSInt("ProductID"); if (AppLogic.ProductHasBeenDeleted(ProductID)) { Response.Redirect(SE.MakeDriverLink("ProductNotFound")); } bool RequiresReg; using (SqlConnection conn = DB.dbConn()) { conn.Open(); using (IDataReader rs = DB.GetRS("select RequiresRegistration from Product with (NOLOCK) where deleted=0 and Product.ProductID=" + ProductID.ToString(), conn)) { if (!rs.Read()) { rs.Close(); Response.Redirect(SE.MakeDriverLink("ProductNotFound")); } RequiresReg = DB.RSFieldBool(rs, "RequiresRegistration"); } } if (RequiresReg && !ThisCustomer.IsRegistered) { output.Append("<b>" + AppLogic.GetString("pb.aspx.1", 1, Localization.GetDefaultLocale()) + "</b>"); } else { output.Append(AppLogic.RunXmlPackage("productbrowser.xml.config", null, ThisCustomer, 1, string.Empty, string.Empty, false, false)); } litOutput.Text = output.ToString(); //Response.Write("</body>\n"); //Response.Write("</html>\n"); }
protected void Page_Load(object sender, System.EventArgs e) { if (AppLogic.AppConfigBool("GoNonSecureAgain")) { SkinBase.GoNonSecureAgain(); } _itemCounter = "ProductID".ToQueryString().TryParseIntUsLocalization().Value; CategoryID = "CategoryID".ToQueryString(); DepartmentID = "DepartmentID".ToQueryString(); ManufacturerID = "ManufacturerID".ToQueryString(); _itemCode = AppLogic.GetItemCodeByCounter(_itemCounter); var eCommerceProductInfoView = AppLogic.GetProductInfoViewForShowProduct(DB.SQuote(_itemCode), DB.SQuote(ThisCustomer.LocaleSetting), DB.SQuote(InterpriseHelper.ConfigInstance.UserCode), DB.SQuote(InterpriseHelper.ConfigInstance.WebSiteCode), DB.SQuote(Localization.DateTimeStringForDB(DateTime.Now)), DB.SQuote(ThisCustomer.ProductFilterID), DB.SQuote(ThisCustomer.ContactCode)); int sessionLifetime = AppLogic.AppConfigUSInt("ViewedProductsSessionLifetime"); if (sessionLifetime == null) { sessionLifetime = 60; } if (ThisCustomer.ContactCode == "") { RequireCustomerRecord(); } //DateTime expirationdatetime = DateTime.Now.AddMinutes(-sessionLifetime); //string updatevieweditems = // string.Format("exec UpdateEcommerceViewedItems @ExpirationDate = {0}, @WebSiteCode = {1}, @ContactCode = {2}, @ItemCode = {3}, @CurrentDate = {4}, @SessionID = {5}", // DB.SQuote(Localization.DateTimeStringForDB(expirationdatetime)), // DB.SQuote(InterpriseHelper.ConfigInstance.WebSiteCode), // DB.SQuote(ThisCustomer.ContactCode), // DB.SQuote(_itemCode), // DB.SQuote(Localization.DateTimeStringForDB(DateTime.Now)), // ThisCustomer.CurrentSessionID); //DB.ExecuteSQL(updatevieweditems); string itemDescription = string.Empty; if (eCommerceProductInfoView == null) { Response.Redirect(SE.MakeDriverLink("ProductNotFound")); } if (eCommerceProductInfoView.CheckOutOption) { Response.Redirect(SE.MakeDriverLink("ProductNotFound")); } if (eCommerceProductInfoView.IsCBN == false && AppLogic.IsCBNMode()) { Response.Redirect(SE.MakeDriverLink("MobileProductNotFound")); } string SENameINURL = "SEName".ToQueryStringDecode(); string ActualSEName = eCommerceProductInfoView.ItemDescription.ToMungeName().ToUrlEncode().ToSubString(90); if (string.IsNullOrEmpty(ActualSEName)) { ActualSEName = eCommerceProductInfoView.ItemName.ToMungeName().ToUrlEncode().ToSubString(90); } if (ActualSEName != SENameINURL) { string NewURL = AppLogic.GetStoreHTTPLocation(false) + SE.MakeProductLink(_itemCounter.ToString(), ActualSEName); string QStr = "?"; var keyvalues = Request.QueryString .ToPairs() .Where(q => q.Key == "productid" && q.Key == "sename") .Select(q => string.Join("=", new[] { q.Key, q.Value + "&" })) .ToArray(); QStr += string.Join("", keyvalues); if (QStr.Length > 1) { NewURL += QStr; } HttpContext.Current.Response.Write("<html><head><title>Object Moved</title></head><body><b>Object moved to <a href=\"" + NewURL + "\">HERE</a></b></body></html>"); Response.Status = "301 Moved Permanently"; Response.AddHeader("Location", NewURL); HttpContext.Current.Response.End(); } m_XmlPackage = eCommerceProductInfoView.MobileXmlPackage.ToLowerInvariant(); IsAKit = eCommerceProductInfoView.IsAKit.TryParseBool(); IsMatrix = eCommerceProductInfoView.IsMatrix.TryParseBool(); if (m_XmlPackage.Length == 0) { if (IsAKit) { m_XmlPackage = AppLogic.MobileDefaultProductKitXmlPackage; // provide a default } else if (IsMatrix) { m_XmlPackage = AppLogic.MobileDefaultProductMatrixXmlPackage; // provide a default } else { m_XmlPackage = AppLogic.MobileDefaultProductXmlPackage; // provide a default } } RequiresReg = eCommerceProductInfoView.RequiresRegistration; ProductName = XmlCommon.GetLocaleEntry(eCommerceProductInfoView.ItemDescription, ThisCustomer.LocaleSetting, true); CategoryHelper = AppLogic.LookupHelper(base.EntityHelpers, DomainConstants.LOOKUP_HELPER_CATEGORIES); SectionHelper = AppLogic.LookupHelper(base.EntityHelpers, DomainConstants.LOOKUP_HELPER_DEPARTMENT); ManufacturerHelper = AppLogic.LookupHelper(base.EntityHelpers, DomainConstants.LOOKUP_HELPER_MANUFACTURERS); itemDescription = eCommerceProductInfoView.ItemDescription; if (string.IsNullOrEmpty(itemDescription)) { itemDescription = ProductName; } string seITitleTemp = XmlCommon.GetLocaleEntry(eCommerceProductInfoView.SETitle, ThisCustomer.LocaleSetting, true); SETitle = string.IsNullOrEmpty(seITitleTemp) ? (AppLogic.AppConfig("StoreName") + " - " + itemDescription).ToHtmlEncode() : seITitleTemp; string seDescription = XmlCommon.GetLocaleEntry(eCommerceProductInfoView.SEDescription, ThisCustomer.LocaleSetting, true); SEDescription = string.IsNullOrEmpty(seDescription) ? ProductName.ToHtmlEncode() : seDescription; string seKeywords = XmlCommon.GetLocaleEntry(eCommerceProductInfoView.SEKeywords, ThisCustomer.LocaleSetting, true); SEKeywords = string.IsNullOrEmpty(seKeywords) ? ProductName.ToHtmlEncode() : seKeywords; SENoScript = XmlCommon.GetLocaleEntry(eCommerceProductInfoView.SENoScript, ThisCustomer.LocaleSetting, true); CategoryName = (CategoryHelper.GetEntityField(CategoryID, "Description", ThisCustomer.LocaleSetting) != String.Empty) ? CategoryHelper.GetEntityField(CategoryID, "Description", ThisCustomer.LocaleSetting) : CategoryHelper.GetEntityName(CategoryID, ThisCustomer.LocaleSetting); SectionName = (SectionHelper.GetEntityField(DepartmentID, "Description", ThisCustomer.LocaleSetting) != String.Empty) ? SectionHelper.GetEntityField(DepartmentID, "Description", ThisCustomer.LocaleSetting) : SectionHelper.GetEntityName(DepartmentID, ThisCustomer.LocaleSetting); ManufacturerName = (ManufacturerHelper.GetEntityField(ManufacturerID, "Description", ThisCustomer.LocaleSetting) != String.Empty) ? ManufacturerHelper.GetEntityField(ManufacturerID, "Description", ThisCustomer.LocaleSetting) : ManufacturerHelper.GetEntityName(ManufacturerID, ThisCustomer.LocaleSetting); if (ManufacturerID.Length != 0) { CookieTool.Add("LastViewedEntityName", "Manufacturer", new TimeSpan(1, 0, 0, 0, 0)); CookieTool.Add("LastViewedEntityInstanceID", ManufacturerID.ToString(), new TimeSpan(1, 0, 0, 0, 0)); CookieTool.Add("LastViewedEntityInstanceName", ManufacturerName, new TimeSpan(1, 0, 0, 0, 0)); String NewURL = AppLogic.GetStoreHTTPLocation(false) + SE.MakeProductLink(_itemCounter.ToString(), _itemCode); HttpContext.Current.Response.Write("<html><head><title>Object Moved</title></head><body><b>Object moved to <a href=\"" + NewURL + "\">HERE</a></b></body></html>"); Response.Status = "301 Moved Permanently"; Response.AddHeader("Location", NewURL); HttpContext.Current.Response.End(); } else if (CategoryID.Length != 0) { CookieTool.Add("LastViewedEntityName", "Category", new TimeSpan(1, 0, 0, 0, 0)); CookieTool.Add("LastViewedEntityInstanceID", CategoryID.ToString(), new TimeSpan(1, 0, 0, 0, 0)); CookieTool.Add("LastViewedEntityInstanceName", CategoryName, new TimeSpan(1, 0, 0, 0, 0)); string NewURL = AppLogic.GetStoreHTTPLocation(false) + SE.MakeProductLink(_itemCounter.ToString(), _itemCode); HttpContext.Current.Response.Write("<html><head><title>Object Moved</title></head><body><b>Object moved to <a href=\"" + NewURL + "\">HERE</a></b></body></html>"); Response.Status = "301 Moved Permanently"; Response.AddHeader("Location", NewURL); HttpContext.Current.Response.End(); } else if (DepartmentID.Length != 0) { var cookierExpires = new TimeSpan(1, 0, 0, 0, 0); CookieTool.Add("LastViewedEntityName", "Department", cookierExpires); CookieTool.Add("LastViewedEntityInstanceID", DepartmentID.ToString(), cookierExpires); CookieTool.Add("LastViewedEntityInstanceName", SectionName, cookierExpires); String NewURL = AppLogic.GetStoreHTTPLocation(false) + SE.MakeProductLink(_itemCounter.ToString(), _itemCode); HttpContext.Current.Response.Write("<html><head><title>Object Moved</title></head><body><b>Object moved to <a href=\"" + NewURL + "\">HERE</a></b></body></html>"); Response.Status = "301 Moved Permanently"; Response.AddHeader("Location", NewURL); HttpContext.Current.Response.End(); } SourceEntity = CommonLogic.CookieCanBeDangerousContent("LastViewedEntityName", true); string SourceEntityInstanceName = CommonLogic.CookieCanBeDangerousContent("LastViewedEntityInstanceName", true); SourceEntityID = CommonLogic.CookieCanBeDangerousContent("LastViewedEntityInstanceID", true); // validate that source entity id is actually valid for this product: if (SourceEntityID.Length != 0) { var alE = AppLogic.GetProductEntityList(_itemCode, SourceEntity); if (alE.Any(i => i == SourceEntityID.TryParseIntUsLocalization())) { SourceEntityID = string.Empty; } } if (SourceEntityID.Length != 0) { PickupBreadCrumb(ref SourceEntity, ref SourceEntityInstanceName, ref SourceEntityID, false); } else { PickupBreadCrumb(ref SourceEntity, ref SourceEntityInstanceName, ref SourceEntityID, true); } AppLogic.LogEvent(ThisCustomer.CustomerCode, 10, _itemCounter.ToString()); }
private void SetupProductDefaults() { String ActualSEName = string.Empty; using (SqlConnection dbconn = new SqlConnection(DB.GetDBConn())) { dbconn.Open(); using (IDataReader rs = DB.GetRS("select * from Product with (NOLOCK) where Deleted=0 and ProductID=" + ProductID.ToString(), dbconn)) { if (!rs.Read()) { Response.Redirect(SE.MakeDriverLink("ProductNotFound")); } else { bool a = DB.RSFieldBool(rs, "Published"); if (!a) { Response.Redirect(SE.MakeDriverLink("ProductNotFound")); } } String SENameINURL = CommonLogic.QueryStringCanBeDangerousContent("SEName"); ActualSEName = SE.MungeName(DB.RSField(rs, "SEName")); if (ActualSEName != SENameINURL) { String NewURL = AppLogic.GetStoreHTTPLocation(false) + SE.MakeProductLink(ProductID, ActualSEName); string QStr = "?"; bool first = true; for (int i = 0; i < Request.QueryString.Count; i++) { string key = Request.QueryString.GetKey(i); if ((key.Equals("productid", StringComparison.InvariantCultureIgnoreCase)) == false && (key.Equals("sename", StringComparison.InvariantCultureIgnoreCase)) == false) { if (!first) { QStr += "&"; } QStr += key + "=" + Request.QueryString[i].ToString(); first = false; } } if (QStr.Length > 1) { NewURL += QStr; } HttpContext.Current.Response.Write("<html><head><title>Object Moved</title></head><body><b>Object moved to <a href=\"" + NewURL + "\">HERE</a></b></body></html>"); Response.Status = "301 Moved Permanently"; Response.AddHeader("Location", NewURL); HttpContext.Current.Response.End(); } m_XmlPackage = DB.RSField(rs, "XmlPackage").ToLowerInvariant(); IsAKit = DB.RSFieldBool(rs, "IsAKit"); IsAPack = DB.RSFieldBool(rs, "IsAPack"); if (m_XmlPackage.Length == 0) { if (IsAKit) { m_XmlPackage = AppLogic.ro_DefaultProductKitXmlPackage; // provide a default } else if (IsAPack) { m_XmlPackage = AppLogic.ro_DefaultProductPackXmlPackage; // provide a default } else { m_XmlPackage = AppLogic.ro_DefaultProductXmlPackage; // provide a default } } RequiresReg = DB.RSFieldBool(rs, "RequiresRegistration"); ProductName = DB.RSFieldByLocale(rs, "Name", ThisCustomer.LocaleSetting); CategoryHelper = AppLogic.LookupHelper("Category", 0); SectionHelper = AppLogic.LookupHelper("Section", 0); ManufacturerHelper = AppLogic.LookupHelper("Manufacturer", 0); DistributorHelper = AppLogic.LookupHelper("Distributor", 0); GenreHelper = AppLogic.LookupHelper("Genre", 0); VectorHelper = AppLogic.LookupHelper("Vector", 0); String SEName = String.Empty; if (DB.RSFieldByLocale(rs, "SETitle", ThisCustomer.LocaleSetting).Length == 0) { SETitle = Security.HtmlEncode(AppLogic.AppConfig("StoreName") + " - " + ProductName); } else { SETitle = DB.RSFieldByLocale(rs, "SETitle", ThisCustomer.LocaleSetting); } if (DB.RSFieldByLocale(rs, "SEDescription", ThisCustomer.LocaleSetting).Length == 0) { SEDescription = Security.HtmlEncode(ProductName); } else { SEDescription = DB.RSFieldByLocale(rs, "SEDescription", ThisCustomer.LocaleSetting); } if (DB.RSFieldByLocale(rs, "SEKeywords", ThisCustomer.LocaleSetting).Length == 0) { SEKeywords = Security.HtmlEncode(ProductName); } else { SEKeywords = DB.RSFieldByLocale(rs, "SEKeywords", ThisCustomer.LocaleSetting); } SENoScript = DB.RSFieldByLocale(rs, "SENoScript", ThisCustomer.LocaleSetting); } } //Log all views of unknown and registered customer if (!AppLogic.ProductIsMLExpress() && (AppLogic.AppConfigBool("DynamicRelatedProducts.Enabled") || AppLogic.AppConfigBool("RecentlyViewedProducts.Enabled"))) { ThisCustomer.LogProductView(ProductID); } CategoryName = CategoryHelper.GetEntityName(CategoryID, ThisCustomer.LocaleSetting); SectionName = SectionHelper.GetEntityName(SectionID, ThisCustomer.LocaleSetting); ManufacturerName = ManufacturerHelper.GetEntityName(ManufacturerID, ThisCustomer.LocaleSetting); DistributorName = DistributorHelper.GetEntityName(DistributorID, ThisCustomer.LocaleSetting); GenreName = GenreHelper.GetEntityName(GenreID, ThisCustomer.LocaleSetting); VectorName = VectorHelper.GetEntityName(VectorID, ThisCustomer.LocaleSetting); String SourceEntityInstanceName = String.Empty; if (ManufacturerID != 0) { Profile.LastViewedEntityName = EntityDefinitions.readonly_ManufacturerEntitySpecs.m_EntityName; Profile.LastViewedEntityInstanceID = ManufacturerID.ToString(); Profile.LastViewedEntityInstanceName = ManufacturerName; String NewURL = AppLogic.GetStoreHTTPLocation(false) + SE.MakeProductLink(ProductID, ActualSEName); HttpContext.Current.Response.Write("<html><head><title>Object Moved</title></head><body><b>Object moved to <a href=\"" + NewURL + "\">HERE</a></b></body></html>"); Response.Status = "301 Moved Permanently"; Response.AddHeader("Location", NewURL); HttpContext.Current.Response.End(); } else if (DistributorID != 0) { Profile.LastViewedEntityName = EntityDefinitions.readonly_DistributorEntitySpecs.m_EntityName; Profile.LastViewedEntityInstanceID = DistributorID.ToString(); Profile.LastViewedEntityInstanceName = DistributorName; String NewURL = AppLogic.GetStoreHTTPLocation(false) + SE.MakeProductLink(ProductID, ActualSEName); HttpContext.Current.Response.Write("<html><head><title>Object Moved</title></head><body><b>Object moved to <a href=\"" + NewURL + "\">HERE</a></b></body></html>"); Response.Status = "301 Moved Permanently"; Response.AddHeader("Location", NewURL); HttpContext.Current.Response.End(); } else if (GenreID != 0) { Profile.LastViewedEntityName = EntityDefinitions.readonly_GenreEntitySpecs.m_EntityName; Profile.LastViewedEntityInstanceID = GenreID.ToString(); Profile.LastViewedEntityInstanceName = GenreName; String NewURL = AppLogic.GetStoreHTTPLocation(false) + SE.MakeProductLink(ProductID, ActualSEName); HttpContext.Current.Response.Write("<html><head><title>Object Moved</title></head><body><b>Object moved to <a href=\"" + NewURL + "\">HERE</a></b></body></html>"); Response.Status = "301 Moved Permanently"; Response.AddHeader("Location", NewURL); HttpContext.Current.Response.End(); } else if (VectorID != 0) { Profile.LastViewedEntityName = EntityDefinitions.readonly_VectorEntitySpecs.m_EntityName; Profile.LastViewedEntityInstanceID = VectorID.ToString(); Profile.LastViewedEntityInstanceName = VectorName; String NewURL = AppLogic.GetStoreHTTPLocation(false) + SE.MakeProductLink(ProductID, ActualSEName); HttpContext.Current.Response.Write("<html><head><title>Object Moved</title></head><body><b>Object moved to <a href=\"" + NewURL + "\">HERE</a></b></body></html>"); Response.Status = "301 Moved Permanently"; Response.AddHeader("Location", NewURL); HttpContext.Current.Response.End(); } else if (CategoryID != 0) { Profile.LastViewedEntityName = EntityDefinitions.readonly_CategoryEntitySpecs.m_EntityName; Profile.LastViewedEntityInstanceID = CategoryID.ToString(); Profile.LastViewedEntityInstanceName = CategoryName; String NewURL = AppLogic.GetStoreHTTPLocation(false) + SE.MakeProductLink(ProductID, ActualSEName); HttpContext.Current.Response.Write("<html><head><title>Object Moved</title></head><body><b>Object moved to <a href=\"" + NewURL + "\">HERE</a></b></body></html>"); Response.Status = "301 Moved Permanently"; Response.AddHeader("Location", NewURL); HttpContext.Current.Response.End(); } else if (SectionID != 0) { Profile.LastViewedEntityName = EntityDefinitions.readonly_SectionEntitySpecs.m_EntityName; Profile.LastViewedEntityInstanceID = SectionID.ToString(); Profile.LastViewedEntityInstanceName = SectionName; String NewURL = AppLogic.GetStoreHTTPLocation(false) + SE.MakeProductLink(ProductID, ActualSEName); HttpContext.Current.Response.Write("<html><head><title>Object Moved</title></head><body><b>Object moved to <a href=\"" + NewURL + "\">HERE</a></b></body></html>"); Response.Status = "301 Moved Permanently"; Response.AddHeader("Location", NewURL); HttpContext.Current.Response.End(); } SourceEntity = Profile.LastViewedEntityName; SourceEntityInstanceName = Profile.LastViewedEntityInstanceName; SourceEntityID = int.Parse(CommonLogic.IIF(CommonLogic.IsInteger(Profile.LastViewedEntityInstanceID), Profile.LastViewedEntityInstanceID, "0")); // validate that source entity id is actually valid for this product: if (SourceEntityID != 0) { String sqlx = "select count(*) as N from dbo.productentity with (NOLOCK) where ProductID=" + ProductID.ToString() + " and EntityID=" + SourceEntityID.ToString() + " and EntityType = " + DB.SQuote(SourceEntity); if (DB.GetSqlN(sqlx) == 0) { SourceEntityID = 0; } } // we had no entity context coming in, try to find a category context for this product, so they have some context if possible: if (SourceEntityID == 0) { SourceEntityID = EntityHelper.GetProductsFirstEntity(ProductID, EntityDefinitions.readonly_CategoryEntitySpecs.m_EntityName); if (SourceEntityID > 0) { CategoryID = SourceEntityID; CategoryName = CategoryHelper.GetEntityName(CategoryID, ThisCustomer.LocaleSetting); Profile.LastViewedEntityName = EntityDefinitions.readonly_CategoryEntitySpecs.m_EntityName; Profile.LastViewedEntityInstanceID = CategoryID.ToString(); Profile.LastViewedEntityInstanceName = CategoryName; SourceEntity = EntityDefinitions.readonly_CategoryEntitySpecs.m_EntityName; SourceEntityInstanceName = CategoryName; } } // we had no entity context coming in, try to find a section context for this product, so they have some context if possible: if (SourceEntityID == 0) { SourceEntityID = EntityHelper.GetProductsFirstEntity(ProductID, EntityDefinitions.readonly_SectionEntitySpecs.m_EntityName); if (SourceEntityID > 0) { SectionID = SourceEntityID; SectionName = CategoryHelper.GetEntityName(SectionID, ThisCustomer.LocaleSetting); Profile.LastViewedEntityName = EntityDefinitions.readonly_SectionEntitySpecs.m_EntityName; Profile.LastViewedEntityInstanceID = SectionID.ToString(); Profile.LastViewedEntityInstanceName = SectionName; SourceEntity = EntityDefinitions.readonly_SectionEntitySpecs.m_EntityName; SourceEntityInstanceName = SectionName; } } // we had no entity context coming in, try to find a Manufacturer context for this product, so they have some context if possible: if (SourceEntityID == 0) { SourceEntityID = EntityHelper.GetProductsFirstEntity(ProductID, EntityDefinitions.readonly_ManufacturerEntitySpecs.m_EntityName); if (SourceEntityID > 0) { ManufacturerID = SourceEntityID; ManufacturerName = CategoryHelper.GetEntityName(ManufacturerID, ThisCustomer.LocaleSetting); Profile.LastViewedEntityName = EntityDefinitions.readonly_ManufacturerEntitySpecs.m_EntityName; Profile.LastViewedEntityInstanceID = ManufacturerID.ToString(); Profile.LastViewedEntityInstanceName = ManufacturerName; SourceEntity = EntityDefinitions.readonly_ManufacturerEntitySpecs.m_EntityName; SourceEntityInstanceName = ManufacturerName; } } // build up breadcrumb if we need: SectionTitle = Breadcrumb.GetProductBreadcrumb(ProductID, ProductName, SourceEntity, SourceEntityID, ThisCustomer); }
protected override void OnPreInit(EventArgs e) { if (HttpContext.Current != null) { //Have to call GetPropertyValue once before you actually need it to initialize the PropertyValues collection HttpContext.Current.Profile.GetPropertyValue("SkinID").ToString(); #region SkinID //If it's mobile, bypass all the rest if (!AppLogic.IsAdminSite && MobileHelper.isMobile()) { MobileHelper.SetCustomerToMobileSkinId(ThisCustomer); SkinID = ThisCustomer.SkinID; } else { //SkinId querystring overrides everything but mobile if (CommonLogic.QueryStringUSInt("skinid") > 0) { SkinID = CommonLogic.QueryStringUSInt("skinid"); //Customer has a querystring so save this to the profile. if (HttpContext.Current.Profile != null) { HttpContext.Current.Profile.SetPropertyValue("SkinID", this.SkinID.ToString()); } } //Check to see if we are previewing the skin else if (CommonLogic.QueryStringUSInt("previewskinid") > 0) { SkinID = CommonLogic.QueryStringUSInt("previewskinid"); //Customer has a preview querystring so save this to the profile. if (HttpContext.Current.Profile != null) { HttpContext.Current.Profile.SetPropertyValue("PreviewSkinID", this.SkinID.ToString()); } } //Use the preview profile value if we have one else if (HttpContext.Current.Profile != null && HttpContext.Current.Profile.PropertyValues["PreviewSkinID"] != null && CommonLogic.IsInteger(HttpContext.Current.Profile.GetPropertyValue("PreviewSkinID").ToString())) { int skinFromProfile = int.Parse(HttpContext.Current.Profile.GetPropertyValue("PreviewSkinID").ToString()); if (skinFromProfile > 0) { SkinID = skinFromProfile; } } //Pull the skinid from the current profile else if (HttpContext.Current.Profile != null && CommonLogic.IsInteger(HttpContext.Current.Profile.GetPropertyValue("SkinID").ToString())) { int skinFromProfile = int.Parse(HttpContext.Current.Profile.GetPropertyValue("SkinID").ToString()); if (skinFromProfile > 0) { SkinID = skinFromProfile; } } } //Now save the skinID to the customer record. This is not used OOB. if (ThisCustomer.SkinID != this.SkinID) { ThisCustomer.SkinID = this.SkinID; ThisCustomer.UpdateCustomer(new SqlParameter[] { new SqlParameter("SkinID", this.SkinID) }); } #endregion if (CommonLogic.QueryStringUSInt("affiliateid") > 0) { HttpContext.Current.Profile.SetPropertyValue("AffiliateID", CommonLogic.QueryStringUSInt("affiliateid").ToString()); } if (HttpContext.Current.Request.UrlReferrer != null && HttpContext.Current.Request.UrlReferrer.Authority != HttpContext.Current.Request.Url.Authority) { HttpContext.Current.Profile.SetPropertyValue("Referrer", HttpContext.Current.Request.UrlReferrer.ToString()); } // don't fire disclaimer logic on admin pages if (!AppLogic.IsAdminSite && CommonLogic.QueryStringCanBeDangerousContent("ReturnURL").IndexOf(AppLogic.AppConfig("AdminDir")) == -1 && (AppLogic.AppConfigBool("SiteDisclaimerRequired") && CommonLogic.CookieCanBeDangerousContent("SiteDisclaimerAccepted", true).Length == 0)) { String ThisPageURL = CommonLogic.GetThisPageName(true) + "?" + CommonLogic.ServerVariables("QUERY_STRING"); Response.Redirect("disclaimer.aspx?returnURL=" + Server.UrlEncode(ThisPageURL)); } #region Impersonation bool IGDQueryClear = false; m_IGD = CommonLogic.QueryStringCanBeDangerousContent("IGD").Trim(); if (m_IGD.Length == 0 && CommonLogic.ServerVariables("QUERY_STRING").IndexOf("IGD=") != -1) { m_IGD = String.Empty; // there was IGD={blank} in the query string, so forcefully clear IGD! IGDQueryClear = true; } bool IsStartOfImpersonation = m_IGD.Length != 0; // the url invocation starts the impersonation only! if (!IGDQueryClear && m_IGD.Length == 0) { if (ThisCustomer.IsAdminUser) { // pull out the impersonation IGD from the customer session, if any m_IGD = ThisCustomer.ThisCustomerSession["IGD"]; } } if (IGDQueryClear) { // forcefully clear any IGD for this customer, just to be safe! ThisCustomer.ThisCustomerSession["IGD"] = ""; ThisCustomer.ThisCustomerSession["IGD_EDITINGORDER"] = ""; } Customer PhoneCustomer = null; if (m_IGD.Length != 0) { if (ThisCustomer.IsAdminUser) { try { Guid IGD = new Guid(m_IGD); PhoneCustomer = new Customer(IGD); PhoneCustomer.IsImpersonated = true; } catch { ThisCustomer.ThisCustomerSession["IGD"] = ""; ThisCustomer.ThisCustomerSession["IGD_EDITINGORDER"] = ""; m_IGD = string.Empty; } } if (PhoneCustomer != null && PhoneCustomer.HasCustomerRecord) { int ImpersonationTimeoutInMinutes = AppLogic.AppConfigUSInt("ImpersonationTimeoutInMinutes"); if (ImpersonationTimeoutInMinutes == 0) { ImpersonationTimeoutInMinutes = 20; } if (PhoneCustomer.ThisCustomerSession.LastActivity >= DateTime.Now.AddMinutes(-ImpersonationTimeoutInMinutes)) { ThisCustomer.ThisCustomerSession["IGD"] = IGD; m_AdminCustomer = ThisCustomer; // save the owning admin user doing the impersonation here ThisCustomer = PhoneCustomer; // build the impersonation customer the phone order customer bool IsAdmin = CommonLogic.ApplicationBool("IsAdminSite"); if (!HttpContext.Current.Items.Contains("IsBeingImpersonated")) { HttpContext.Current.Items.Add("IsBeingImpersonated", "true"); } } else { if (HttpContext.Current.Items.Contains("IsBeingImpersonated")) { HttpContext.Current.Items["IsBeingImpersonated"] = "false"; } ThisCustomer.ThisCustomerSession["IGD"] = ""; ThisCustomer.ThisCustomerSession["IGD_EDITINGORDER"] = ""; m_IGD = string.Empty; //Response.Redirect("t-phoneordertimeout.aspx"); Response.Redirect(SE.MakeDriverLink("phoneordertimeout")); } } } #endregion Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(Localization.GetDefaultLocale()); Thread.CurrentThread.CurrentUICulture = new CultureInfo(ThisCustomer.LocaleSetting); m_TemplateName = GetTemplateName(); if (!AppLogic.IsAdminSite) { ThisCustomer = MobileRedirectController.SkinBaseHook(SkinID, ThisCustomer); if (SkinID == Vortx.Data.Config.MobilePlatform.SkinId && MobileHelper.isMobile()) { m_TemplateName = "template.master"; } } //needs to come after the mobile check m_Parser = new Parser(m_EntityHelpers, SkinID, ThisCustomer); String SkinDirectory = String.Empty; String PageTheme = String.Empty; SkinDirectory = "Skin_" + this.SkinID.ToString(); PageTheme = "Skin_" + this.SkinID.ToString(); if (!m_TemplateName.EndsWith(".master", StringComparison.OrdinalIgnoreCase)) { m_TemplateName = m_TemplateName + ".master"; } this.MasterPageFile = "~/App_Templates/" + SkinDirectory + "/" + m_TemplateName; this.Theme = PageTheme; if (!CommonLogic.FileExists(this.MasterPageFile)) { this.SkinID = AppLogic.DefaultSkinID(); m_TemplateName = "template.master"; SkinDirectory = "Skin_" + this.SkinID.ToString(); PageTheme = "Skin_" + this.SkinID.ToString(); this.MasterPageFile = "~/App_Templates/" + SkinDirectory + "/" + m_TemplateName; this.Theme = PageTheme; } } base.OnPreInit(e); }
protected void Page_Load(object sender, System.EventArgs e) { Response.ContentType = "text/xml"; Response.ContentEncoding = new System.Text.UTF8Encoding(); Response.Write("<?xml version=\"1.0\" encoding=\"utf-8\"?>"); Response.Write("<rss version=\"2.0\" xmlns:ror=\"http://rorweb.com/0.1/\">"); Response.Write("<channel>"); Response.Write("<title>Articles</title>"); int SkinID = 1; // not sure what to do about this...google can't invoke different skins easily String StoreLoc = AppLogic.GetStoreHTTPLocation(false); if (AppLogic.AppConfigBool("SiteMap.ShowTopics")) { // DB Topics: using (SqlConnection con = new SqlConnection(DB.GetDBConn())) { con.Open(); using (IDataReader rs = DB.GetRS(string.Format("select * from Topic with (NOLOCK) where {0} Deleted=0 and (SkinID IS NULL or SkinID=0 or SkinID={1}) Order By DisplayOrder, Name ASC", CommonLogic.IIF(AppLogic.IsAdminSite, "", "ShowInSiteMap=1 and "), SkinID.ToString()), con)) { while (rs.Read()) { Response.Write("<item>"); Response.Write("<link>" + XmlCommon.XmlEncode(StoreLoc + SE.MakeDriverLink(DB.RSFieldByLocale(rs, "Name", Localization.GetDefaultLocale()))) + "</link>"); Response.Write("<ror:type>Article</ror:type>"); Response.Write("<ror:descLong>" + XmlCommon.XmlEncode(DB.RSFieldByLocale(rs, "Name", Localization.GetDefaultLocale())) + "</ror:descLong>"); Response.Write("<ror:author></ror:author>"); // not available topics Response.Write("<ror:created>" + DB.RSFieldDateTime(rs, "CreatedOn").Year.ToString() + "-" + DB.RSFieldDateTime(rs, "CreatedOn").Month.ToString() + "-" + DB.RSFieldDateTime(rs, "CreatedOn").Day.ToString() + "</ror:created>"); Response.Write("<ror:published>" + DB.RSFieldDateTime(rs, "CreatedOn").Year.ToString() + "-" + DB.RSFieldDateTime(rs, "CreatedOn").Month.ToString() + "-" + DB.RSFieldDateTime(rs, "CreatedOn").Day.ToString() + "</ror:published>"); Response.Write("<ror:publisher>" + StoreLoc + "</ror:publisher>"); Response.Write("</item>"); } } } // File Topics: // create an array to hold the list of files ArrayList fArray = new ArrayList(); // get information about our initial directory String SFP = CommonLogic.SafeMapPath(CommonLogic.IIF(AppLogic.IsAdminSite, "../", "") + "~/App_Templates/Skin_" + SkinID.ToString() + "/template.htm").Replace("template.htm", ""); DirectoryInfo dirInfo = new DirectoryInfo(SFP); // retrieve array of files & subdirectories FileSystemInfo[] myDir = dirInfo.GetFileSystemInfos(); for (int i = 0; i < myDir.Length; i++) { // check the file attributes // if a subdirectory, add it to the sArray // otherwise, add it to the fArray if (((Convert.ToUInt32(myDir[i].Attributes) & Convert.ToUInt32(FileAttributes.Directory)) > 0)) { } else { bool skipit = false; if (!myDir[i].FullName.EndsWith("htm", StringComparison.InvariantCultureIgnoreCase) || (myDir[i].FullName.IndexOf("TEMPLATE", StringComparison.InvariantCultureIgnoreCase) != -1) || (myDir[i].FullName.IndexOf("AFFILIATE_", StringComparison.InvariantCultureIgnoreCase) != -1) || (myDir[i].FullName.IndexOf(AppLogic.ro_PMMicropay, StringComparison.InvariantCultureIgnoreCase) != -1)) { skipit = true; } if (!skipit) { fArray.Add(Path.GetFileName(myDir[i].FullName)); } } } if (fArray.Count != 0) { // sort the files alphabetically fArray.Sort(0, fArray.Count, null); for (int i = 0; i < fArray.Count; i++) { Response.Write("<item>"); Response.Write("<link>" + StoreLoc + SE.MakeDriverLink(fArray[i].ToString().Replace(".htm", "")) + "</link>"); Response.Write("<ror:type>Article</ror:type>"); Response.Write("<ror:descLong></ror:descLong>"); // not available for file based topics Response.Write("<ror:author></ror:author>"); // not available for file based topics Response.Write("<ror:created></ror:created>"); // not available for file based topics Response.Write("<ror:published></ror:published>"); // not available for file based topics Response.Write("<ror:publisher>" + StoreLoc + "</ror:publisher>"); Response.Write("</item>"); } } } Response.Write("</channel>"); Response.Write("</rss>"); }
protected void Page_Load(object sender, EventArgs e) { MobileHelper.RedirectPageWhenMobileIsDisabled("~/emailproduct.aspx", ThisCustomer); ProductID = CommonLogic.QueryStringUSInt("ProductID"); if (AppLogic.AppConfigBool("GoNonSecureAgain")) { GoNonSecureAgain(); } // DOS attack prevention: if (AppLogic.OnLiveServer() && (Request.UrlReferrer == null || Request.UrlReferrer.Authority != Request.Url.Authority)) { Response.Redirect(SE.MakeDriverLink("EmailError")); } if (ProductID == 0) { HttpContext.Current.Server.Transfer("pagenotfound.aspx"); } if (AppLogic.ProductHasBeenDeleted(ProductID)) { HttpContext.Current.Server.Transfer("pagenotfound.aspx"); } EntityHelper CategoryHelper = AppLogic.LookupHelper("Category", AppLogic.StoreID()); baseSkinID = (Page as SkinBase).SkinID; using (SqlConnection conn = DB.dbConn()) { conn.Open(); using (IDataReader rs = DB.GetRS("select p.*, pv.name variantname from product p with (NOLOCK) join productvariant pv with (NOLOCK) on p.ProductID = pv.ProductID and pv.isdefault = 1 where p.ProductID=" + ProductID.ToString(), conn)) { if (!rs.Read()) { Response.Redirect("default.aspx"); } SEName = DB.RSField(rs, "SEName"); ProductName = DB.RSFieldByLocale(rs, "Name", ThisCustomer.LocaleSetting); VariantName = DB.RSFieldByLocale(rs, "VariantName", ThisCustomer.LocaleSetting); RequiresReg = DB.RSFieldBool(rs, "RequiresRegistration"); ProductDescription = DB.RSFieldByLocale(rs, "Description", ThisCustomer.LocaleSetting); if (AppLogic.ReplaceImageURLFromAssetMgr) { ProductDescription = ProductDescription.Replace("../images", "images"); } String FileDescription = new ProductDescriptionFile(ProductID, ThisCustomer.LocaleSetting, baseSkinID).Contents; if (FileDescription.Length != 0) { ProductDescription += "<div align=\"left\">" + FileDescription + "</div>"; } } } String SourceEntityInstanceName = String.Empty; SourceEntity = Profile.LastViewedEntityName; SourceEntityInstanceName = Profile.LastViewedEntityInstanceName; SourceEntityID = int.Parse(CommonLogic.IIF(CommonLogic.IsInteger(Profile.LastViewedEntityInstanceID), Profile.LastViewedEntityInstanceID, "0"));; // validate that source entity id is actually valid for this product: if (SourceEntityID != 0) { String sqlx = "select count(*) as N from dbo.productentity with (NOLOCK) where ProductID=" + ProductID.ToString() + " and EntityID=" + SourceEntityID.ToString() + " and EntityType = " + DB.SQuote(SourceEntity); if (DB.GetSqlN(sqlx) == 0) { SourceEntityID = 0; } } // we had no entity context coming in, try to find a category context for this product, so they have some context if possible: if (SourceEntityID == 0) { SourceEntityID = EntityHelper.GetProductsFirstEntity(ProductID, EntityDefinitions.readonly_CategoryEntitySpecs.m_EntityName); if (SourceEntityID > 0) { CategoryID = SourceEntityID; CategoryName = CategoryHelper.GetEntityName(CategoryID, ThisCustomer.LocaleSetting); Profile.LastViewedEntityName = EntityDefinitions.readonly_CategoryEntitySpecs.m_EntityName; Profile.LastViewedEntityInstanceID = CategoryID.ToString(); Profile.LastViewedEntityInstanceName = CategoryName; SourceEntity = EntityDefinitions.readonly_CategoryEntitySpecs.m_EntityName; SourceEntityInstanceName = CategoryName; } } // we had no entity context coming in, try to find a section context for this product, so they have some context if possible: if (SourceEntityID == 0) { SourceEntityID = EntityHelper.GetProductsFirstEntity(ProductID, EntityDefinitions.readonly_SectionEntitySpecs.m_EntityName); if (SourceEntityID > 0) { SectionID = SourceEntityID; SectionName = CategoryHelper.GetEntityName(SectionID, ThisCustomer.LocaleSetting); Profile.LastViewedEntityName = EntityDefinitions.readonly_SectionEntitySpecs.m_EntityName; Profile.LastViewedEntityInstanceID = SectionID.ToString(); Profile.LastViewedEntityInstanceName = SectionName; SourceEntity = EntityDefinitions.readonly_SectionEntitySpecs.m_EntityName; SourceEntityInstanceName = SectionName; } } // we had no entity context coming in, try to find a Manufacturer context for this product, so they have some context if possible: if (SourceEntityID == 0) { SourceEntityID = EntityHelper.GetProductsFirstEntity(ProductID, EntityDefinitions.readonly_ManufacturerEntitySpecs.m_EntityName); if (SourceEntityID > 0) { ManufacturerID = SourceEntityID; ManufacturerName = CategoryHelper.GetEntityName(ManufacturerID, ThisCustomer.LocaleSetting); Profile.LastViewedEntityName = EntityDefinitions.readonly_ManufacturerEntitySpecs.m_EntityName; Profile.LastViewedEntityInstanceID = ManufacturerID.ToString(); Profile.LastViewedEntityInstanceName = ManufacturerName; SourceEntity = EntityDefinitions.readonly_ManufacturerEntitySpecs.m_EntityName; SourceEntityInstanceName = ManufacturerName; } } // build up breadcrumb if we need: (Page as SkinBase).SectionTitle = Breadcrumb.GetProductBreadcrumb(ProductID, ProductName, SourceEntity, SourceEntityID, ThisCustomer); reqToAddress.ErrorMessage = AppLogic.GetString("emailproduct.aspx.13", baseSkinID, ThisCustomer.LocaleSetting); regexToAddress.ErrorMessage = AppLogic.GetString("emailproduct.aspx.14", baseSkinID, ThisCustomer.LocaleSetting); reqFromAddress.ErrorMessage = AppLogic.GetString("emailproduct.aspx.16", baseSkinID, ThisCustomer.LocaleSetting); regexFromAddress.ErrorMessage = AppLogic.GetString("emailproduct.aspx.17", baseSkinID, ThisCustomer.LocaleSetting); if (!this.IsPostBack) { InitializePageContent(); } }
protected void Page_Load(object sender, System.EventArgs e) { if (AppLogic.AppConfigBool("GoNonSecureAgain")) { SkinBase.GoNonSecureAgain(); } ProductID = CommonLogic.QueryStringUSInt("ProductID"); CategoryID = CommonLogic.QueryStringUSInt("CategoryID"); SectionID = CommonLogic.QueryStringUSInt("SectionID"); ManufacturerID = CommonLogic.QueryStringUSInt("ManufacturerID"); DistributorID = CommonLogic.QueryStringUSInt("DistributorID"); GenreID = CommonLogic.QueryStringUSInt("GenreID"); VectorID = CommonLogic.QueryStringUSInt("VectorID"); if (ProductID == 0) { if (IsAddToCartPostBack) { int PackID = 0; int packProductID = 0; int packVariantID = 0; int packQuantity = 0; int packProductTypeID = 0; bool FromCart = false; int packCartRecID = 0; String ChosenColor = String.Empty; String ChosenColorSKUModifier = String.Empty; String ChosenSize = String.Empty; String ChosenSizeSKUModifier = String.Empty; String color = string.Empty; String size = string.Empty; String TextOption = CommonLogic.FormCanBeDangerousContent("TextOption"); for (int i = 0; i <= HttpContext.Current.Request.Form.Count - 1; i++) { if (HttpContext.Current.Request.Form.Keys[i].StartsWith("ProductID", StringComparison.InvariantCultureIgnoreCase)) { packProductID = Localization.ParseUSInt(CommonLogic.FormCanBeDangerousContent("__EVENTARGUMENT").Split('_')[1]); } if (HttpContext.Current.Request.Form.Keys[i].StartsWith("VariantID", StringComparison.InvariantCultureIgnoreCase)) { packVariantID = Localization.ParseUSInt(CommonLogic.FormCanBeDangerousContent("__EVENTARGUMENT").Split('_')[2]); } if (HttpContext.Current.Request.Form.Keys[i].StartsWith("PackID", StringComparison.InvariantCultureIgnoreCase)) { PackID = Localization.ParseUSInt(CommonLogic.FormCanBeDangerousContent(HttpContext.Current.Request.Form.Keys[i])); if (CommonLogic.FormCanBeDangerousContent(HttpContext.Current.Request.Form.Keys[i]).Contains(",") && PackID == 0) { PackID = Localization.ParseUSInt(CommonLogic.FormCanBeDangerousContent(HttpContext.Current.Request.Form.Keys[i]).Split(',')[0]); } } if (HttpContext.Current.Request.Form.Keys[i].StartsWith("Quantity", StringComparison.InvariantCultureIgnoreCase) && !HttpContext.Current.Request.Form.Keys[i].StartsWith("Quantity_vldt", StringComparison.InvariantCultureIgnoreCase)) { if (Localization.ParseUSInt(HttpContext.Current.Request.Form.Keys[i].Split('_')[2]) == packVariantID) { packQuantity = Localization.ParseUSInt(CommonLogic.FormCanBeDangerousContent(HttpContext.Current.Request.Form.Keys[i])); } } if (HttpContext.Current.Request.Form.Keys[i].StartsWith("CartRecID", StringComparison.InvariantCultureIgnoreCase)) { packCartRecID = Localization.ParseUSInt(CommonLogic.FormCanBeDangerousContent(HttpContext.Current.Request.Form.Keys[i])); } if (HttpContext.Current.Request.Form.Keys[i].StartsWith("Color", StringComparison.InvariantCultureIgnoreCase)) { if (Localization.ParseUSInt(HttpContext.Current.Request.Form.Keys[i].Split('_')[2]) == packVariantID) { color = CommonLogic.FormCanBeDangerousContent(HttpContext.Current.Request.Form.Keys[i]).ToString(); } } if (HttpContext.Current.Request.Form.Keys[i].StartsWith("Size", StringComparison.InvariantCultureIgnoreCase)) { if (Localization.ParseUSInt(HttpContext.Current.Request.Form.Keys[i].Split('_')[2]) == packVariantID) { size = CommonLogic.FormCanBeDangerousContent(HttpContext.Current.Request.Form.Keys[i]).ToString(); } } if (HttpContext.Current.Request.Form.Keys[i].StartsWith("ProductTypeID", StringComparison.InvariantCultureIgnoreCase)) { if (Localization.ParseUSInt(HttpContext.Current.Request.Form.Keys[i].Split('_')[2]) == packVariantID) { packProductTypeID = Localization.ParseUSInt(CommonLogic.FormCanBeDangerousContent(HttpContext.Current.Request.Form.Keys[i])); } } } ThisCustomer.RequireCustomerRecord(); if (packQuantity == 0) { packQuantity = 1; } FromCart = (packCartRecID > 0); if (color.Length != 0) { String[] ColorSel = color.Split(','); try { ChosenColor = ColorSel[0]; } catch { } try { ChosenColorSKUModifier = ColorSel[1]; } catch { } } if (ChosenColor.Length != 0) { ThisCustomer.ThisCustomerSession["ChosenColor"] = ChosenColor; } if (size.Length != 0) { String[] SizeSel = size.Split(','); try { ChosenSize = SizeSel[0]; } catch { } try { ChosenSizeSKUModifier = SizeSel[1]; } catch { } } if (ChosenSize.Length != 0) { ThisCustomer.ThisCustomerSession["ChosenSize"] = ChosenSize; } if (packQuantity > 0) { // add to custom cart: if (FromCart) { CustomCart.AddItem(PackID, packProductID, packVariantID, packQuantity, ChosenColor, ChosenColorSKUModifier, ChosenSize, ChosenSizeSKUModifier, packCartRecID, ThisCustomer, CartTypeEnum.ShoppingCart); } else { CustomCart cart = new CustomCart(ThisCustomer, PackID, 1, CartTypeEnum.ShoppingCart); cart.AddItem(packProductID, packVariantID, packQuantity, ChosenColor, ChosenColorSKUModifier, ChosenSize, ChosenSizeSKUModifier); } } if (CommonLogic.QueryStringCanBeDangerousContent("UpdateCartPack") == "") { String url = "pb.aspx?type=" + packProductTypeID.ToString() + "&PackID=" + PackID.ToString() + "&ProductID=" + packProductID.ToString() + "&cartrecid=" + packCartRecID; Response.Redirect(url + CommonLogic.IIF(FromCart, "?cartrecid=" + packCartRecID.ToString(), "")); Response.Redirect(url); } else { Response.Redirect(ResolveClientUrl("~/shoppingcart.aspx")); } } } String ActualSEName = string.Empty; using (SqlConnection dbconn = new SqlConnection(DB.GetDBConn())) { dbconn.Open(); using (IDataReader rs = DB.GetRS(string.Format("select * from Product a with (NOLOCK) inner join (select a.ProductID, b.StoreID from Product a with (nolock) left join ProductStore b " + "with (NOLOCK) on a.ProductID = b.ProductID) b on a.ProductID = b.ProductID where Deleted=0 and a.ProductID={0} and ({1}=0 or StoreID={2})", + ProductID, CommonLogic.IIF(AppLogic.GlobalConfigBool("AllowProductFiltering") == true, 1, 0), AppLogic.StoreID()), dbconn)) { if (!rs.Read()) { Response.Redirect(SE.MakeDriverLink("ProductNotFound")); } else { bool a = DB.RSFieldBool(rs, "Published"); if (!a) { Response.Redirect(SE.MakeDriverLink("ProductNotFound")); } } String SENameINURL = CommonLogic.QueryStringCanBeDangerousContent("SEName"); ActualSEName = SE.MungeName(DB.RSField(rs, "SEName")); if (ActualSEName != SENameINURL) { String NewURL = AppLogic.GetStoreHTTPLocation(false, false) + SE.MakeProductLink(ProductID, ActualSEName); string QStr = "?"; bool first = true; for (int i = 0; i < Request.QueryString.Count; i++) { string key = Request.QueryString.GetKey(i); if ((key.Equals("productid", StringComparison.InvariantCultureIgnoreCase)) == false && (key.Equals("sename", StringComparison.InvariantCultureIgnoreCase)) == false) { if (!first) { QStr += "&"; } QStr += key + "=" + Request.QueryString[i]; first = false; } } if (QStr.Length > 1) { NewURL += QStr; } HttpContext.Current.Response.Write("<html><head><title>Object Moved</title></head><body><b>Object moved to <a href=\"" + NewURL + "\">HERE</a></b></body></html>"); Response.Status = "301 Moved Permanently"; Response.AddHeader("Location", NewURL); HttpContext.Current.Response.End(); } #region Vortx Mobile Xml Package Modification m_XmlPackage = Vortx.MobileFramework.MobileXmlPackageController.XmlPackageHook(DB.RSField(rs, "XmlPackage").ToLowerInvariant(), ThisCustomer); #endregion IsAKit = DB.RSFieldBool(rs, "IsAKit"); IsAPack = DB.RSFieldBool(rs, "IsAPack"); if (m_XmlPackage.Length == 0) { if (IsAKit) { m_XmlPackage = AppLogic.ro_DefaultProductKitXmlPackage; // provide a default } else if (IsAPack) { m_XmlPackage = AppLogic.ro_DefaultProductPackXmlPackage; // provide a default } else { m_XmlPackage = AppLogic.ro_DefaultProductXmlPackage; // provide a default } } RequiresReg = DB.RSFieldBool(rs, "RequiresRegistration"); ProductName = DB.RSFieldByLocale(rs, "Name", ThisCustomer.LocaleSetting); CategoryHelper = AppLogic.LookupHelper("Category", 0); SectionHelper = AppLogic.LookupHelper("Section", 0); ManufacturerHelper = AppLogic.LookupHelper("Manufacturer", 0); DistributorHelper = AppLogic.LookupHelper("Distributor", 0); GenreHelper = AppLogic.LookupHelper("Genre", 0); VectorHelper = AppLogic.LookupHelper("Vector", 0); String SEName = String.Empty; if (DB.RSFieldByLocale(rs, "SETitle", ThisCustomer.LocaleSetting).Length == 0) { SETitle = Security.HtmlEncode(AppLogic.AppConfig("StoreName") + " - " + ProductName); } else { SETitle = DB.RSFieldByLocale(rs, "SETitle", ThisCustomer.LocaleSetting); } if (DB.RSFieldByLocale(rs, "SEDescription", ThisCustomer.LocaleSetting).Length == 0) { SEDescription = Security.HtmlEncode(ProductName); } else { SEDescription = DB.RSFieldByLocale(rs, "SEDescription", ThisCustomer.LocaleSetting); } if (DB.RSFieldByLocale(rs, "SEKeywords", ThisCustomer.LocaleSetting).Length == 0) { SEKeywords = Security.HtmlEncode(ProductName); } else { SEKeywords = DB.RSFieldByLocale(rs, "SEKeywords", ThisCustomer.LocaleSetting); } SENoScript = DB.RSFieldByLocale(rs, "SENoScript", ThisCustomer.LocaleSetting); } } //Log all views of unknown and registered customer if (!AppLogic.ProductIsMLExpress() && (AppLogic.AppConfigBool("DynamicRelatedProducts.Enabled") || AppLogic.AppConfigBool("RecentlyViewedProducts.Enabled"))) { ThisCustomer.LogProductView(ProductID); } if (IsAKit && !Vortx.MobileFramework.MobileHelper.isMobile()) { Server.Transfer(ResolveClientUrl("~/kitproduct.aspx"), true); return; } else if (IsAKit && Vortx.MobileFramework.MobileHelper.isMobile()) { Server.Transfer(ResolveClientUrl("~/mobilekitproduct.aspx"), true); return; } CategoryName = CategoryHelper.GetEntityName(CategoryID, ThisCustomer.LocaleSetting); SectionName = SectionHelper.GetEntityName(SectionID, ThisCustomer.LocaleSetting); ManufacturerName = ManufacturerHelper.GetEntityName(ManufacturerID, ThisCustomer.LocaleSetting); DistributorName = DistributorHelper.GetEntityName(DistributorID, ThisCustomer.LocaleSetting); GenreName = GenreHelper.GetEntityName(GenreID, ThisCustomer.LocaleSetting); VectorName = VectorHelper.GetEntityName(VectorID, ThisCustomer.LocaleSetting); String SourceEntityInstanceName = String.Empty; if (ManufacturerID != 0) { Profile.LastViewedEntityName = EntityDefinitions.readonly_ManufacturerEntitySpecs.m_EntityName; Profile.LastViewedEntityInstanceID = ManufacturerID.ToString(); Profile.LastViewedEntityInstanceName = ManufacturerName; String NewURL = AppLogic.GetStoreHTTPLocation(false, false) + SE.MakeProductLink(ProductID, ActualSEName); HttpContext.Current.Response.Write("<html><head><title>Object Moved</title></head><body><b>Object moved to <a href=\"" + NewURL + "\">HERE</a></b></body></html>"); Response.Status = "301 Moved Permanently"; Response.AddHeader("Location", NewURL); HttpContext.Current.Response.End(); } else if (DistributorID != 0) { Profile.LastViewedEntityName = EntityDefinitions.readonly_DistributorEntitySpecs.m_EntityName; Profile.LastViewedEntityInstanceID = DistributorID.ToString(); Profile.LastViewedEntityInstanceName = DistributorName; String NewURL = AppLogic.GetStoreHTTPLocation(false, false) + SE.MakeProductLink(ProductID, ActualSEName); HttpContext.Current.Response.Write("<html><head><title>Object Moved</title></head><body><b>Object moved to <a href=\"" + NewURL + "\">HERE</a></b></body></html>"); Response.Status = "301 Moved Permanently"; Response.AddHeader("Location", NewURL); HttpContext.Current.Response.End(); } else if (GenreID != 0) { Profile.LastViewedEntityName = EntityDefinitions.readonly_GenreEntitySpecs.m_EntityName; Profile.LastViewedEntityInstanceID = GenreID.ToString(); Profile.LastViewedEntityInstanceName = GenreName; String NewURL = AppLogic.GetStoreHTTPLocation(false, false) + SE.MakeProductLink(ProductID, ActualSEName); HttpContext.Current.Response.Write("<html><head><title>Object Moved</title></head><body><b>Object moved to <a href=\"" + NewURL + "\">HERE</a></b></body></html>"); Response.Status = "301 Moved Permanently"; Response.AddHeader("Location", NewURL); HttpContext.Current.Response.End(); } else if (VectorID != 0) { Profile.LastViewedEntityName = EntityDefinitions.readonly_VectorEntitySpecs.m_EntityName; Profile.LastViewedEntityInstanceID = VectorID.ToString(); Profile.LastViewedEntityInstanceName = VectorName; String NewURL = AppLogic.GetStoreHTTPLocation(false, false) + SE.MakeProductLink(ProductID, ActualSEName); HttpContext.Current.Response.Write("<html><head><title>Object Moved</title></head><body><b>Object moved to <a href=\"" + NewURL + "\">HERE</a></b></body></html>"); Response.Status = "301 Moved Permanently"; Response.AddHeader("Location", NewURL); HttpContext.Current.Response.End(); } else if (CategoryID != 0) { Profile.LastViewedEntityName = EntityDefinitions.readonly_CategoryEntitySpecs.m_EntityName; Profile.LastViewedEntityInstanceID = CategoryID.ToString(); Profile.LastViewedEntityInstanceName = CategoryName; String NewURL = AppLogic.GetStoreHTTPLocation(false, false) + SE.MakeProductLink(ProductID, ActualSEName); HttpContext.Current.Response.Write("<html><head><title>Object Moved</title></head><body><b>Object moved to <a href=\"" + NewURL + "\">HERE</a></b></body></html>"); Response.Status = "301 Moved Permanently"; Response.AddHeader("Location", NewURL); HttpContext.Current.Response.End(); } else if (SectionID != 0) { Profile.LastViewedEntityName = EntityDefinitions.readonly_SectionEntitySpecs.m_EntityName; Profile.LastViewedEntityInstanceID = SectionID.ToString(); Profile.LastViewedEntityInstanceName = SectionName; String NewURL = AppLogic.GetStoreHTTPLocation(false, false) + SE.MakeProductLink(ProductID, ActualSEName); HttpContext.Current.Response.Write("<html><head><title>Object Moved</title></head><body><b>Object moved to <a href=\"" + NewURL + "\">HERE</a></b></body></html>"); Response.Status = "301 Moved Permanently"; Response.AddHeader("Location", NewURL); HttpContext.Current.Response.End(); } SourceEntity = Profile.LastViewedEntityName; SourceEntityInstanceName = Profile.LastViewedEntityInstanceName; SourceEntityID = int.Parse(CommonLogic.IIF(CommonLogic.IsInteger(Profile.LastViewedEntityInstanceID), Profile.LastViewedEntityInstanceID, "0")); // validate that source entity id is actually valid for this product: if (SourceEntityID != 0) { String sqlx = string.Format("select count(*) as N from productentity a with (nolock) inner join (select distinct a.entityid, a.EntityType from productentity a with (nolock) left join EntityStore b with (nolock) " + "on a.EntityID = b.EntityID where ({0} = 0 or StoreID = {1})) b on a.EntityID = b.EntityID and a.EntityType=b.EntityType where ProductID = {2} and a.EntityID = {3} and a.EntityType = {4}" , CommonLogic.IIF(AppLogic.GlobalConfigBool("AllowEntityFiltering") == true, 1, 0), AppLogic.StoreID(), ProductID, SourceEntityID, DB.SQuote(SourceEntity)); if (DB.GetSqlN(sqlx) == 0) { SourceEntityID = 0; } } // we had no entity context coming in, try to find a category context for this product, so they have some context if possible: if (SourceEntityID == 0) { SourceEntityID = EntityHelper.GetProductsFirstEntity(ProductID, EntityDefinitions.readonly_CategoryEntitySpecs.m_EntityName); if (SourceEntityID > 0) { CategoryID = SourceEntityID; CategoryName = CategoryHelper.GetEntityName(CategoryID, ThisCustomer.LocaleSetting); Profile.LastViewedEntityName = EntityDefinitions.readonly_CategoryEntitySpecs.m_EntityName; Profile.LastViewedEntityInstanceID = CategoryID.ToString(); Profile.LastViewedEntityInstanceName = CategoryName; SourceEntity = EntityDefinitions.readonly_CategoryEntitySpecs.m_EntityName; SourceEntityInstanceName = CategoryName; } } // we had no entity context coming in, try to find a section context for this product, so they have some context if possible: if (SourceEntityID == 0) { SourceEntityID = EntityHelper.GetProductsFirstEntity(ProductID, EntityDefinitions.readonly_SectionEntitySpecs.m_EntityName); if (SourceEntityID > 0) { SectionID = SourceEntityID; SectionName = CategoryHelper.GetEntityName(SectionID, ThisCustomer.LocaleSetting); Profile.LastViewedEntityName = EntityDefinitions.readonly_SectionEntitySpecs.m_EntityName; Profile.LastViewedEntityInstanceID = SectionID.ToString(); Profile.LastViewedEntityInstanceName = SectionName; SourceEntity = EntityDefinitions.readonly_SectionEntitySpecs.m_EntityName; SourceEntityInstanceName = SectionName; } } // we had no entity context coming in, try to find a Manufacturer context for this product, so they have some context if possible: if (SourceEntityID == 0) { SourceEntityID = EntityHelper.GetProductsFirstEntity(ProductID, EntityDefinitions.readonly_ManufacturerEntitySpecs.m_EntityName); if (SourceEntityID > 0) { ManufacturerID = SourceEntityID; ManufacturerName = CategoryHelper.GetEntityName(ManufacturerID, ThisCustomer.LocaleSetting); Profile.LastViewedEntityName = EntityDefinitions.readonly_ManufacturerEntitySpecs.m_EntityName; Profile.LastViewedEntityInstanceID = ManufacturerID.ToString(); Profile.LastViewedEntityInstanceName = ManufacturerName; SourceEntity = EntityDefinitions.readonly_ManufacturerEntitySpecs.m_EntityName; SourceEntityInstanceName = ManufacturerName; } } // build up breadcrumb if we need: SectionTitle = Breadcrumb.GetProductBreadcrumb(ProductID, ProductName, SourceEntity, SourceEntityID, ThisCustomer); //Reset LastViewedEntityInstanceID to zero if no entities are mapped to the product so the left nav will render properly. if (SourceEntityID <= 0) { HttpContext.Current.Profile.SetPropertyValue("LastViewedEntityInstanceID", "0"); } if (RequiresReg && !ThisCustomer.IsRegistered) { m_PageOutput += "<br/><br/><br/><br/><b>" + AppLogic.GetString("showproduct.aspx.1", SkinID, ThisCustomer.LocaleSetting) + "</b><br/><br/><br/><a href=\"signin.aspx?returnurl=" + CommonLogic.GetThisPageName(false) + "?ProductID=" + ProductID.ToString() + CommonLogic.IIF(CommonLogic.ServerVariables("QUERY_STRING").Trim().Length > 0, "&" + Security.HtmlEncode(Security.UrlEncode(CommonLogic.ServerVariables("QUERY_STRING"))), String.Empty) + "\">" + AppLogic.GetString("showproduct.aspx.2", SkinID, ThisCustomer.LocaleSetting) + "</a> " + AppLogic.GetString("showproduct.aspx.3", SkinID, ThisCustomer.LocaleSetting); } else { AppLogic.eventHandler("ViewProductPage").CallEvent("&ViewProductPage=true"); // check if the postback was caused by an addtocart button if (this.IsPostBack && this.IsAddToCartPostBack) { HandleAddToCart(); return; } DB.ExecuteSQL("update product set Looks=Looks+1 where ProductID=" + ProductID.ToString()); m_PageOutput = "<!-- XmlPackage: " + m_XmlPackage + " -->\n"; if (m_XmlPackage.Length == 0) { m_PageOutput += "<p><b><font color=red>XmlPackage format was chosen, but no XmlPackage was specified!</font></b></p>"; } else { using (XmlPackage2 p = new XmlPackage2(m_XmlPackage, ThisCustomer, SkinID, "", "EntityName=" + SourceEntity + "&EntityID=" + SourceEntityID.ToString() + CommonLogic.IIF(CommonLogic.ServerVariables("QUERY_STRING").IndexOf("cartrecid") != -1, "&cartrecid=" + CommonLogic.QueryStringUSInt("cartrecid").ToString(), "&showproduct=1"), String.Empty, true)) { m_PageOutput += AppLogic.RunXmlPackage(p, base.GetParser, ThisCustomer, SkinID, true, true); if (p.SectionTitle != "") { SectionTitle = p.SectionTitle; } if (p.SETitle != "") { SETitle = p.SETitle; } if (p.SEDescription != "") { SEDescription = p.SEDescription; } if (p.SEKeywords != "") { SEKeywords = p.SEKeywords; } if (p.SENoScript != "") { SENoScript = p.SENoScript; } } } } litOutput.Text = m_PageOutput; }
protected void Page_Load(object sender, System.EventArgs e) { if (AppLogic.AppConfigBool("GoNonSecureAgain")) { SkinBase.GoNonSecureAgain(); } PackID = CommonLogic.QueryStringUSInt("PackID"); if (PackID == 0) { Response.Redirect("default.aspx"); } if (AppLogic.ProductHasBeenDeleted(PackID)) { Response.Redirect(SE.MakeDriverLink("ProductNotFound")); } m_CategoryHelper = AppLogic.LookupHelper(base.EntityHelpers, "Category"); m_SectionHelper = AppLogic.LookupHelper(base.EntityHelpers, "Section"); CategoryID = CommonLogic.QueryStringUSInt("CategoryID"); SectionID = CommonLogic.QueryStringUSInt("SectionID"); if (CategoryID == 0 && SectionID == 0) { // no category or section passed in, pick first one that this product is mapped to: String tmpS = m_CategoryHelper.GetObjectEntities(PackID, true); if (tmpS.Length != 0) { String[] catIDs = tmpS.Split(','); CategoryID = Localization.ParseUSInt(catIDs[0]); } else { String tmpS2 = m_SectionHelper.GetObjectEntities(PackID, true); if (tmpS2.Length != 0) { String[] secIDs = tmpS2.Split(','); SectionID = Localization.ParseUSInt(secIDs[0]); } } } CategoryName = m_CategoryHelper.GetEntityName(CategoryID, ThisCustomer.LocaleSetting); SectionName = m_SectionHelper.GetEntityName(SectionID, ThisCustomer.LocaleSetting); using (SqlConnection conn = DB.dbConn()) { conn.Open(); using (IDataReader rs = DB.GetRS("select product.*,productvariant.price,productvariant.points,productvariant.saleprice from product with (NOLOCK) left outer join productvariant with (NOLOCK) on product.productid=productvariant.productid where productvariant.deleted=0 and productvariant.published=1 and product.ProductID=" + PackID.ToString(), conn)) { if (!rs.Read()) { Response.Redirect("default.aspx"); } base.ContentsBGColor = DB.RSField(rs, "ContentsBGColor"); base.PageBGColor = DB.RSField(rs, "PageBGColor"); base.GraphicsColor = DB.RSField(rs, "GraphicsColor"); SpecsInline = DB.RSFieldBool(rs, "SpecsInline"); SpecTitle = DB.RSFieldByLocale(rs, "SpecTitle", ThisCustomer.LocaleSetting); Points = DB.RSFieldInt(rs, "Points"); ProductName = DB.RSFieldByLocale(rs, "Name", ThisCustomer.LocaleSetting); ProductDescription = DB.RSFieldByLocale(rs, "Description", ThisCustomer.LocaleSetting); if (AppLogic.ReplaceImageURLFromAssetMgr) { ProductDescription = ProductDescription.Replace("../images", "images"); } FileDescription = new ProductDescriptionFile(PackID, ThisCustomer.LocaleSetting, SkinID).Contents; if (FileDescription.Length != 0) { ProductDescription += "<br/>" + FileDescription; } String ProductPicture = String.Empty; bool m_WatermarksEnabled = AppLogic.AppConfigBool("Watermark.Enabled"); if (m_WatermarksEnabled) { ProductPicture = String.Format("watermark.axd?productid={0}&size=medium", PackID.ToString()); } else { ProductPicture = AppLogic.LookupImage("Product", PackID, "medium", ThisCustomer.SkinID, ThisCustomer.LocaleSetting); } LargePic = AppLogic.LookupImage("Product", PackID, "large", ThisCustomer.SkinID, ThisCustomer.LocaleSetting); HasLargePic = (LargePic.Length != 0); String LargePicWatermarked = String.Format("watermark.axd?productid={0}&size=large", PackID.ToString()); String LargePicForPopup = LargePic; if (m_WatermarksEnabled) { LargePicForPopup = Server.UrlEncode(LargePicWatermarked); } RequiresReg = DB.RSFieldBool(rs, "RequiresRegistration"); BasePrice = System.Decimal.Zero; if (DB.RSFieldDecimal(rs, "SalePrice") != System.Decimal.Zero) { BasePrice = DB.RSFieldDecimal(rs, "SalePrice"); } else { BasePrice = DB.RSFieldDecimal(rs, "Price"); } } } if (RequiresReg && !ThisCustomer.IsRegistered) { litOutput.Text = "<br/><br/><br/><br/><b>" + AppLogic.GetString("dyop.aspx.1", SkinID, ThisCustomer.LocaleSetting) + "</b><br/><br/><br/><a href=\"signin.aspx?returnurl=showproduct.aspx?" + Server.HtmlEncode(Server.UrlEncode(CommonLogic.ServerVariables("QUERY_STRING"))) + "\">" + AppLogic.GetString("dyop.aspx.2", SkinID, ThisCustomer.LocaleSetting) + "</a> " + AppLogic.GetString("dyop.aspx.3", SkinID, ThisCustomer.LocaleSetting); } else { PresetPackPrice = System.Decimal.Zero; PresetPackProducts = String.Empty; AppLogic.PresetPack(ThisCustomer, PackID, CartTypeEnum.ShoppingCart, out PresetPackPrice, out PresetPackProducts); m_XmlPackage = AppLogic.GetProductXmlPackage(PackID); using (XmlPackage2 p = new XmlPackage2(m_XmlPackage, ThisCustomer, SkinID, String.Empty, String.Empty, String.Empty, true)) { litOutput.Text = AppLogic.RunXmlPackage(p, null, ThisCustomer, SkinID, false, false); this.SETitle = p.SETitle; this.SEDescription = p.SEDescription; this.SEKeywords = p.SEKeywords; this.SENoScript = p.SENoScript; this.SectionTitle = p.SectionTitle; } } }
private void Page_Load(object sender, System.EventArgs e) { Response.CacheControl = "private"; Response.Expires = -1; Response.AddHeader("pragma", "no-cache"); Response.Cache.SetAllowResponseInBrowserHistory(false); bool PhoneOrder = CommonLogic.IIF(Customer.Current.ThisCustomerSession["IGD"].Length > 0, true, false); Customer ThisCustomer = AppLogic.GetCurrentCustomer(); if (ThisCustomer == null) { //Response.Redirect("t-phoneordertimeout.aspx"); Response.Redirect(SE.MakeDriverLink("phoneordertimeout")); } ThisCustomer.RequireCustomerRecord(); int CustomerID = ThisCustomer.CustomerID; String Payload = ThisCustomer.ThisCustomerSession["Cardinal.Payload"]; String PaRes = CommonLogic.FormCanBeDangerousContent("PaRes"); String TransactionID = ThisCustomer.ThisCustomerSession["Cardinal.TransactionID"]; int OrderNumber = ThisCustomer.ThisCustomerSession.SessionUSInt("Cardinal.OrderNumber"); String ReturnURL = String.Empty; if (ShoppingCart.CartIsEmpty(CustomerID, CartTypeEnum.ShoppingCart)) { ReturnURL = "ShoppingCart.aspx"; } ErrorMessage err; if (ReturnURL.Length == 0) { if (OrderNumber == 0) { err = new ErrorMessage(Server.HtmlEncode(AppLogic.GetString("cardinalecheck_process.aspx.1", 1, Localization.GetDefaultLocale()))); ReturnURL = "checkoutpayment.aspx?error=1&errormsg=" + err.MessageId; } } if (ReturnURL.Length == 0) { if (Payload.Length == 0 || TransactionID.Length == 0) { err = new ErrorMessage(Server.HtmlEncode(AppLogic.GetString("cardinalecheck_process.aspx.1", 1, Localization.GetDefaultLocale()))); ReturnURL = "checkoutpayment.aspx?error=1&errormsg=" + err.MessageId; } } String PAResStatus = String.Empty; String CardinalOrderId = String.Empty; String SignatureVerification = String.Empty; String ErrorNo = String.Empty; String ErrorDesc = String.Empty; if (ReturnURL.Length == 0) { String CardinalAuthenticateResult = String.Empty; String AuthResult = Cardinal.MyECheckAuthenticate(OrderNumber, PaRes, TransactionID, out CardinalOrderId, out PAResStatus, out SignatureVerification, out ErrorNo, out ErrorDesc, out CardinalAuthenticateResult); ThisCustomer.ThisCustomerSession["Cardinal.AuthenticateResult"] = CardinalAuthenticateResult; // handle success cases: if ((PAResStatus == "Y" && SignatureVerification == "Y")) { ShoppingCart cart = new ShoppingCart(1, ThisCustomer, CartTypeEnum.ShoppingCart, 0, false); Address UseBillingAddress = new Address(); UseBillingAddress.LoadByCustomer(ThisCustomer.CustomerID, ThisCustomer.PrimaryBillingAddressID, AddressTypes.Billing); String status = Gateway.MakeOrder(String.Empty, AppLogic.TransactionMode(), cart, OrderNumber, String.Empty, String.Empty, String.Empty, String.Empty); if (status != AppLogic.ro_OK) { err = new ErrorMessage(status); ReturnURL = "checkoutpayment.aspx?error=1&errormsg=" + err.MessageId; } else { // store cardinal call results for posterity: string sql = "update orders set AuthorizationPNREF=" + DB.SQuote(CardinalOrderId) + ", CardinalLookupResult=" + DB.SQuote(ThisCustomer.ThisCustomerSession["Cardinal.LookupResult"]) + ", CardinalAuthenticateResult=" + DB.SQuote(ThisCustomer.ThisCustomerSession["Cardinal.AuthenticateResult"]) + " where OrderNumber=" + OrderNumber.ToString(); DB.ExecuteSQL(sql); ReturnURL = "orderconfirmation.aspx?ordernumber=" + OrderNumber.ToString() + "&paymentmethod=eCheck"; } } else { String sql = "insert into FailedTransaction(CustomerID,OrderNumber,IPAddress,OrderDate,PaymentGateway,PaymentMethod,TransactionCommand,TransactionResult) values(" + ThisCustomer.CustomerID.ToString() + "," + OrderNumber.ToString() + "," + DB.SQuote(ThisCustomer.LastIPAddress) + ",getdate(),'Cardinal'," + DB.SQuote(AppLogic.ro_PMCardinalMyECheck) + ",''," + DB.SQuote(CardinalAuthenticateResult) + ")"; DB.ExecuteSQL(sql); } // handle canceled: if (PAResStatus == "X") { err = new ErrorMessage(Server.HtmlEncode(AppLogic.GetString("cardinalecheck_process.aspx.2", 1, Localization.GetDefaultLocale()))); ReturnURL = "checkoutpayment.aspx?error=1&errormsg=" + err.MessageId; } // handle failure: if (PAResStatus == "E" && ErrorDesc.Length != 0) { err = new ErrorMessage(Server.HtmlEncode(String.Format(AppLogic.GetString("cardinalecheck_process.aspx.3", 1, Localization.GetDefaultLocale()), ErrorDesc))); ReturnURL = "checkoutpayment.aspx?error=1&errormsg=" + err.MessageId; } } if (ReturnURL.Length == 0) { err = new ErrorMessage(Server.HtmlEncode(AppLogic.GetString("cardinalecheck_process.aspx.4", 1, Localization.GetDefaultLocale()))); ReturnURL = "checkoutpayment.aspx?error=1&errormsg=" + err.MessageId; } ThisCustomer.ThisCustomerSession["Cardinal.LookupResult"] = String.Empty; ThisCustomer.ThisCustomerSession["Cardinal.AuthenticateResult"] = String.Empty; ThisCustomer.ThisCustomerSession["Cardinal.ACSUrl"] = String.Empty; ThisCustomer.ThisCustomerSession["Cardinal.Payload"] = String.Empty; ThisCustomer.ThisCustomerSession["Cardinal.TransactionID"] = String.Empty; ThisCustomer.ThisCustomerSession["Cardinal.OrderNumber"] = String.Empty; ThisCustomer.ThisCustomerSession["Cardinal.LookupResult"] = String.Empty; if (PhoneOrder) { //For phone order. Response.Redirect(ReturnURL); } else { Response.CacheControl = "private"; Response.Expires = 0; Response.AddHeader("pragma", "no-cache"); Response.Write("<html><head><title>Cardinal Process</title></head><body>"); Response.Write("<script type=\"text/javascript\">\n"); Response.Write("top.location='" + ReturnURL + "';\n"); Response.Write("</SCRIPT>\n"); Response.Write("<div align=\"center\">" + String.Format(AppLogic.GetString("cardinalecheck_process.aspx.5", 1, Localization.GetDefaultLocale()), ReturnURL) + "</div>"); Response.Write("</body></html>"); } }
protected void Page_Load(object sender, System.EventArgs e) { Customer ThisCustomer = ((AspDotNetStorefrontPrincipal)Context.User).ThisCustomer; MobileHelper.RedirectPageWhenMobileIsDisabled("~/googletopics.aspx", ThisCustomer); Response.ContentType = "text/xml"; Response.ContentEncoding = new System.Text.UTF8Encoding(); Response.Write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); int SkinID = 1; // not sure what to do about this...google can't invoke different skins easily String StoreLoc = AppLogic.GetStoreHTTPLocation(false); Response.Write("<urlset xmlns='http://www.sitemaps.org/schemas/sitemap/0.9' xmlns:mobile='http://www.google.com/schemas/sitemap-mobile/1.0'>\n"); if (AppLogic.AppConfigBool("SiteMap.ShowTopics")) { // DB Topics: using (SqlConnection conn = DB.dbConn()) { conn.Open(); using (IDataReader rs = DB.GetRS(string.Format("select Name from Topic with (NOLOCK) where {0} Deleted=0 and (SkinID IS NULL or SkinID=0 or SkinID={1}) Order By DisplayOrder, Name ASC", CommonLogic.IIF(AppLogic.IsAdminSite, "", "ShowInSiteMap=1 and "), SkinID.ToString()), conn)) { while (rs.Read()) { Response.Write("<url>"); Response.Write("<loc>" + XmlCommon.XmlEncode(StoreLoc + SE.MakeDriverLink(DB.RSFieldByLocale(rs, "Name", Localization.GetDefaultLocale()))) + "</loc> "); Response.Write("<changefreq>" + AppLogic.AppConfig("GoogleSiteMap.TopicChangeFreq") + "</changefreq> "); Response.Write("<priority>" + AppLogic.AppConfig("GoogleSiteMap.TopicPriority") + "</priority> "); Response.Write("<mobile:mobile/></url>\n"); } } } // File Topics: // create an array to hold the list of files ArrayList fArray = new ArrayList(); // get information about our initial directory String SFP = CommonLogic.SafeMapPath(CommonLogic.IIF(AppLogic.IsAdminSite, "../", "") + "~/App_Templates/Skin_" + SkinID.ToString() + "/template.htm").Replace("template.htm", ""); DirectoryInfo dirInfo = new DirectoryInfo(SFP); // retrieve array of files & subdirectories FileSystemInfo[] myDir = dirInfo.GetFileSystemInfos(); for (int i = 0; i < myDir.Length; i++) { // check the file attributes // if a subdirectory, add it to the sArray // otherwise, add it to the fArray if (((Convert.ToUInt32(myDir[i].Attributes) & Convert.ToUInt32(FileAttributes.Directory)) > 0)) { } else { bool skipit = false; if (!myDir[i].FullName.EndsWith("htm", StringComparison.InvariantCultureIgnoreCase) || (myDir[i].FullName.IndexOf("TEMPLATE", StringComparison.InvariantCultureIgnoreCase) != -1) || (myDir[i].FullName.IndexOf("AFFILIATE_", StringComparison.InvariantCultureIgnoreCase) != -1) || (myDir[i].FullName.IndexOf(AppLogic.ro_PMMicropay, StringComparison.InvariantCultureIgnoreCase) != -1)) { skipit = true; } if (!skipit) { fArray.Add(Path.GetFileName(myDir[i].FullName)); } } } if (fArray.Count != 0) { // sort the files alphabetically fArray.Sort(0, fArray.Count, null); for (int i = 0; i < fArray.Count; i++) { Response.Write("<url>"); Response.Write("<loc>" + StoreLoc + SE.MakeDriverLink(fArray[i].ToString().Replace(".htm", "")) + "</loc> "); Response.Write("<changefreq>" + AppLogic.AppConfig("GoogleSiteMap.TopicChangeFreq") + "</changefreq> "); Response.Write("<priority>" + AppLogic.AppConfig("GoogleSiteMap.TopicPriority") + "</priority> "); Response.Write("</url>"); } } } Response.Write("</urlset>"); }
private SkinBase m_SkinBase = null; // if not null, this control will set the page metatags to the results from the Topic, IF those Topic results are not "empty strings" protected void Page_Load(object sender, EventArgs e) { m_DesignMode = (HttpContext.Current == null); if (m_DesignMode) { if (TopicName.Length != 0) { Contents.Text = "Topic: " + TopicName; } else { Contents.Text = "Topic"; } } else { m_SkinBase = (SkinBase)this.Page; try { if (m_SkinBase != null) { if (TopicID != 0) { m_T = new Topic(TopicID, m_SkinBase.ThisCustomer.LocaleSetting, m_SkinBase.ThisCustomer.SkinID, m_SkinBase.GetParser); } else { m_T = new Topic(TopicName, m_SkinBase.ThisCustomer.LocaleSetting, m_SkinBase.ThisCustomer.SkinID, m_SkinBase.GetParser); } m_SkinID = m_SkinBase.ThisCustomer.SkinID; m_LocaleSetting = m_SkinBase.ThisCustomer.LocaleSetting; } else { m_LocaleSetting = Localization.GetDefaultLocale(); if (TopicID != 0) { m_T = new Topic(TopicID, m_LocaleSetting, m_SkinID, null); } else { m_T = new Topic(TopicName, m_LocaleSetting, m_SkinID, null); } } StringBuilder tmpS = new StringBuilder(4096); String xpdd = m_SkinBase.ThisCustomer.ThisCustomerSession["Topic" + XmlCommon.GetLocaleEntry(m_T.TopicName, m_SkinBase.ThisCustomer.LocaleSetting, true)]; if (xpdd.Length != 0) { // don't let decrypt failure crash, just set xpdd to string.empty so it fails. try { xpdd = Security.UnmungeString(xpdd); } catch { xpdd = String.Empty; // some kind of decrypt failure, deny access, not sure what else to do here. } } if (EnforcePassword && m_T.Password.Length != 0 && xpdd != m_T.Password) { String Url = String.Empty; if (CommonLogic.GetThisPageName(false).Equals("driver.aspx", StringComparison.InvariantCultureIgnoreCase)) { Url = SE.MakeDriverLink(XmlCommon.GetLocaleEntry(m_T.TopicName, m_SkinBase.ThisCustomer.LocaleSetting, true)); } else { Url = SE.MakeDriver2Link(XmlCommon.GetLocaleEntry(m_T.TopicName, m_SkinBase.ThisCustomer.LocaleSetting, true)); } tmpS.Append("<form method=\"POST\" action=\"" + Url + "\">\n"); tmpS.Append("<p><b>"); tmpS.Append(AppLogic.GetString("driver.aspx.1", m_SkinID, m_LocaleSetting)); tmpS.Append("</b></p>\n"); tmpS.Append("<p>"); tmpS.Append(AppLogic.GetString("driver.aspx.2", m_SkinID, m_LocaleSetting)); tmpS.Append(" <input type=\"text\" name=\"Password\" size=\"20\" maxlength=\"100\"><input type=\"submit\" value=\""); tmpS.Append(AppLogic.GetString("driver.aspx.5", m_SkinID, m_LocaleSetting)); tmpS.Append("\" name=\"B1\"></p>\n"); tmpS.Append("</form>\n"); m_SkinBase.ThisCustomer.RequireCustomerRecord(); } else { if (EnforceDisclaimer && m_T.RequiresDisclaimer && CommonLogic.CookieCanBeDangerousContent("SiteDisclaimerAccepted", true).Length == 0) { String ThisPageURL = CommonLogic.GetThisPageName(true) + "?" + CommonLogic.ServerVariables("QUERY_STRING"); Response.Redirect("disclaimer.aspx?returnURL=" + HttpContext.Current.Server.UrlEncode(ThisPageURL)); } if (EnforceSubscription && m_T.RequiresSubscription && m_SkinBase.ThisCustomer.SubscriptionExpiresOn.AddDays((double)AppLogic.AppConfigNativeInt("SubscriptionExpiredGracePeriod")) < System.DateTime.Now) { String Msg = AppLogic.AppConfig("Suscription.ExpiredMessageWhenViewingTopic"); if (Msg.Length == 0) { Msg = "<p><b>" + AppLogic.GetString("driver.aspx.3", m_SkinID, m_LocaleSetting) + "</b></p>"; } tmpS.Append(Msg); } else { tmpS.Append("<!-- READ FROM "); tmpS.Append(CommonLogic.IIF(m_T.FromDB, "DB", "FILE")); tmpS.Append(" -->"); tmpS.Append(m_T.Contents); tmpS.Append("<!-- END OF "); tmpS.Append(CommonLogic.IIF(m_T.FromDB, "DB", "FILE")); tmpS.Append(" -->"); } } Contents.Text = tmpS.ToString(); } catch (Exception ex) { Contents.Text = CommonLogic.GetExceptionDetail(ex, "<br/>"); } if (m_SkinBase != null && m_AllowSEPropogation && m_T != null) { if (m_T.SectionTitle.Length != 0) { m_SkinBase.SectionTitle = m_T.SectionTitle; } if (m_T.SETitle.Length != 0) { m_SkinBase.SETitle = m_T.SETitle; } if (m_T.SEKeywords.Length != 0) { m_SkinBase.SEKeywords = m_T.SEKeywords; } if (m_T.SEDescription.Length != 0) { m_SkinBase.SEDescription = m_T.SEDescription; } if (m_T.SENoScript.Length != 0) { m_SkinBase.SENoScript = m_T.SENoScript; } } } }
private void Page_Load(object sender, EventArgs e) { bool showPoll = AppLogic.ProductIsMLExpress() == false && AppLogic.AppConfigBool("Polls.Enabled"); if (!AppLogic.IsAdminSite && showPoll) { InitializePollControl(); } if (PageMenu != null) { // get menu config file: String MN = string.Empty; if (AppLogic.ProductIsMLExpress() && AppLogic.IsAdminSite) { MN = "expressMenuData.xml"; } else { MN = "menuData.xml"; } if (AppLogic.IsAdminSite) { if (Page.ThisCustomer.Notes.Trim().Length != 0 && Page.ThisCustomer.Notes.IndexOf(".xml", StringComparison.InvariantCultureIgnoreCase) != -1) { MN = Page.ThisCustomer.Notes.Trim(); } } String CacheName = String.Format("menudoc_{0}_{1}_{2}_{3}", AppLogic.IsAdminSite.ToString(), Page.SkinID.ToString(), Page.ThisCustomer.LocaleSetting, MN); XmlDocument doc = null; if (AppLogic.CachingOn) { doc = (XmlDocument)HttpContext.Current.Cache.Get(CacheName); } if (doc == null) { doc = new XmlDocument(); String MenuConfigFileString = CommonLogic.ReadFile(CommonLogic.SafeMapPath("skins/skin_" + Page.SkinID.ToString() + "/" + MN), false); doc.LoadXml(MenuConfigFileString); HierarchicalTableMgr tblMgr; XmlNode rootNode = doc.SelectSingleNode("/SiteMap"); // Find Manufacturers menu top XmlNode mNode = doc.DocumentElement.SelectSingleNode("//item[@Text='(!" + CommonLogic.IIF(AppLogic.IsAdminSite, "admin.", "") + "menu.Manufacturers!)']"); tblMgr = AppLogic.ManufacturerStoreEntityHelper[0].m_TblMgr; if (tblMgr.NumRootLevelNodes <= AppLogic.MaxMenuSize()) { AddEntityMenuXsl(doc, "Manufacturer", tblMgr, mNode, 0, String.Empty); } mNode = doc.DocumentElement.SelectSingleNode("//item[@Text='(!" + CommonLogic.IIF(AppLogic.IsAdminSite, "admin.", "") + "menu.Manufacturers0!)']"); if (tblMgr.NumRootLevelNodes <= AppLogic.MaxMenuSize()) { AddEntityMenuXsl(doc, "Manufacturer", tblMgr, mNode, 0, "TopItemLook"); } // Find Categories menu top mNode = doc.DocumentElement.SelectSingleNode("//item[@Text='(!" + CommonLogic.IIF(AppLogic.IsAdminSite, "admin.", "") + "menu.Categories!)']"); AddEntityMenuXsl(doc, "Category", AppLogic.CategoryStoreEntityHelper[0].m_TblMgr, mNode, 0, String.Empty); mNode = doc.DocumentElement.SelectSingleNode("//item[@Text='(!" + CommonLogic.IIF(AppLogic.IsAdminSite, "admin.", "") + "menu.Categories0!)']"); AddEntityMenuXsl(doc, "Category", AppLogic.CategoryStoreEntityHelper[0].m_TblMgr, mNode, 0, "TopItemLook"); // Find Sections menu top mNode = doc.DocumentElement.SelectSingleNode("//item[@Text='(!" + CommonLogic.IIF(AppLogic.IsAdminSite, "admin.", "") + "menu.Sections!)']"); AddEntityMenuXsl(doc, "Section", AppLogic.SectionStoreEntityHelper[0].m_TblMgr, mNode, 0, String.Empty); mNode = doc.DocumentElement.SelectSingleNode("//item[@Text='(!" + CommonLogic.IIF(AppLogic.IsAdminSite, "admin.", "") + "menu.Sections0!)']"); AddEntityMenuXsl(doc, "Section", AppLogic.SectionStoreEntityHelper[0].m_TblMgr, mNode, 0, "TopItemLook"); if (AppLogic.ProductIsMLX() && AppLogic.IsAdminSite) { mNode = doc.DocumentElement.SelectSingleNode("//item[@Text='(!" + CommonLogic.IIF(AppLogic.IsAdminSite, "admin.", "") + "menu.Currencies!)']"); mNode.ParentNode.RemoveChild(mNode); mNode = doc.DocumentElement.SelectSingleNode("//item[@Text='(!" + CommonLogic.IIF(AppLogic.IsAdminSite, "admin.", "") + "menu.OrderRecurring!)']"); mNode.ParentNode.RemoveChild(mNode); mNode = doc.DocumentElement.SelectSingleNode("//item[@Text='(!" + CommonLogic.IIF(AppLogic.IsAdminSite, "admin.", "") + "menu.OrderRecurringPending!)']"); mNode.ParentNode.RemoveChild(mNode); mNode = doc.DocumentElement.SelectSingleNode("//item[@Text='(!" + CommonLogic.IIF(AppLogic.IsAdminSite, "admin.", "") + "menu.OrderRecurringImport!)']"); mNode.ParentNode.RemoveChild(mNode); mNode = doc.DocumentElement.SelectSingleNode("//item[@Text='(!" + CommonLogic.IIF(AppLogic.IsAdminSite, "admin.", "") + "menu.ProductLoadFromXml!)']"); mNode.ParentNode.RemoveChild(mNode); mNode = doc.DocumentElement.SelectSingleNode("//item[@Text='(!" + CommonLogic.IIF(AppLogic.IsAdminSite, "admin.", "") + "menu.ShippingZones!)']"); mNode.ParentNode.RemoveChild(mNode); mNode = doc.DocumentElement.SelectSingleNode("//item[@Text='(!" + CommonLogic.IIF(AppLogic.IsAdminSite, "admin.", "") + "menu.RunSQL!)']"); mNode.ParentNode.RemoveChild(mNode); mNode = doc.DocumentElement.SelectSingleNode("//item[@Text='(!" + CommonLogic.IIF(AppLogic.IsAdminSite, "admin.", "") + "menu.Mailing!)']"); mNode.ParentNode.RemoveChild(mNode); mNode = doc.DocumentElement.SelectSingleNode("//item[@Text='(!" + CommonLogic.IIF(AppLogic.IsAdminSite, "admin.", "") + "menu.ProductEdit!)']"); mNode.ParentNode.RemoveChild(mNode); mNode = doc.DocumentElement.SelectSingleNode("//item[@Text='(!" + CommonLogic.IIF(AppLogic.IsAdminSite, "admin.", "") + "menu.EventHandlerParameters!)']"); mNode.ParentNode.RemoveChild(mNode); } // not supported in PRO version if (AppLogic.m_ProductIsML()) { // Find Distributors menu top mNode = doc.DocumentElement.SelectSingleNode("//item[@Text='(!" + CommonLogic.IIF(AppLogic.IsAdminSite, "admin.", "") + "menu.Distributors!)']"); tblMgr = AppLogic.DistributorStoreEntityHelper[0].m_TblMgr; if (tblMgr.NumRootLevelNodes <= AppLogic.MaxMenuSize()) { AddEntityMenuXsl(doc, "Distributors", tblMgr, mNode, 0, String.Empty); } mNode = doc.DocumentElement.SelectSingleNode("//item[@Text='(!" + CommonLogic.IIF(AppLogic.IsAdminSite, "admin.", "") + "menu.Distributors0!)']"); if (tblMgr.NumRootLevelNodes <= AppLogic.MaxMenuSize()) { AddEntityMenuXsl(doc, "Distributors", tblMgr, mNode, 0, "TopItemLook"); } } Regex m_ReMatch = new Regex(@"\(!(.*?)!\)", RegexOptions.Compiled); MatchEvaluator m_ResourceMatch = new MatchEvaluator(ResourceMatchEvaluatorXmlEncoded); doc.InnerXml = m_ReMatch.Replace(doc.InnerXml, m_ResourceMatch); if (AppLogic.CachingOn) { HttpContext.Current.Cache.Insert(CacheName, doc, null, System.DateTime.Now.AddMinutes(AppLogic.CacheDurationMinutes()), TimeSpan.Zero); } } if (PageMenu != null) { PageMenu.LoadXml(doc); } } if (VertMenu != null) { String CacheName = String.Format("vertmenudoc_{0}_{1}_{2}", AppLogic.IsAdminSite.ToString(), Page.SkinID.ToString(), Page.ThisCustomer.LocaleSetting); XmlDocument doc = null; if (AppLogic.CachingOn) { doc = (XmlDocument)HttpContext.Current.Cache.Get(CacheName); } if (doc == null) { doc = new XmlDocument(); // get menu config file: String MenuConfigFileString = CommonLogic.ReadFile(CommonLogic.SafeMapPath("skins/skin_" + Page.SkinID.ToString() + "/vertMenuData.xml"), false); doc.LoadXml(MenuConfigFileString); XmlNode rootNode = doc.SelectSingleNode("/SiteMap"); // Find Manufacturers menu top XmlNode mNode = doc.DocumentElement.SelectSingleNode("//item[@Text='(!" + CommonLogic.IIF(AppLogic.IsAdminSite, "admin.", "") + "menu.Manufacturers!)']"); AddEntityMenuXsl(doc, "Manufacturer", AppLogic.ManufacturerStoreEntityHelper[0].m_TblMgr, mNode, 0, String.Empty); mNode = doc.DocumentElement.SelectSingleNode("//item[@Text='(!" + CommonLogic.IIF(AppLogic.IsAdminSite, "admin.", "") + "menu.Manufacturers0!)']"); AddEntityMenuXsl(doc, "Manufacturer", AppLogic.ManufacturerStoreEntityHelper[0].m_TblMgr, mNode, 0, "VertTopItemLook"); // Find Categories menu top mNode = doc.DocumentElement.SelectSingleNode("//item[@Text='(!" + CommonLogic.IIF(AppLogic.IsAdminSite, "admin.", "") + "menu.Categories!)']"); AddEntityMenuXsl(doc, "Category", AppLogic.CategoryStoreEntityHelper[0].m_TblMgr, mNode, 0, String.Empty); mNode = doc.DocumentElement.SelectSingleNode("//item[@Text='(!" + CommonLogic.IIF(AppLogic.IsAdminSite, "admin.", "") + "menu.Categories0!)']"); AddEntityMenuXsl(doc, "Category", AppLogic.CategoryStoreEntityHelper[0].m_TblMgr, mNode, 0, "VertTopItemLook"); // Find Sections menu top mNode = doc.DocumentElement.SelectSingleNode("//item[@Text='(!" + CommonLogic.IIF(AppLogic.IsAdminSite, "admin.", "") + "menu.Sections!)']"); AddEntityMenuXsl(doc, "Section", AppLogic.SectionStoreEntityHelper[0].m_TblMgr, mNode, 0, String.Empty); mNode = doc.DocumentElement.SelectSingleNode("//item[@Text='(!" + CommonLogic.IIF(AppLogic.IsAdminSite, "admin.", "") + "menu.Sections0!)']"); AddEntityMenuXsl(doc, "Section", AppLogic.SectionStoreEntityHelper[0].m_TblMgr, mNode, 0, "VertTopItemLook"); // not supported in PRO version if (AppLogic.m_ProductIsML()) { } Regex m_ReMatch = new Regex(@"\(!(.*?)!\)", RegexOptions.Compiled); MatchEvaluator m_ResourceMatch = new MatchEvaluator(ResourceMatchEvaluatorXmlEncoded); doc.InnerXml = m_ReMatch.Replace(doc.InnerXml, m_ResourceMatch); if (AppLogic.CachingOn) { HttpContext.Current.Cache.Insert(CacheName, doc, null, System.DateTime.Now.AddMinutes(AppLogic.CacheDurationMinutes()), TimeSpan.Zero); } } if (VertMenu != null) { VertMenu.LoadXml(doc); } } if (PageTree != null) { // Note: Tree doc cannot be cached, as it changes every page, (as we have to open the selected tree node based on query string params) StringBuilder tmpS = new StringBuilder(4096); int curEntityID = CommonLogic.QueryStringUSInt("EntityID"); String curEntity = CurrentEntity; tmpS.Append("<siteMap>"); if (AppLogic.AppConfigBool("Tree.ShowCategories")) { tmpS.Append(AppLogic.LookupHelper("Category", 0).ComponentArtTree(0, Page.SkinID, Page.ThisCustomer.LocaleSetting, CommonLogic.QueryStringUSInt("CategoryID"))); } if (AppLogic.AppConfigBool("Tree.ShowSections")) { tmpS.Append(AppLogic.LookupHelper("Section", 0).ComponentArtTree(0, Page.SkinID, Page.ThisCustomer.LocaleSetting, CommonLogic.QueryStringUSInt("SectionID"))); } // not supported in PRO version if (AppLogic.m_ProductIsML()) { if (AppLogic.AppConfigBool("Tree.ShowLibraries")) { tmpS.Append(AppLogic.LookupHelper("Library", 0).ComponentArtTree(0, Page.SkinID, Page.ThisCustomer.LocaleSetting, CommonLogic.QueryStringUSInt("LibraryID"))); } if (AppLogic.AppConfigBool("Tree.ShowGenres")) { tmpS.Append(AppLogic.LookupHelper("Genre", 0).ComponentArtTree(0, Page.SkinID, Page.ThisCustomer.LocaleSetting, CommonLogic.QueryStringUSInt("GenreID"))); } if (AppLogic.AppConfigBool("Tree.ShowVectors")) { tmpS.Append(AppLogic.LookupHelper("Vector", 0).ComponentArtTree(0, Page.SkinID, Page.ThisCustomer.LocaleSetting, CommonLogic.QueryStringUSInt("VectorID"))); } } if (AppLogic.AppConfigBool("Tree.ShowManufacturers")) { tmpS.Append(AppLogic.LookupHelper("Manufacturer", 0).ComponentArtTree(0, Page.SkinID, Page.ThisCustomer.LocaleSetting, CommonLogic.QueryStringUSInt("ManufacturerID"))); } if (AppLogic.AppConfigBool("Tree.ShowCustomerService")) { string custSvcXml = "<siteMapNode Text=\"" + XmlCommon.XmlEncodeAttribute(AppLogic.GetString("" + CommonLogic.IIF(AppLogic.IsAdminSite, "admin.", "") + "menu.CustomerService", Page.SkinID, Page.ThisCustomer.LocaleSetting)) + "\" NavigateUrl=\"" + SE.MakeDriverLink("service") + "\">"; custSvcXml += AppLogic.AppConfig("Tree.CustomerServiceXml"); if (custSvcXml.Length != 0) { Regex m_ReMatch = new Regex(@"\(!(.*?)!\)"); MatchEvaluator m_ResourceMatch = new MatchEvaluator(ResourceMatchEvaluatorXmlEncoded); custSvcXml = m_ReMatch.Replace(custSvcXml, m_ResourceMatch); } custSvcXml += "</siteMapNode>"; XmlDocument x = new XmlDocument(); try { x.LoadXml(custSvcXml); } catch { custSvcXml = "<siteMapNode Text=\"Invalid XML fragment in Tree.ShowCustomerService AppConfig parameter\" NavigateUrl=\"\" />"; } tmpS.Append(custSvcXml); } tmpS.Append("</siteMap>"); XmlDocument doc = new XmlDocument(); doc.LoadXml(tmpS.ToString()); PageTree.LoadXml(doc); } }