/// <summary> /// Preselects shipping option. /// </summary> protected void SelectShippingOption() { try { // Try to select shipping from ViewState first object viewStateValue = ShoppingCartControl.GetTempValue(SHIPPING_OPTION_ID); if (viewStateValue != null) { selectShipping.ShippingID = Convert.ToInt32(viewStateValue); } // Try to select shipping option according to saved option in shopping cart object else if (ShoppingCart.ShoppingCartShippingOptionID > 0) { selectShipping.ShippingID = ShoppingCart.ShoppingCartShippingOptionID; } // Try to select shipping option according to user preffered option else { CustomerInfo customer = ShoppingCart.Customer; int shippingOptionId = (customer.CustomerUser != null) ? customer.CustomerUser.GetUserPreferredShippingOptionID(SiteContext.CurrentSiteName) : 0; if (shippingOptionId > 0) { selectShipping.ShippingID = shippingOptionId; } } } catch { } }
/// <summary> /// Preselects payment option. /// </summary> protected void SelectPaymentOption() { try { // Try to select payment from ViewState first object viewStateValue = ShoppingCartControl.GetTempValue(PAYMENT_OPTION_ID); if (viewStateValue != null) { selectPayment.PaymentID = Convert.ToInt32(viewStateValue); } // Try to select payment option according to saved option in shopping cart object else if (ShoppingCart.ShoppingCartPaymentOptionID > 0) { selectPayment.PaymentID = ShoppingCart.ShoppingCartPaymentOptionID; } // Try to select payment option according to user preffered option else { CustomerInfo customer = ShoppingCart.Customer; int paymentOptionId = (customer.CustomerUser != null) ? customer.CustomerUser.GetUserPreferredPaymentOptionID(SiteContext.CurrentSiteName) : 0; if (paymentOptionId > 0) { selectPayment.PaymentID = paymentOptionId; } } } catch { } }
/// <summary> /// Preselects shipping option. /// </summary> protected void SelectShippingOption() { try { // Try to select shipping from ViewState first object viewStateValue = ShoppingCartControl.GetTempValue(SHIPPING_OPTION_ID); if (viewStateValue != null) { selectShipping.SelectedID = Convert.ToInt32(viewStateValue); } // Try to select shipping option according to saved option in shopping cart object else if (ShoppingCart.ShoppingCartShippingOptionID > 0) { selectShipping.SelectedID = ShoppingCart.ShoppingCartShippingOptionID; } // Try to select shipping option according to user preferred option else { if (mPreferences.ShippingOptionID.HasValue) { selectShipping.SelectedID = mPreferences.ShippingOptionID.Value; } } } catch { } }
/// <summary> /// Loads company address temp values. /// </summary> private void LoadCompanyFromViewState() { txtCompanyName.Text = Convert.ToString(ShoppingCartControl.GetTempValue(COMPANY_ADDRESS_NAME)); txtCompanyLine1.Text = Convert.ToString(ShoppingCartControl.GetTempValue(COMPANY_ADDRESS_LINE1)); txtCompanyLine2.Text = Convert.ToString(ShoppingCartControl.GetTempValue(COMPANY_ADDRESS_LINE2)); txtCompanyCity.Text = Convert.ToString(ShoppingCartControl.GetTempValue(COMPANY_ADDRESS_CITY)); txtCompanyZip.Text = Convert.ToString(ShoppingCartControl.GetTempValue(COMPANY_ADDRESS_ZIP)); txtCompanyPhone.Text = Convert.ToString(ShoppingCartControl.GetTempValue(COMPANY_ADDRESS_PHONE)); CountrySelector3.CountryID = ValidationHelper.GetInteger(ShoppingCartControl.GetTempValue(COMPANY_ADDRESS_COUNTRY_ID), 0); CountrySelector3.StateID = ValidationHelper.GetInteger(ShoppingCartControl.GetTempValue(COMPANY_ADDRESS_STATE_ID), 0); }
/// <summary> /// Loads shipping address temp values. /// </summary> private void LoadShippingFromViewState() { txtShippingName.Text = Convert.ToString(ShoppingCartControl.GetTempValue(SHIPPING_ADDRESS_NAME)); txtShippingAddr1.Text = Convert.ToString(ShoppingCartControl.GetTempValue(SHIPPING_ADDRESS_LINE1)); txtShippingAddr2.Text = Convert.ToString(ShoppingCartControl.GetTempValue(SHIPPING_ADDRESS_LINE2)); txtShippingCity.Text = Convert.ToString(ShoppingCartControl.GetTempValue(SHIPPING_ADDRESS_CITY)); txtShippingZip.Text = Convert.ToString(ShoppingCartControl.GetTempValue(SHIPPING_ADDRESS_ZIP)); txtShippingPhone.Text = Convert.ToString(ShoppingCartControl.GetTempValue(SHIPPING_ADDRESS_PHONE)); CountrySelector2.CountryID = ValidationHelper.GetInteger(ShoppingCartControl.GetTempValue(SHIPPING_ADDRESS_COUNTRY_ID), 0); CountrySelector2.StateID = ValidationHelper.GetInteger(ShoppingCartControl.GetTempValue(SHIPPING_ADDRESS_STATE_ID), 0); }
protected void LoadBillingSelectedValue() { try { drpBillingAddr.ClearSelection(); // Set billing address // Try to select billing address from ViewState first object viewStateValue = ShoppingCartControl.GetTempValue(BILLING_ADDRESS_ID); if (viewStateValue != null) { try { drpBillingAddr.SelectedValue = Convert.ToString(viewStateValue); } catch { } } // If there is already selected billing address, set it else if (ShoppingCart.ShoppingCartBillingAddress != null) { try { drpBillingAddr.SelectedValue = ShoppingCart.ShoppingCartBillingAddress.AddressID.ToString(); } catch { } } // If there is last used billing address, set it else if (mLastUsedAddress.AddressID > 0) { try { drpBillingAddr.SelectedValue = mLastUsedAddress.AddressID.ToString(); } catch { } } else if (drpBillingAddr.Items.Count > 1) { drpBillingAddr.SelectedIndex = 1; } } catch { } }
/// <summary> /// Loads selected company address info. /// </summary> protected void LoadCompanyAddressInfo() { // Load company address info only if company part is visible if (plcCompanyDetail.Visible) { // Try to select company address from ViewState first if (!ShoppingCartControl.IsCurrentStepPostBack && ShoppingCartControl.GetTempValue(COMPANY_ADDRESS_ID) != null) { LoadCompanyFromViewState(); } else { if (drpCompanyAddress.SelectedValue != "0") { var addressId = Convert.ToInt32(drpCompanyAddress.SelectedValue); var ai = AddressInfoProvider.GetAddressInfo(addressId); if (ai != null) { txtCompanyName.Text = ai.AddressPersonalName; txtCompanyLine1.Text = ai.AddressLine1; txtCompanyLine2.Text = ai.AddressLine2; txtCompanyCity.Text = ai.AddressCity; txtCompanyZip.Text = ai.AddressZip; txtCompanyPhone.Text = ai.AddressPhone; CountrySelector3.CountryID = ai.AddressCountryID; CountrySelector3.StateID = ai.AddressStateID; CountrySelector3.ReloadData(true); } } else { // clean shipping part of the form CleanForm(false, false, true); // Prefill customer company name or full name if ((ShoppingCart.Customer != null) && (ShoppingCart.Customer.CustomerCompany != "")) { txtCompanyName.Text = ShoppingCart.Customer.CustomerCompany; } else { txtCompanyName.Text = ShoppingCart.Customer.CustomerFirstName + " " + ShoppingCart.Customer.CustomerLastName; } } } } }
/// <summary> /// Loads selected shipping address info. /// </summary> protected void LoadShippingAddressInfo() { // Load shipping info only if shipping part is visible if (plhShipping.Visible) { // Try to select company address from ViewState first if (!ShoppingCartControl.IsCurrentStepPostBack && ShoppingCartControl.GetTempValue(SHIPPING_ADDRESS_ID) != null) { LoadShippingFromViewState(); } else { if (drpShippingAddr.SelectedValue != "0") { var addressId = Convert.ToInt32(drpShippingAddr.SelectedValue); var ai = AddressInfo.Provider.Get(addressId); if (ai != null) { txtShippingName.Text = ai.AddressPersonalName; txtShippingAddr1.Text = ai.AddressLine1; txtShippingAddr2.Text = ai.AddressLine2; txtShippingCity.Text = ai.AddressCity; txtShippingZip.Text = ai.AddressZip; txtShippingPhone.Text = ai.AddressPhone; CountrySelector2.CountryID = ai.AddressCountryID; CountrySelector2.StateID = ai.AddressStateID; CountrySelector2.ReloadData(true); } } else { // clean shipping part of the form CleanForm(false, true, false); // Prefill customer company name or full name if ((ShoppingCart.Customer != null) && (ShoppingCart.Customer.CustomerCompany != "")) { txtShippingName.Text = ShoppingCart.Customer.CustomerCompany; } else { txtShippingName.Text = ShoppingCart.Customer.CustomerFirstName + " " + ShoppingCart.Customer.CustomerLastName; } } } } }
/// <summary> /// Preselects payment option. /// </summary> protected void SelectPaymentOption() { try { // Try to select payment from ViewState first object viewStateValue = ShoppingCartControl.GetTempValue(PAYMENT_OPTION_ID); if (viewStateValue != null) { selectPayment.SelectedID = Convert.ToInt32(viewStateValue); } // Try to select payment option according to saved option in shopping cart object else if (ShoppingCart.ShoppingCartPaymentOptionID > 0) { selectPayment.SelectedID = ShoppingCart.ShoppingCartPaymentOptionID; } } catch { } }
protected void LoadCompanySelectedValue() { try { int lastCompanyAddressId = 0; // Get last used shipping and billing addresses in the order DataSet ds = OrderInfoProvider.GetOrders("OrderCustomerID=" + mCustomerId, "OrderDate DESC"); if (!DataHelper.DataSourceIsEmpty(ds)) { OrderInfo oi = new OrderInfo(ds.Tables[0].Rows[0]); lastCompanyAddressId = oi.OrderCompanyAddressID; } // Try to select company address from ViewState first object viewStateValue = ShoppingCartControl.GetTempValue(COMPANY_ADDRESS_ID); bool viewStateChecked = ValidationHelper.GetBoolean(ShoppingCartControl.GetTempValue(COMPANY_ADDRESS_CHECKED), false); } catch { } }
protected void Page_Load(object sender, EventArgs e) { currentSite = SiteContext.CurrentSite; lblTitle.Text = GetString("ShoppingCartPreview.Title"); if ((ShoppingCart != null) && (ShoppingCart.CountryID == 0) && (currentSite != null)) { string countryName = ECommerceSettings.DefaultCountryName(currentSite.SiteName); CountryInfo ci = CountryInfoProvider.GetCountryInfo(countryName); ShoppingCart.CountryID = (ci != null) ? ci.CountryID : 0; } ShoppingCartControl.ButtonNext.Text = GetString("Ecommerce.OrderPreview.NextButtonText"); // Addresses initialization pnlBillingAddress.GroupingText = GetString("Ecommerce.CartPreview.BillingAddressPanel"); pnlShippingAddress.GroupingText = GetString("Ecommerce.CartPreview.ShippingAddressPanel"); pnlCompanyAddress.GroupingText = GetString("Ecommerce.CartPreview.CompanyAddressPanel"); FillBillingAddressForm(ShoppingCart.ShoppingCartBillingAddressID); FillShippingAddressForm(ShoppingCart.ShoppingCartShippingAddressID); // Load company address if (ShoppingCart.ShoppingCartCompanyAddressID > 0) { lblCompany.Text = OrderInfoProvider.GetAddress(ShoppingCart.ShoppingCartCompanyAddressID); mAddressCount++; tdCompanyAddress.Visible = true; } else { tdCompanyAddress.Visible = false; } // Enable sending order notifications when creating order from CMSDesk if ((ShoppingCartControl.CheckoutProcessType == CheckoutProcessEnum.CMSDeskOrder) || ShoppingCartControl.CheckoutProcessType == CheckoutProcessEnum.CMSDeskCustomer) { chkSendEmail.Visible = true; chkSendEmail.Checked = ECommerceSettings.SendOrderNotification(currentSite.SiteName); chkSendEmail.Text = GetString("ShoppingCartPreview.SendNotification"); //send mail EventLogProvider p1 = new EventLogProvider(); p1.LogEvent("I", DateTime.Now, "Envoi MAIL" + currentSite.SiteName, "code BO"); } // Show tax registration ID and organization ID InitializeIDs(); // shopping cart content table initialization gridData.Columns[4].HeaderText = GetString("Ecommerce.ShoppingCartContent.SKUName"); gridData.Columns[5].HeaderText = GetString("Ecommerce.ShoppingCartContent.SKUUnits"); gridData.Columns[6].HeaderText = GetString("Ecommerce.ShoppingCartContent.UnitPrice"); gridData.Columns[7].HeaderText = GetString("Ecommerce.ShoppingCartContent.UnitDiscount"); gridData.Columns[8].HeaderText = GetString("Ecommerce.ShoppingCartContent.Tax"); gridData.Columns[9].HeaderText = GetString("Ecommerce.ShoppingCartContent.Subtotal"); // Product tax summary table initialiazation gridTaxSummary.Columns[0].HeaderText = GetString("Ecommerce.CartContent.TaxDisplayName"); gridTaxSummary.Columns[1].HeaderText = GetString("Ecommerce.CartContent.TaxSummary"); // Shipping tax summary table initialiazation gridShippingTaxSummary.Columns[0].HeaderText = GetString("com.CartContent.ShippingTaxDisplayName"); gridShippingTaxSummary.Columns[1].HeaderText = GetString("Ecommerce.CartContent.TaxSummary"); ReloadData(); // Order note initialization lblNote.Text = GetString("ecommerce.cartcontent.notelabel"); if (!ShoppingCartControl.IsCurrentStepPostBack) { // Try to select payment from ViewState first object viewStateValue = ShoppingCartControl.GetTempValue(ORDER_NOTE); if (viewStateValue != null) { txtNote.Text = Convert.ToString(viewStateValue); } else { txtNote.Text = ShoppingCart.ShoppingCartNote; } } // Display/Hide column with applied discount gridData.Columns[7].Visible = ShoppingCart.IsDiscountApplied; if (mAddressCount == 2) { tblAddressPreview.Attributes["class"] = "AddressPreviewWithTwoColumns"; } else if (mAddressCount == 3) { tblAddressPreview.Attributes["class"] = "AddressPreviewWithThreeColumns"; } }
protected void LoadCompanySelectedValue() { try { drpCompanyAddress.ClearSelection(); // Try to select company address from ViewState first var viewStateValue = ShoppingCartControl.GetTempValue(COMPANY_ADDRESS_ID); var viewStateChecked = ValidationHelper.GetBoolean(ShoppingCartControl.GetTempValue(COMPANY_ADDRESS_CHECKED), false); if (viewStateValue != null) { try { drpCompanyAddress.SelectedValue = Convert.ToString(viewStateValue); plcCompanyDetail.Visible = viewStateChecked; chkCompanyAddress.Checked = viewStateChecked; return; } catch { } } else if ((ShoppingCart.ShoppingCartCompanyAddress != null) && (ShoppingCart.ShoppingCartCompanyAddress.AddressID != ShoppingCart.ShoppingCartBillingAddress.AddressID)) { try { drpCompanyAddress.SelectedValue = ShoppingCart.ShoppingCartCompanyAddress.AddressID.ToString(); // Display company address part of the form and check the check box plcCompanyDetail.Visible = true; chkCompanyAddress.Checked = true; return; } catch { } } // Select some address only if CompanyAddressID is different from BillingAddressID else if (mLastUsedAddress.AddressID > 0) { try { drpCompanyAddress.SelectedValue = mLastUsedAddress.AddressID.ToString(); if (drpCompanyAddress.SelectedIndex != 0) { return; } } catch { } } if (drpCompanyAddress.Items.Count > 1) { drpCompanyAddress.SelectedIndex = 1; } } catch { } }
protected void LoadShippingSelectedValue() { try { drpShippingAddr.ClearSelection(); // Try to select shipping address from ViewState first object viewStateValue = ShoppingCartControl.GetTempValue(SHIPPING_ADDRESS_ID); bool viewStateChecked = ValidationHelper.GetBoolean(ShoppingCartControl.GetTempValue(SHIPPING_ADDRESS_CHECKED), false); if (viewStateValue != null) { try { drpShippingAddr.SelectedValue = Convert.ToString(viewStateValue); plhShipping.Visible = viewStateChecked; chkShippingAddr.Checked = viewStateChecked; return; } catch { } } else if ((ShoppingCart.ShoppingCartShippingAddress != null) && (ShoppingCart.ShoppingCartShippingAddress.AddressID != ShoppingCart.ShoppingCartBillingAddress.AddressID)) { try { drpShippingAddr.SelectedValue = ShoppingCart.ShoppingCartShippingAddress.AddressID.ToString(); // Display Shipping part of the form and check the check box plhShipping.Visible = true; chkShippingAddr.Checked = true; return; } catch { } } // Select some address only if ShippingAddressID is different from BillingAddressID else if (mLastUsedAddress.AddressID > 0) { try { drpShippingAddr.SelectedValue = mLastUsedAddress.AddressID.ToString(); if (drpShippingAddr.SelectedIndex != 0) { return; } } catch { } } if (drpShippingAddr.Items.Count > 1) { drpShippingAddr.SelectedIndex = 1; } } catch { } }
protected void Page_Load(object sender, EventArgs e) { currentSite = SiteContext.CurrentSite; ShoppingCartControl.ButtonNext.Text = GetString("Ecommerce.OrderPreview.NextButtonText"); // Addresses initialization FillBillingAddressForm(ShoppingCart.ShoppingCartBillingAddress); FillShippingAddressForm(ShoppingCart.ShoppingCartShippingAddress); // Load company address if (ShoppingCart.ShoppingCartCompanyAddress != null) { lblCompany.Text = GetAddressHTML(ShoppingCart.ShoppingCartCompanyAddress); mAddressCount++; tdCompanyAddress.Visible = true; } else { tdCompanyAddress.Visible = false; } // Enable sending order notifications when creating order from CMSDesk if ((ShoppingCartControl.CheckoutProcessType == CheckoutProcessEnum.CMSDeskOrder) || ShoppingCartControl.CheckoutProcessType == CheckoutProcessEnum.CMSDeskCustomer) { chkSendEmail.Visible = true; chkSendEmail.Checked = ECommerceSettings.SendOrderNotification(currentSite.SiteName); chkSendEmail.Text = GetString("ShoppingCartPreview.SendNotification"); } // Show tax registration ID and organization ID InitializeIDs(); // shopping cart content table initialization gridData.Columns[4].HeaderText = GetString("Ecommerce.ShoppingCartContent.SKUName"); gridData.Columns[5].HeaderText = GetString("Ecommerce.ShoppingCartContent.SKUUnits"); gridData.Columns[6].HeaderText = GetString("Ecommerce.ShoppingCartContent.UnitPrice"); gridData.Columns[7].HeaderText = GetString("Ecommerce.ShoppingCartContent.Subtotal"); // Product tax summary table initialization gridTaxSummary.Columns[0].HeaderText = GetString("Ecommerce.CartContent.TaxDisplayName"); gridTaxSummary.Columns[1].HeaderText = GetString("Ecommerce.CartContent.TaxSummary"); ReloadData(); // Order note initialization if (!ShoppingCartControl.IsCurrentStepPostBack) { // Try to select payment from ViewState first object viewStateValue = ShoppingCartControl.GetTempValue(ORDER_NOTE); txtNote.Text = (viewStateValue != null) ? Convert.ToString(viewStateValue) : ShoppingCart.ShoppingCartNote; } if (mAddressCount == 2) { tblAddressPreview.Attributes["class"] = "AddressPreviewWithTwoColumns"; } else if (mAddressCount == 3) { tblAddressPreview.Attributes["class"] = "AddressPreviewWithThreeColumns"; } }