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; }