コード例 #1
0
ファイル: edit.ascx.cs プロジェクト: appliedi/MerchantTribe
        private void LoadData()
        {

            this.NameField.Text = ShippingMethod.Name;
            if (this.NameField.Text == string.Empty)
            {
                this.NameField.Text = "Flat Rate Per Order";
            }

            FlatRatePerOrderSettings Settings = new FlatRatePerOrderSettings();
            Settings.Merge(ShippingMethod.Settings);
            if (Settings.Amount < 0) Settings.Amount = 0;
            this.AmountField.Text = Settings.Amount.ToString("C");

            // 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 amount = decimal.Parse(AmountField.Text, System.Globalization.NumberStyles.Currency);
            FlatRatePerOrderSettings Settings = new FlatRatePerOrderSettings();
            Settings.Merge(ShippingMethod.Settings);
            Settings.Amount = amount;
            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);
        }