private void LoadData() { GatewayCheckoutByAmazon.CheckoutByAmazon checkoutByAmazon = new GatewayCheckoutByAmazon.CheckoutByAmazon(); var addresses = new Addresses(); foreach (Address address in GetAddresses()) { if (checkoutByAmazon.IsAmazonAddress(address)) { continue; } address.AddressType = this.AddressMode; if (CheckPOBox(address.Address1) && (address.AddressType == AddressTypes.Shipping) && (AppLogic.AppConfigBool("DisallowShippingToPOBoxes"))) { lblPOBoxError.Visible = true; lblPOBoxError.Text = "address.cs.80".StringResource(); } else { addresses.Add(address); //show addresses that have no po boxes. } } dlAddress.DataSource = addresses; dlAddress.DataBind(); }
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; }
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); }