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;
            }
        }