示例#1
0
        /// <summary>
        /// Adds the rate per weight formula shipping method.
        /// </summary>
        //[TestMethod]
        //[Priority(17)]
        public void AddSM_RatePerWeightFormula()
        {
            #region Arrange
            var smethod0     = new ShippingMethod();
            var setting      = _irepo.GetAddSMInfo_RatePerWeightFormula(ref smethod0);
            var spproviderid = GetShippingProviderId(smethod0.ShippingProviderId);

            var smethod1 = new ShippingMethod
            {
                Name               = smethod0.Name,
                StoreId            = _application.CurrentStore.Id,
                ZoneId             = smethod0.ZoneId,
                AdjustmentType     = ShippingMethodAdjustmentType.Amount,
                Adjustment         = 0,
                ShippingProviderId = spproviderid,
            };

            var settings = new RatePerWeightFormulaSettings();
            settings.Merge(smethod1.Settings);

            settings.BaseAmount             = setting.BaseAmount;
            settings.BaseWeight             = setting.BaseWeight;
            settings.AdditionalWeightCharge = setting.AdditionalWeightCharge;
            settings.MaxWeight = setting.MaxWeight;
            settings.MinWeight = setting.MinWeight;

            smethod1.Settings.Merge(settings);
            #endregion

            //Act/Assert
            Assert.IsTrue(_application.OrderServices.ShippingMethods.Create(smethod1));
        }
示例#2
0
        private void SaveData()
        {
            decimal baseAmount             = decimal.Parse(BaseAmountField.Text, System.Globalization.NumberStyles.Currency);
            decimal additionalWeightCharge = decimal.Parse(AdditionalWeightChargeField.Text, System.Globalization.NumberStyles.Currency);
            decimal baseWeight             = decimal.Parse(BaseWeightField.Text);
            decimal minWeight = decimal.Parse(MinWeightField.Text);
            decimal maxWeight = decimal.Parse(MaxWeightField.Text);

            RatePerWeightFormulaSettings Settings = new RatePerWeightFormulaSettings();

            Settings.Merge(ShippingMethod.Settings);

            Settings.BaseAmount             = baseAmount;
            Settings.AdditionalWeightCharge = additionalWeightCharge;
            Settings.BaseWeight             = baseWeight;
            Settings.MinWeight    = minWeight;
            Settings.MaxWeight    = maxWeight;
            Settings["highlight"] = this.lstHighlights.SelectedValue;

            ShippingMethod.Settings.Merge(Settings);

            ShippingMethod.Name           = this.NameField.Text.Trim();
            ShippingMethod.AdjustmentType = ShippingMethodAdjustmentType.Amount;
            ShippingMethod.Adjustment     = 0;
            ShippingMethod.ZoneId         = long.Parse(this.lstZones.SelectedItem.Value);
        }
        private void SaveData()
        {
            var baseAmount             = decimal.Parse(BaseAmountField.Text, NumberStyles.Currency);
            var additionalWeightCharge = decimal.Parse(AdditionalWeightChargeField.Text, NumberStyles.Currency);
            var baseWeight             = decimal.Parse(BaseWeightField.Text);
            var minWeight = decimal.Parse(MinWeightField.Text);
            var maxWeight = decimal.Parse(MaxWeightField.Text);

            var Settings = new RatePerWeightFormulaSettings();

            Settings.Merge(ShippingMethod.Settings);

            Settings.BaseAmount             = Money.RoundCurrency(baseAmount);
            Settings.AdditionalWeightCharge = additionalWeightCharge;
            Settings.BaseWeight             = baseWeight;
            Settings.MinWeight    = minWeight;
            Settings.MaxWeight    = maxWeight;
            Settings["highlight"] = lstHighlights.SelectedValue;

            ShippingMethod.Settings.Merge(Settings);

            ShippingMethod.Name           = NameField.Text.Trim();
            ShippingMethod.AdjustmentType = ShippingMethodAdjustmentType.Amount;
            ShippingMethod.Adjustment     = 0;
            ShippingMethod.ZoneId         = long.Parse(lstZones.SelectedItem.Value);
        }
示例#4
0
        private void LoadData()
        {
            this.NameField.Text = ShippingMethod.Name;
            if (this.NameField.Text == string.Empty)
            {
                this.NameField.Text = "Rate Per Weight Formula";
            }

            RatePerWeightFormulaSettings Settings = new RatePerWeightFormulaSettings();

            Settings.Merge(ShippingMethod.Settings);
            if (Settings.BaseAmount < 0)
            {
                Settings.BaseAmount = 0;
            }
            if (Settings.BaseWeight < 0)
            {
                Settings.BaseWeight = 0;
            }
            if (Settings.MinWeight < 0)
            {
                Settings.MinWeight = 0;
            }
            if (Settings.MaxWeight < 0)
            {
                Settings.MaxWeight = 9999;
            }
            if (Settings.AdditionalWeightCharge < 0)
            {
                Settings.AdditionalWeightCharge = 0;
            }


            this.BaseAmountField.Text             = Settings.BaseAmount.ToString("C");
            this.AdditionalWeightChargeField.Text = Settings.AdditionalWeightCharge.ToString("C");
            this.BaseWeightField.Text             = Settings.BaseWeight.ToString();
            this.MinWeightField.Text = Settings.MinWeight.ToString();
            this.MaxWeightField.Text = Settings.MaxWeight.ToString();



            // ZONES
            if (this.lstZones.Items.FindByValue(ShippingMethod.ZoneId.ToString()) != null)
            {
                this.lstZones.ClearSelection();
                this.lstZones.Items.FindByValue(ShippingMethod.ZoneId.ToString()).Selected = true;
            }

            // Select Hightlights
            string highlight = Settings.GetSettingOrEmpty("highlight");

            if (this.lstHighlights.Items.FindByText(highlight) != null)
            {
                this.lstHighlights.ClearSelection();
                this.lstHighlights.Items.FindByText(highlight).Selected = true;
            }
        }
示例#5
0
        /// <summary>
        /// Edits the rate per weight formula shipping method.
        /// </summary>
        //[TestMethod]
        //[Priority(18)]
        public void EditSM_RatePerWeightFormula()
        {
            #region Arrange
            var smethod0 = new ShippingMethod();
            var setting  = _irepo.GetEditSMInfo_RatePerWeightFormula(ref smethod0);

            var smethod1 = _application.OrderServices.ShippingMethods.FindAll(_application.CurrentStore.Id)
                           .FirstOrDefault(x => x.ShippingProviderId.Equals(GetShippingProviderId(smethod0.ShippingProviderId)));

            smethod1.Name   = smethod0.Name;
            smethod1.ZoneId = smethod0.ZoneId;
            var settings = new RatePerWeightFormulaSettings();
            settings.Merge(smethod1.Settings);
            settings.BaseAmount             = setting.BaseAmount;
            settings.BaseWeight             = setting.BaseWeight;
            settings.AdditionalWeightCharge = setting.AdditionalWeightCharge;
            settings.MaxWeight = setting.MaxWeight;
            settings.MinWeight = setting.MinWeight;
            smethod1.Settings.Merge(settings);
            #endregion

            //Act/Assert
            Assert.IsTrue(_application.OrderServices.ShippingMethods.Update(smethod1));
        }