예제 #1
0
        protected void Page_Init(object sender, EventArgs e)
        {
            int shipmentId = AlwaysConvert.ToInt(Request.QueryString["OrderShipmentId"]);

            _OrderShipment = OrderShipmentDataSource.Load(shipmentId);
            if (_OrderShipment == null)
            {
                Response.Redirect(CancelLink.NavigateUrl);
            }

            // BIND THE ADDRESS
            initAddress();

            // BIND ADDITIONAL DETAILS
            ShipFrom.DataSource = AbleContext.Current.Store.Warehouses;
            ShipFrom.DataBind();
            if (!Page.IsPostBack)
            {
                ListItem selectedItem = ShipFrom.Items.FindByValue(_OrderShipment.WarehouseId.ToString());
                if (selectedItem != null)
                {
                    selectedItem.Selected = true;
                }
            }
            ShipMessage.Text             = _OrderShipment.ShipMessage;
            Caption.Text                 = string.Format(Caption.Text, _OrderShipment.Order.OrderNumber);
            EditShipmentCaption.Text     = string.Format(EditShipmentCaption.Text, _OrderShipment.ShipmentNumber);
            CancelLink.NavigateUrl      += "?OrderNumber=" + _OrderShipment.Order.OrderNumber.ToString();
            TrackingNumbersLabel.Visible = (_OrderShipment.TrackingNumbers != null && _OrderShipment.TrackingNumbers.Count > 0);
            ShipGateway.DataSource       = ShipGatewayDataSource.LoadAll();
            ShipGateway.DataBind();
            trAddTrackingNumber.Visible = (_OrderShipment.TrackingNumbers.Count == 0);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            // LOCATE THE SHIP GATEWAY INFORMATION
            string classId = Misc.GetClassId(typeof(UPS));
            IList <ShipGateway> gateways = ShipGatewayDataSource.LoadForClassId(classId);

            if (gateways.Count == 0)
            {
                Response.Redirect("License.aspx");
            }
            _ShipGateway = gateways[0];

            if (!Page.IsPostBack)
            {
                UPS provider = (UPS)_ShipGateway.GetProviderInstance();

                // INITIALIZE THE FORM FIELDS ON FIRST VISIT
                UserId.Text    = provider.UserId;
                AccessKey.Text = provider.AccessKey;
                Password.Text  = provider.Password;
                EnableAddressValidation.Checked = provider.EnableAddressValidation;
                AddressServiceTestUrl.Text      = provider.AddressServiceTestUrl;
                AddressServiceLiveUrl.Text      = provider.AddressServiceLiveUrl;
            }
        }
예제 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // LOCATE THE SHIP GATEWAY INFORMATION
            string classId = Misc.GetClassId(typeof(AustraliaPost));
            IList <ShipGateway> gateways = ShipGatewayDataSource.LoadForClassId(classId);

            if (gateways.Count == 0)
            {
                Response.Redirect("Register.aspx");
            }
            _ShipGateway = gateways[0];

            // INITIALIZE THE PROVIDER SHIP METHOD CONTROL
            ShipMethods.ShipGatewayId = _ShipGateway.Id;

            // INITIALIZE THE FORM FIELDS ON FIRST VISIT
            if (!Page.IsPostBack)
            {
                AustraliaPost provider = (AustraliaPost)_ShipGateway.GetProviderInstance();
                UseDebugMode.Checked    = provider.UseDebugMode;
                EnablePackaging.Checked = provider.EnablePackageBreakup;
                MaxWeight.Text          = provider.MaxPackageWeight.ToString();
                MinWeight.Text          = provider.MinPackageWeight.ToString();
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     _ShipGateway = ShipGatewayDataSource.Load(this.ShipGatewayId);
     if (!Page.IsPostBack)
     {
         BindShipMethods();
     }
 }
예제 #5
0
        protected void ShipmentRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            //CAST DATA ITEM
            BasketShipment shipment = (BasketShipment)e.Item.DataItem;

            //UPDATE SHIPPING WEIGHT
            Literal shipWeight = (Literal)e.Item.FindControl("ShipWeight");

            if (shipWeight != null)
            {
                shipWeight.Text = string.Format(weightFormat, shipment.Items.TotalWeight());
            }
            //SHOW SHIPPING METHODS
            DropDownList ShipMethodsList        = (DropDownList)e.Item.FindControl("ShipMethodsList");
            Localize     ShipMethodErrorMessage = (Localize)e.Item.FindControl("ShipMethodErrorMessage");
            PlaceHolder  phNoShippingMethods    = (PlaceHolder)e.Item.FindControl("phNoShippingMethods");
            PlaceHolder  phShipMessage          = (PlaceHolder)e.Item.FindControl("PHShipMessage");

            if (phShipMessage != null)
            {
                phShipMessage.Visible = AbleContext.Current.Store.Settings.EnableShipMessage;
            }

            if (ShipMethodsList != null)
            {
                _ShipmentIndex = e.Item.ItemIndex;
                IShipRateQuoteCalculator    shippingCalculator = AbleContext.Resolve <IShipRateQuoteCalculator>();
                ICollection <ShipRateQuote> rateQuotes         = shippingCalculator.QuoteForShipment(shipment);
                foreach (var rec in rateQuotes)
                {
                    rec.Rate = Math.Abs(rec.Rate);
                }
                ShipMethodsList.DataSource = GetShipMethodListDs(rateQuotes);
                ShipMethodsList.DataBind();
                if (rateQuotes.Count == 0)
                {
                    ShipMethodErrorMessage.Visible = true;
                    phNoShippingMethods.Visible    = true;
                    ShipMethodsList.Visible        = false;
                    Localize ShipMethodUPSErrorMessage = (Localize)e.Item.FindControl("ShipMethodUPSErrorMessage");
                    // CHECK IF UPS IS ENABLED
                    string classId = Misc.GetClassId(typeof(UPS));
                    IList <ShipGateway> gateways = ShipGatewayDataSource.LoadForClassId(classId);
                    if (gateways.Count > 0)
                    {
                        // CHECK IF PROVIDED ADDRESS IS A PO-BOX ADDRESS
                        if (ValidationHelper.IsPostOfficeBoxAddress(shipment.Address.Address1))
                        {
                            ShipMethodUPSErrorMessage.Visible = true;
                        }
                    }

                    _shippingMethodsAvailable = false;
                }
            }
        }
예제 #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // LOCATE THE SHIP GATEWAY INFORMATION
            string classId = Misc.GetClassId(typeof(UPS));
            IList <ShipGateway> gateways = ShipGatewayDataSource.LoadForClassId(classId);

            if (gateways.Count == 0)
            {
                Response.Redirect("License.aspx");
            }
            _ShipGateway = gateways[0];
            UPS provider = (UPS)_ShipGateway.GetProviderInstance();

            // INITIALIZE THE PROVIDER SHIP METHOD CONTROL
            ShipMethods.ShipGatewayId = _ShipGateway.Id;

            // INITIALIZE THE FORM FIELDS ON FIRST VISIT
            UserId.Text    = provider.UserId;
            AccessKey.Text = provider.AccessKey;
            if (!Page.IsPostBack)
            {
                if ((provider.CustomerType == UPS.UpsCustomerType.DailyPickup))
                {
                    CustomerType_DailyPickup.Checked = true;
                }
                else if ((provider.CustomerType == UPS.UpsCustomerType.Occasional))
                {
                    CustomerType_Occasional.Checked = true;
                }
                else if ((provider.CustomerType == UPS.UpsCustomerType.Retail))
                {
                    CustomerType_Retail.Checked = true;
                }
                else
                {
                    CustomerType_Negotiated.Checked = true;
                }
                UseInsurance.Checked    = provider.UseInsurance;
                UseDebugMode.Checked    = provider.UseDebugMode;
                UseTestMode.Checked     = provider.UseTestMode;
                LiveServerURL.Text      = provider.LiveModeUrl;
                TestServerURL.Text      = provider.TestModeUrl;
                TrackingURL.Text        = provider.TrackingUrl;
                ShipperNumber.Text      = provider.ShipperNumber;
                EnableLabels.Checked    = provider.EnableShipping;
                MaxWeight.Text          = provider.MaxPackageWeight.ToString();
                MinWeight.Text          = provider.MinPackageWeight.ToString();
                EnablePackaging.Checked = provider.EnablePackageBreakup;
                //EnableAddressValidation.Checked = provider.EnableAddressValidation;
                //AddressServiceTestUrl.Text = provider.AddressServiceTestUrl;
                //AddressServiceLiveUrl.Text = provider.AddressServiceLiveUrl;
            }
        }
예제 #7
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            // VERIFY THIS PROVIDER IS NOT ALREADY REGISTERED
            string classId = Misc.GetClassId(typeof(USPS));
            IList <ShipGateway> gateways = ShipGatewayDataSource.LoadForClassId(classId);

            if (gateways.Count > 0)
            {
                Response.Redirect("Configure.aspx?ShipGatewayId=" + gateways[0].Id);
            }

            Logo.ImageUrl = new USPS().GetLogoUrl(this.Page.ClientScript);
        }
예제 #8
0
        protected void ShipmentRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            //CAST DATA ITEM
            BasketShipment shipment = (BasketShipment)e.Item.DataItem;

            //UPDATE SHIPPING WEIGHT
            Literal shipWeight = (Literal)e.Item.FindControl("ShipWeight");

            if (shipWeight != null)
            {
                shipWeight.Text = string.Format(weightFormat, shipment.Items.TotalWeight());
            }
            //SHOW SHIPPING METHODS
            RadioButtonList ShipMethodsList        = (RadioButtonList)e.Item.FindControl("ShipMethodsList");
            Localize        ShipMethodErrorMessage = (Localize)e.Item.FindControl("ShipMethodErrorMessage");
            PlaceHolder     phNoShippingMethods    = (PlaceHolder)e.Item.FindControl("phNoShippingMethods");

            if (ShipMethodsList != null)
            {
                _ShipmentIndex = e.Item.ItemIndex;
                IShipRateQuoteCalculator    shippingCalculator = AbleContext.Resolve <IShipRateQuoteCalculator>();
                ICollection <ShipRateQuote> rateQuotes         = shippingCalculator.QuoteForShipment(shipment);
                ShipMethodsList.DataSource = GetShipMethodListDs(rateQuotes);
                ShipMethodsList.DataBind();
                if (rateQuotes.Count == 0)
                {
                    ShipMethodErrorMessage.Visible = true;
                    phNoShippingMethods.Visible    = true;
                    ShipMethodsList.Visible        = false;
                    Localize ShipMethodUPSErrorMessage = (Localize)e.Item.FindControl("ShipMethodUPSErrorMessage");
                    // CHECK IF UPS IS ENABLED
                    string classId = Misc.GetClassId(typeof(UPS));
                    IList <ShipGateway> gateways = ShipGatewayDataSource.LoadForClassId(classId);
                    if (gateways.Count > 0)
                    {
                        // CHECK IF PROVIDED ADDRESS IS A PO-BOX ADDRESS
                        if (ValidationHelper.IsPostOfficeBoxAddress(shipment.Address.Address1))
                        {
                            ShipMethodUPSErrorMessage.Visible = true;
                        }
                    }

                    ContinueButton.Visible = false;
                }
                else
                {
                    // IN CASE WE HAVE DISABLED THE CONTINUE BUTTON BEFORE
                    ContinueButton.Visible = true;
                }
            }
        }
예제 #9
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            // VERIFY THIS PROVIDER IS NOT ALREADY REGISTERED
            string classId = Misc.GetClassId(typeof(AustraliaPost));
            IList <ShipGateway> gateways = ShipGatewayDataSource.LoadForClassId(classId);

            if (gateways.Count > 0)
            {
                Response.Redirect("Configure.aspx?ShipGatewayId=" + gateways[0].Id);
            }

            ConditionText.Text = string.Format(ConditionText.Text, AbleContext.Current.Store.Name);
            Logo.ImageUrl      = new AustraliaPost().GetLogoUrl(this.Page.ClientScript);
        }
예제 #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            IList <IShippingProvider> allProviders       = ShippingProviderDataSource.GetShippingProviders();
            IList <ShipGateway>       gateways           = ShipGatewayDataSource.LoadAll();
            List <IShippingProvider>  availableProviders = new List <IShippingProvider>();

            foreach (IShippingProvider provider in allProviders)
            {
                string providerClassId = Misc.GetClassId(provider.GetType());
                if (gateways.Where(gw => gw.ClassId.Equals(providerClassId)).Count() == 0)
                {
                    availableProviders.Add(provider);
                }
            }
            ProviderGrid.DataSource = availableProviders;
            ProviderGrid.DataBind();
        }
예제 #11
0
 protected void Page_Init(object sender, System.EventArgs e)
 {
     _ShipProviders = ShipGatewayDataSource.LoadAll();
     if (_ShipProviders.Count == 0)
     {
         NoShipProviderMessage.Visible   = true;
         IntegratedProviderPanel.Visible = false;
     }
     else
     {
         NoShipProviderMessage.Visible   = false;
         IntegratedProviderPanel.Visible = true;
         Provider.DataSource             = _ShipProviders;
         Provider.DataBind();
     }
     _IconPath = AbleCommerce.Code.PageHelper.GetAdminThemeIconPath(this.Page);
     AbleCommerce.Code.PageHelper.SetDefaultButton(AddShipMethodName, AddShipMethodButton.ClientID);
 }
예제 #12
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            // LOCATE THE SHIP GATEWAY INFORMATION
            string classId = Misc.GetClassId(typeof(DHLInternational));
            IList <ShipGateway> gateways = ShipGatewayDataSource.LoadForClassId(classId);

            if (gateways.Count == 0)
            {
                Response.Redirect("Register.aspx");
            }
            _ShipGateway = gateways[0];

            // INITIALIZE THE PROVIDER SHIP METHOD CONTROL
            ShipMethods.ShipGatewayId = _ShipGateway.Id;

            // INITIALIZE THE FORM FIELDS ON FIRST VISIT
            if (!Page.IsPostBack)
            {
                DHLInternational provider = (DHLInternational)_ShipGateway.GetProviderInstance();
                UseDebugMode.Checked        = provider.UseDebugMode;
                UseTestMode.Checked         = provider.UseTestMode;
                EnablePackaging.Checked     = provider.EnablePackageBreakup;
                UserID.Text                 = provider.UserID;
                Password.Text               = provider.Password;
                ShippingKey.Text            = provider.ShippingKey;
                AccountNumber.Text          = provider.AccountNumber;
                DaysToShip.Text             = provider.DaysToShip.ToString();
                LiveServerURL.Text          = provider.LiveModeUrl;
                TestServerURL.Text          = provider.TestModeUrl;
                TrackingURL.Text            = provider.TrackingUrl;
                MaxWeight.Text              = provider.MaxPackageWeight.ToString();
                MinWeight.Text              = provider.MinPackageWeight.ToString();
                DutiableFlag.Checked        = provider.DutiableFlag;
                CustomsValueMultiplier.Text = provider.CustomsValueMultiplier.ToString();
                CommerceLicensed.Checked    = provider.CommerceLicensed;
                BindFilingType(provider.FilingType);
                FTRExemptionCode.Text = provider.FTRExemptionCode;
                ITNNumber.Text        = provider.ITNNumber;
                EINCode.Text          = provider.EINCode;
            }
        }
예제 #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // VERIFY THIS PROVIDER IS NOT ALREADY REGISTERED
            string classId = Misc.GetClassId(typeof(UPS));
            IList <ShipGateway> gateways = ShipGatewayDataSource.LoadForClassId(classId);

            if (gateways.Count > 0)
            {
                Response.Redirect("Configure.aspx?ShipGatewayId=" + gateways[0].Id);
            }

            // INITIALIZE FORM
            if (!Page.IsPostBack)
            {
                Warehouse defaultWarehouse = AbleContext.Current.Store.DefaultWarehouse;
                ContactName.Text = AbleContext.Current.User.PrimaryAddress.FullName;
                CompanyName.Text = AbleContext.Current.Store.Name;
                Address1.Text    = defaultWarehouse.Address1;
                Address2.Text    = defaultWarehouse.Address2;
                City.Text        = defaultWarehouse.City;
                string countryCode = defaultWarehouse.CountryCode;
                if ((countryCode.Equals("US") || countryCode.Equals("CA")))
                {
                    Province userProvince = new Province();
                    if ((!string.IsNullOrEmpty(defaultWarehouse.Province) &&
                         (defaultWarehouse.Province.Length == 2)))
                    {
                        Province.Text = defaultWarehouse.Province;
                    }
                    PostalCode.Text = defaultWarehouse.PostalCode;
                }
                ListItem countryItem = Country.Items.FindByValue(countryCode);
                if (countryItem != null)
                {
                    countryItem.Selected = true;
                }
                Phone.Text = Regex.Replace(defaultWarehouse.Phone, "[^0-9]", "");
                Email.Text = defaultWarehouse.Email;
            }
        }
예제 #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // LOCATE THE SHIP GATEWAY INFORMATION
            string classId = Misc.GetClassId(typeof(USPS));
            IList <ShipGateway> gateways = ShipGatewayDataSource.LoadForClassId(classId);

            if (gateways.Count == 0)
            {
                Response.Redirect("Register.aspx");
            }
            _ShipGateway = gateways[0];
            USPS provider = (USPS)_ShipGateway.GetProviderInstance();

            // INITIALIZE THE PROVIDER SHIP METHOD CONTROL
            ShipMethods.ShipGatewayId = _ShipGateway.Id;

            // INITIALIZE THE FORM FIELDS ON FIRST VISIT
            if (!Page.IsPostBack)
            {
                UseDebugMode.Checked            = provider.UseDebugMode;
                UseTestMode.Checked             = provider.UseTestMode;
                UserId.Text                     = provider.UserId;
                LiveServerURL.Text              = provider.LiveModeUrl;
                TestServerURL.Text              = provider.TestModeUrl;
                TrackingURL.Text                = provider.TrackingUrl;
                MaxWeight.Text                  = provider.MaxPackageWeight.ToString();
                MinWeight.Text                  = provider.MinPackageWeight.ToString();
                EnablePackaging.Checked         = provider.EnablePackageBreakup;
                EnableAddressValidation.Checked = provider.EnableAddressValidation;
                AddressServiceUrl.Text          = provider.AddressServiceUrl;
                UseOnlineRates.Checked          = provider.UseOnlineRate;
                var item = IntlMailType.Items.FindByValue(provider.IntlMailType);
                if (item != null)
                {
                    item.Selected = true;
                }
            }
        }
예제 #15
0
        protected void Page_Init(object sender, EventArgs e)
        {
            int shipmentId = AlwaysConvert.ToInt(Request.QueryString["OrderShipmentId"]);

            _OrderShipment = OrderShipmentDataSource.Load(shipmentId);
            if (_OrderShipment == null)
            {
                Response.Redirect("../Default.aspx");
            }
            _Order                   = _OrderShipment.Order;
            Caption.Text             = string.Format(Caption.Text, _Order.OrderNumber);
            ShipmentNumber.Text      = string.Format(ShipmentNumber.Text, _Order.Shipments.IndexOf(_OrderShipment.Id) + 1, _Order.Shipments.Count);
            ShippingMethod.Text      = _OrderShipment.ShipMethodName;
            trShipMessage.Visible    = !string.IsNullOrEmpty(_OrderShipment.ShipMessage);
            ShipMessage.Text         = _OrderShipment.ShipMessage;
            ShipFrom.Text            = _OrderShipment.FormatFromAddress();
            ShipTo.Text              = _OrderShipment.FormatToAddress();
            ShipmentItems.DataSource = GetShipmentItems();
            ShipmentItems.DataBind();

            // check if ship gateway supports shipping feature
            CommerceBuilder.Shipping.ShipGateway shipGateway = _OrderShipment.ShipMethod != null ?_OrderShipment.ShipMethod.ShipGateway : null;
            IShippingProvider shipProvider = null;

            if (shipGateway != null)
            {
                shipProvider = shipGateway.GetProviderInstance();
                _IsProviderSupportShipping = shipProvider != null && shipProvider.IsShippingSupported;
            }

            ShipGateway.DataSource = ShipGatewayDataSource.LoadAll();
            ShipGateway.DataBind();
            if (ShipGateway.Items.Count > 1)
            {
                //TRY TO PRESET THE CORRECT GATEWAY
                if (_OrderShipment.ShipMethod != null)
                {
                    ListItem item = ShipGateway.Items.FindByValue(_OrderShipment.ShipMethod.ShipGatewayId.ToString());
                    if (item != null)
                    {
                        item.Selected = true;
                    }
                }
            }
            else
            {
                ShipGateway.Visible = false;
            }

            if (_IsProviderSupportShipping)
            {
                autoTrackingInputPanel.Visible = true;

                // update the provider name
                ProviderInstructionText.Text    = string.Format(ProviderInstructionText.Text, shipProvider.Name);
                ProviderInstructionText.Visible = true;
            }
            else
            {
                autoTrackingInputPanel.Visible = false;
            }

            CancelButton.NavigateUrl += "?OrderNumber=" + _OrderShipment.Order.OrderNumber.ToString();
        }