private void SetShippingStateList(string shippingCountry) { string sql = String.Empty; if (shippingCountry.Length > 0) { sql = "select s.* from dbo.State s with (NOLOCK) join dbo.country c on s.countryid = c.countryid where c.name = " + DB.SQuote(shippingCountry) + " order by s.DisplayOrder,s.Name"; } else { sql = "select * from dbo.State with (NOLOCK) where countryid = 222 order by DisplayOrder,Name"; } using (SqlConnection con = new SqlConnection(DB.GetDBConn())) { con.Open(); using (IDataReader rs = DB.GetRS(sql, con)) { ShippingState.DataSource = rs; ShippingState.DataTextField = "Name"; ShippingState.DataValueField = "Abbreviation"; ShippingState.DataBind(); } } if (ShippingState.Items.Count == 0) { ShippingState.Items.Insert(0, new ListItem("state.countrywithoutstates".StringResource(), "--")); ShippingState.SelectedIndex = 0; } }
protected void Page_Load(object sender, EventArgs e) { Response.CacheControl = "private"; Response.Expires = 0; Response.AddHeader("pragma", "no-cache"); /****************************************************************************/ // * WARNING TO DEVELOPERS // * The redirect below is a SAFETY feature. Removing the redirect will not // * enable ML-only features on a lower version of AspDotNetStorefront. // * Attempting to do so can very easily result in a partially implemented // * feature, invalid or incomplete data in your DB, and other serious // * conditions that will cause your store to be non-functional. // * // * If you break your store attempting to enable ML-only features in PRO or // * Standard, our staff cannot help you fix it, and it will also invalidate // * your AspDotNetStorefront License. /***************************************************************************/ if (AppLogic.ProductIsMLExpress()) { Response.Redirect(AppLogic.AdminLinkUrl("restrictedfeature.aspx")); } m_OrderNumber = CommonLogic.QueryStringUSInt("OrderNumber"); GetJavaScriptFunctions(); if (!IsPostBack) { saveOrderNumber.Text = m_OrderNumber.ToString(); if (AppLogic.AppConfigBool("PhoneOrder.EMailIsOptional")) { valRegExValEmail.Enabled = false; } BillingState.ClearSelection(); BillingState.Items.Clear(); ShippingState.ClearSelection(); ShippingState.Items.Clear(); using (SqlConnection conn = DB.dbConn()) { conn.Open(); using (IDataReader rs = DB.GetRS("select * from State with (NOLOCK) order by DisplayOrder,Name", conn)) { ShippingState.DataValueField = "Abbreviation"; ShippingState.DataTextField = "Name"; ShippingState.DataSource = rs; ShippingState.DataBind(); } } using (SqlConnection conn = DB.dbConn()) { conn.Open(); using (IDataReader rs = DB.GetRS("select * from State with (NOLOCK) order by DisplayOrder,Name", conn)) { BillingState.DataValueField = "Abbreviation"; BillingState.DataTextField = "Name"; BillingState.DataSource = rs; BillingState.DataBind(); } } ShippingCountry.ClearSelection(); ShippingCountry.Items.Clear(); BillingCountry.ClearSelection(); BillingCountry.Items.Clear(); using (SqlConnection conn = DB.dbConn()) { conn.Open(); using (IDataReader rs = DB.GetRS("select * from Country with (NOLOCK) order by DisplayOrder,Name", conn)) { ShippingCountry.DataValueField = "Name"; ShippingCountry.DataTextField = "Name"; ShippingCountry.DataSource = rs; ShippingCountry.DataBind(); } } using (SqlConnection conn = DB.dbConn()) { conn.Open(); using (IDataReader rs = DB.GetRS("select * from Country with (NOLOCK) order by DisplayOrder,Name", conn)) { BillingCountry.DataValueField = "Name"; BillingCountry.DataTextField = "Name"; BillingCountry.DataSource = rs; BillingCountry.DataBind(); } } AffiliateList.ClearSelection(); AffiliateList.Items.Clear(); using (SqlConnection conn = DB.dbConn()) { conn.Open(); using (IDataReader rs = DB.GetRS("select AffiliateID,Name,DisplayOrder from Affiliate with (NOLOCK) union select 0,'--N/A--', 0 from Affiliate with (NOLOCK) order by DisplayOrder,Name", conn)) { AffiliateList.DataSource = rs; AffiliateList.DataBind(); if (AffiliateList.Items.Count == 0) { AffiliateList.Visible = false; AffiliatePrompt.Visible = false; } } } CustomerLevelList.ClearSelection(); CustomerLevelList.Items.Clear(); using (SqlConnection conn = DB.dbConn()) { conn.Open(); using (IDataReader dr = DB.GetRS("select CustomerLevelID,Name,DisplayOrder from CustomerLevel with (NOLOCK) union select 0,'--N/A--', 0 from CustomerLevel with (NOLOCK) order by DisplayOrder,Name", conn)) { while (dr.Read()) { CustomerLevelList.Items.Add(new ListItem(DB.RSFieldByLocale(dr, "Name", LocaleSetting), DB.RSFieldInt(dr, "CustomerLevelID").ToString())); } } } ThisCustomer.ThisCustomerSession.ClearVal("IGD_EDITINGORDER"); // are we order editing? if (m_OrderNumber != 0) { ThisCustomer.ThisCustomerSession["IGD_EDITINGORDER"] = m_OrderNumber.ToString(); // setup cart to match order: DB.ExecuteSQL("aspdnsf_EditOrder " + m_OrderNumber.ToString()); Button89.Visible = true; Button90.Visible = true; Button91.Visible = true; helpphone.Visible = false; helporderedit.Visible = true; backtoorderlink.NavigateUrl = AppLogic.AdminLinkUrl("orders.aspx") + "?ordernumber=" + m_OrderNumber.ToString(); content.Visible = false; SearchCustomerPanel.Visible = false; txtordernumber.Text = m_OrderNumber.ToString(); Order ord = new Order(m_OrderNumber); // use customer as is: TopPanel.Visible = false; SearchCustomerPanel.Visible = false; CreateNewCustomerPanel.Visible = false; CustomerStatsPanel.Visible = true; CreateCustomer.Visible = false; UseCustomer.Visible = false; UpdateCustomer.Visible = false; SetContextToCustomerID(ord.CustomerID); UsingCustomerID.Text = CustomerID.Text; UsingFirstName.Text = FirstName.Text; UsingLastName.Text = LastName.Text; UsingEMail.Text = EMail.Text.ToLowerInvariant().Trim(); SetToImpersonationPageContext(ord.CustomerID, "../shoppingcart.aspx", false); } } else { m_OrderNumber = System.Int32.Parse(saveOrderNumber.Text); } bool RequireEmail = !(AppLogic.AppConfigBool("PasswordIsOptionalDuringCheckout") && !AppLogic.AppConfigBool("AnonCheckoutReqEmail")); RequiredEmailValidator.Enabled = RequireEmail; lblRequiredEmailAsterix.Visible = RequireEmail; }
protected void Page_Load(object sender, EventArgs e) { Response.CacheControl = "private"; Response.Expires = 0; Response.AddHeader("pragma", "no-cache"); m_OrderNumber = CommonLogic.QueryStringUSInt("OrderNumber"); GetJavaScriptFunctions(); if (!IsPostBack) { saveOrderNumber.Text = m_OrderNumber.ToString(); if (AppLogic.AppConfigBool("PhoneOrder.EMailIsOptional")) { valRegExValEmail.Enabled = false; } BillingState.ClearSelection(); BillingState.Items.Clear(); ShippingState.ClearSelection(); ShippingState.Items.Clear(); using (SqlConnection conn = DB.dbConn()) { conn.Open(); using (IDataReader rs = DB.GetRS("select * from State with (NOLOCK) order by DisplayOrder,Name", conn)) { ShippingState.DataValueField = "Abbreviation"; ShippingState.DataTextField = "Name"; ShippingState.DataSource = rs; ShippingState.DataBind(); } } using (SqlConnection conn = DB.dbConn()) { conn.Open(); using (IDataReader rs = DB.GetRS("select * from State with (NOLOCK) order by DisplayOrder,Name", conn)) { BillingState.DataValueField = "Abbreviation"; BillingState.DataTextField = "Name"; BillingState.DataSource = rs; BillingState.DataBind(); } } ShippingCountry.ClearSelection(); ShippingCountry.Items.Clear(); BillingCountry.ClearSelection(); BillingCountry.Items.Clear(); using (SqlConnection conn = DB.dbConn()) { conn.Open(); using (IDataReader rs = DB.GetRS("select * from Country with (NOLOCK) order by DisplayOrder,Name", conn)) { ShippingCountry.DataValueField = "Name"; ShippingCountry.DataTextField = "Name"; ShippingCountry.DataSource = rs; ShippingCountry.DataBind(); } } using (SqlConnection conn = DB.dbConn()) { conn.Open(); using (IDataReader rs = DB.GetRS("select * from Country with (NOLOCK) order by DisplayOrder,Name", conn)) { BillingCountry.DataValueField = "Name"; BillingCountry.DataTextField = "Name"; BillingCountry.DataSource = rs; BillingCountry.DataBind(); } } AffiliateList.ClearSelection(); AffiliateList.Items.Clear(); using (SqlConnection conn = DB.dbConn()) { conn.Open(); using (IDataReader rs = DB.GetRS("select AffiliateID,Name,DisplayOrder from Affiliate with (NOLOCK) union select 0,'--N/A--', 0 from Affiliate with (NOLOCK) order by DisplayOrder,Name", conn)) { AffiliateList.DataSource = rs; AffiliateList.DataBind(); if (AffiliateList.Items.Count == 0) { AffiliateList.Visible = false; AffiliatePrompt.Visible = false; } } } CustomerLevelList.ClearSelection(); CustomerLevelList.Items.Clear(); using (SqlConnection conn = DB.dbConn()) { conn.Open(); using (IDataReader dr = DB.GetRS("select CustomerLevelID,Name,DisplayOrder from CustomerLevel with (NOLOCK) union select 0,'--N/A--', 0 from CustomerLevel with (NOLOCK) order by DisplayOrder,Name", conn)) { while (dr.Read()) { CustomerLevelList.Items.Add(new ListItem(DB.RSFieldByLocale(dr, "Name", LocaleSetting), DB.RSFieldInt(dr, "CustomerLevelID").ToString())); } } } ThisCustomer.ThisCustomerSession.ClearVal("IGD_EDITINGORDER"); // are we order editing? if (m_OrderNumber != 0) { ThisCustomer.ThisCustomerSession["IGD_EDITINGORDER"] = m_OrderNumber.ToString(); // setup cart to match order: DB.ExecuteSQL("aspdnsf_EditOrder " + m_OrderNumber.ToString()); Button89.Visible = true; Button90.Visible = true; Button91.Visible = true; helpphone.Visible = false; helporderedit.Visible = true; backtoorderlink.NavigateUrl = AppLogic.AdminLinkUrl("orders.aspx") + "?ordernumber=" + m_OrderNumber.ToString(); content.Visible = false; SearchCustomerPanel.Visible = false; txtordernumber.Text = m_OrderNumber.ToString(); Order ord = new Order(m_OrderNumber); // use customer as is: TopPanel.Visible = false; SearchCustomerPanel.Visible = false; CreateNewCustomerPanel.Visible = false; CustomerStatsPanel.Visible = true; CreateCustomer.Visible = false; UseCustomer.Visible = false; UpdateCustomer.Visible = false; SetContextToCustomerID(ord.CustomerID); UsingCustomerID.Text = CustomerID.Text; UsingFirstName.Text = FirstName.Text; UsingLastName.Text = LastName.Text; UsingEMail.Text = EMail.Text.ToLowerInvariant().Trim(); SetToImpersonationPageContext(ord.CustomerID, "../shoppingcart.aspx", false); } } else { m_OrderNumber = System.Int32.Parse(saveOrderNumber.Text); } bool RequireEmail = !(AppLogic.AppConfigBool("PasswordIsOptionalDuringCheckout") && !AppLogic.AppConfigBool("AnonCheckoutReqEmail")); RequiredEmailValidator.Enabled = RequireEmail; lblRequiredEmailAsterix.Visible = RequireEmail; }
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); }