Пример #1
0
    /// <summary>
    /// Saving billing requires recalculation of order. Save action is executed by this custom code.
    /// </summary>
    protected void editOrderBilling_OnBeforeSave(object sender, EventArgs e)
    {
        // Load the shopping cart to process the data
        ShoppingCartInfo sci = ShoppingCartInfoProvider.GetShoppingCartInfoFromOrder(Order.OrderID);

        // Update data only if shopping cart data were changed
        int paymentID  = ValidationHelper.GetInteger(editOrderBilling.FieldEditingControls["OrderPaymentOptionID"].DataValue, 0);
        int currencyID = ValidationHelper.GetInteger(editOrderBilling.FieldEditingControls["OrderCurrencyID"].DataValue, 0);

        // Recalculate order
        if ((sci != null) && ((sci.ShoppingCartPaymentOptionID != paymentID) || (sci.ShoppingCartCurrencyID != currencyID)))
        {
            // Set order new properties
            sci.ShoppingCartPaymentOptionID = paymentID;
            sci.ShoppingCartCurrencyID      = currencyID;

            // Evaluate order data
            ShoppingCartInfoProvider.EvaluateShoppingCart(sci);

            // Update order data
            ShoppingCartInfoProvider.SetOrder(sci, true);
        }

        // Update only one order property
        if (Order.OrderIsPaid != OrderIsPaid)
        {
            Order.OrderIsPaid = OrderIsPaid;
            OrderInfoProvider.SetOrderInfo(Order);
        }

        ShowChangesSaved();

        // Stop automatic saving action
        editOrderBilling.StopProcessing = true;
    }
Пример #2
0
 void editOrderBilling_OnAfterSave(object sender, EventArgs e)
 {
     if (recalculateOrder)
     {
         ShoppingCartInfo sci = ShoppingCartInfoProvider.GetShoppingCartInfoFromOrder(Order.OrderID);
         // Evaluate order data
         ShoppingCartInfoProvider.EvaluateShoppingCart(sci);
         // Update order data
         ShoppingCartInfoProvider.SetOrder(sci, true);
     }
 }
 private void editOrderBilling_OnAfterSave(object sender, EventArgs e)
 {
     if (mRecalculateOrder)
     {
         var cart = ShoppingCartInfoProvider.GetShoppingCartInfoFromOrder(Order.OrderID);
         // Evaluate order data
         cart.Evaluate();
         // Update order data
         ShoppingCartInfoProvider.SetOrder(cart, true);
     }
 }
    /// <summary>
    /// Page load.
    /// </summary>
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!CMSContext.CurrentUser.IsAuthorizedPerUIElement("CMS.Ecommerce", "Orders.Items"))
        {
            RedirectToCMSDeskUIElementAccessDenied("CMS.Ecommerce", "Orders.Items");
        }

        // Get order id
        orderId = QueryHelper.GetInteger("orderid", 0);

        if (!RequestHelper.IsPostBack())
        {
            if (!QueryHelper.GetBoolean("cartexist", false))
            {
                this.ShoppingCart = ShoppingCartInfoProvider.GetShoppingCartInfoFromOrder(orderId);
            }
        }

        if (orderId > 0)
        {
            if ((ShoppingCart != null) && (ShoppingCart.Order != null))
            {
                // Check order site ID
                CheckOrderSiteID(ShoppingCart.Order.OrderSiteID);
            }

            this.Cart.LocalShoppingCart        = this.ShoppingCart;
            this.Cart.EnableProductPriceDetail = true;
            this.Cart.ShoppingCartInfoObj.IsCreatedFromOrder = true;
            this.Cart.CheckoutProcessType = CheckoutProcessEnum.CMSDeskOrderItems;
            this.Cart.OnPaymentCompleted += new EventHandler(Cart_OnPaymentCompleted);
            this.Cart.OnPaymentSkipped   += new EventHandler(Cart_OnPaymentSkipped);
            this.Cart.OnCheckPermissions += new CMSAdminControl.CheckPermissionsEventHandler(Cart_OnCheckPermissions);
            this.Cart.RequiredFieldsMark  = CMS.EcommerceProvider.ShoppingCart.DEFAULT_REQUIRED_FIELDS_MARK;
        }


        if (!RequestHelper.IsPostBack())
        {
            // Display 'Changes saved' message
            if (QueryHelper.GetBoolean("saved", false))
            {
                lblInfo.Visible = true;
                lblInfo.Text    = GetString("General.ChangesSaved");
            }
            // Display 'Payment completed' message
            else if (QueryHelper.GetBoolean("paymentcompleted", false))
            {
                lblInfo.Visible = true;
                lblInfo.Text    = GetString("PaymentGateway.CMSDeskOrderItems.PaymentCompleted");
            }
        }
    }
    protected void btnOk_Click(object sender, EventArgs e)
    {
        // Check 'EcommerceModify' permission
        if (!ECommerceContext.IsUserAuthorizedForPermission("ModifyOrders"))
        {
            RedirectToAccessDenied("CMS.Ecommerce", "EcommerceModify OR ModifyOrders");
        }

        // Check whether some address is selected
        int addressId = addressElem.AddressID;

        if (addressId <= 0)
        {
            // Show error message
            ShowError(GetString("Order_Edit_Billing.NoAddress"));

            return;
        }

        OrderInfo oi = OrderInfoProvider.GetOrderInfo(orderId);

        EditedObject = oi;

        if (oi != null)
        {
            // Check if paid status was changed
            orderIsPaidChanged = (oi.OrderIsPaid != chkOrderIsPaid.Checked);

            // Load the shopping cart to process the data
            ShoppingCartInfo sci = ShoppingCartInfoProvider.GetShoppingCartInfoFromOrder(orderId);
            if (sci != null)
            {
                // Set order new properties
                sci.ShoppingCartBillingAddressID = addressId;
                sci.ShoppingCartPaymentOptionID  = drpPayment.PaymentID;
                sci.ShoppingCartCurrencyID       = drpCurrency.CurrencyID;

                // Evaluate order data
                ShoppingCartInfoProvider.EvaluateShoppingCart(sci);

                // Update order data
                ShoppingCartInfoProvider.SetOrder(sci, false);
            }

            // Mark order as paid
            oi.OrderIsPaid = chkOrderIsPaid.Checked;
            OrderInfoProvider.SetOrderInfo(oi);

            // Show message
            ShowChangesSaved();
        }
    }
    /// <summary>
    /// Page load.
    /// </summary>
    protected void Page_Load(object sender, EventArgs e)
    {
        // Get order id
        orderId = QueryHelper.GetInteger("orderid", 0);

        if (!RequestHelper.IsPostBack())
        {
            if (!QueryHelper.GetBoolean("cartexist", false))
            {
                ShoppingCart = ShoppingCartInfoProvider.GetShoppingCartInfoFromOrder(orderId);
            }
        }

        if (orderId > 0)
        {
            if (ShoppingCart == null)
            {
                RedirectToInformation("editedobject.notexists");
            }

            if (ShoppingCart.Order != null)
            {
                // Check order site ID
                CheckEditedObjectSiteID(ShoppingCart.Order.OrderSiteID);
            }

            Cart.LocalShoppingCart        = ShoppingCart;
            Cart.EnableProductPriceDetail = true;
            Cart.ShoppingCartInfoObj.IsCreatedFromOrder = true;
            Cart.CheckoutProcessType = CheckoutProcessEnum.CMSDeskOrderItems;
            Cart.OnPaymentCompleted += Cart_OnPaymentCompleted;
            Cart.OnPaymentSkipped   += Cart_OnPaymentSkipped;
            Cart.OnCheckPermissions += Cart_OnCheckPermissions;
            Cart.RequiredFieldsMark  = CMS.EcommerceProvider.ShoppingCart.DEFAULT_REQUIRED_FIELDS_MARK;
        }

        if (!RequestHelper.IsPostBack())
        {
            // Display 'Changes saved' message
            if (QueryHelper.GetBoolean("saved", false))
            {
                // Show message
                ShowChangesSaved();
            }
            // Display 'Payment completed' message
            else if (QueryHelper.GetBoolean("paymentcompleted", false))
            {
                ShowInformation(GetString("PaymentGateway.CMSDeskOrderItems.PaymentCompleted"));
            }
        }
    }
    protected void btnGenerate_Click(object sender, EventArgs e)
    {
        // check 'EcommerceModify' permission
        if (!ECommerceContext.IsUserAuthorizedForPermission(EcommercePermissions.ORDERS_MODIFY))
        {
            RedirectToAccessDenied(ModuleName.ECOMMERCE, "EcommerceModify OR ModifyOrders");
        }

        // Load the shopping cart from order
        ShoppingCartInfo sci = ShoppingCartInfoProvider.GetShoppingCartInfoFromOrder(orderId);

        // Update order invoice number
        order.OrderInvoiceNumber = txtInvoiceNumber.Text.Truncate(txtInvoiceNumber.MaxLength);
        order.OrderInvoice       = ShoppingCartInfoProvider.GetOrderInvoice(sci);

        OrderInfoProvider.SetOrderInfo(order);

        // Show message
        ShowChangesSaved();
    }
Пример #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Check if order is not edited from another site
        CheckEditedObjectSiteID(Order.OrderSiteID);

        // Hide Select and Clear button which are visible by default for UniSelector
        UniSelector billingAddressSelector = editOrderBilling.FieldControls["OrderBillingAddressID"] as UniSelector;

        if (billingAddressSelector != null)
        {
            billingAddressSelector.ButtonSelect.Visible = false;
            billingAddressSelector.ButtonClear.Visible  = false;
        }

        BaseObjectSelector paymentSelector = editOrderBilling.FieldControls["OrderPaymentOptionID"] as BaseObjectSelector;

        if (paymentSelector != null)
        {
            paymentSelector.SetValue("ShoppingCart", ShoppingCartInfoProvider.GetShoppingCartInfoFromOrder(Order.OrderID));
        }
    }
Пример #9
0
    protected double GetProductPricettc(object oid, object id)
    {
        int              orderId = Convert.ToInt32(oid);
        double           result  = 0;
        ShoppingCartInfo cart    = ShoppingCartInfoProvider.GetShoppingCartInfoFromOrder(orderId);

        if (cart != null)
        {
            string where = "SKUID = " + id;

            ShoppingCartItemInfo item = null;

            DataSet items = ShoppingCartItemInfoProvider.GetShoppingCartItems(where, null);
            if (!DataHelper.DataSourceIsEmpty(items))
            {
                item   = new ShoppingCartItemInfo(items.Tables[0].Rows[0]);
                result = item.UnitTotalPrice;
            }
        }

        return(System.Math.Round(result, 2));
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        // Check if order is not edited from another site
        CheckEditedObjectSiteID(Order.OrderSiteID);

        var paymentSelector = editOrderBilling.FieldControls["OrderPaymentOptionID"] as BaseObjectSelector;

        paymentSelector?.SetValue("ShoppingCart", ShoppingCartInfoProvider.GetShoppingCartInfoFromOrder(Order.OrderID));

        if (IsCaptureVisible())
        {
            // Add button for payment capture
            mCaptureAction = new HeaderAction
            {
                Text        = GetString("com.capture.payment"),
                CommandName = CAPTURE_COMMAND_NAME,
                ButtonStyle = ButtonStyle.Default
            };
            HeaderActions.AddAction(mCaptureAction);

            ComponentEvents.RequestEvents.RegisterForEvent(CAPTURE_COMMAND_NAME, ActionPerformed);
        }
    }
    protected void btnGenerate_Click(object sender, EventArgs e)
    {
        // check 'EcommerceModify' permission
        if (!ECommerceContext.IsUserAuthorizedForPermission("ModifyOrders"))
        {
            RedirectToAccessDenied("CMS.Ecommerce", "EcommerceModify OR ModifyOrders");
        }

        // Load the shopping cart from order
        ShoppingCartInfo sci = ShoppingCartInfoProvider.GetShoppingCartInfoFromOrder(orderId);

        // Update order invoice number
        order.OrderInvoiceNumber = txtInvoiceNumber.Text.Truncate(txtInvoiceNumber.MaxLength);

        // Generate new invoice, in case discount and subtotal data are stored in the order, recalculation of shopping cart is disabled
        sci.InvalidationEnabled = sci.PriceCalculatedOnTheFly;
        order.OrderInvoice      = ShoppingCartInfoProvider.GetOrderInvoice(sci);
        sci.InvalidationEnabled = true;

        OrderInfoProvider.SetOrderInfo(order);

        // Show message
        ShowChangesSaved();
    }
Пример #12
0
    protected void btnOk_Click(object sender, EventArgs e)
    {
        // check 'EcommerceModify' permission
        if (!ECommerceContext.IsUserAuthorizedForPermission("ModifyOrders"))
        {
            RedirectToAccessDenied("CMS.Ecommerce", "EcommerceModify OR ModifyOrders");
        }

        // Get order
        OrderInfo oi = OrderInfoProvider.GetOrderInfo(orderId);

        if (oi != null)
        {
            // Get order site
            SiteInfo si = SiteInfoProvider.GetSiteInfo(oi.OrderSiteID);

            // If shipping address is required
            if (((this.ShoppingCartInfoObj != null) && (ShippingOptionInfoProvider.IsShippingNeeded(this.ShoppingCartInfoObj))) ||
                ((si != null) && (ECommerceSettings.ApplyTaxesBasedOn(si.SiteName) == ApplyTaxBasedOnEnum.ShippingAddress)))
            {
                // If shipping address is not set
                if (this.addressElem.AddressID <= 0)
                {
                    lblError.Visible = true;
                    lblError.Text    = GetString("Order_Edit_Shipping.NoAddress");

                    return;
                }
            }

            try
            {
                // Load the shopping cart to process the data
                ShoppingCartInfo sci = ShoppingCartInfoProvider.GetShoppingCartInfoFromOrder(orderId);
                if (sci != null)
                {
                    // Set order new properties
                    sci.ShoppingCartShippingOptionID  = drpShippingOption.ShippingID;
                    sci.ShoppingCartShippingAddressID = this.addressElem.AddressID;

                    // Evaulate order data
                    ShoppingCartInfoProvider.EvaluateShoppingCart(sci);

                    // Update order data
                    ShoppingCartInfoProvider.SetOrder(sci, false);
                }

                // Update tracking number
                oi.OrderTrackingNumber = txtTrackingNumber.Text.Trim();
                OrderInfoProvider.SetOrderInfo(oi);

                lblInfo.Visible = true;
                lblInfo.Text    = GetString("General.ChangesSaved");
            }
            catch (Exception ex)
            {
                lblError.Visible = true;
                lblError.Text    = ex.Message;
            }
        }
    }
        private void GenerateEcommerceData(int siteID)
        {
            var siteName     = SiteInfoProvider.GetSiteName(siteID);
            var currencyInfo = CurrencyInfoProvider.GetCurrencies(siteID)
                               .Where("CurrencyIsMain", QueryOperator.Equals, 1).TopN(1).FirstOrDefault();
            var list1 = PaymentOptionInfoProvider.GetPaymentOptions(siteID).ToList();
            var list2 = ShippingOptionInfoProvider.GetShippingOptions(siteID).ToList();

            var orderStatusList = OrderStatusInfoProvider.GetOrderStatuses(siteID).ToDictionary(status => status.StatusName);

            var manufacturerExceptionList = new List <int>
            {
                ManufacturerInfoProvider.GetManufacturerInfo("Aerobie", siteName).ManufacturerID,
                //ManufacturerInfoProvider.GetManufacturerInfo("Chemex", siteName).ManufacturerID,
                //ManufacturerInfoProvider.GetManufacturerInfo("Espro", siteName).ManufacturerID
            };
            var list3 = SKUInfoProvider.GetSKUs(siteID).ToList().Where(sku =>
            {
                if (sku.IsProduct)
                {
                    return(!manufacturerExceptionList.Contains(sku.SKUManufacturerID));
                }
                return(false);
            }).ToList();
            int         num1;
            IList <int> intList;

            if (CustomerInfoProvider.GetCustomers().WhereEquals("CustomerSiteID", siteID).Count < 50)
            {
                num1    = customerNames.Length;
                intList = new List <int>();
                for (var index = 0; index < num1; ++index)
                {
                    intList.Add(GenerateCustomer(customerNames[index], siteID).CustomerID);
                }
            }
            else
            {
                intList = DataHelper.GetIntegerValues(CustomerInfoProvider.GetCustomers().Column("CustomerID")
                                                      .WhereEquals("CustomerSiteID", siteID).WhereNotEquals("CustomerEmail", "alex").Tables[0],
                                                      "CustomerID");
                num1 = intList.Count;
            }

            var num2 = 0;
            var num3 = 0;

            for (var index1 = 0; index1 <= 30; ++index1)
            {
                ++num2;
                var num4 = 0;
                if (index1 > 5)
                {
                    num4 = rand.Next(-1, 2);
                }
                for (var index2 = 0; index2 < num2 / 2 + num4; ++index2)
                {
                    var orderStatusInfo = index1 >= 25
                        ? index1 >= 29 ? orderStatusList["New"] : orderStatusList["InProgress"]
                        : orderStatusList["Completed"];
                    var orderInfo = new OrderInfo
                    {
                        OrderCustomerID = intList[num3 % num1],
                        OrderCurrencyID = currencyInfo.CurrencyID,
                        OrderSiteID     = siteID,
                        OrderStatusID   = orderStatusInfo.StatusID,
                        OrderIsPaid     = "Completed".Equals(orderStatusInfo.StatusName, StringComparison.Ordinal) ||
                                          (uint)rand.Next(0, 2) > 0U,
                        OrderShippingOptionID         = list2[rand.Next(list2.Count)].ShippingOptionID,
                        OrderPaymentOptionID          = list1[rand.Next(list1.Count)].PaymentOptionID,
                        OrderGrandTotal               = decimal.Zero,
                        OrderGrandTotalInMainCurrency = decimal.Zero,
                        OrderTotalPrice               = decimal.Zero,
                        OrderTotalPriceInMainCurrency = decimal.Zero,
                        OrderTotalShipping            = new decimal(10),
                        OrderTotalTax = new decimal(10)
                    };
                    OrderInfoProvider.SetOrderInfo(orderInfo);
                    var orderItems = GenerateOrderItems(orderInfo, list3);
                    GenerateOrderAddress(orderInfo.OrderID, GetRandomCountryId(), AddressType.Billing);
                    GenerateOrderAddress(orderInfo.OrderID, GetRandomCountryId(), AddressType.Shipping);
                    orderInfo.OrderDate       = DateTime.Now.AddDays(index1 - 30);
                    orderInfo.OrderTotalPrice = orderItems;
                    orderInfo.OrderTotalPriceInMainCurrency = orderItems;
                    orderInfo.OrderGrandTotal = orderItems;
                    orderInfo.OrderGrandTotalInMainCurrency = orderItems;
                    var cartInfoFromOrder = ShoppingCartInfoProvider.GetShoppingCartInfoFromOrder(orderInfo.OrderID);
                    orderInfo.OrderInvoiceNumber = OrderInfoProvider.GenerateInvoiceNumber(cartInfoFromOrder);
                    orderInfo.OrderInvoice       = ShoppingCartInfoProvider.GetOrderInvoice(cartInfoFromOrder);
                    OrderInfoProvider.SetOrderInfo(orderInfo);
                    ++num3;
                }
            }

            if (UserInfoProvider.GetUserInfo("alex") != null)
            {
                return;
            }
            var customerInfo = new CustomerInfo
            {
                CustomerEmail             = "*****@*****.**",
                CustomerFirstName         = "Alexander",
                CustomerLastName          = "Adams",
                CustomerSiteID            = siteID,
                CustomerCompany           = "Alex & Co. Ltd",
                CustomerTaxRegistrationID = "12S379BDF798",
                CustomerOrganizationID    = "WRQ7987VRG79"
            };

            CustomerInfoProvider.SetCustomerInfo(customerInfo);
            var userInfo = CustomerInfoProvider.RegisterCustomer(customerInfo, "", "alex");
            var roleInfo = RoleInfoProvider.GetRoleInfo("SilverPartner", siteID);

            if (roleInfo != null)
            {
                UserInfoProvider.AddUserToRole(userInfo.UserID, roleInfo.RoleID);
            }
            for (var index = 0; index < 5; ++index)
            {
                var cart = new ShoppingCartInfo();
                cart.ShoppingCartCulture         = CultureHelper.GetDefaultCultureCode(siteName);
                cart.ShoppingCartCurrencyID      = currencyInfo.CurrencyID;
                cart.ShoppingCartSiteID          = siteID;
                cart.ShoppingCartCustomerID      = customerInfo.CustomerID;
                cart.ShoppingCartBillingAddress  = GenerateAddress(GetRandomCountryId(), customerInfo.CustomerID);
                cart.ShoppingCartShippingAddress = GenerateAddress(GetRandomCountryId(), customerInfo.CustomerID);
                cart.User = userInfo;
                ShoppingCartInfoProvider.SetShoppingCartInfo(cart);
                ShoppingCartInfoProvider.SetShoppingCartItem(cart,
                                                             new ShoppingCartItemParameters(list3.ElementAt(rand.Next(list3.Count)).SKUID, rand.Next(5)));
                cart.Evaluate();
                ShoppingCartInfoProvider.SetOrder(cart);
            }
        }
    protected void btnOk_Click(object sender, EventArgs e)
    {
        // check 'EcommerceModify' permission
        if (!ECommerceContext.IsUserAuthorizedForPermission("ModifyOrders"))
        {
            RedirectToAccessDenied("CMS.Ecommerce", "EcommerceModify OR ModifyOrders");
        }

        // Get order
        OrderInfo oi = OrderInfoProvider.GetOrderInfo(orderId);

        if (oi != null)
        {
            // Are taxes based on shipping address?
            bool     taxesBasedOnShipping = false;
            SiteInfo si = SiteInfoProvider.GetSiteInfo(oi.OrderSiteID);
            if (si != null)
            {
                taxesBasedOnShipping = (ECommerceSettings.ApplyTaxesBasedOn(si.SiteName) == ApplyTaxBasedOnEnum.ShippingAddress);
            }

            // Is shipping needed?
            bool isShippingNeeded = ((ShoppingCartInfoObj != null) && (ShippingOptionInfoProvider.IsShippingNeeded(ShoppingCartInfoObj)));

            // If shipping address is required
            if (isShippingNeeded || taxesBasedOnShipping)
            {
                // If shipping address is not set
                if (addressElem.AddressID <= 0)
                {
                    // Show error message
                    ShowError(GetString("Order_Edit_Shipping.NoAddress"));

                    return;
                }
            }

            try
            {
                // Load the shopping cart to process the data
                ShoppingCartInfo sci = ShoppingCartInfoProvider.GetShoppingCartInfoFromOrder(orderId);
                if (sci != null)
                {
                    // Set order new properties
                    sci.ShoppingCartShippingOptionID  = drpShippingOption.ShippingID;
                    sci.ShoppingCartShippingAddressID = addressElem.AddressID;

                    // Evaluate order data
                    ShoppingCartInfoProvider.EvaluateShoppingCart(sci);

                    // Update order data
                    ShoppingCartInfoProvider.SetOrder(sci, false);
                }

                // Update tracking number
                oi.OrderTrackingNumber = txtTrackingNumber.Text.Trim();
                OrderInfoProvider.SetOrderInfo(oi);

                // Show message
                ShowChangesSaved();

                // Update shipping charge in selector
                if (taxesBasedOnShipping)
                {
                    drpShippingOption.ShoppingCart = sci;
                    drpShippingOption.Reload(false);
                }
            }
            catch (Exception ex)
            {
                // Show error message
                ShowError(ex.Message);
            }
        }
    }
    protected void OnBeforeSave(object sender, EventArgs e)
    {
        if ((Order == null) || (ShippingAddressSelector == null) || (ShippingOptionSelector == null))
        {
            return;
        }

        // Get shopping cart from order
        ShoppingCartInfo sci = ShoppingCartInfoProvider.GetShoppingCartInfoFromOrder(Order.OrderID);

        // Get current values
        int addressID        = ValidationHelper.GetInteger(ShippingAddressSelector.Value, 0);
        int shippingOptionID = ValidationHelper.GetInteger(ShippingOptionSelector.Value, 0);

        // Is shipping needed?
        bool isShippingNeeded = ((sci != null) && sci.IsShippingNeeded);

        // If shipping address is required
        if (isShippingNeeded || IsTaxBasedOnShippingAddress)
        {
            // If shipping address is not set
            if (addressID <= 0)
            {
                // Show error message
                ShowError(GetString("Order_Edit_Shipping.NoAddress"));
                return;
            }
        }

        try
        {
            // Shipping option changed
            if ((sci != null) && (Order.OrderShippingOptionID != shippingOptionID))
            {
                // Shipping option and payment method combination is not allowed
                if (PaymentShippingInfoProvider.GetPaymentShippingInfo(Order.OrderPaymentOptionID, shippingOptionID) == null)
                {
                    PaymentOptionInfo payment = PaymentOptionInfoProvider.GetPaymentOptionInfo(Order.OrderPaymentOptionID);

                    // Check if payment is allowed with no shipping
                    if ((payment != null) && !(payment.PaymentOptionAllowIfNoShipping && shippingOptionID == 0))
                    {
                        // Set payment method to none and display warning
                        sci.ShoppingCartPaymentOptionID = 0;

                        string paymentMethodName  = ResHelper.LocalizeString(payment.PaymentOptionDisplayName, null, true);
                        string shippingOptionName = HTMLHelper.HTMLEncode(ShippingOptionSelector.ValueDisplayName);

                        ShowWarning(String.Format(ResHelper.GetString("com.shippingoption.paymentsetnone"), paymentMethodName, shippingOptionName));
                    }
                }

                // Set order new properties
                sci.ShoppingCartShippingOptionID = shippingOptionID;

                // Evaluate order data
                ShoppingCartInfoProvider.EvaluateShoppingCart(sci);

                // Update order data
                ShoppingCartInfoProvider.SetOrder(sci, true);
            }

            // Update tracking number
            Order.OrderTrackingNumber = ValidationHelper.GetString(orderShippingForm.FieldEditingControls["OrderTrackingNumber"].DataValue, String.Empty).Trim();
            OrderInfoProvider.SetOrderInfo(Order);

            // Show message
            ShowChangesSaved();

            // Update shipping charge in selector
            if (IsTaxBasedOnShippingAddress)
            {
                var shippingSelector = orderShippingForm.FieldControls["OrderShippingOptionID"] as SiteSeparatedObjectSelector;
                if (shippingSelector != null)
                {
                    shippingSelector.SetValue("ShoppingCart", sci);
                    shippingSelector.Reload(false);
                }
            }

            // Stop automatic saving action
            orderShippingForm.StopProcessing = true;
        }
        catch (Exception ex)
        {
            // Show error message
            ShowError(ex.Message);
        }
    }