/// <summary> /// Displays proper cost text /// </summary> /// <param name="opt"></param> /// <returns></returns> protected string DisplayCost(OrderOption opt) { string displayText = string.Empty; decimal cost = opt.Cost; if (cost == decimal.Zero) { // display FREE displayText = AppLogic.GetString("shoppingcart.aspx.16", this.ThisCustomer.SkinID, this.ThisCustomer.LocaleSetting); } else { if (Datasource.VatEnabled) { if (Datasource.VatIsInclusive) { cost += opt.TaxRate; } // sample display format would be: // $10.00 ex vat // VAT: $1.00 displayText = Localization.CurrencyStringForDisplayWithExchangeRate(cost, this.ThisCustomer.CurrencySetting); displayText += " "; displayText += CommonLogic.IIF(Datasource.VatIsInclusive, AppLogic.GetString("setvatsetting.aspx.6", ThisCustomer.SkinID, ThisCustomer.LocaleSetting), AppLogic.GetString("setvatsetting.aspx.7", ThisCustomer.SkinID, ThisCustomer.LocaleSetting)); displayText += "VAT: " + ThisCustomer.CurrencyString(opt.TaxRate); } else { displayText = Localization.CurrencyStringForDisplayWithExchangeRate(cost, this.ThisCustomer.CurrencySetting); } } return(displayText); }
private void RenderHtml() { StringBuilder writer = new StringBuilder(); if (authorized) { //If there is a DeleteID remove it from the cart int DeleteRecurringOrderNumber = CommonLogic.QueryStringUSInt("DeleteID"); String DeleteRecurringOrderResult = String.Empty; if (DeleteRecurringOrderNumber != 0) { Order originalOrder = new Order(DeleteRecurringOrderNumber); RecurringOrderMgr rmgr = new RecurringOrderMgr(); ExpressAPIType expressApiType = PayPalController.GetAppropriateExpressType(); if (originalOrder.PaymentMethod == AppLogic.ro_PMPayPalExpress && expressApiType == ExpressAPIType.PayPalExpress) { DeleteRecurringOrderResult = rmgr.CancelPPECRecurringOrder(DeleteRecurringOrderNumber, false); } else { DeleteRecurringOrderResult = rmgr.CancelRecurringOrder(DeleteRecurringOrderNumber); } } //If there is a FullRefundID refund it int FullRefundID = CommonLogic.QueryStringUSInt("FullRefundID"); String FullRefundResult = String.Empty; if (FullRefundID != 0) { RecurringOrderMgr rmgr = new RecurringOrderMgr(); FullRefundResult = rmgr.ProcessAutoBillFullRefund(FullRefundID); } //If there is a PartialRefundID refund it int PartialRefundID = CommonLogic.QueryStringUSInt("PartialRefundID"); String PartialRefundResult = String.Empty; if (PartialRefundID != 0) { RecurringOrderMgr rmgr = new RecurringOrderMgr(); PartialRefundResult = rmgr.ProcessAutoBillPartialRefund(PartialRefundID); } //If there is a retrypaymentid, retry it int RetryPaymentID = CommonLogic.QueryStringUSInt("retrypaymentid"); String RetryPaymentResult = String.Empty; if (RetryPaymentID != 0) { RecurringOrderMgr rmgr = new RecurringOrderMgr(); RetryPaymentResult = rmgr.ProcessAutoBillRetryPayment(RetryPaymentID); } //If there is a restartid, restart it int RestartPaymentID = CommonLogic.QueryStringUSInt("restartid"); String RestartPaymentResult = String.Empty; if (RestartPaymentID != 0) { RecurringOrderMgr rmgr = new RecurringOrderMgr(); RestartPaymentResult = rmgr.ProcessAutoBillRestartPayment(RestartPaymentID); } if (AppLogic.AppConfigBool("AuditLog.Enabled")) { writer.Append("<p><a href=\"" + AppLogic.AdminLinkUrl("auditlog.aspx") + "?CustomerID=" + TargetCustomer.CustomerID.ToString() + "\">View Customer Activity Log</a></p>\n"); } if (ShoppingCart.NumItems(TargetCustomer.CustomerID, CartTypeEnum.RecurringCart) != 0) { writer.Append("<p align=\"left\"><b>" + AppLogic.GetString("admin.common.CstMsg9", SkinID, LocaleSetting) + "</b></p>\n"); // build JS code to show/hide address update block: StringBuilder tmpS = new StringBuilder(4096); tmpS.Append("<script type=\"text/javascript\">\n"); tmpS.Append("function toggleLayer(DivID)\n"); tmpS.Append("{\n"); tmpS.Append(" var elem;\n"); tmpS.Append(" var vis;\n"); tmpS.Append(" if(document.getElementById)\n"); tmpS.Append(" {\n"); tmpS.Append(" // standards\n"); tmpS.Append(" elem = document.getElementById(DivID);\n"); tmpS.Append(" }\n"); tmpS.Append(" else if(document.all)\n"); tmpS.Append(" {\n"); tmpS.Append(" // old msie versions\n"); tmpS.Append(" elem = document.all[DivID];\n"); tmpS.Append(" }\n"); tmpS.Append(" else if(document.layers)\n"); tmpS.Append(" {\n"); tmpS.Append(" // nn4\n"); tmpS.Append(" elem = document.layers[DivID];\n"); tmpS.Append(" }\n"); tmpS.Append(" vis = elem.style;\n"); tmpS.Append(" if(vis.display == '' && elem.offsetWidth != undefined && elem.offsetHeight != undefined)\n"); tmpS.Append(" {\n"); tmpS.Append(" vis.display = (elem.offsetWidth != 0 && elem.offsetHeight != 0) ? 'block' : 'none';\n"); tmpS.Append(" }\n"); tmpS.Append(" vis.display = (vis.display == '' || vis.display == 'block') ? 'none' : 'block' ;\n"); tmpS.Append("}\n"); tmpS.Append("</script>\n"); tmpS.Append("\n"); tmpS.Append("<style type=\"text/css\">\n"); tmpS.Append(" .addressBlockDiv { margin: 0px 20px 0px 20px; display: none;}\n"); tmpS.Append("</style>\n"); writer.Append(tmpS.ToString()); var parser = new Parser(); using (var dbconn = DB.dbConn()) { dbconn.Open(); using (var rsr = DB.GetRS("Select distinct OriginalRecurringOrderNumber from ShoppingCart with (NOLOCK) where CartType=" + ((int)CartTypeEnum.RecurringCart).ToString() + " and CustomerID=" + TargetCustomer.CustomerID.ToString() + " order by OriginalRecurringOrderNumber desc", dbconn)) { while (rsr.Read()) { bool ShowCancelButton = true; bool ShowRetryButton = false; bool ShowRestartButton = false; String GatewayStatus = String.Empty; RecurringOrderMgr rmgr1 = new RecurringOrderMgr(); rmgr1.ProcessAutoBillGetAdminButtons(DB.RSFieldInt(rsr, "OriginalRecurringOrderNumber"), out ShowCancelButton, out ShowRetryButton, out ShowRestartButton, out GatewayStatus); if (DeleteRecurringOrderNumber == DB.RSFieldInt(rsr, "OriginalRecurringOrderNumber")) { writer.Append("<table class=\"table\">\n"); writer.Append("<tr><td>\n"); writer.Append("<span class=\"h4\">" + AppLogic.GetString("admin.cst_history.StopBillingResult", SkinID, LocaleSetting) + " " + DeleteRecurringOrderResult + "</span>\n"); writer.Append("</td></tr>\n"); writer.Append("</table>\n"); } if (FullRefundID == DB.RSFieldInt(rsr, "OriginalRecurringOrderNumber")) { writer.Append("<table class=\"table\">\n"); writer.Append("<tr><td>\n"); writer.Append("<span class=\"h4\">" + AppLogic.GetString("admin.cst_history.FullRefundResult", SkinID, LocaleSetting) + " " + FullRefundResult + "</span>\n"); writer.Append("</td></tr>\n"); writer.Append("</table>\n"); } if (PartialRefundID == DB.RSFieldInt(rsr, "OriginalRecurringOrderNumber")) { writer.Append("<table class=\"table\">\n"); writer.Append("<tr><td>\n"); writer.Append("<span class=\"h4\">" + AppLogic.GetString("admin.cst_history.PartialRefundResult", SkinID, LocaleSetting) + " " + PartialRefundResult + "</span>\n"); writer.Append("</td></tr>\n"); writer.Append("</table>\n"); } if (RetryPaymentID == DB.RSFieldInt(rsr, "OriginalRecurringOrderNumber")) { writer.Append("<table class=\"table\">\n"); writer.Append("<tr><td>\n"); writer.Append("<span class=\"h4\">" + AppLogic.GetString("admin.cst_history.RetryPaymentResult", SkinID, LocaleSetting) + " " + RetryPaymentResult + "</span>\n"); writer.Append("</td></tr>\n"); writer.Append("</table>\n"); } if (RestartPaymentID == DB.RSFieldInt(rsr, "OriginalRecurringOrderNumber")) { writer.Append("<table class=\"table\">\n"); writer.Append("<tr><td>\n"); writer.Append("<span class=\"h4\">" + AppLogic.GetString("admin.cst_history.RestartPaymentResult", SkinID, LocaleSetting) + " " + RestartPaymentResult + "</span>\n"); writer.Append("</td></tr>\n"); writer.Append("</table>\n"); } writer.Append(AppLogic.GetRecurringCart(parser, TargetCustomer, DB.RSFieldInt(rsr, "OriginalRecurringOrderNumber"), SkinID, false, ShowCancelButton, ShowRetryButton, ShowRestartButton, GatewayStatus)); } } } } writer.Append("<div class=\"admin-module\">\n"); writer.Append("<h3>" + AppLogic.GetString("admin.orderframe.OrderHistory", SkinID, LocaleSetting) + "</h3>\n"); int N = 0; writer.Append("<table class=\"table\">\n"); writer.Append("<tr>\n"); writer.Append("<td><b>" + AppLogic.GetString("admin.common.OrderNumber", SkinID, LocaleSetting) + "</b></td>\n"); writer.Append("<td><b>" + AppLogic.GetString("admin.common.OrderDate", SkinID, LocaleSetting) + "</b></td>\n"); writer.Append("<td><b>" + AppLogic.GetString("admin.cst_history.PaymentStatus", SkinID, LocaleSetting) + "</b></td>\n"); writer.Append("<td><b>" + AppLogic.GetString("admin.common.ShippingStatus", SkinID, LocaleSetting) + "</b></td>\n"); writer.Append("<td><b>" + AppLogic.GetString("admin.common.OrderTotal", SkinID, LocaleSetting) + "</b></td>\n"); if (AppLogic.AppConfigBool("ShowCustomerServiceNotesInReceipts")) { writer.Append("<td><b>" + AppLogic.GetString("admin.cst_history.CustomerServiceNotes", SkinID, LocaleSetting) + "</b></td>\n"); } writer.Append("</tr>\n"); using (var dbconn = DB.dbConn()) { dbconn.Open(); using (var rs = DB.GetRS("Select '' Failed, PaymentGateway, PaymentMethod, ShippedOn, ShippedVIA, ShippingTrackingNumber, OrderNumber, OrderDate, OrderTotal, cast(CustomerServiceNotes as nvarchar(4000)) CustomerServiceNotes, TransactionState, DownloadEMailSentOn, CustomerID, RecurringSubscriptionID from orders with (NOLOCK) where CustomerID=" + TargetCustomer.CustomerID.ToString() + " union select 'Failed' Failed, PaymentGateway, PaymentMethod, null ShippedOn, null ShippedVIA, null ShippingTrackingNumber, OrderNumber, OrderDate, null OrderTotal, cast(TransactionResult as nvarchar(4000)) CustomerServiceNotes, null TransactionState, null DownloadEMailSentOn, CustomerID, RecurringSubscriptionID from FailedTransaction with (NOLOCK) where CustomerID=" + TargetCustomer.CustomerID.ToString() + " order by OrderDate desc", dbconn)) { while (rs.Read()) { String PaymentStatus = String.Empty; if (DB.RSField(rs, "PaymentMethod").Length != 0) { PaymentStatus = AppLogic.GetString("admin.order.PaymentMethod", SkinID, LocaleSetting) + " " + DB.RSField(rs, "PaymentMethod") + "<br/>"; } else { PaymentStatus = AppLogic.GetString("admin.order.PaymentMethod", SkinID, LocaleSetting) + " " + CommonLogic.IIF(DB.RSField(rs, "CardNumber").StartsWith(AppLogic.ro_PMPayPal, StringComparison.InvariantCultureIgnoreCase), AppLogic.ro_PMPayPal, "Credit Card") + "<br/>"; } if (DB.RSField(rs, "RecurringSubscriptionID").Length > 0 && DB.RSField(rs, "PaymentGateway") == AspDotNetStorefrontGateways.Gateway.ro_GWPAYFLOWPRO) { // include link to recurringgatewaydetails.aspx for live gateway status PaymentStatus += "Subscription ID: <a href=\"" + AppLogic.AdminLinkUrl("recurringgatewaydetails.aspx") + "?RecurringSubscriptionID=" + DB.RSField(rs, "RecurringSubscriptionID") + "\">" + DB.RSField(rs, "RecurringSubscriptionID") + "</a><br/>"; } String ShippingStatus = String.Empty; if (AppLogic.OrderHasShippableComponents(DB.RSFieldInt(rs, "OrderNumber"))) { if (DB.RSFieldDateTime(rs, "ShippedOn") != System.DateTime.MinValue) { ShippingStatus = "Shipped"; if (DB.RSField(rs, "ShippedVIA").Length != 0) { ShippingStatus += " via " + DB.RSField(rs, "ShippedVIA"); } ShippingStatus += " on " + Localization.ToThreadCultureShortDateString(DB.RSFieldDateTime(rs, "ShippedOn")) + "."; if (DB.RSField(rs, "ShippingTrackingNumber").Length != 0) { ShippingStatus += " " + AppLogic.GetString("admin.orderframe.TrackingNumber", SkinID, LocaleSetting) + " "; String TrackURL = Shipping.GetTrackingURL(DB.RSField(rs, "ShippingTrackingNumber")); if (TrackURL.Length != 0) { ShippingStatus += "<a href=\"" + TrackURL + "\" target=\"_blank\">" + DB.RSField(rs, "ShippingTrackingNumber") + "</a>"; } else { ShippingStatus += DB.RSField(rs, "ShippingTrackingNumber"); } } } else { ShippingStatus = AppLogic.GetString("admin.cst_history.NotYetShipped", SkinID, LocaleSetting); } } if (AppLogic.OrderHasDownloadComponents(DB.RSFieldInt(rs, "OrderNumber"), true)) { if (DB.RSField(rs, "TransactionState") == AppLogic.ro_TXStateCaptured && DB.RSFieldDateTime(rs, "DownloadEMailSentOn") != System.DateTime.MinValue) { if (ShippingStatus.Length != 0) { ShippingStatus += "<hr size=\"1\"/>"; } } else { if (ShippingStatus.Length == 0) { ShippingStatus += AppLogic.GetString("admin.cst_history.DownloadListPendingPayment", SkinID, LocaleSetting); } } } writer.Append("<tr>\n"); writer.Append("<td>"); writer.Append("<a href=\"" + AppLogic.AdminLinkUrl("order.aspx") + "?ordernumber=" + DB.RSFieldInt(rs, "OrderNumber").ToString() + "\">" + DB.RSFieldInt(rs, "OrderNumber").ToString() + "</a>"); writer.Append("<br/><br/>"); if (string.IsNullOrEmpty(DB.RSField(rs, "Failed"))) { var urlHelper = DependencyResolver.Current.GetService <UrlHelper>(); writer.AppendFormat(@"<a href=""{0}"" target=""_blank"">{1}</a>", urlHelper.Action( actionName: ActionNames.Index, controllerName: ControllerNames.Receipt, routeValues: new { OrderNumber = DB.RSFieldInt(rs, "OrderNumber") }), AppLogic.GetString("admin.cst_history.PrintableReceipt", SkinID, LocaleSetting)); } else { writer.Append("<font color=\"red\">" + DB.RSField(rs, "Failed") + "</font>"); } writer.Append("</td>"); writer.Append("<td>" + Localization.ToNativeDateTimeString(DB.RSFieldDateTime(rs, "OrderDate"))); writer.Append("</td>"); writer.Append("<td>" + PaymentStatus + " " + "</td>"); writer.Append("<td>" + ShippingStatus + " " + "</td>"); writer.Append("<td>" + ThisCustomer.CurrencyString(DB.RSFieldDecimal(rs, "OrderTotal")) + "</td>"); if (AppLogic.AppConfigBool("ShowCustomerServiceNotesInReceipts")) { if (DB.RSField(rs, "CustomerServiceNotes").Length > 110) { writer.Append("<td><textarea READONLY rows=\"10\" cols=\"50\">" + DB.RSField(rs, "CustomerServiceNotes") + "</textarea></td>"); } else { writer.Append("<td>" + CommonLogic.IIF(DB.RSField(rs, "CustomerServiceNotes").Length == 0, "None", DB.RSField(rs, "CustomerServiceNotes")) + "</td>"); } } else { writer.Append(" "); } writer.Append("</tr>\n"); N++; } } } writer.Append("</table>\n"); if (N == 0) { writer.Append("<p align=\"left\">" + AppLogic.GetString("admin.common.NoOrdersFound", SkinID, LocaleSetting) + "</p>\n"); } } ltContent.Text = writer.ToString(); }
private void UpdatepageContent() { if (CommonLogic.QueryStringNativeInt("ErrorMsg") > 0) { ErrorMessage e = new ErrorMessage(CommonLogic.QueryStringNativeInt("ErrorMsg")); ErrorMsgLabel.Text = "<p align=\"left\"><span class=\"errorLg\">" + Server.HtmlEncode(e.Message) + "</span></p>"; pnlErrorMsg.Visible = true; } else { pnlErrorMsg.Visible = false; } //write out header package is it exists String XmlPackageName = AppLogic.AppConfig("XmlPackage.CheckoutShippingMultPageHeader"); if (XmlPackageName.Length != 0) { XmlPackage_CheckoutShippingPageHeader.Text = AppLogic.RunXmlPackage(XmlPackageName, base.GetParser, ThisCustomer, SkinID, String.Empty, String.Empty, true, true); } // if (!cart.ShippingIsFree && cart.MoreNeededToReachFreeShipping != 0.0M) { GetFreeShipping.Text = "<div class=\"FreeShippingThresholdPrompt\">"; GetFreeShipping.Text += String.Format(AppLogic.GetString("checkoutshippingmult.aspx.2", SkinID, ThisCustomer.LocaleSetting), ThisCustomer.CurrencyString(cart.FreeShippingThreshold), CommonLogic.Capitalize(cart.FreeShippingMethod)); GetFreeShipping.Text += " "; GetFreeShipping.Text += "</div>"; pnlGetFreeShipping.Visible = true; } else { pnlGetFreeShipping.Visible = false; } checkoutshippingmultaspx16.Text = AppLogic.GetString("checkoutshippingmult.aspx.16", SkinID, ThisCustomer.LocaleSetting); checkoutshippingmultaspx18.Text = String.Format(AppLogic.GetString("checkoutshippingmult.aspx.18", SkinID, ThisCustomer.LocaleSetting), "account.aspx?checkout=true", "checkoutshippingmult.aspx?setallprimary=true"); String XmlPackageName2 = AppLogic.AppConfig("XmlPackage.CheckoutShippingMultPageFooter"); if (XmlPackageName2.Length != 0) { XmlPackage_CheckoutShippingMultPageFooter.Text = AppLogic.RunXmlPackage(XmlPackageName2, base.GetParser, ThisCustomer, SkinID, String.Empty, String.Empty, true, true); } }
public void InitializePageContent() { int AgeCartDays = AppLogic.AppConfigUSInt("AgeCartDays"); if (AgeCartDays == 0) { AgeCartDays = 7; } ShoppingCart.Age(ThisCustomer.CustomerID, AgeCartDays, CartTypeEnum.ShoppingCart); cart = new ShoppingCart(SkinID, ThisCustomer, CartTypeEnum.ShoppingCart, 0, false); shoppingcartaspx8.Text = AppLogic.GetString("shoppingcart.aspx.8", SkinID, ThisCustomer.LocaleSetting); shoppingcartaspx10.Text = AppLogic.GetString("shoppingcart.aspx.10", SkinID, ThisCustomer.LocaleSetting); shoppingcartaspx9.Text = AppLogic.GetString("shoppingcart.aspx.9", SkinID, ThisCustomer.LocaleSetting); shoppingcartcs31.Text = AppLogic.GetString("shoppingcart.cs.117", SkinID, ThisCustomer.LocaleSetting); btnUpdateCart1.Text = AppLogic.GetString("shoppingcart.cs.110", SkinID, ThisCustomer.LocaleSetting); btnUpdateCart2.Text = AppLogic.GetString("shoppingcart.cs.110", SkinID, ThisCustomer.LocaleSetting); btnUpdateCart3.Text = AppLogic.GetString("shoppingcart.cs.110", SkinID, ThisCustomer.LocaleSetting); btnUpdateCart4.Text = AppLogic.GetString("shoppingcart.cs.110", SkinID, ThisCustomer.LocaleSetting); lblOrderNotes.Text = AppLogic.GetString("shoppingcart.cs.66", SkinID, ThisCustomer.LocaleSetting); btnContinueShoppingTop.Text = AppLogic.GetString("shoppingcart.cs.62", SkinID, ThisCustomer.LocaleSetting); btnContinueShoppingBottom.Text = AppLogic.GetString("shoppingcart.cs.62", SkinID, ThisCustomer.LocaleSetting); btnCheckOutNowTop.Text = AppLogic.GetString("shoppingcart.cs.111", SkinID, ThisCustomer.LocaleSetting); btnCheckOutNowBottom.Text = AppLogic.GetString("shoppingcart.cs.111", SkinID, ThisCustomer.LocaleSetting); bool reqOver13 = AppLogic.AppConfigBool("RequireOver13Checked"); btnCheckOutNowTop.Enabled = !cart.IsEmpty() && !cart.RecurringScheduleConflict && (!reqOver13 || (reqOver13 && ThisCustomer.IsOver13)) || !ThisCustomer.IsRegistered; if (btnCheckOutNowTop.Enabled && AppLogic.MicropayIsEnabled() && !AppLogic.AppConfigBool("MicroPay.HideOnCartPage") && cart.CartItems.Count == 1 && cart.HasMicropayProduct() && ((CartItem)cart.CartItems[0]).Quantity == 0) { // We have only one item and it is the Micropay Product and the Quantity is zero // Don't allow checkout btnCheckOutNowTop.Enabled = false; } ErrorMsgLabel.Text = CommonLogic.IIF(!cart.IsEmpty() && (reqOver13 && !ThisCustomer.IsOver13 && ThisCustomer.IsRegistered), AppLogic.GetString("Over13OnCheckout", SkinID, ThisCustomer.LocaleSetting), String.Empty); btnCheckOutNowBottom.Enabled = btnCheckOutNowTop.Enabled; PayPalExpressSpan.Visible = false; PayPalExpressSpan2.Visible = false; Decimal MinOrderAmount = AppLogic.AppConfigUSDecimal("CartMinOrderAmount"); if (!cart.IsEmpty() && !cart.ContainsRecurringAutoShip) { // Enable PayPalExpress if using PayPalPro or PayPal Express is an active payment method. bool IncludePayPalExpress = false; if (AppLogic.AppConfigBool("PayPal.Express.ShowOnCartPage") && cart.MeetsMinimumOrderAmount(MinOrderAmount)) { if (AppLogic.ActivePaymentGatewayCleaned() == Gateway.ro_GWPAYPALPRO) { IncludePayPalExpress = true; } else { foreach (String PM in AppLogic.AppConfig("PaymentMethods").ToUpperInvariant().Split(',')) { String PMCleaned = AppLogic.CleanPaymentMethod(PM); if (PMCleaned == AppLogic.ro_PMPayPalExpress) { IncludePayPalExpress = true; break; } } } } if (IncludePayPalExpress) { if (AppLogic.AppConfigExists("Mobile.PayPal.Express.ButtonImageURL")) { btnPayPalExpressCheckout.ImageUrl = AppLogic.AppConfig("Mobile.PayPal.Express.ButtonImageURL"); } else { btnPayPalExpressCheckout.ImageUrl = AppLogic.AppConfig("PayPal.Express.ButtonImageURL"); } btnPayPalExpressCheckout2.ImageUrl = btnPayPalExpressCheckout.ImageUrl; if (AppLogic.AppConfigExists("Mobile.PayPal.Express.BillMeLaterButtonURL")) { btnPayPalBillMeLaterCheckout.ImageUrl = AppLogic.AppConfig("Mobile.PayPal.Express.BillMeLaterButtonURL"); } else { btnPayPalBillMeLaterCheckout.ImageUrl = AppLogic.AppConfig("PayPal.Express.BillMeLaterButtonURL"); } btnPayPalBillMeLaterCheckout.Visible = btnPayPalBillMeLaterCheckout2.Visible = AppLogic.AppConfigBool("PayPal.Express.ShowBillMeLaterButton"); btnPayPalBillMeLaterCheckout2.ImageUrl = btnPayPalBillMeLaterCheckout.ImageUrl; PayPalExpressSpan.Visible = true; PayPalExpressSpan2.Visible = true; } } AlternativeCheckouts.Visible = PayPalExpressSpan.Visible; AlternativeCheckouts2.Visible = PayPalExpressSpan2.Visible; if (!AppLogic.AppConfigBool("Mobile.ShowAlternateCheckouts")) { AlternativeCheckouts.Visible = AlternativeCheckouts2.Visible = false; } Shipping.ShippingCalculationEnum ShipCalcID = Shipping.GetActiveShippingCalculationID(); StringBuilder html = new StringBuilder(""); html.Append("<script type=\"text/javascript\">\n"); html.Append("function Cart_Validator(theForm)\n"); html.Append("{\n"); String cartJS = CommonLogic.ReadFile("jscripts/shoppingcart.js", true); foreach (CartItem c in cart.CartItems) { html.Append(cartJS.Replace("%SKU%", c.ShoppingCartRecordID.ToString())); } html.Append("return(true);\n"); html.Append("}\n"); html.Append("</script>\n"); ValidationScript.Text = html.ToString(); JSPopupRoutines.Text = AppLogic.GetJSPopupRoutines(); ShippingInformation.Visible = (!AppLogic.AppConfigBool("SkipShippingOnCheckout") && !cart.IsAllFreeShippingComponents() && !cart.IsAllSystemComponents()); AddresBookLlink.Visible = ThisCustomer.IsRegistered; btnCheckOutNowTop.Visible = (!cart.IsEmpty()); if (!cart.IsEmpty() && cart.HasCoupon() && !cart.CouponIsValid) { pnlCouponError.Visible = true; CouponError.Text = cart.CouponStatusMessage + " (" + Server.HtmlEncode(CommonLogic.IIF(cart.Coupon.CouponCode.Length != 0, cart.Coupon.CouponCode, ThisCustomer.CouponCode)) + ")"; cart.ClearCoupon(); } if (!String.IsNullOrEmpty(errorMessage.Message) || ErrorMsgLabel.Text.Length > 0) { pnlErrorMsg.Visible = true; ErrorMsgLabel.Text += errorMessage.Message; } if (cart.InventoryTrimmed || this.InventoryTrimmed) { pnlInventoryTrimmedError.Visible = true; if (cart.TrimmedReason == InventoryTrimmedReason.RestrictedQuantities || TrimmedEarlyReason == InventoryTrimmedReason.RestrictedQuantities) { InventoryTrimmedError.Text = AppLogic.GetString("shoppingcart.aspx.33", SkinID, ThisCustomer.LocaleSetting); } else { InventoryTrimmedError.Text = AppLogic.GetString("shoppingcart.aspx.3", SkinID, ThisCustomer.LocaleSetting); } cart = new ShoppingCart(SkinID, ThisCustomer, CartTypeEnum.ShoppingCart, 0, false); ctrlShoppingCart.DataSource = cart.CartItems; ctrlCartSummary.DataSource = cart; } if (cart.RecurringScheduleConflict) { pnlRecurringScheduleConflictError.Visible = true; RecurringScheduleConflictError.Text = AppLogic.GetString("shoppingcart.aspx.19", SkinID, ThisCustomer.LocaleSetting); } if (CommonLogic.QueryStringBool("minimumQuantitiesUpdated")) { pnlMinimumQuantitiesUpdatedError.Visible = true; MinimumQuantitiesUpdatedError.Text = AppLogic.GetString("shoppingcart.aspx.7", SkinID, ThisCustomer.LocaleSetting); } if (!cart.MeetsMinimumOrderAmount(MinOrderAmount)) { pnlMeetsMinimumOrderAmountError.Visible = true; MeetsMinimumOrderAmountError.Text = String.Format(AppLogic.GetString("shoppingcart.aspx.4", SkinID, ThisCustomer.LocaleSetting), ThisCustomer.CurrencyString(MinOrderAmount)); } int MinQuantity = AppLogic.AppConfigUSInt("MinCartItemsBeforeCheckout"); if (!cart.MeetsMinimumOrderQuantity(MinQuantity)) { pnlMeetsMinimumOrderQuantityError.Visible = true; MeetsMinimumOrderQuantityError.Text = String.Format(AppLogic.GetString("shoppingcart.cs.20", SkinID, ThisCustomer.LocaleSetting), MinQuantity.ToString(), MinQuantity.ToString()); } int MaxQuantity = AppLogic.AppConfigUSInt("MaxCartItemsBeforeCheckout"); if (cart.ExceedsMaximumOrderQuantity(MaxQuantity)) { pnlExceedsMaximumOrderQuantityError.Visible = true; ExceedsMaximumOrderQuantityError.Text = String.Format(AppLogic.GetString("shoppingcart.cs.119", SkinID, ThisCustomer.LocaleSetting), MaxQuantity.ToString()); } if (AppLogic.MicropayIsEnabled() && AppLogic.AppConfigBool("Micropay.ShowTotalOnTopOfCartPage")) { pnlMicropay_EnabledError.Visible = true; Micropay_EnabledError.Text = "<div align=\"left\">" + String.Format(AppLogic.GetString("account.aspx.10", ThisCustomer.SkinID, ThisCustomer.LocaleSetting), AppLogic.GetString("account.aspx.11", ThisCustomer.SkinID, ThisCustomer.LocaleSetting), ThisCustomer.CurrencyString(ThisCustomer.MicroPayBalance)) + "</div>"; } if (!cart.IsEmpty()) { pnlOrderOptions.Visible = cart.AllOrderOptions.Count > 0; if (cart.GiftCardsEnabled) { if (CouponCode.Text.Length == 0) { CouponCode.Text = cart.Coupon.CouponCode; } btnRemoveCoupon.Visible = CouponCode.Text.Length != 0; pnlCoupon.Visible = true; } else { pnlCoupon.Visible = false; } pnlPromotion.Visible = cart.PromotionsEnabled; if (!AppLogic.AppConfigBool("DisallowOrderNotes")) { OrderNotes.Text = cart.OrderNotes; pnlOrderNotes.Visible = true; } else { pnlOrderNotes.Visible = false; } btnCheckOutNowBottom.Visible = true; } else { pnlOrderOptions.Visible = false; pnlCoupon.Visible = false; pnlOrderNotes.Visible = false; btnCheckOutNowBottom.Visible = false; } if (AppLogic.AppConfigBool("SkipShippingOnCheckout") || cart.IsAllFreeShippingComponents() || cart.IsAllSystemComponents()) { ctrlCartSummary.ShowShipping = false; } if (!cart.HasTaxableComponents() || AppLogic.CustomerLevelHasNoTax(ThisCustomer.CustomerLevelID)) { ctrlCartSummary.ShowTax = false; } if (cart.ShippingThresHoldIsDefinedButFreeShippingMethodIDIsNot) { pnlErrorMsg.Visible = true; ErrorMsgLabel.Text += Server.HtmlEncode(AppLogic.GetString("shoppingcart.aspx.21", SkinID, ThisCustomer.LocaleSetting)); } }
public string GetOrderTotal(int QuoteCheckout, string PaymentMethod, object decOrderTotal, int CouponType, object decCouponAmount) { decimal OrderTotal = Convert.ToDecimal(decOrderTotal); decimal CouponAmount = Convert.ToDecimal(decCouponAmount); if (CouponType == 2) { OrderTotal = CommonLogic.IIF(OrderTotal < CouponAmount, 0, OrderTotal - CouponAmount); } return(CommonLogic.IIF(QuoteCheckout == 1 || AppLogic.CleanPaymentMethod(PaymentMethod) == AppLogic.ro_PMRequestQuote, AppLogic.GetString("account.aspx.54", SkinID, ThisCustomer.LocaleSetting), ThisCustomer.CurrencyString(OrderTotal))); }
public void RefreshPage() { Address BillingAddress = new Address(); Address ShippingAddress = new Address(); BillingAddress.LoadByCustomer(ThisCustomer.CustomerID, ThisCustomer.PrimaryBillingAddressID, AddressTypes.Billing); ShippingAddress.LoadByCustomer(ThisCustomer.CustomerID, ThisCustomer.PrimaryShippingAddressID, AddressTypes.Shipping); if (Checkout) { if (ThisCustomer.PrimaryBillingAddressID == 0 || ThisCustomer.PrimaryShippingAddressID == 0 || !ThisCustomer.HasAtLeastOneAddress() || (AppLogic.AppConfigBool("DisallowShippingToPOBoxes") && (!(new POBoxAddressValidator()).IsValid(ShippingAddress)))) { lblErrorMessage.Text = AppLogic.GetString("account.aspx.73", ThisCustomer.SkinID, ThisCustomer.LocaleSetting); pnlErrorMsg.Visible = true; } } ErrorMessage e = new ErrorMessage(CommonLogic.QueryStringNativeInt("errormsg")); lblErrorMessage.Text += Server.HtmlEncode(e.Message); pnlAccountUpdated.Visible = AccountUpdated; if (AccountUpdated) { if (!NewEmailAddressAllowed) { lblAcctUpdateMsg.Text += CommonLogic.IIF(lblAcctUpdateMsg.Text.Trim() == "", "", "") + AppLogic.GetString("account.aspx.3", SkinID, ThisCustomer.LocaleSetting); ctrlAccount.Email = ThisCustomer.EMail; } else { lblAcctUpdateMsg.Text = CommonLogic.IIF(lblAcctUpdateMsg.Text.Trim() == "", "", "") + AppLogic.GetString("account.aspx.2", SkinID, ThisCustomer.LocaleSetting); } //In case email address confirmation is on. TextBox txtReEnterEmail = (TextBox)ctrlAccount.FindControl("txtReEnterEmail"); if (txtReEnterEmail != null) { txtReEnterEmail.Text = String.Empty; } } pnlNotCheckOutButtons.Visible = !Checkout; pnlShowWishButton.Visible = AppLogic.AppConfigBool("ShowWishButtons"); pnlShowGiftRegistryButtons.Visible = AppLogic.AppConfigBool("ShowGiftRegistryButtons"); pnlSubscriptionExpiresOn.Visible = (ThisCustomer.SubscriptionExpiresOn > System.DateTime.Now); lblSubscriptionExpiresOn.Text = String.Format(AppLogic.GetString("account.aspx.5", ThisCustomer.SkinID, ThisCustomer.LocaleSetting), Localization.ToThreadCultureShortDateString(ThisCustomer.SubscriptionExpiresOn)); OriginalEMail.Text = ThisCustomer.EMail; //lblCustomerLevel.Visible = pnlCustomerLevel.Visible = (ThisCustomer.CustomerLevelID != 0); lblCustomerLevel.Visible = pnlCustomerLevel.Visible = false; lblCustomerLevel.Text = String.Format(AppLogic.GetString("account.aspx.9", ThisCustomer.SkinID, ThisCustomer.LocaleSetting), ThisCustomer.CustomerLevelName); lblMicroPayEnabled.Visible = pnlMicroPayEnabled.Visible = (AppLogic.MicropayIsEnabled() && ThisCustomer.IsRegistered && AppLogic.GetMicroPayProductID() != 0); lblMicroPayEnabled.Text = String.Format(AppLogic.GetString("account.aspx.10", ThisCustomer.SkinID, ThisCustomer.LocaleSetting), AppLogic.GetString("account.aspx.11", ThisCustomer.SkinID, ThisCustomer.LocaleSetting), ThisCustomer.CurrencyString(ThisCustomer.MicroPayBalance)); btnContinueToCheckOut.Visible = Checkout; GatewayCheckoutByAmazon.CheckoutByAmazon checkoutByAmazon = new GatewayCheckoutByAmazon.CheckoutByAmazon(); if (ThisCustomer.PrimaryBillingAddressID == 0 || checkoutByAmazon.IsAmazonAddress(ThisCustomer.PrimaryBillingAddress)) { // pnlBilling.Visible = false; } if (ThisCustomer.PrimaryShippingAddressID == 0 || checkoutByAmazon.IsAmazonAddress(ThisCustomer.PrimaryShippingAddress)) { //pnlShipping.Visible = false; } lnkChangeBilling.NavigateUrl = "javascript:self.location='JWMyAddresses.aspx?Checkout=" + Checkout.ToString() + "&AddressType=1&returnURL=" + Server.UrlEncode("account.aspx?checkout=" + Checkout.ToString()) + "'"; lnkChangeShipping.NavigateUrl = "javascript:self.location='JWMyAddresses.aspx?Checkout=" + Checkout.ToString() + "&AddressType=2&returnURL=" + Server.UrlEncode("account.aspx?checkout=" + Checkout.ToString()) + "'"; //lnkAddBillingAddress.NavigateUrl = "JWMyAddresses.aspx?add=true&addressType=1&Checkout=" + Checkout.ToString() + "&returnURL=" + Server.UrlEncode("account.aspx?checkout=" + Checkout.ToString()); //lnkAddBillingAddress.Text = "<div>" + AppLogic.GetString("account.aspx.63", SkinID, ThisCustomer.LocaleSetting) + "</div>"; //lnkAddShippingAddress.NavigateUrl = "JWMyAddresses.aspx?add=true&addressType=2&Checkout=" + Checkout.ToString() + "&returnURL=" + Server.UrlEncode("account.aspx?checkout=" + Checkout.ToString()); //lnkAddShippingAddress.Text = "<div>" + AppLogic.GetString("account.aspx.62", SkinID, ThisCustomer.LocaleSetting) + "</div>"; if (BillingAddress.AddressID != 0) { litBillingAddress.Text = BillingAddress.DisplayHTML(true); } if (BillingAddress.PaymentMethodLastUsed.Length != 0) { //need for future use //litBillingAddress.Text += "<div>" + AppLogic.GetString("account.aspx.31", SkinID, ThisCustomer.LocaleSetting); // litBillingAddress.Text += "<div>" + BillingAddress.DisplayPaymentMethodInfo(ThisCustomer, BillingAddress.PaymentMethodLastUsed) + "</div>"; } if (!(new POBoxAddressValidator()).IsValid(ShippingAddress)) { litShippingAddress.Text = "<div class='error-wrap'>" + "createaccount_process.aspx.3".StringResource() + "</div>"; //PO box not allowed } else { if (ShippingAddress.AddressID != 0) { litShippingAddress.Text = "Cannot ship to P.O boxes" + ShippingAddress.DisplayHTML(true); } } pnlOrderHistory.Visible = !Checkout; GiftCards gc = new GiftCards(ThisCustomer.CustomerID, GiftCardCollectionFilterType.UsingCustomerID); if (gc.Count > 0) { rptrGiftCards.DataSource = gc; rptrGiftCards.DataBind(); pnlGiftCards.Visible = true; } if (ShoppingCart.NumItems(ThisCustomer.CustomerID, CartTypeEnum.RecurringCart) != 0) { ltRecurringOrders.Text = "<div class=\"group-header account-header recurring-header\">" + AppLogic.GetString("account.aspx.35", SkinID, ThisCustomer.LocaleSetting) + "</div>"; // build JS code to show/hide address update block: StringBuilder tmpS = new StringBuilder(4096); tmpS.Append("<script type=\"text/javascript\">\n"); tmpS.Append("function toggleLayer(DivID)\n"); tmpS.Append("{\n"); tmpS.Append(" var elem;\n"); tmpS.Append(" var vis;\n"); tmpS.Append(" if(document.getElementById)\n"); tmpS.Append(" {\n"); tmpS.Append(" // standards\n"); tmpS.Append(" elem = document.getElementById(DivID);\n"); tmpS.Append(" }\n"); tmpS.Append(" else if(document.all)\n"); tmpS.Append(" {\n"); tmpS.Append(" // old msie versions\n"); tmpS.Append(" elem = document.all[DivID];\n"); tmpS.Append(" }\n"); tmpS.Append(" else if(document.layers)\n"); tmpS.Append(" {\n"); tmpS.Append(" // nn4\n"); tmpS.Append(" elem = document.layers[DivID];\n"); tmpS.Append(" }\n"); tmpS.Append(" vis = elem.style;\n"); tmpS.Append(" if(vis.display == '' && elem.offsetWidth != undefined && elem.offsetHeight != undefined)\n"); tmpS.Append(" {\n"); tmpS.Append(" vis.display = (elem.offsetWidth != 0 && elem.offsetHeight != 0) ? 'block' : 'none';\n"); tmpS.Append(" }\n"); tmpS.Append(" vis.display = (vis.display == '' || vis.display == 'block') ? 'none' : 'block' ;\n"); tmpS.Append("}\n"); tmpS.Append("</script>\n"); tmpS.Append("\n"); tmpS.Append("<style type=\"text/css\">\n"); tmpS.Append(" .addressBlockDiv { margin: 0px 20px 0px 20px; display: none;}\n"); tmpS.Append("</style>\n"); ltRecurringOrders.Text += tmpS.ToString(); using (SqlConnection con = new SqlConnection(DB.GetDBConn())) { con.Open(); using (IDataReader rsr = DB.GetRS("Select distinct OriginalRecurringOrderNumber from ShoppingCart with (NOLOCK) where CartType=" + ((int)CartTypeEnum.RecurringCart).ToString() + " and CustomerID=" + ThisCustomer.CustomerID.ToString() + " order by OriginalRecurringOrderNumber desc", con)) { while (rsr.Read()) { ltRecurringOrders.Text += AppLogic.GetRecurringCart(base.EntityHelpers, base.GetParser, ThisCustomer, DB.RSFieldInt(rsr, "OriginalRecurringOrderNumber"), SkinID, false); } } } } string[] TrxStates = { DB.SQuote(AppLogic.ro_TXStateAuthorized), DB.SQuote(AppLogic.ro_TXStateCaptured), DB.SQuote(AppLogic.ro_TXStatePending) }; using (SqlConnection con = new SqlConnection(DB.GetDBConn())) { con.Open(); using (IDataReader rs = DB.GetRS(string.Format("Select OrderNumber, OrderDate, RecurringSubscriptionID, PaymentMethod, CardNumber, TransactionState, QuoteCheckout, ShippedOn, ShippedVIA, ShippingTrackingNumber, DownloadEMailSentOn, QuoteCheckout, PaymentMethod, " + "OrderTotal, CouponType, isnull(CouponDiscountAmount, 0) CouponDiscountAmount, CustomerServiceNotes from dbo.orders with (NOLOCK) where TransactionState in ({0}) and CustomerID={1} and ({2} = 0 or StoreID = {3}) order by OrderDate desc", String.Join(",", TrxStates), ThisCustomer.CustomerID, CommonLogic.IIF(AppLogic.GlobalConfigBool("AllowCustomerFiltering") == true, 1, 0), AppLogic.StoreID()), con)) { orderhistorylist.DataSource = rs; orderhistorylist.DataBind(); } } accountaspx55.Visible = (orderhistorylist.Items.Count == 0); ClientScriptManager cs = Page.ClientScript; cs.RegisterClientScriptBlock(this.GetType(), Guid.NewGuid().ToString(), "function ReOrder(OrderNumber) {if(confirm('" + AppLogic.GetString("account.aspx.64", SkinID, ThisCustomer.LocaleSetting) + "')) {top.location.href='reorder.aspx?ordernumber='+OrderNumber;} }", true); ctrlAccount.Password = String.Empty; ctrlAccount.PasswordConfirm = String.Empty; }
private void GenerateReport() { string sql = "select OrderNumber, OrderDate, IsNew from orders with (NOLOCK) where " + WhereClause() + DateClause() + " order by " + OrderByFields; bool hasOrders = false; using (SqlConnection dbconn = new SqlConnection(DB.GetDBConn())) { dbconn.Open(); using (IDataReader rs = DB.GetRS(sql, dbconn)) { dlSelected.DataSource = rs; dlSelected.DataBind(); } } hasOrders = dlSelected.Items.Count > 0; if (hasOrders) { // NOTE: // Because the use of datareaders, we removed getting the first row before assigning the datasource // to the datalist above, since the datasource is already bound, we will then need to query // the first order number on the datalist items. Here we assume the control holding the // order number info is a hyperlink control HyperLink lnkOrderNumber = dlSelected.Items[0].FindControl("hlOrderNumber") as HyperLink; if (lnkOrderNumber != null) { string text = lnkOrderNumber.Text; m_FirstOrderNumber = int.Parse(text); } } if (hasOrders) { orderframe.Attributes["src"] = string.Format(AppLogic.AdminLinkUrl("orderframe.aspx") + "?ordernumber={0}", m_FirstOrderNumber); } lblError.Text = String.Empty; if (AppLogic.AppConfigBool("Admin_ShowReportSQL")) { lblError.Text = "SQL=" + sql; } pnlBulkPrintingReport.Visible = BulkPrintingReport.Checked; pnlRegularReport.Visible = RegularReport.Checked; pnlSummaryReport.Visible = SummaryReport.Checked; if (hasOrders) { if (RegularReport.Checked) { // don't have to do anything here } if (BulkPrintingReport.Checked) { String summarySQL = "select Count(OrderNumber) as N from orders with (NOLOCK) where " + WhereClause() + DateClause() + "; " + "select OrderNumber, Shippedon, IsPrinted,ReadyToShip from orders with (NOLOCK) where " + WhereClause() + DateClause() + " order by OrderNumber"; using (SqlConnection dbconn = DB.dbConn()) { dbconn.Open(); using (IDataReader rs = DB.GetRS(summarySQL, dbconn)) { if (rs.Read() && DB.RSFieldInt(rs, "N") > 0) { if (rs.NextResult()) { StringBuilder tmpS = new StringBuilder(4096); tmpS.Append("<script type=\"text/javascript\">\n"); tmpS.Append(" function checkUncheckAll(theElement, ElementName)\n"); tmpS.Append("{\n"); tmpS.Append(" var chkb = theElement.form.PrintNow;\n"); tmpS.Append(" var chkb0 = theElement.form.checkall;\n"); tmpS.Append(" for (var i=0; i < chkb.length; i++)\n"); tmpS.Append(" {\n"); tmpS.Append(" chkb[i].checked = chkb0.checked;\n"); tmpS.Append(" }\n"); tmpS.Append(" }\n"); tmpS.Append("</script>\n"); tmpS.Append("<table cellpadding=\"4\" cellspacing=\"0\" border=\"0\" style=\"border-width: 1px; border-style: solid;\">"); tmpS.Append("<tr class=\"table-header\">"); tmpS.Append("<td align=\"center\"><b><nobr>" + AppLogic.GetString("admin.orders.BulkPrinting.OrderNumber", SkinID, LocaleSetting) + "</nobr></b></td>"); tmpS.Append("<td align=\"center\"><b><nobr>" + AppLogic.GetString("admin.orders.BulkPrinting.OrderDate", SkinID, LocaleSetting) + "</nobr></b></td>"); tmpS.Append("<td align=\"center\"><b><nobr>" + AppLogic.GetString("admin.orders.BulkPrinting.OrderTotal", SkinID, LocaleSetting) + "</nobr></b></td>"); tmpS.Append("<td align=\"left\"><b><nobr>" + AppLogic.GetString("admin.orders.BulkPrinting.ShipToAddress", SkinID, LocaleSetting) + "</nobr></b></td>"); tmpS.Append("<td align=\"left\"><b><nobr>" + AppLogic.GetString("admin.orders.BulkPrinting.Items", SkinID, LocaleSetting) + "</nobr></b></td>"); tmpS.Append("<td align=\"center\"><b><nobr>" + AppLogic.GetString("admin.orders.BulkPrinting.IsShipped", SkinID, LocaleSetting) + "</nobr></b></td>"); tmpS.Append("<td align=\"center\"><b><nobr>" + AppLogic.GetString("admin.orders.BulkPrinting.IsPrinted", SkinID, LocaleSetting) + "</nobr></b></td>"); tmpS.Append("<td align=\"center\"><b><nobr>" + AppLogic.GetString("admin.orders.BulkPrinting.PrintItNow", SkinID, LocaleSetting) + "</nobr></b><br/>check all<br/><input type=\"checkbox\" id=\"checkall\" name=\"checkall\" onclick=\"checkUncheckAll(this,'PrintNow');\"/></td>"); tmpS.Append("</tr>"); int ctr = 0; while (rs.Read()) { int ONX = DB.RSFieldInt(rs, "OrderNumber"); Order ord = new Order(ONX, LocaleSetting); String ShipAddr = (ord.ShippingAddress.m_FirstName + " " + ord.ShippingAddress.m_LastName).Trim() + "<br/>"; ShipAddr += ord.ShippingAddress.m_Address1; if (ord.ShippingAddress.m_Address2.Length != 0) { ShipAddr += "<br/>" + ord.ShippingAddress.m_Address2; } if (ord.ShippingAddress.m_Suite.Length != 0) { ShipAddr += ", " + ord.ShippingAddress.m_Suite; } ShipAddr += "<br/>" + ord.ShippingAddress.m_City + ", " + ord.ShippingAddress.m_State + " " + ord.ShippingAddress.m_Zip; ShipAddr += "<br/>" + ord.ShippingAddress.m_Country.ToUpper(CultureInfo.InvariantCulture); ShipAddr += "<br/>" + ord.ShippingAddress.m_Phone; ctr++; if (ctr % 2 == 0) { tmpS.Append("<tr class=\"table-alternatingrow2\">"); } else { tmpS.Append("<tr class=\"table-row2\">"); } tmpS.Append("<td align=\"center\" valign=\"top\" style=\"border-width: 1px; border-style: solid;\">"); tmpS.Append(ONX.ToString()); tmpS.Append("</td>"); tmpS.Append("<td align=\"center\" valign=\"top\" style=\"border-width: 1px; border-style: solid;\">"); tmpS.Append(Localization.ToNativeDateTimeString(ord.OrderDate)); tmpS.Append("</td>"); tmpS.Append("<td align=\"center\" valign=\"top\" style=\"border-width: 1px; border-style: solid;\">"); tmpS.Append(ThisCustomer.CurrencyString(ord.Total(true))); tmpS.Append("</td>"); tmpS.Append("<td align=\"left\" valign=\"top\" style=\"border-width: 1px; border-style: solid;\">"); tmpS.Append(ShipAddr); tmpS.Append("</td>"); tmpS.Append("<td align=\"left\" valign=\"top\" style=\"border-width: 1px; border-style: solid;\">"); bool first = true; foreach (CartItem c in ord.CartItems) { if (!first) { tmpS.Append("<br/><br/>"); } tmpS.Append("(" + c.Quantity.ToString() + ") "); tmpS.Append(ord.GetLineItemDescription(c)); first = false; } tmpS.Append("</td>"); tmpS.Append("<td align=\"center\" valign=\"top\" style=\"border-width: 1px; border-style: solid;\">"); tmpS.Append(CommonLogic.IIF(DB.RSFieldDateTime(rs, "ShippedOn") == System.DateTime.MinValue, "No", Localization.ToNativeDateTimeString(DB.RSFieldDateTime(rs, "ShippedOn")))); tmpS.Append("</td>"); tmpS.Append("<td align=\"center\" valign=\"top\" style=\"border-width: 1px; border-style: solid;\">"); tmpS.Append(CommonLogic.IIF(DB.RSFieldBool(rs, "IsPrinted"), "Yes", "No")); tmpS.Append("</td>"); tmpS.Append("<td align=\"center\" valign=\"top\" style=\"border-width: 1px; border-style: solid;\">"); tmpS.Append("<input type=\"checkbox\" id=\"PrintNow\" name=\"PrintNow\" value=\"" + ONX.ToString() + "\" " + CommonLogic.IIF(!DB.RSFieldBool(rs, "IsPrinted"), " checked ", "") + ">"); tmpS.Append("</td>"); tmpS.Append("</tr>"); } tmpS.Append("<tr>"); tmpS.Append("<td colspan=\"7\"> </td>"); tmpS.Append("<td>"); tmpS.Append("<div style=\"display:none;\"><input type=\"checkbox\" id=\"PrintNow\" name=\"PrintNow\" value=\"0\"></div>"); tmpS.Append("<input type=\"button\" value=\"" + AppLogic.GetString("admin.orders.BulkPrinting.PrintReceipts", SkinID, LocaleSetting) + "\" class=\"normalButtons\" onClick=\"OpenPrintWindow();\">"); tmpS.Append("</td>"); tmpS.Append("</tr>"); tmpS.Append("</table>"); tmpS.Append("<script type=\"text/javascript\">\n"); tmpS.Append(" function OpenPrintWindow()\n"); tmpS.Append(" {\n"); tmpS.Append(" alert('"+ AppLogic.GetString("admin.orders.BulkPrinting.AlertWindow", SkinID, LocaleSetting) + "');\n"); tmpS.Append(" var Orders = '';\n"); tmpS.Append(" var chkb = document.getElementsByName('PrintNow');\n"); tmpS.Append(" for (var i=0; i < chkb.length; i++)\n"); tmpS.Append(" {\n"); tmpS.Append(" if (chkb[i].checked)\n"); tmpS.Append(" {\n"); tmpS.Append(" if(i > 0)\n"); tmpS.Append(" {\n"); tmpS.Append(" Orders = Orders + ',';\n"); tmpS.Append(" }\n"); tmpS.Append(" if(chkb[i].value != '0') Orders = Orders + chkb[i].value;\n"); tmpS.Append(" }\n"); tmpS.Append(" }\n"); tmpS.Append(" if(Orders == '')\n"); tmpS.Append(" {\n"); tmpS.Append(" alert('"+ AppLogic.GetString("admin.common.NothingToPrint", SkinID, LocaleSetting) + "');\n"); tmpS.Append(" }\n"); tmpS.Append(" else\n"); tmpS.Append(" {\n"); tmpS.Append(" window.open('"+ AppLogic.AdminLinkUrl("printreceipts.aspx") + "?ordernumbers=' + Orders,'ASPDNSF_ML" + CommonLogic.GetRandomNumber(1, 100000).ToString() + "','height=600,width=800,top=0,left=0,status=yes,toolbar=yes,menubar=yes,scrollbars=yes,location=yes')\n"); tmpS.Append(" }\n"); tmpS.Append(" }\n"); tmpS.Append("</SCRIPT>\n"); Literal4.Text = tmpS.ToString(); } } } } } if (SummaryReport.Checked) { // doing summary report: String SummaryReportFields = AppLogic.AppConfig("OrderSummaryReportFields"); if (SummaryReportFields.Length == 0) { SummaryReportFields = "*"; } if (AppLogic.ProductIsMLExpress()) { int affiliateidindex = SummaryReportFields.IndexOf("affiliateId", StringComparison.InvariantCultureIgnoreCase); string[] summaryField = SummaryReportFields.Split(','); string newSummaryField = string.Empty; for (int i = 0; i < summaryField.Length; i++) { if (summaryField[i].Equals("AffiliateId", StringComparison.InvariantCultureIgnoreCase) == false && summaryField[i].Equals("PONumber", StringComparison.InvariantCultureIgnoreCase) == false && summaryField[i].Equals("CardNumber", StringComparison.InvariantCultureIgnoreCase) == false) { newSummaryField += summaryField[i]; if ((i + 1) < summaryField.Length) { newSummaryField += ","; } } } SummaryReportFields = newSummaryField; } String summarySQL = "select " + SummaryReportFields + " from orders with (NOLOCK) where " + WhereClause() + DateClause() + " order by " + OrderByFields; using (SqlConnection dbconn = DB.dbConn()) { dbconn.Open(); using (IDataReader rs = DB.GetRS(summarySQL, dbconn)) { using (DataTable dt = new DataTable()) { dt.Load(rs); // unencrypt some data in the ds: int SummaryCardNumberFieldIndex = -1; int col = 0; foreach (String s in SummaryReportFields.Split(',')) { if (s.Trim().Equals("CARDNUMBER", StringComparison.InvariantCultureIgnoreCase)) { SummaryCardNumberFieldIndex = col; } col++; } if (SummaryCardNumberFieldIndex != -1) { foreach (DataRow row in dt.Rows) { String s = row[SummaryCardNumberFieldIndex].ToString(); if (ThisCustomer.AdminCanViewCC) { if (s.Length != 0) { try { s = Security.UnmungeString(s, Order.StaticGetSaltKey(DB.RowFieldInt(row, "OrderNumber"))); if (!s.StartsWith(Security.ro_DecryptFailedPrefix, StringComparison.InvariantCultureIgnoreCase)) { row[SummaryCardNumberFieldIndex] = s; } } catch { } } } else { row[SummaryCardNumberFieldIndex] = "Cannot View"; } } } SummaryGrid.DataSource = dt; SummaryGrid.DataBind(); } } } } } else { lblError.Text += "<br/><br/>" + AppLogic.GetString("admin.common.NoOrdersFound", SkinID, LocaleSetting); // remind the merchant that a frequent cause of zero results is having 'New Orders Only' selected if (rbNewOrdersOnly.SelectedValue == "1") { lblError.Text += " " + AppLogic.GetString("admin.common.NoOrdersFoundReminder", SkinID, LocaleSetting); } pnlBulkPrintingReport.Visible = false; pnlRegularReport.Visible = false; pnlSummaryReport.Visible = false; } //Page.DataBind(); }
private void UpdatepageContent() { //set header graphic image and set the hotspot alternate text checkoutheadergraphic.ImageUrl = AppLogic.LocateImageURL("App_Themes/skin_" + SkinID.ToString() + "/images/step_3.gif"); ((RectangleHotSpot)checkoutheadergraphic.HotSpots[0]).AlternateText = AppLogic.GetString("checkoutshippingmult.aspx.3", SkinID, ThisCustomer.LocaleSetting); ((RectangleHotSpot)checkoutheadergraphic.HotSpots[1]).AlternateText = AppLogic.GetString("checkoutshippingmult.aspx.4", SkinID, ThisCustomer.LocaleSetting); if (CommonLogic.QueryStringNativeInt("ErrorMsg") > 0) { ErrorMessage e = new ErrorMessage(CommonLogic.QueryStringNativeInt("ErrorMsg")); ErrorMsgLabel.Text = "<p align=\"left\"><span class=\"errorLg\">" + Server.HtmlEncode(e.Message) + "</span></p>"; pnlErrorMsg.Visible = true; } else { pnlErrorMsg.Visible = false; } //write out header package is it exists String XmlPackageName = AppLogic.AppConfig("XmlPackage.CheckoutShippingMultPageHeader"); if (XmlPackageName.Length != 0) { XmlPackage_CheckoutShippingPageHeader.Text = AppLogic.RunXmlPackage(XmlPackageName, base.GetParser, ThisCustomer, SkinID, String.Empty, String.Empty, true, true); } // if (!cart.ShippingIsFree && cart.MoreNeededToReachFreeShipping != 0.0M) { GetFreeShipping.Text = "<div class=\"FreeShippingThresholdPrompt\">"; GetFreeShipping.Text += String.Format(AppLogic.GetString("checkoutshippingmult.aspx.2", SkinID, ThisCustomer.LocaleSetting), ThisCustomer.CurrencyString(cart.FreeShippingThreshold), CommonLogic.Capitalize(cart.FreeShippingMethod)); GetFreeShipping.Text += "<br/> "; GetFreeShipping.Text += "</div>"; pnlGetFreeShipping.Visible = true; } else { pnlGetFreeShipping.Visible = false; } checkoutshippingmultaspx16.Text = "<p><b>" + AppLogic.GetString("checkoutshippingmult.aspx.16", SkinID, ThisCustomer.LocaleSetting) + "</b></p>"; checkoutshippingmultaspx18.Text = "<p>" + String.Format(AppLogic.GetString("checkoutshippingmult.aspx.18", SkinID, ThisCustomer.LocaleSetting), "account.aspx?checkout=true", "checkoutshippingmult.aspx?setallprimary=true") + "</p>"; String XmlPackageName2 = AppLogic.AppConfig("XmlPackage.CheckoutShippingMultPageFooter"); if (XmlPackageName2.Length != 0) { XmlPackage_CheckoutShippingMultPageFooter.Text = AppLogic.RunXmlPackage(XmlPackageName2, base.GetParser, ThisCustomer, SkinID, String.Empty, String.Empty, true, true); } }
public void RefreshPage() { Address BillingAddress = new Address(); Address ShippingAddress = new Address(); BillingAddress.LoadByCustomer(ThisCustomer.CustomerID, ThisCustomer.PrimaryBillingAddressID, AddressTypes.Billing); ShippingAddress.LoadByCustomer(ThisCustomer.CustomerID, ThisCustomer.PrimaryShippingAddressID, AddressTypes.Shipping); if (Checkout) { pnlCheckoutImage.Visible = true; CheckoutImage.ImageUrl = AppLogic.SkinImage("step_2.gif"); if (ThisCustomer.PrimaryBillingAddressID == 0 || ThisCustomer.PrimaryShippingAddressID == 0 || !ThisCustomer.HasAtLeastOneAddress() || (AppLogic.AppConfigBool("DisallowShippingToPOBoxes") && CheckPOBox(ShippingAddress.Address1))) { ErrorMsgLabel.Text = AppLogic.GetString("account.aspx.73", ThisCustomer.SkinID, ThisCustomer.LocaleSetting);; } } String XRI = AppLogic.SkinImage("redarrow.gif"); redarrow1.ImageUrl = XRI; redarrow2.ImageUrl = XRI; redarrow3.ImageUrl = XRI; pnlCheckoutImage.Visible = Checkout; ErrorMessage e = new ErrorMessage(CommonLogic.QueryStringNativeInt("errormsg")); ErrorMsgLabel.Text += Server.HtmlEncode(e.Message); pnlAccountUpdated.Visible = AccountUpdated; if (AccountUpdated) { if (!NewEmailAddressAllowed) { lblAcctUpdateMsg.Text += CommonLogic.IIF(lblAcctUpdateMsg.Text.Trim() == "", "", "<br/>") + AppLogic.GetString("account.aspx.3", SkinID, ThisCustomer.LocaleSetting); } else { lblAcctUpdateMsg.Text = CommonLogic.IIF(lblAcctUpdateMsg.Text.Trim() == "", "", "<br/>") + AppLogic.GetString("account.aspx.2", SkinID, ThisCustomer.LocaleSetting); } } pnlNotCheckOutButtons.Visible = !Checkout; pnlShowWishButton.Visible = AppLogic.ProductIsMLExpress() == false && AppLogic.AppConfigBool("ShowWishButtons"); pnlShowGiftRegistryButtons.Visible = AppLogic.ProductIsMLExpress() == false && AppLogic.AppConfigBool("ShowGiftRegistryButtons"); pnlSubscriptionExpiresOn.Visible = (ThisCustomer.SubscriptionExpiresOn > System.DateTime.Now); lblSubscriptionExpiresOn.Text = String.Format(AppLogic.GetString("account.aspx.5", ThisCustomer.SkinID, ThisCustomer.LocaleSetting), Localization.ToThreadCultureShortDateString(ThisCustomer.SubscriptionExpiresOn)); OriginalEMail.Text = ThisCustomer.EMail; imgAccountinfo.ImageUrl = AppLogic.SkinImage("accountinfo.gif"); note1.Visible = (ThisCustomer.CustomerLevelID != 0); note1.Text = String.Format(AppLogic.GetString("account.aspx.9", ThisCustomer.SkinID, ThisCustomer.LocaleSetting), ThisCustomer.CustomerLevelName); MicroPayEnabled.Visible = (AppLogic.MicropayIsEnabled() && ThisCustomer.IsRegistered && AppLogic.GetMicroPayProductID() != 0); MicroPayEnabled.Text = String.Format(AppLogic.GetString("account.aspx.10", ThisCustomer.SkinID, ThisCustomer.LocaleSetting), AppLogic.GetString("account.aspx.11", ThisCustomer.SkinID, ThisCustomer.LocaleSetting), ThisCustomer.CurrencyString(ThisCustomer.MicroPayBalance)); btnContinueToCheckOut.Visible = Checkout; lnkChangeBilling.ImageUrl = AppLogic.SkinImage("change.gif"); lnkChangeShipping.ImageUrl = AppLogic.SkinImage("change.gif"); GatewayCheckoutByAmazon.CheckoutByAmazon checkoutByAmazon = new GatewayCheckoutByAmazon.CheckoutByAmazon(); if (ThisCustomer.PrimaryBillingAddressID == 0 || checkoutByAmazon.IsAmazonAddress(ThisCustomer.PrimaryBillingAddress)) { pnlBilling.Visible = false; } if (ThisCustomer.PrimaryShippingAddressID == 0 || checkoutByAmazon.IsAmazonAddress(ThisCustomer.PrimaryShippingAddress)) { pnlShipping.Visible = false; } lnkChangeBilling.NavigateUrl = "javascript:self.location='address.aspx?Checkout=" + Checkout.ToString() + "&AddressType=billing&returnURL=" + Server.UrlEncode("account.aspx?checkout=" + Checkout.ToString()) + "'"; lnkChangeShipping.NavigateUrl = "javascript:self.location='address.aspx?Checkout=" + Checkout.ToString() + "&AddressType=shipping&returnURL=" + Server.UrlEncode("account.aspx?checkout=" + Checkout.ToString()) + "'"; imgAddressbook.ImageUrl = AppLogic.SkinImage("addressbook.gif"); lnkAddBillingAddress.NavigateUrl = "address.aspx?add=true&addressType=Billing&Checkout=" + Checkout.ToString() + "&returnURL=" + Server.UrlEncode("account.aspx?checkout=" + Checkout.ToString()); lnkAddBillingAddress.Text = AppLogic.GetString("account.aspx.63", SkinID, ThisCustomer.LocaleSetting); lnkAddShippingAddress.NavigateUrl = "address.aspx?add=true&addressType=Shipping&Checkout=" + Checkout.ToString() + "&returnURL=" + Server.UrlEncode("account.aspx?checkout=" + Checkout.ToString()); lnkAddShippingAddress.Text = AppLogic.GetString("account.aspx.62", SkinID, ThisCustomer.LocaleSetting); litBillingAddress.Text = BillingAddress.DisplayHTML(Checkout); if (BillingAddress.PaymentMethodLastUsed.Length != 0) { litBillingAddress.Text += "<b>" + AppLogic.GetString("account.aspx.31", SkinID, ThisCustomer.LocaleSetting) + "</b><br/>"; litBillingAddress.Text += BillingAddress.DisplayPaymentMethodInfo(ThisCustomer, BillingAddress.PaymentMethodLastUsed); } if (CheckPOBox(ShippingAddress.Address1)) { litShippingAddress.Text = "<span style=\"color:red; font-weight:bold;\">" + "createaccount_process.aspx.3".StringResource() + "</span>"; //PO box not allowed } else { litShippingAddress.Text = ShippingAddress.DisplayHTML(Checkout); } pnlOrderHistory.Visible = !Checkout; imgOrderhistory.ImageUrl = AppLogic.SkinImage("orderhistory.gif"); if (!AppLogic.m_ProductIsML()) { // gift cards not supported in PRO } else { GiftCards gc = new GiftCards(ThisCustomer.CustomerID, GiftCardCollectionFilterType.UsingCustomerID); if (gc.Count > 0) { rptrGiftCards.DataSource = gc; rptrGiftCards.DataBind(); tblGiftCards.Attributes.Add("style", "border-style: solid; border-width: 0px; border-color: #" + AppLogic.AppConfig("HeaderBGColor")); tblGiftCardsBox.Attributes.Add("style", AppLogic.AppConfig("BoxFrameStyle")); giftcards_gif.ImageUrl = AppLogic.LocateImageURL("App_Themes/skin_" + SkinID.ToString() + "/images/giftcards.gif"); pnlGiftCards.Visible = true; } } if (ShoppingCart.NumItems(ThisCustomer.CustomerID, CartTypeEnum.RecurringCart) != 0) { RecurringOrders.Text = "<p align=\"left\"><b>" + AppLogic.GetString("account.aspx.35", SkinID, ThisCustomer.LocaleSetting) + "</b></p>"; // build JS code to show/hide address update block: StringBuilder tmpS = new StringBuilder(4096); tmpS.Append("<script type=\"text/javascript\">\n"); tmpS.Append("function toggleLayer(DivID)\n"); tmpS.Append("{\n"); tmpS.Append(" var elem;\n"); tmpS.Append(" var vis;\n"); tmpS.Append(" if(document.getElementById)\n"); tmpS.Append(" {\n"); tmpS.Append(" // standards\n"); tmpS.Append(" elem = document.getElementById(DivID);\n"); tmpS.Append(" }\n"); tmpS.Append(" else if(document.all)\n"); tmpS.Append(" {\n"); tmpS.Append(" // old msie versions\n"); tmpS.Append(" elem = document.all[DivID];\n"); tmpS.Append(" }\n"); tmpS.Append(" else if(document.layers)\n"); tmpS.Append(" {\n"); tmpS.Append(" // nn4\n"); tmpS.Append(" elem = document.layers[DivID];\n"); tmpS.Append(" }\n"); tmpS.Append(" vis = elem.style;\n"); tmpS.Append(" if(vis.display == '' && elem.offsetWidth != undefined && elem.offsetHeight != undefined)\n"); tmpS.Append(" {\n"); tmpS.Append(" vis.display = (elem.offsetWidth != 0 && elem.offsetHeight != 0) ? 'block' : 'none';\n"); tmpS.Append(" }\n"); tmpS.Append(" vis.display = (vis.display == '' || vis.display == 'block') ? 'none' : 'block' ;\n"); tmpS.Append("}\n"); tmpS.Append("</script>\n"); tmpS.Append("\n"); tmpS.Append("<style type=\"text/css\">\n"); tmpS.Append(" .addressBlockDiv { margin: 0px 20px 0px 20px; display: none;}\n"); tmpS.Append("</style>\n"); RecurringOrders.Text += tmpS.ToString(); using (SqlConnection con = new SqlConnection(DB.GetDBConn())) { con.Open(); using (IDataReader rsr = DB.GetRS("Select distinct OriginalRecurringOrderNumber from ShoppingCart with (NOLOCK) where CartType=" + ((int)CartTypeEnum.RecurringCart).ToString() + " and CustomerID=" + ThisCustomer.CustomerID.ToString() + " order by OriginalRecurringOrderNumber desc", con)) { while (rsr.Read()) { RecurringOrders.Text += AppLogic.GetRecurringCart(base.EntityHelpers, base.GetParser, ThisCustomer, DB.RSFieldInt(rsr, "OriginalRecurringOrderNumber"), SkinID, false); } } } RecurringOrders.Text += "<br/><br/>"; } string[] TrxStates = { DB.SQuote(AppLogic.ro_TXStateAuthorized), DB.SQuote(AppLogic.ro_TXStateCaptured), DB.SQuote(AppLogic.ro_TXStatePending) }; using (SqlConnection con = new SqlConnection(DB.GetDBConn())) { con.Open(); using (IDataReader rs = DB.GetRS(string.Format("Select OrderNumber, OrderDate, RecurringSubscriptionID, PaymentMethod, CardNumber, TransactionState, QuoteCheckout, ShippedOn, ShippedVIA, ShippingTrackingNumber, DownloadEMailSentOn, QuoteCheckout, PaymentMethod, " + "OrderTotal, CouponType, isnull(CouponDiscountAmount, 0) CouponDiscountAmount, CustomerServiceNotes from dbo.orders with (NOLOCK) where TransactionState in ({0}) and CustomerID={1} and ({2} = 0 or StoreID = {3}) order by OrderDate desc", String.Join(",", TrxStates), ThisCustomer.CustomerID, CommonLogic.IIF(AppLogic.GlobalConfigBool("AllowCustomerFiltering") == true, 1, 0), AppLogic.StoreID()), con)) { orderhistorylist.DataSource = rs; orderhistorylist.DataBind(); } } accountaspx55.Visible = (orderhistorylist.Items.Count == 0); ctrlAccount.Password = String.Empty; ctrlAccount.PasswordConfirm = String.Empty; ClientScriptManager cs = Page.ClientScript; cs.RegisterClientScriptBlock(this.GetType(), Guid.NewGuid().ToString(), "function ReOrder(OrderNumber) {if(confirm('" + AppLogic.GetString("account.aspx.64", SkinID, ThisCustomer.LocaleSetting) + "')) {top.location.href='reorder.aspx?ordernumber='+OrderNumber;} }", true); }
// these can change on EVERY page request!! public void BuildPageDynamicTokens() { if (m_DynamicTokens == null) { // page/customer specific items (that may change every page): m_DynamicTokens = new Hashtable(); if (CommonLogic.GetThisPageName(false).ToLowerInvariant().StartsWith("orderconfirmation.aspx")) { m_DynamicTokens.Add("(!GOOGLE_ECOM_TRACKING!)", AppLogic.GetGoogleEComTracking(ThisCustomer)); } else { m_DynamicTokens.Add("(!GOOGLE_ECOM_TRACKING!)", String.Empty); } if (CommonLogic.GetThisPageName(false).ToLowerInvariant().StartsWith("orderconfirmation.aspx")) { m_DynamicTokens.Add("(!GOOGLE_ECOM_TRACKING_V2!)", String.Empty); } else { m_DynamicTokens.Add("(!GOOGLE_ECOM_TRACKING_V2!)", AppLogic.GetGoogleEComTrackingV2(ThisCustomer, false)); } if (!AppLogic.VATIsEnabled()) { m_DynamicTokens.Add("(!VATREGISTRATIONID!)", String.Empty); } else { StringBuilder tmpS2 = new StringBuilder(1024); if (ThisCustomer.HasCustomerRecord) { tmpS2.Append("<span class=\"VATRegistrationIDPrompt\">" + AppLogic.GetString("setvatsetting.aspx.8", ThisCustomer.SkinID, ThisCustomer.LocaleSetting) + "</span><input type=\"text\" style=\"VATRegistrationID\" id=\"VATRegistrationID\" value=\"" + ThisCustomer.VATRegistrationID + "\">"); } m_DynamicTokens.Add("(!VATREGISTRATIONID!)", tmpS2.ToString()); } if (AppLogic.NumLocaleSettingsInstalled() < 2) { m_DynamicTokens.Add("(!COUNTRYDIVVISIBILITY!)", "hidden"); m_DynamicTokens.Add("(!COUNTRYDIVDISPLAY!)", "none"); m_DynamicTokens.Add("(!COUNTRYSELECTLIST!)", String.Empty); } else { m_DynamicTokens.Add("(!COUNTRYDIVVISIBILITY!)", "visible"); m_DynamicTokens.Add("(!COUNTRYDIVDISPLAY!)", "inline"); m_DynamicTokens.Add("(!COUNTRYSELECTLIST!)", AppLogic.GetCountrySelectList(ThisCustomer.LocaleSetting)); } if (Currency.NumPublishedCurrencies() < 2) { m_DynamicTokens.Add("(!CURRENCYDIVVISIBILITY!)", "hidden"); m_DynamicTokens.Add("(!CURRENCYDIVDISPLAY!)", "none"); m_DynamicTokens.Add("(!CURRENCYSELECTLIST!)", String.Empty); } else { m_DynamicTokens.Add("(!CURRENCYDIVVISIBILITY!)", "visible"); m_DynamicTokens.Add("(!CURRENCYDIVDISPLAY!)", "inline"); m_DynamicTokens.Add("(!CURRENCYSELECTLIST!)", AppLogic.GetCurrencySelectList(ThisCustomer)); } if (AppLogic.VATIsEnabled() && AppLogic.AppConfigBool("VAT.AllowCustomerToChooseSetting")) { m_DynamicTokens.Add("(!VATDIVVISIBILITY!)", "visible"); m_DynamicTokens.Add("(!VATDIVDISPLAY!)", "inline"); m_DynamicTokens.Add("(!VATSELECTLIST!)", AppLogic.GetVATSelectList(ThisCustomer)); } else { m_DynamicTokens.Add("(!VATDIVVISIBILITY!)", "hidden"); m_DynamicTokens.Add("(!VATDIVDISPLAY!)", "none"); m_DynamicTokens.Add("(!VATSELECTLIST!)", String.Empty); } if (!ThisCustomer.IsRegistered) { m_DynamicTokens.Add("(!SUBSCRIPTION_EXPIRATION!)", AppLogic.ro_NotApplicable); } else { if (ThisCustomer.SubscriptionExpiresOn.Equals(System.DateTime.MinValue)) { m_DynamicTokens.Add("(!SUBSCRIPTION_EXPIRATION!)", "Expired"); } else { m_DynamicTokens.Add("(!SUBSCRIPTION_EXPIRATION!)", Localization.ToThreadCultureShortDateString(ThisCustomer.SubscriptionExpiresOn)); } } m_DynamicTokens.Add("(!PAGEURL!)", HttpContext.Current.Server.UrlEncode(CommonLogic.GetThisPageName(false) + "?" + CommonLogic.ServerVariables("QUERY_STRING"))); m_DynamicTokens.Add("(!RANDOM!)", CommonLogic.GetRandomNumber(1, 7).ToString()); m_DynamicTokens.Add("(!HDRID!)", CommonLogic.GetRandomNumber(1, 7).ToString()); m_DynamicTokens.Add("(!INVOCATION!)", HttpContext.Current.Server.HtmlEncode(CommonLogic.PageInvocation())); m_DynamicTokens.Add("(!REFERRER!)", HttpContext.Current.Server.HtmlEncode(CommonLogic.PageReferrer())); StringBuilder tmp = new StringBuilder(4096); tmp.Append("<!--\n"); tmp.Append("PAGE INVOCATION: " + HttpContext.Current.Server.HtmlEncode(CommonLogic.PageInvocation()) + "\n"); tmp.Append("PAGE REFERRER: " + HttpContext.Current.Server.HtmlEncode(CommonLogic.PageReferrer()) + "\n"); tmp.Append("STORE LOCALE: " + Localization.GetDefaultLocale() + "\n"); tmp.Append("STORE CURRENCY: " + Localization.GetPrimaryCurrency() + "\n"); tmp.Append("CUSTOMER ID: " + ThisCustomer.CustomerID.ToString() + "\n"); tmp.Append("AFFILIATE ID: " + ThisCustomer.AffiliateID.ToString() + "\n"); tmp.Append("CUSTOMER LOCALE: " + ThisCustomer.LocaleSetting + "\n"); tmp.Append("CURRENCY SETTING: " + ThisCustomer.CurrencySetting + "\n"); tmp.Append("CACHE MENUS: " + AppLogic.AppConfigBool("CacheMenus").ToString() + "\n"); tmp.Append("-->\n"); m_DynamicTokens.Add("(!PAGEINFO!)", tmp.ToString()); bool IsRegistered = CommonLogic.IIF(ThisCustomer != null, ThisCustomer.IsRegistered, false); String tmpS = String.Empty; if (IsRegistered) { if (!AppLogic.IsAdminSite) { tmpS = AppLogic.GetString("skinbase.cs.1", SkinID, ThisCustomer.LocaleSetting) + " <a class=\"username\" href=\"account.aspx\">" + ThisCustomer.FullName() + "</a>" + CommonLogic.IIF(ThisCustomer.CustomerLevelID != 0, " (" + ThisCustomer.CustomerLevelName + ")", ""); } m_DynamicTokens.Add("(!USER_NAME!)", tmpS); m_DynamicTokens.Add("(!USERNAME!)", tmpS); } else { m_DynamicTokens.Add("(!USER_NAME!)", String.Empty); m_DynamicTokens.Add("(!USERNAME!)", String.Empty); } m_DynamicTokens.Add("(!USER_MENU_NAME!)", CommonLogic.IIF(!IsRegistered, "my account", ThisCustomer.FullName())); m_DynamicTokens.Add("(!USER_MENU!)", AppLogic.GetUserMenu(ThisCustomer.IsRegistered, SkinID, ThisCustomer.LocaleSetting)); if (AppLogic.MicropayIsEnabled()) { tmpS = "Your " + AppLogic.GetString("account.aspx.11", SkinID, ThisCustomer.LocaleSetting) + " balance is: " + Localization.DecimalStringForDB(ThisCustomer.MicroPayBalance); m_DynamicTokens.Add("(!MICROPAY_BALANCE!)", tmpS); m_DynamicTokens.Add("(!MICROPAY_BALANCE_RAW!)", Localization.DecimalStringForDB(ThisCustomer.MicroPayBalance)); m_DynamicTokens.Add("(!MICROPAY_BALANCE_CURRENCY!)", ThisCustomer.CurrencyString(ThisCustomer.MicroPayBalance)); } tmpS = ShoppingCart.NumItems(ThisCustomer.CustomerID, CartTypeEnum.ShoppingCart).ToString(); m_DynamicTokens.Add("(!NUM_CART_ITEMS!)", tmpS); tmpS = AppLogic.GetString("AppConfig.CartPrompt", SkinID, ThisCustomer.LocaleSetting); m_DynamicTokens.Add("(!CARTPROMPT!)", tmpS); tmpS = ShoppingCart.NumItems(ThisCustomer.CustomerID, CartTypeEnum.WishCart).ToString(); m_DynamicTokens.Add("(!NUM_WISH_ITEMS!)", tmpS); tmpS = ShoppingCart.NumItems(ThisCustomer.CustomerID, CartTypeEnum.GiftRegistryCart).ToString(); m_DynamicTokens.Add("(!NUM_GIFT_ITEMS!)", tmpS); tmpS = CommonLogic.IIF(!IsRegistered, AppLogic.GetString("skinbase.cs.4", SkinID, ThisCustomer.LocaleSetting), AppLogic.GetString("skinbase.cs.5", SkinID, ThisCustomer.LocaleSetting)); m_DynamicTokens.Add("(!SIGNINOUT_TEXT!)", tmpS); m_DynamicTokens.Add("(!SIGNINOUT_LINK!)", CommonLogic.IIF(!IsRegistered, "signin.aspx", "signout.aspx")); String PN = CommonLogic.GetThisPageName(false); if (AppLogic.AppConfigBool("ShowMiniCart")) { if (PN.StartsWith("shoppingcart", StringComparison.InvariantCultureIgnoreCase) || PN.StartsWith("checkout", StringComparison.InvariantCultureIgnoreCase) || PN.StartsWith("cardinal", StringComparison.InvariantCultureIgnoreCase) || PN.StartsWith("addtocart") || PN.IndexOf("_process", StringComparison.InvariantCultureIgnoreCase) != -1 || PN.StartsWith("lat_", StringComparison.InvariantCultureIgnoreCase)) { m_DynamicTokens.Add("(!MINICART!)", String.Empty); // don't show on these pages } else { m_DynamicTokens.Add("(!MINICART!)", ShoppingCart.DisplayMiniCart(ThisCustomer, SkinID, true)); } if (PN.StartsWith("shoppingcart", StringComparison.InvariantCultureIgnoreCase) || PN.StartsWith("checkout", StringComparison.InvariantCultureIgnoreCase) || PN.StartsWith("cardinal", StringComparison.InvariantCultureIgnoreCase) || PN.StartsWith("addtocart", StringComparison.InvariantCultureIgnoreCase) || PN.IndexOf("_process", StringComparison.InvariantCultureIgnoreCase) != -1 || PN.StartsWith("lat_", StringComparison.InvariantCultureIgnoreCase)) { m_DynamicTokens.Add("(!MINICART_PLAIN!)", String.Empty); // don't show on these pages } else { m_DynamicTokens.Add("(!MINICART_PLAIN!)", ShoppingCart.DisplayMiniCart(ThisCustomer, SkinID, false)); } } m_DynamicTokens.Add("(!CUSTOMERID!)", ThisCustomer.CustomerID.ToString()); } }
protected void Page_Load(object sender, EventArgs e) { Response.CacheControl = "private"; Response.Expires = 0; Response.AddHeader("pragma", "no-cache"); Page.Form.DefaultButton = btnSearch.UniqueID; Page.Form.DefaultFocus = txtSearch.ClientID; if (!IsPostBack) { string query = CommonLogic.QueryStringCanBeDangerousContent("searchfor").Trim(); AppLogic.CheckForScriptTag(query); Balance = System.Decimal.Zero; if (CommonLogic.QueryStringCanBeDangerousContent("Balance").Length > 0) { try { Balance = CommonLogic.QueryStringUSDecimal("Balance"); } catch { } } if (Balance != System.Decimal.Zero) { resetError("<b>Showing ALL affiliates with account balances >= " + ThisCustomer.CurrencyString(Balance) + "</b>", false); } loadTree(); ViewState["SQLString"] = selectSQL; //set page settings if (ThisCustomer.ThisCustomerSession.Session("AffiliatesSort").Length == 0) { ViewState["Sort"] = "Company"; } else { ViewState["Sort"] = ThisCustomer.ThisCustomerSession.Session("AffiliatesSort"); } if (ThisCustomer.ThisCustomerSession.Session("AffiliatesOrder").Length == 0) { ViewState["SortOrder"] = "ASC"; } else { ViewState["SortOrder"] = ThisCustomer.ThisCustomerSession.Session("AffiliatesOrder"); } if (ThisCustomer.ThisCustomerSession.Session("AffiliatesSearch").Length != 0) { query = ThisCustomer.ThisCustomerSession.Session("AffiliatesSearch"); } if (ThisCustomer.ThisCustomerSession.Session("AffiliatesTree").Length != 0) { treeMain.FindNode(ThisCustomer.ThisCustomerSession.Session("AffiliatesTree")).Selected = true; } resultFilter(query); txtSearch.Attributes.Add("onKeyPress", "javascript:if (event.keyCode == 13) __doPostBack('btnSearch','')"); } }
private void InitializePageContent() { JSPopupRoutines.Text = AppLogic.GetJSPopupRoutines(); ShippingResidenceType.Items.Add(new ListItem(AppLogic.GetString("address.cs.55", SkinID, ThisCustomer.LocaleSetting), ((int)ResidenceTypes.Unknown).ToString())); ShippingResidenceType.Items.Add(new ListItem(AppLogic.GetString("address.cs.56", SkinID, ThisCustomer.LocaleSetting), ((int)ResidenceTypes.Residential).ToString())); ShippingResidenceType.Items.Add(new ListItem(AppLogic.GetString("address.cs.57", SkinID, ThisCustomer.LocaleSetting), ((int)ResidenceTypes.Commercial).ToString())); ShippingResidenceType.SelectedIndex = 1; if (CommonLogic.QueryStringNativeInt("ErrorMsg") > 0) { pnlErrorMsg.Visible = true; ErrorMessage e = new ErrorMessage(CommonLogic.QueryStringNativeInt("ErrorMsg")); //ctrlShippingMethods.ErrorMessage = e.Message; pnlErrorMsg.Controls.Add(new LiteralControl(String.Format("<b style='color:red;'>{0}</b>", e.Message))); } if (!cart.ShippingIsFree && cart.MoreNeededToReachFreeShipping != 0.0M) { pnlGetFreeShippingMsg.Visible = true; GetFreeShippingMsg.Text = String.Format(AppLogic.GetString("checkoutshipping.aspx.2", SkinID, ThisCustomer.LocaleSetting), ThisCustomer.CurrencyString(cart.FreeShippingThreshold), CommonLogic.Capitalize(cart.FreeShippingMethod)); } if (cart.ShippingIsFree) { pnlFreeShippingMsg.Visible = true; String Reason = String.Empty; if (cart.FreeShippingReason == Shipping.FreeShippingReasonEnum.AllDownloadItems) { Reason = AppLogic.GetString("checkoutshipping.aspx.5", SkinID, ThisCustomer.LocaleSetting); btnContinueCheckout.Text = AppLogic.GetString("checkoutshipping.aspx.19", ThisCustomer.SkinID, ThisCustomer.LocaleSetting); } if (cart.FreeShippingReason == Shipping.FreeShippingReasonEnum.AllFreeShippingItems) { Reason = AppLogic.GetString("checkoutshipping.aspx.18", SkinID, ThisCustomer.LocaleSetting); btnContinueCheckout.Text = AppLogic.GetString("checkoutshipping.aspx.19", ThisCustomer.SkinID, ThisCustomer.LocaleSetting); } if (cart.FreeShippingReason == Shipping.FreeShippingReasonEnum.CouponHasFreeShipping) { Reason = AppLogic.GetString("checkoutshipping.aspx.6", SkinID, ThisCustomer.LocaleSetting); btnContinueCheckout.Text = AppLogic.GetString("checkoutshipping.aspx.19", ThisCustomer.SkinID, ThisCustomer.LocaleSetting); } if (cart.FreeShippingReason == Shipping.FreeShippingReasonEnum.AllOrdersHaveFreeShipping) { Reason = String.Format(AppLogic.GetString("checkoutshipping.aspx.7", SkinID, ThisCustomer.LocaleSetting), cart.FreeShippingMethod); btnContinueCheckout.Text = AppLogic.GetString("checkoutshipping.aspx.19", ThisCustomer.SkinID, ThisCustomer.LocaleSetting); } if (cart.FreeShippingReason == Shipping.FreeShippingReasonEnum.CustomerLevelHasFreeShipping) { Reason = String.Format(AppLogic.GetString("checkoutshipping.aspx.8", SkinID, ThisCustomer.LocaleSetting), ThisCustomer.CustomerLevelName); btnContinueCheckout.Text = AppLogic.GetString("checkoutshipping.aspx.19", ThisCustomer.SkinID, ThisCustomer.LocaleSetting); } if (cart.FreeShippingReason == Shipping.FreeShippingReasonEnum.ExceedsFreeShippingThreshold) { Reason = cart.FreeShippingMethod; btnContinueCheckout.Text = AppLogic.GetString("checkoutshipping.aspx.19", ThisCustomer.SkinID, ThisCustomer.LocaleSetting); } FreeShippingMsg.Text = Reason; } Addresses addrs = new Addresses(); addrs.LoadCustomer(ThisCustomer.CustomerID); ddlChooseShippingAddr.Items.Clear(); Hashtable ht = new Hashtable(); // add their primary shipping address id FIRST: foreach (Address a in addrs) { if (a.AddressID == ThisCustomer.PrimaryShippingAddressID) { string addrString = a.Address1 + " " + a.City + " " + a.State + " " + a.Country + " " + a.Zip; while (addrString.IndexOf(" ") != -1) { addrString = addrString.Replace(" ", " "); } ht.Add(addrString, "true"); ddlChooseShippingAddr.Items.Add(new ListItem(addrString, a.AddressID.ToString())); } } // now add their remaining addresses, only if they are materially different from the primary shipping address foreach (Address a in addrs) { if (a.AddressID != ThisCustomer.PrimaryShippingAddressID) { string addrString = a.Address1 + " " + a.City + " " + a.State + " " + a.Country + " " + a.Zip; while (addrString.IndexOf(" ") != -1) { addrString = addrString.Replace(" ", " "); } if (!ht.Contains(addrString)) { ht.Add(addrString, "true"); ddlChooseShippingAddr.Items.Add(new ListItem(addrString, a.AddressID.ToString())); } } } //allow the customer to add a new address ddlChooseShippingAddr.Items.Add(new ListItem(AppLogic.GetString("checkoutshipping.aspx.22", ThisCustomer.SkinID, ThisCustomer.LocaleSetting), "0")); ddlChooseShippingAddr.SelectedValue = ThisCustomer.PrimaryShippingAddressID.ToString(); ddlChooseShippingAddr.AutoPostBack = true; using (SqlConnection con = new SqlConnection(DB.GetDBConn())) { con.Open(); using (IDataReader rs = DB.GetRS("select * from State with (NOLOCK) order by DisplayOrder,Name", con)) { ShippingState.DataSource = rs; ShippingState.DataTextField = "Name"; ShippingState.DataValueField = "Abbreviation"; ShippingState.DataBind(); } } using (SqlConnection con = new SqlConnection(DB.GetDBConn())) { con.Open(); using (IDataReader rs = DB.GetRS("select * from Country with (NOLOCK) order by DisplayOrder,Name", con)) { ShippingCountry.DataSource = rs; ShippingCountry.DataTextField = "Name"; ShippingCountry.DataValueField = "Name"; ShippingCountry.DataBind(); } } ShippingCountry.SelectedValue = "United States"; pnlCartAllowsShippingMethodSelection.Visible = cart.CartAllowsShippingMethodSelection; ctrlShippingMethods.Visible = cart.CartAllowsShippingMethodSelection; if ((!cart.CartAllowsShippingMethodSelection || AnyShippingMethodsFound) || (!AnyShippingMethodsFound && !AppLogic.AppConfigBool("FreeShippingAllowsRateSelection") && cart.ShippingIsFree)) { btnContinueCheckout.Visible = true; } ShippingDisplay(AnyShippingMethodsFound); }
private void Render() { StringBuilder writer = new StringBuilder(); writer.Append("<p align=\"left\"<b>Editing Variants for Product: <a href=\"" + AppLogic.AdminLinkUrl("editproduct.aspx") + "?productid=" + ProductID.ToString() + "\">" + ProductName + "</a> (Product SKU=" + ProductSKU + ", ProductID=" + ProductID.ToString() + ")</b>"); writer.Append(" "); writer.Append("<a class=\"ProductNavLink\" href=\"" + AppLogic.AdminLinkUrl("editproduct.aspx") + "?productid=" + ProductID.ToString() + "\"><img src=\"" + AppLogic.LocateImageURL("~/App_Themes/Admin_Default/images/up.gif") + "\" border=\"0\" align=\"absmiddle\"></a>"); bool HasRecurringOrder = 0 < DB.GetSqlN("select count(*) N from ShoppingCart with (NOLOCK) where ProductID=" + ProductID.ToString() + " and CartType=" + ((int)CartTypeEnum.RecurringCart).ToString()); if (!HasRecurringOrder) { writer.Append(" "); writer.Append("<input style=\"font-size: 9px;\" type=\"button\" class=\"normalButtons\" value=\"Delete All Variants\" name=\"DeleteAllVariants_" + ProductID.ToString() + "\" onClick=\"if(confirm('Are you sure you want to delete ALL variants for this product? This will also remove all items from customer shopping carts, wish lists, and gift registries IF they reference any of these variants!')){self.location='" + AppLogic.AdminLinkUrl("variants.aspx") + "?DeleteAllVariants=true&productid=" + ProductID.ToString() + "';}\">"); } writer.Append("</p>\n"); writer.Append("<form id=\"Form1\" name=\"Form1\" method=\"POST\" action=\"" + AppLogic.AdminLinkUrl("variants.aspx") + "?productid=" + ProductID.ToString() + "\">\n"); writer.Append("<input type=\"hidden\" name=\"IsSubmit\" value=\"true\">\n"); writer.Append("<table border=\"0\" cellpadding=\"0\" border=\"0\" cellspacing=\"0\" width=\"100%\">\n"); writer.Append("<tr class=\"table-header\">\n"); writer.Append("<td><b>ID</b></td>\n"); writer.Append("<td><b>Variant</b></td>\n"); writer.Append("<td><b>Variant SKU Suffix</b></td>\n"); writer.Append("<td><b>Full SKU</b></td>\n"); writer.Append("<td><b>Price</b></td>\n"); writer.Append("<td><b>Sale Price</b></td>\n"); writer.Append("<td align=\"center\"><b>Inventory</b></td>\n"); writer.Append("<td align=\"center\"><b>Display Order</b></td>\n"); writer.Append("<td align=\"center\"><b>Is Default Variant</b></td>\n"); writer.Append("<td align=\"center\"><b>Edit</b></td>\n"); writer.Append("<td align=\"center\"><b>Clone</b></td>\n"); writer.Append("<td align=\"center\"><b>Move</b></td>\n"); writer.Append("<td align=\"center\"><b>Delete</b></td>\n"); writer.Append("</tr>\n"); using (SqlConnection conn = new SqlConnection(DB.GetDBConn())) { conn.Open(); string sql = "select * from productvariant with (NOLOCK) where deleted=0 and ProductID=" + ProductID.ToString() + " order by DisplayOrder,Name"; using (IDataReader rs = DB.GetRS(sql, conn)) { int i = 0; while (rs.Read()) { if (i % 2 == 0) { writer.Append("<tr class=\"table-row2\">\n"); } else { writer.Append("<tr class=\"table-alternatingrow2\">\n"); } writer.Append("<td >" + DB.RSFieldInt(rs, "VariantID").ToString() + "</td>\n"); writer.Append("<td >"); String Image1URL = AppLogic.LookupImage("Variant", DB.RSFieldInt(rs, "VariantID"), "icon", SkinID, LocaleSetting); if (Image1URL.Length != 0) { writer.Append("<a href=\"" + AppLogic.AdminLinkUrl("editVariant.aspx") + "?Variantid=" + DB.RSFieldInt(rs, "VariantID").ToString() + "\">"); writer.Append("<img src=\"" + Image1URL + "\" height=\"35\" border=\"0\" align=\"absmiddle\">"); writer.Append("</a> \n"); } writer.Append("<a href=\"" + AppLogic.AdminLinkUrl("editVariant.aspx") + "?productid=" + ProductID.ToString() + "&Variantid=" + DB.RSFieldInt(rs, "VariantID").ToString() + "\">" + CommonLogic.IIF(DB.RSFieldByLocale(rs, "Name", LocaleSetting).Length == 0, "(Unnamed Variant)", DB.RSFieldByLocale(rs, "Name", LocaleSetting)) + "</a>"); writer.Append("</td>\n"); writer.Append("<td >" + DB.RSField(rs, "SKUSuffix") + "</td>\n"); writer.Append("<td >" + AppLogic.GetProductSKU(ProductID) + DB.RSField(rs, "SKUSuffix") + "</td>\n"); writer.Append("<td >" + ThisCustomer.CurrencyString(DB.RSFieldDecimal(rs, "Price")) + "</td>\n"); writer.Append("<td >" + CommonLogic.IIF(DB.RSFieldDecimal(rs, "SalePrice") != System.Decimal.Zero, ThisCustomer.CurrencyString(DB.RSFieldDecimal(rs, "SalePrice")), " ") + "</td>\n"); if (ProductTracksInventoryBySizeAndColor) { writer.Append("<td align=\"center\"><a href=\"" + AppLogic.AdminLinkUrl("editinventory.aspx") + "?productid=" + ProductID.ToString() + "&variantid=" + DB.RSFieldInt(rs, "VariantID").ToString() + "\">Click Here</a></td>\n"); } else { writer.Append("<td align=\"center\">"); writer.Append(DB.RSFieldInt(rs, "Inventory").ToString()); writer.Append("</td>"); } writer.Append("<td align=\"center\"><input size=2 type=\"text\" name=\"DisplayOrder_" + DB.RSFieldInt(rs, "VariantID").ToString() + "\" value=\"" + DB.RSFieldInt(rs, "DisplayOrder").ToString() + "\"></td>\n"); writer.Append("<td align=\"center\"><input type=\"radio\" name=\"IsDefault\" value=\"" + DB.RSFieldInt(rs, "VariantID").ToString() + "\" " + CommonLogic.IIF(DB.RSFieldBool(rs, "IsDefault"), " checked ", "") + "></td>\n"); writer.Append("<td align=\"center\"><input type=\"button\" class=\"normalButtons\" value=\"Edit\" name=\"Edit_" + DB.RSFieldInt(rs, "VariantID").ToString() + "\" onClick=\"self.location='" + AppLogic.AdminLinkUrl("editVariant.aspx") + "?productid=" + ProductID.ToString() + "&Variantid=" + DB.RSFieldInt(rs, "VariantID").ToString() + "'\"></td>\n"); writer.Append("<td align=\"center\">"); if (DB.RSFieldBool(rs, "IsSystem")) { writer.Append("System<br/>Product"); // this type of product can only be deleted in the db! } else { writer.Append("<input type=\"button\" value=\"Clone\" class=\"normalButtons\" name=\"Clone_" + DB.RSFieldInt(rs, "ProductID").ToString() + "\" onClick=\"if(confirm('Are you sure you want to create a clone of this variant?')) {self.location='" + AppLogic.AdminLinkUrl("variants.aspx") + "?productid=" + ProductID.ToString() + "&cloneid=" + DB.RSFieldInt(rs, "VariantID").ToString() + "';}\">\n"); } writer.Append("</td>"); if (HasRecurringOrder && 0 < DB.GetSqlN("select count(*) N from ShoppingCart with (NOLOCK) where VariantID=" + DB.RSFieldInt(rs, "VariantID").ToString() + " and CartType=" + ((int)CartTypeEnum.RecurringCart).ToString())) { writer.Append("<td align=\"center\"> </td>\n"); writer.Append("<td align=\"center\"> </td>\n"); } else { writer.Append("<td align=\"center\"><input type=\"button\" class=\"normalButtons\" value=\"Move\" name=\"Move_" + DB.RSFieldInt(rs, "VariantID").ToString() + "\" onClick=\"self.location='" + AppLogic.AdminLinkUrl("moveVariant.aspx") + "?productid=" + ProductID.ToString() + "&Variantid=" + DB.RSFieldInt(rs, "VariantID").ToString() + "'\"></td>\n"); writer.Append("<td align=\"center\"><input type=\"button\" class=\"normalButtons\" value=\"Delete\" name=\"Delete_" + DB.RSFieldInt(rs, "VariantID").ToString() + "\" onClick=\"DeleteVariant(" + DB.RSFieldInt(rs, "VariantID").ToString() + ")\"></td>\n"); } writer.Append("</tr>\n"); i++; } } } writer.Append("<tr>\n"); writer.Append("<td colspan=\"7\" align=\"left\"></td>\n"); writer.Append("<td colspan=\"2\" align=\"center\" ><input type=\"submit\" class=\"normalButtons\" value=\"Update\" name=\"Submit\"></td>\n"); writer.Append("<td colspan=\"3\"></td>\n"); writer.Append("</tr>\n"); writer.Append("</table>\n"); writer.Append("<input type=\"button\" class=\"normalButtons\" value=\"Add New Variant\" name=\"AddNew\" onClick=\"self.location='" + AppLogic.AdminLinkUrl("editVariant.aspx") + "?productid=" + ProductID.ToString() + "';\">\n"); writer.Append("</form>\n"); writer.Append("<script type=\"text/javascript\">\n"); writer.Append("function DeleteVariant(id)\n"); writer.Append("{\n"); writer.Append("if(confirm('Are you sure you want to delete Variant: ' + id + '? This will also remove all items from customer shopping carts, wish lists, and gift registries IF they reference this variant!'))\n"); writer.Append("{\n"); writer.Append("self.location = '" + AppLogic.AdminLinkUrl("variants.aspx") + "?productid=" + ProductID.ToString() + "&deleteid=' + id;\n"); writer.Append("}\n"); writer.Append("}\n"); writer.Append("</SCRIPT>\n"); ltContent.Text = writer.ToString(); }
public void InitializePageContent() { int AgeCartDays = AppLogic.AppConfigUSInt("AgeCartDays"); if (AgeCartDays == 0) { AgeCartDays = 7; } ShoppingCart.Age(ThisCustomer.CustomerID, AgeCartDays, CartTypeEnum.ShoppingCart); cart = new ShoppingCart(SkinID, ThisCustomer, CartTypeEnum.ShoppingCart, 0, false); shoppingcartaspx8.Text = AppLogic.GetString("shoppingcart.aspx.8", SkinID, ThisCustomer.LocaleSetting); shoppingcartaspx10.Text = AppLogic.GetString("shoppingcart.aspx.10", SkinID, ThisCustomer.LocaleSetting); shoppingcartaspx9.Text = AppLogic.GetString("shoppingcart.aspx.9", SkinID, ThisCustomer.LocaleSetting); shoppingcartcs31.Text = AppLogic.GetString("shoppingcart.cs.117", SkinID, ThisCustomer.LocaleSetting); btnUpdateCart1.Text = AppLogic.GetString("shoppingcart.cs.110", SkinID, ThisCustomer.LocaleSetting); btnUpdateCart2.Text = AppLogic.GetString("shoppingcart.cs.110", SkinID, ThisCustomer.LocaleSetting); btnUpdateCart3.Text = AppLogic.GetString("shoppingcart.cs.110", SkinID, ThisCustomer.LocaleSetting); btnUpdateCart4.Text = AppLogic.GetString("shoppingcart.cs.110", SkinID, ThisCustomer.LocaleSetting); lblOrderNotes.Text = AppLogic.GetString("shoppingcart.cs.66", SkinID, ThisCustomer.LocaleSetting); btnContinueShoppingTop.Text = AppLogic.GetString("shoppingcart.cs.62", SkinID, ThisCustomer.LocaleSetting); btnContinueShoppingBottom.Text = AppLogic.GetString("shoppingcart.cs.62", SkinID, ThisCustomer.LocaleSetting); btnCheckOutNowTop.Text = AppLogic.GetString("shoppingcart.cs.111", SkinID, ThisCustomer.LocaleSetting); btnCheckOutNowBottom.Text = AppLogic.GetString("shoppingcart.cs.111", SkinID, ThisCustomer.LocaleSetting); bool reqOver13 = AppLogic.AppConfigBool("RequireOver13Checked"); btnCheckOutNowTop.Enabled = !cart.IsEmpty() && !cart.RecurringScheduleConflict && (!reqOver13 || (reqOver13 && ThisCustomer.IsOver13)) || !ThisCustomer.IsRegistered; if (btnCheckOutNowTop.Enabled && AppLogic.MicropayIsEnabled() && !AppLogic.AppConfigBool("MicroPay.HideOnCartPage") && cart.CartItems.Count == 1 && cart.HasMicropayProduct() && ((CartItem)cart.CartItems[0]).Quantity == 0) { // We have only one item and it is the Micropay Product and the Quantity is zero // Don't allow checkout btnCheckOutNowTop.Enabled = false; } btnCheckOutNowBottom.Enabled = btnCheckOutNowTop.Enabled; ErrorMsgLabel.Text = CommonLogic.IIF(!cart.IsEmpty() && (reqOver13 && !ThisCustomer.IsOver13 && ThisCustomer.IsRegistered), AppLogic.GetString("Over13OnCheckout", SkinID, ThisCustomer.LocaleSetting), String.Empty); PayPalExpressSpan.Visible = false; PayPalExpressSpan2.Visible = false; Decimal MinOrderAmount = AppLogic.AppConfigUSDecimal("CartMinOrderAmount"); if (!cart.IsEmpty() && !cart.ContainsRecurringAutoShip) { // Enable PayPalExpress if using PayPalPro or PayPal Express is an active payment method. bool IncludePayPalExpress = false; if (AppLogic.AppConfigBool("PayPal.Express.ShowOnCartPage") && cart.MeetsMinimumOrderAmount(MinOrderAmount)) { if (AppLogic.ActivePaymentGatewayCleaned() == Gateway.ro_GWPAYPALPRO) { IncludePayPalExpress = true; } else { foreach (String PM in AppLogic.AppConfig("PaymentMethods").ToUpperInvariant().Split(',')) { String PMCleaned = AppLogic.CleanPaymentMethod(PM); if (PMCleaned == AppLogic.ro_PMPayPalExpress) { IncludePayPalExpress = true; break; } } } } if (IncludePayPalExpress) { if (AppLogic.AppConfigBool("PayPal.Promo.Enabled") && cart.Total(true) >= AppLogic.AppConfigNativeDecimal("PayPal.Promo.CartMinimum") && cart.Total(true) <= AppLogic.AppConfigNativeDecimal("PayPal.Promo.CartMaximum")) { btnPayPalExpressCheckout.ImageUrl = AppLogic.AppConfig("PayPal.Promo.ButtonImageURL"); } else if (AppLogic.AppConfigExists("Mobile.PayPal.Express.ButtonImageURL")) { btnPayPalExpressCheckout.ImageUrl = AppLogic.AppConfig("Mobile.PayPal.Express.ButtonImageURL"); } else { btnPayPalExpressCheckout.ImageUrl = AppLogic.AppConfig("PayPal.Express.ButtonImageURL"); } btnPayPalExpressCheckout2.ImageUrl = btnPayPalExpressCheckout.ImageUrl; PayPalExpressSpan.Visible = true; PayPalExpressSpan2.Visible = true; } } string googleimageurl; if (AppLogic.AppConfigExists("Mobile.GoogleCheckout.LiveCheckoutButton")) { googleimageurl = String.Format(AppLogic.AppConfig("Mobile.GoogleCheckout.LiveCheckoutButton"), AppLogic.AppConfig("GoogleCheckout.MerchantId")); } else { googleimageurl = String.Format(AppLogic.AppConfig("GoogleCheckout.LiveCheckoutButton"), AppLogic.AppConfig("GoogleCheckout.MerchantId")); } if (AppLogic.AppConfigBool("GoogleCheckout.UseSandbox")) { googleimageurl = String.Format(AppLogic.AppConfig("GoogleCheckout.SandBoxCheckoutButton"), AppLogic.AppConfig("GoogleCheckout.SandboxMerchantId")); } googleimageurl = CommonLogic.IsSecureConnection() ? googleimageurl.ToLower().Replace("http://", "https://") : googleimageurl; if (AppLogic.ProductIsMLExpress() == true) { googleimageurl = string.Empty; } btnGoogleCheckout.ImageUrl = googleimageurl; btnGoogleCheckout2.ImageUrl = googleimageurl; bool ForceGoogleOff = false; if (cart.IsEmpty() || cart.ContainsRecurringAutoShip || !cart.MeetsMinimumOrderAmount(MinOrderAmount) || ThisCustomer.ThisCustomerSession["IGD"].Length != 0 || (AppLogic.AppConfig("GoogleCheckout.MerchantId").Length == 0 && AppLogic.AppConfig("GoogleCheckout.SandboxMerchantId").Length == 0)) { GoogleCheckoutSpan.Visible = false; GoogleCheckoutSpan2.Visible = false; ForceGoogleOff = true; // these conditions force google off period (don't care about other settings) } if (!AppLogic.AppConfigBool("GoogleCheckout.ShowOnCartPage")) { // turn off the google checkout, but not in a forced condition, as the mall may turn it back on GoogleCheckoutSpan.Visible = false; GoogleCheckoutSpan2.Visible = false; } // allow the GooglerMall to turn google checkout back on, if not forced off prior and not already visible anyway: if (!ForceGoogleOff && !GoogleCheckoutSpan.Visible && (AppLogic.AppConfigBool("GoogleCheckout.GoogleMallEnabled") && Profile.GoogleMall != String.Empty)) { GoogleCheckoutSpan.Visible = true; GoogleCheckoutSpan2.Visible = true; } AlternativeCheckouts.Visible = GoogleCheckoutSpan.Visible || PayPalExpressSpan.Visible; AlternativeCheckouts2.Visible = GoogleCheckoutSpan2.Visible || PayPalExpressSpan2.Visible; if (!AppLogic.AppConfigBool("Mobile.ShowAlternateCheckouts")) { AlternativeCheckouts.Visible = AlternativeCheckouts2.Visible = false; } if (!ForceGoogleOff) { // hide GC button for carts that don't qualify imgGoogleCheckoutDisabled.Visible = !GoogleCheckout.PermitGoogleCheckout(cart); btnGoogleCheckout.Visible = !imgGoogleCheckoutDisabled.Visible; imgGoogleCheckout2Disabled.Visible = imgGoogleCheckoutDisabled.Visible; btnGoogleCheckout2.Visible = btnGoogleCheckout.Visible; } Shipping.ShippingCalculationEnum ShipCalcID = Shipping.GetActiveShippingCalculationID(); StringBuilder html = new StringBuilder(""); html.Append("<script type=\"text/javascript\">\n"); html.Append("function Cart_Validator(theForm)\n"); html.Append("{\n"); String cartJS = CommonLogic.ReadFile("jscripts/shoppingcart.js", true); foreach (CartItem c in cart.CartItems) { html.Append(cartJS.Replace("%SKU%", c.ShoppingCartRecordID.ToString())); } html.Append("return(true);\n"); html.Append("}\n"); html.Append("</script>\n"); ValidationScript.Text = html.ToString(); JSPopupRoutines.Text = AppLogic.GetJSPopupRoutines(); ShippingInformation.Visible = (!AppLogic.AppConfigBool("SkipShippingOnCheckout") && !cart.IsAllFreeShippingComponents() && !cart.IsAllSystemComponents()); AddresBookLlink.Visible = ThisCustomer.IsRegistered; btnCheckOutNowTop.Visible = (!cart.IsEmpty()); if (!cart.IsEmpty() && cart.HasCoupon() && !cart.CouponIsValid) { pnlCouponError.Visible = true; CouponError.Text = cart.CouponStatusMessage + " (" + Server.HtmlEncode(CommonLogic.IIF(cart.Coupon.CouponCode.Length != 0, cart.Coupon.CouponCode, ThisCustomer.CouponCode)) + ")"; cart.ClearCoupon(); } if (!String.IsNullOrEmpty(errorMessage.Message) || ErrorMsgLabel.Text.Length > 0) { pnlErrorMsg.Visible = true; ErrorMsgLabel.Text += errorMessage.Message; } if (cart.InventoryTrimmed || this.InventoryTrimmed) { pnlInventoryTrimmedError.Visible = true; if (cart.TrimmedReason == InventoryTrimmedReason.RestrictedQuantities || TrimmedEarlyReason == InventoryTrimmedReason.RestrictedQuantities) { InventoryTrimmedError.Text = AppLogic.GetString("shoppingcart.aspx.33", SkinID, ThisCustomer.LocaleSetting); } else { InventoryTrimmedError.Text = AppLogic.GetString("shoppingcart.aspx.3", SkinID, ThisCustomer.LocaleSetting); } cart = new ShoppingCart(SkinID, ThisCustomer, CartTypeEnum.ShoppingCart, 0, false); ctrlShoppingCart.DataSource = cart.CartItems; ctrlCartSummary.DataSource = cart; } if (cart.RecurringScheduleConflict) { pnlRecurringScheduleConflictError.Visible = true; RecurringScheduleConflictError.Text = AppLogic.GetString("shoppingcart.aspx.19", SkinID, ThisCustomer.LocaleSetting); } if (CommonLogic.QueryStringBool("minimumQuantitiesUpdated")) { pnlMinimumQuantitiesUpdatedError.Visible = true; MinimumQuantitiesUpdatedError.Text = AppLogic.GetString("shoppingcart.aspx.7", SkinID, ThisCustomer.LocaleSetting); } if (!cart.MeetsMinimumOrderAmount(MinOrderAmount)) { pnlMeetsMinimumOrderAmountError.Visible = true; MeetsMinimumOrderAmountError.Text = String.Format(AppLogic.GetString("shoppingcart.aspx.4", SkinID, ThisCustomer.LocaleSetting), ThisCustomer.CurrencyString(MinOrderAmount)); } int MinQuantity = AppLogic.AppConfigUSInt("MinCartItemsBeforeCheckout"); if (!cart.MeetsMinimumOrderQuantity(MinQuantity)) { pnlMeetsMinimumOrderQuantityError.Visible = true; MeetsMinimumOrderQuantityError.Text = String.Format(AppLogic.GetString("shoppingcart.cs.20", SkinID, ThisCustomer.LocaleSetting), MinQuantity.ToString(), MinQuantity.ToString()); } if (AppLogic.MicropayIsEnabled() && AppLogic.AppConfigBool("Micropay.ShowTotalOnTopOfCartPage")) { pnlMicropay_EnabledError.Visible = true; Micropay_EnabledError.Text = "<div align=\"left\">" + String.Format(AppLogic.GetString("account.aspx.10", ThisCustomer.SkinID, ThisCustomer.LocaleSetting), AppLogic.GetString("account.aspx.11", ThisCustomer.SkinID, ThisCustomer.LocaleSetting), ThisCustomer.CurrencyString(ThisCustomer.MicroPayBalance)) + "</div>"; } ctrlShoppingCart.HeaderTabImageURL = AppLogic.SkinImage("ShoppingCart.gif"); if (!cart.IsEmpty()) { pnlOrderOptions.Visible = cart.AllOrderOptions.Count > 0; if (cart.CouponsAllowed) { if (CouponCode.Text.Length == 0) { CouponCode.Text = cart.Coupon.CouponCode; } btnRemoveCoupon.Visible = CouponCode.Text.Length != 0; pnlCoupon.Visible = true; } else { pnlCoupon.Visible = false; } if (!AppLogic.AppConfigBool("DisallowOrderNotes")) { OrderNotes.Text = cart.OrderNotes; pnlOrderNotes.Visible = true; } else { pnlOrderNotes.Visible = false; } btnCheckOutNowBottom.Visible = true; } else { pnlOrderOptions.Visible = false; pnlCoupon.Visible = false; pnlOrderNotes.Visible = false; btnCheckOutNowBottom.Visible = false; } if (AppLogic.AppConfigBool("SkipShippingOnCheckout") || cart.IsAllFreeShippingComponents() || cart.IsAllSystemComponents()) { ctrlCartSummary.ShowShipping = false; } if (!cart.HasTaxableComponents() || AppLogic.CustomerLevelHasNoTax(ThisCustomer.CustomerLevelID)) { ctrlCartSummary.ShowTax = false; } if (cart.ShippingThresHoldIsDefinedButFreeShippingMethodIDIsNot) { pnlErrorMsg.Visible = true; ErrorMsgLabel.Text += Server.HtmlEncode(AppLogic.GetString("shoppingcart.aspx.21", SkinID, ThisCustomer.LocaleSetting)); } }
private void UpdatepageContent() { if (CommonLogic.QueryStringNativeInt("ErrorMsg") > 0) { ErrorMessage e = new ErrorMessage(CommonLogic.QueryStringNativeInt("ErrorMsg")); ErrorMsgLabel.Text = "<div class='error-wrap'><span class=\"error-large\">" + Server.HtmlEncode(e.Message) + "</span></div>"; pnlErrorMsg.Visible = true; } else { pnlErrorMsg.Visible = false; } //write out header package is it exists String XmlPackageName = AppLogic.AppConfig("XmlPackage.CheckoutShippingMult2PageHeader"); if (XmlPackageName.Length != 0) { XmlPackage_CheckoutShippingMult2PageHeader.Text = AppLogic.RunXmlPackage(XmlPackageName, base.GetParser, ThisCustomer, SkinID, String.Empty, String.Empty, true, true); } if (!cart.ShippingIsFree && cart.MoreNeededToReachFreeShipping != 0.0M) { GetFreeShipping.Text = "<div class=\"page-row free-shipping-prompt\">"; GetFreeShipping.Text += String.Format(AppLogic.GetString("checkoutshippingmult.aspx.2", SkinID, ThisCustomer.LocaleSetting), ThisCustomer.CurrencyString(cart.FreeShippingThreshold), CommonLogic.Capitalize(cart.FreeShippingMethod)); GetFreeShipping.Text += "</div>"; pnlGetFreeShipping.Visible = true; } else { pnlGetFreeShipping.Visible = false; } CartItems.Text = WriteItemAddresses(); String XmlPackageName2 = AppLogic.AppConfig("XmlPackage.CheckoutShippingMult2PageFooter"); if (XmlPackageName2.Length != 0) { XmlPackage_CheckoutShippingMult2PageFooter.Text = AppLogic.RunXmlPackage(XmlPackageName2, base.GetParser, ThisCustomer, SkinID, String.Empty, String.Empty, true, true); } }