Esempio n. 1
0
        private void LoadData()
        {
            // Method Settings
            FedExServiceSettings Settings = new FedExServiceSettings();

            Settings.Merge(ShippingMethod.Settings);


            this.NameField.Text = ShippingMethod.Name;
            if (this.NameField.Text == string.Empty)
            {
                this.NameField.Text = "FedEx";
            }
            if (this.lstServiceCode.Items.FindByValue(((int)Settings.ServiceCode).ToString()) != null)
            {
                this.lstServiceCode.ClearSelection();
                this.lstServiceCode.Items.FindByValue(((int)Settings.ServiceCode).ToString()).Selected = true;
            }
            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;
            }


            //Globals
            if (this.lstPackaging.Items.FindByValue(MyPage.MTApp.CurrentStore.Settings.ShippingFedExDefaultPackaging.ToString()) != null)
            {
                this.lstPackaging.ClearSelection();
                this.lstPackaging.Items.FindByValue(MyPage.MTApp.CurrentStore.Settings.ShippingFedExDefaultPackaging.ToString()).Selected = true;
            }
            if (this.lstPackaging.Items.FindByValue(Settings.Packaging.ToString()) != null)
            {
                this.lstPackaging.ClearSelection();
                this.lstPackaging.Items.FindByValue(Settings.Packaging.ToString()).Selected = true;
            }

            this.KeyField.Text           = MyPage.MTApp.CurrentStore.Settings.ShippingFedExKey;
            this.PasswordField.Text      = MyPage.MTApp.CurrentStore.Settings.ShippingFedExPassword;
            this.AccountNumberField.Text = MyPage.MTApp.CurrentStore.Settings.ShippingFedExAccountNumber;
            this.MeterNumberField.Text   = MyPage.MTApp.CurrentStore.Settings.ShippingFedExMeterNumber;
            if (this.lstDefaultPackaging.Items.FindByValue(MyPage.MTApp.CurrentStore.Settings.ShippingFedExDefaultPackaging.ToString()) != null)
            {
                this.lstDefaultPackaging.ClearSelection();
                this.lstDefaultPackaging.Items.FindByValue(MyPage.MTApp.CurrentStore.Settings.ShippingFedExDefaultPackaging.ToString()).Selected = true;
            }
            this.chkListRates.Checked = MyPage.MTApp.CurrentStore.Settings.ShippingFedExUseListRates;
            if (this.lstDropOffType.Items.FindByValue(MyPage.MTApp.CurrentStore.Settings.ShippingFedExDropOffType.ToString()) != null)
            {
                this.lstDropOffType.ClearSelection();
                this.lstDropOffType.Items.FindByValue(MyPage.MTApp.CurrentStore.Settings.ShippingFedExDropOffType.ToString()).Selected = true;
            }
            this.chkResidential.Checked = MyPage.MTApp.CurrentStore.Settings.ShippingFedExForceResidentialRates;

            this.chkDiagnostics.Checked = MyPage.MTApp.CurrentStore.Settings.ShippingFedExDiagnostics;

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

            if (this.lstHighlights.Items.FindByText(highlight) != null)
            {
                this.lstHighlights.ClearSelection();
                this.lstHighlights.Items.FindByText(highlight).Selected = true;
            }
        }
Esempio n. 2
0
        private void LoadData()
        {
            // Method Settings
            var Settings = new FedExServiceSettings();

            Settings.Merge(ShippingMethod.Settings);

            NameField.Text = string.IsNullOrEmpty(ShippingMethod.Name) ? "FedEx" : ShippingMethod.Name;

            if (lstServiceCode.Items.FindByValue(Settings.ServiceCode.ToString()) != null)
            {
                lstServiceCode.ClearSelection();
                lstServiceCode.Items.FindByValue(Settings.ServiceCode.ToString()).Selected = true;
            }

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

            // set the negotiated rates to true, or the setting in the local settings
            chkNegotiatedRates.Checked = !Settings.ContainsKey("UseNegotiatedRates") ||
                                         bool.Parse(Settings["UseNegotiatedRates"]);

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

            // Globals
            if (lstPackaging.Items.FindByValue(HccApp.CurrentStore.Settings.ShippingFedExDefaultPackaging.ToString()) !=
                null)
            {
                lstPackaging.ClearSelection();
                lstPackaging.Items.FindByValue(HccApp.CurrentStore.Settings.ShippingFedExDefaultPackaging.ToString())
                .Selected = true;
            }

            if (lstPackaging.Items.FindByValue(Settings.Packaging.ToString()) != null)
            {
                lstPackaging.ClearSelection();
                lstPackaging.Items.FindByValue(Settings.Packaging.ToString()).Selected = true;
            }

            KeyField.Text           = HccApp.CurrentStore.Settings.ShippingFedExKey;
            PasswordField.Text      = HccApp.CurrentStore.Settings.ShippingFedExPassword;
            AccountNumberField.Text = HccApp.CurrentStore.Settings.ShippingFedExAccountNumber;
            MeterNumberField.Text   = HccApp.CurrentStore.Settings.ShippingFedExMeterNumber;

            if (
                lstDefaultPackaging.Items.FindByValue(
                    HccApp.CurrentStore.Settings.ShippingFedExDefaultPackaging.ToString()) != null)
            {
                lstDefaultPackaging.ClearSelection();
                lstDefaultPackaging.Items.FindByValue(
                    HccApp.CurrentStore.Settings.ShippingFedExDefaultPackaging.ToString()).Selected = true;
            }

            if (lstDropOffType.Items.FindByValue(HccApp.CurrentStore.Settings.ShippingFedExDropOffType.ToString()) !=
                null)
            {
                lstDropOffType.ClearSelection();
                lstDropOffType.Items.FindByValue(HccApp.CurrentStore.Settings.ShippingFedExDropOffType.ToString())
                .Selected = true;
            }

            chkResidential.Checked = HccApp.CurrentStore.Settings.ShippingFedExForceResidentialRates;

            chkDiagnostics.Checked = HccApp.CurrentStore.Settings.ShippingFedExDiagnostics;

            chkDevelopmentUrl.Checked = HccApp.CurrentStore.Settings.ShippingFedExUseDevelopmentServiceUrl;

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

            if (lstHighlights.Items.FindByText(highlight) != null)
            {
                lstHighlights.ClearSelection();
                lstHighlights.Items.FindByText(highlight).Selected = true;
            }
        }