Exemple #1
0
        private void LoadData()
        {
            NameField.Text = ShippingMethod.Name;

            if (NameField.Text == string.Empty)
            {
                NameField.Text = Localization.GetString("USPostalServiceInternational");
            }

            // Adjustment
            AdjustmentDropDownList.SelectedValue = ((int)ShippingMethod.AdjustmentType).ToString();

            if (ShippingMethod.AdjustmentType == ShippingMethodAdjustmentType.Amount)
            {
                AdjustmentTextBox.Text = string.Format("{0:c}", ShippingMethod.Adjustment);
            }
            else
            {
                AdjustmentTextBox.Text = string.Format("{0:f}", ShippingMethod.Adjustment);
            }

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

            // Global
            txtUserId.Text         = HccApp.CurrentStore.Settings.ShippingUSPostalUserId;
            chbDiagnostics.Checked = HccApp.CurrentStore.Settings.ShippingUSPostalDiagnostics;

            var settings = new USPostalServiceSettings();

            settings.Merge(ShippingMethod.Settings);

            foreach (ServiceCode code in settings.ServiceCodeFilter)
            {
                foreach (ListItem item in ShippingTypesCheckBoxList.Items)
                {
                    if (string.Compare(item.Value, code.Code, true) == 0)
                    {
                        item.Selected = true;
                        break;
                    }
                }
            }

            // Select Hightlights
            var highlight = settings.GetSettingOrEmpty("highlight");

            if (lstHighlights.Items.FindByText(highlight) != null)
            {
                lstHighlights.ClearSelection();
                lstHighlights.Items.FindByText(highlight).Selected = true;
            }
        }
Exemple #2
0
        private void LoadData()
        {
            this.NameField.Text = ShippingMethod.Name;
            if (this.NameField.Text == string.Empty)
            {
                this.NameField.Text = "US Postal Service";
            }

            // Adjustment
            AdjustmentDropDownList.SelectedValue = ((int)ShippingMethod.AdjustmentType).ToString();
            if (ShippingMethod.AdjustmentType == ShippingMethodAdjustmentType.Amount)
            {
                AdjustmentTextBox.Text = string.Format("{0:c}", ShippingMethod.Adjustment);
            }
            else
            {
                AdjustmentTextBox.Text = string.Format("{0:f}", ShippingMethod.Adjustment);
            }


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

            // Global
            this.Diagnostics.Checked = MyPage.MTApp.CurrentStore.Settings.ShippingUSPostalDiagnostics;

            USPostalServiceSettings settings = new USPostalServiceSettings();

            settings.Merge(ShippingMethod.Settings);

            foreach (MerchantTribe.Shipping.ServiceCode code in settings.ServiceCodeFilter)
            {
                foreach (ListItem item in ShippingTypesCheckBoxList.Items)
                {
                    if (string.Compare(item.Value, code.Code, true) == 0)
                    {
                        item.Selected = true;
                        break;
                    }
                }
            }

            string matchPackage = ((int)settings.PackageType).ToString();

            if (lstPackageType.Items.FindByValue(matchPackage) != null)
            {
                lstPackageType.ClearSelection();
                lstPackageType.Items.FindByValue(matchPackage).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;
            }
        }