protected void SetContextToNewCustomer() { SearchCustomerPanel.Visible = false; CustomerIDPanel.Visible = false; CustomerID.Text = String.Empty; FirstName.Text = String.Empty; LastName.Text = String.Empty; EMail.Text = String.Empty; Phone.Text = String.Empty; RadioButtonList1.SelectedIndex = 0; Over13.Checked = true; BillingFirstName.Text = String.Empty; BillingLastName.Text = String.Empty; BillingPhone.Text = String.Empty; BillingCompany.Text = String.Empty; BillingResidenceType.ClearSelection(); BillingResidenceType.SelectedIndex = 1; BillingAddress1.Text = String.Empty; BillingAddress2.Text = String.Empty; BillingSuite.Text = String.Empty; BillingCity.Text = String.Empty; BillingState.ClearSelection(); BillingState.SelectedIndex = 0; BillingZip.Text = String.Empty; BillingCountry.ClearSelection(); BillingCountry.SelectedIndex = 0; ShippingFirstName.Text = String.Empty; ShippingLastName.Text = String.Empty; ShippingPhone.Text = String.Empty; ShippingCompany.Text = String.Empty; ShippingResidenceType.ClearSelection(); ShippingResidenceType.SelectedIndex = 1; ShippingAddress1.Text = String.Empty; ShippingAddress2.Text = String.Empty; ShippingSuite.Text = String.Empty; ShippingCity.Text = String.Empty; ShippingCountry.ClearSelection(); ShippingCountry.SelectedIndex = -1; ShippingState.ClearSelection(); ShippingState.SelectedIndex = -1; ShippingZip.Text = String.Empty; try { AffiliateList.SelectedIndex = -1; AffiliateList.ClearSelection(); } catch { } try { CustomerLevelList.SelectedIndex = -1; CustomerLevelList.ClearSelection(); } catch { } CreateCustomer.Visible = true; UseCustomer.Visible = false; UpdateCustomer.Visible = false; CreateNewCustomerPanel.Visible = true; CustomerStatsPanel.Visible = false; ImpersonationPanel.Visible = false; Panel3.Visible = false; Panel2.Visible = false; }
protected void SetContextToCustomerID(int iCustomerID) { CustomerID.Text = iCustomerID.ToString(); using (SqlConnection conn = DB.dbConn()) { conn.Open(); using (IDataReader rs = DB.GetRS("select * from Customer with (NOLOCK) where deleted=0 and IsAdmin=0 and CustomerID=" + iCustomerID.ToString(), conn)) { if (rs.Read()) { FirstName.Text = DB.RSField(rs, "FirstName"); LastName.Text = DB.RSField(rs, "LastName"); EMail.Text = DB.RSField(rs, "EMail").ToLowerInvariant().Trim(); Phone.Text = DB.RSField(rs, "Phone"); Over13.Checked = DB.RSFieldBool(rs, "Over13Checked"); RadioButtonList1.SelectedIndex = CommonLogic.IIF(DB.RSFieldBool(rs, "OkToEMail"), 0, 1); Address BillingAddress = new Address(); BillingAddress.LoadByCustomer(iCustomerID, AddressTypes.Billing); BillingFirstName.Text = BillingAddress.FirstName; BillingLastName.Text = BillingAddress.LastName; BillingPhone.Text = BillingAddress.Phone; BillingCompany.Text = BillingAddress.Company; try { BillingResidenceType.ClearSelection(); if (BillingAddress.ResidenceType != ResidenceTypes.Unknown) { BillingResidenceType.Items.FindByValue(((int)BillingAddress.ResidenceType).ToString()).Selected = true; } } catch { } BillingAddress1.Text = BillingAddress.Address1; BillingAddress2.Text = BillingAddress.Address2; BillingSuite.Text = BillingAddress.Suite; BillingCity.Text = BillingAddress.City; try { BillingState.SelectedIndex = -1; BillingState.ClearSelection(); BillingState.Items.FindByValue(BillingAddress.State).Selected = true; } catch { } BillingZip.Text = BillingAddress.Zip; try { BillingCountry.SelectedIndex = -1; BillingCountry.ClearSelection(); BillingCountry.Items.FindByValue(BillingAddress.Country).Selected = true; } catch { } Address ShippingAddress = new Address(); ShippingAddress.LoadByCustomer(iCustomerID, AddressTypes.Shipping); ShippingFirstName.Text = ShippingAddress.FirstName; ShippingLastName.Text = ShippingAddress.LastName; ShippingPhone.Text = ShippingAddress.Phone; ShippingCompany.Text = ShippingAddress.Company; try { ShippingResidenceType.ClearSelection(); if (ShippingAddress.ResidenceType != ResidenceTypes.Unknown) { ShippingResidenceType.Items.FindByValue(((int)ShippingAddress.ResidenceType).ToString()).Selected = true; } } catch { } ShippingAddress1.Text = ShippingAddress.Address1; ShippingAddress2.Text = ShippingAddress.Address2; ShippingSuite.Text = ShippingAddress.Suite; ShippingCity.Text = ShippingAddress.City; try { ShippingState.SelectedIndex = -1; ShippingState.ClearSelection(); ShippingState.Items.FindByValue(ShippingAddress.State).Selected = true; } catch { } ShippingZip.Text = ShippingAddress.Zip; try { ShippingCountry.SelectedIndex = -1; ShippingCountry.ClearSelection(); ShippingCountry.Items.FindByValue(ShippingAddress.Country).Selected = true; } catch { } try { AffiliateList.SelectedIndex = -1; AffiliateList.ClearSelection(); AffiliateList.Items.FindByValue(DB.RSFieldInt(rs, "AffiliateID").ToString()).Selected = true; } catch { } try { CustomerLevelList.SelectedIndex = -1; CustomerLevelList.ClearSelection(); CustomerLevelList.Items.FindByValue(DB.RSFieldInt(rs, "CustomerLevelID").ToString()).Selected = true; } catch { } } } } }
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; }