예제 #1
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;
            }
        }
예제 #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);
        }
예제 #3
0
 public RatePerWeightFormula()
 {
     Settings = new RatePerWeightFormulaSettings();
 }
 public RatePerWeightFormula()
 {
     Settings = new RatePerWeightFormulaSettings();
 }