Esempio n. 1
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            // DISPLAY THE SHIPMENT REPEATER ON PRERENDER TO ACCOUNT FOR
            // POSSIBLE IMPACTS OF APPLIED COUPONS
            Basket basket = AbleContext.Current.User.Basket;

            ShipmentRepeater.DataSource = basket.Shipments;
            ShipmentRepeater.DataBind();
        }
Esempio n. 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (this.Order != null && this.Order.Shipments.Count > 0)
     {
         ShipmentRepeater.DataSource = this.Order.Shipments;
         ShipmentRepeater.DataBind();
     }
     else
     {
         ShipmentsPanel.Visible = false;
     }
 }
        protected void ContinueButton_Click(object sender, EventArgs e)
        {
            //LOOP SHIPMENTS, GET SHIPPING METHODS
            Basket basket = AbleContext.Current.User.Basket;
            IList <BasketShipment> shipments = basket.Shipments;

            _ShipmentIndex = 0;
            bool allMethodsValid = true;

            foreach (BasketShipment shipment in shipments)
            {
                // shipment.ShipMethod = ShipMethodDataSource.Load(AlwaysConvert.ToInt(Request.Form["ShipMethod" + _ShipmentIndex]));
                RadioButtonList ShipMethodsList = ShipmentRepeater.Items[_ShipmentIndex].FindControl("ShipMethodsList") as RadioButtonList;
                shipment.ShipMethod = ShipMethodDataSource.Load(AlwaysConvert.ToInt(ShipMethodsList.SelectedValue));
                TextBox shipMessage = ShipmentRepeater.Items[_ShipmentIndex].FindControl("ShipMessage") as TextBox;

                if (shipMessage != null && !string.IsNullOrEmpty(shipMessage.Text))
                {
                    shipMessage.Text = StringHelper.StripHtml(shipMessage.Text.Trim());
                    if (shipMessage.Text.Length > 255)
                    {
                        shipMessage.Text = shipMessage.Text.Substring(0, 255);
                    }
                    shipment.ShipMessage = shipMessage.Text;
                }
                else
                {
                    shipment.ShipMessage = "";
                }
                shipment.Save();
                if (shipment.ShipMethod == null)
                {
                    allMethodsValid = false;
                }
                _ShipmentIndex++;
            }
            if (allMethodsValid)
            {
                Response.Redirect("Payment.aspx");
            }
            else
            {
                ShipmentRepeater.DataSource = AbleContext.Current.User.Basket.Shipments;
                ShipmentRepeater.DataBind();

                //HANDLE ERROR MESSAGE (UNEXPECTED)
                InvalidShipMethodPanel.Visible = true;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (Request.UrlReferrer != null)
                {
                    Back.NavigateUrl = Request.UrlReferrer.ToString();
                }
            }

            IList <int> selectedOrders = GetSelectedOrders();

            if ((selectedOrders == null) || (selectedOrders.Count == 0))
            {
                Response.Redirect("~/Admin/Orders/Default.aspx");
            }
            ShipmentRepeater.DataSource = GetShipments(selectedOrders.ToArray());
            ShipmentRepeater.DataBind();
            OrderList.Text = GetOrderNumbers(selectedOrders);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            CommerceBuilder.Users.User user = AbleContext.Current.User;
            if (user.IsAnonymous)
            {
                Response.Redirect("~/Checkout/Default.aspx");
                return;
            }

            if (CheckQuoteBasketItems())
            {
                Response.Redirect(AbleCommerce.Code.NavigationHelper.GetQuotePageUrl());
            }

            // VALIDATE BILLING ADDRESS
            if (!AbleContext.Current.User.PrimaryAddress.IsValid)
            {
                if (Request.UrlReferrer != null)
                {
                    Response.Redirect(Request.UrlReferrer.AbsoluteUri);
                }
                else
                {
                    Response.Redirect("EditBillAddress.aspx");
                }
            }

            Basket basket = AbleContext.Current.User.Basket;

            // VERIFY ANY SHIPPABLE ITEMS ARE IN PROPERLY CONFIGURED SHIPMENTS
            int unpackagedItems = basket.Items.Count(i => i.Shippable != CommerceBuilder.Shipping.Shippable.No && i.Shipment == null);

            if (unpackagedItems > 0)
            {
                Response.Redirect("ShipAddress.aspx");
            }
            int missingShippingAddress = basket.Shipments.Count(s => s.Address == null || !s.Address.IsValid);

            if (missingShippingAddress > 0)
            {
                Response.Redirect("ShipAddress.aspx");
            }

            IBasketService preCheckoutService = AbleContext.Resolve <IBasketService>();

            preCheckoutService.Recalculate(basket);
            if (basket.Items.Count == 0)
            {
                Response.Redirect(AbleCommerce.Code.NavigationHelper.GetBasketUrl());
            }
            if (!basket.Items.HasShippableProducts())
            {
                Response.Redirect("Payment.aspx");
            }
            weightFormat = "{0:0.##} " + AbleContext.Current.Store.WeightUnit;
            if (!Page.IsPostBack)
            {
                ShipmentRepeater.DataSource = AbleContext.Current.User.Basket.Shipments;
                ShipmentRepeater.DataBind();
            }
            else
            {
                UpdateShipments();
                preCheckoutService.Recalculate(basket);
                BasketTotalsAjax.Update();
            }
            foreach (var rec in basket.Items)
            {
                rec.Price = Math.Abs(rec.Price);
            }
            foreach (RepeaterItem item in ShipmentRepeater.Items)
            {
                if (item.ItemType == ListItemType.AlternatingItem || item.ItemType == ListItemType.Item)
                {
                    Control msgBox    = item.FindControl("ShipMessage");
                    Control msgBoxLbl = item.FindControl("ShipMessageCount");
                    if (msgBox != null && msgBoxLbl != null)
                    {
                        AbleCommerce.Code.PageHelper.SetMaxLengthCountDown(msgBox as TextBox, msgBoxLbl as Label);
                    }
                }
            }
        }
Esempio n. 6
0
 protected void BindShipping()
 {
     ShipmentRepeater.DataSource = _Order.Shipments;
     ShipmentRepeater.DataBind();
 }