protected void Page_Load(object sender, EventArgs e)
 {
     _addressValidator = AddressValidatorServiceLocator.Locate();
     if (!Page.IsPostBack)
     {
         this.AddressId = AlwaysConvert.ToInt(Request.QueryString["AddressId"]);
         InitAddressForm();
     }
 }
Example #2
0
        protected void Page_Init(object sender, EventArgs e)
        {
            _settings = AbleContext.Current.Store.Settings;

            if (AbleContext.Current.User.Basket.Items.Count == 0)
            {
                Response.Redirect(AbleCommerce.Code.NavigationHelper.GetBasketUrl());
            }
            _addressValidator  = AddressValidatorServiceLocator.Locate();
            Country.DataSource = CountryDataSource.LoadAll();
            Country.DataBind();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            User user = AbleContext.Current.User;

            if (user.IsAnonymous)
            {
                Response.Redirect("~/Checkout/Default.aspx");
                return;
            }

            GetAddressId();
            _addressValidator = AddressValidatorServiceLocator.Locate();
            AddressValidationPanel.Visible = _addressValidator != null;
            if (!Page.IsPostBack)
            {
                ShowEditShipToPanel(_addressId);
            }
        }
        private void SaveWareHouse()
        {
            _Warehouse.Name        = Name.Text;
            _Warehouse.Address1    = Address1.Text;
            _Warehouse.Address2    = Address2.Text;
            _Warehouse.City        = City.Text;
            _Warehouse.Province    = (Province.Visible ? Province.Text : Province2.SelectedValue);
            _Warehouse.PostalCode  = PostalCode.Text;
            _Warehouse.CountryCode = Country.SelectedValue;
            _Warehouse.Phone       = Phone.Text;
            _Warehouse.Fax         = Fax.Text;
            _Warehouse.Email       = Email.Text;
            IAddressValidatorService validationService = AddressValidatorServiceLocator.Locate();

            if (validationService != null)
            {
                validationService.ValidateAddress(_Warehouse);
            }
            _Warehouse.Save();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            User user = AbleContext.Current.User;

            if (user.IsAnonymous)
            {
                Response.Redirect("~/Checkout/Default.aspx");
                return;
            }

            //PREPARE BASKET FOR CHECKOUT
            Basket basket = AbleContext.Current.User.Basket;

            //VALIDATE THE BASKET CONTAINS SHIPPABLE ITEMS, OTHERWISE REDIRECT
            if (basket.Items.Count == 0)
            {
                Response.Redirect("~/Basket.aspx");
            }
            if (!basket.Items.HasShippableProducts())
            {
                Response.Redirect("Payment.aspx");
            }

            _addressValidator = AddressValidatorServiceLocator.Locate();
            //BIND ADDRESSES FOR SELECTION
            InitAddressBook();

            //HIDE MULTIPLE SHIP TO IF ONLY ONE ITEM
            //MultipleDestinationsPanel.Visible = (AbleContext.Current.Store.Settings.EnableShipToMultipleAddresses && basket.Items.ShippableProductCount() > 1);
            bool referredByMultiShipPage = Request.UrlReferrer != null && Request.UrlReferrer.AbsolutePath.ToLower().EndsWith("shipaddresses.aspx");
            bool isChangeAddressRequest  = Request.UrlReferrer != null && (Request.UrlReferrer.AbsolutePath.ToLower().EndsWith("shipmethod.aspx") || Request.UrlReferrer.AbsolutePath.ToLower().EndsWith("payment.aspx"));
            bool isEditAddressRequest    = Request.UrlReferrer != null && (Request.UrlReferrer.AbsolutePath.ToLower().EndsWith("editaddress.aspx"));

            // SHOW ADD ADDRESS POPUP IF THERE IS ONLY A BILLING ADDRESS AVAILABE
            if (!Page.IsPostBack && !isChangeAddressRequest && (AbleContext.Current.User.Addresses.Count < 2 || referredByMultiShipPage) && !isEditAddressRequest)
            {
                ShowEditShipToPanel(0);
            }
        }
 protected void SaveButton_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         Warehouse warehouse = new Warehouse();
         warehouse.Name        = Name.Text;
         warehouse.Address1    = Address1.Text;
         warehouse.Address2    = Address2.Text;
         warehouse.City        = City.Text;
         warehouse.Province    = (Province.Visible ? Province.Text : Province2.SelectedValue);
         warehouse.PostalCode  = PostalCode.Text;
         warehouse.CountryCode = Country.SelectedValue;
         warehouse.Phone       = Phone.Text;
         warehouse.Fax         = Fax.Text;
         warehouse.Email       = Email.Text;
         IAddressValidatorService validationService = AddressValidatorServiceLocator.Locate();
         if (validationService != null)
         {
             validationService.ValidateAddress(warehouse);
         }
         warehouse.Save();
         Response.Redirect("Default.aspx");
     }
 }