Exemplo n.º 1
0
        private void SaveData()
        {
            ShippingMethod.Name           = this.NameField.Text.Trim();
            ShippingMethod.ZoneId         = long.Parse(this.lstZones.SelectedItem.Value);
            ShippingMethod.AdjustmentType = (ShippingMethodAdjustmentType)int.Parse(AdjustmentDropDownList.SelectedValue);
            ShippingMethod.Adjustment     = decimal.Parse(AdjustmentTextBox.Text, System.Globalization.NumberStyles.Currency);

            // Method Settings
            FedExServiceSettings Settings = new FedExServiceSettings();

            Settings.Merge(ShippingMethod.Settings);
            Settings.ServiceCode = int.Parse(this.lstServiceCode.SelectedValue);
            Settings.Packaging   = int.Parse(this.lstPackaging.SelectedValue);
            ShippingMethod.Settings.Merge(Settings);

            // Globals
            MyPage.MTApp.CurrentStore.Settings.ShippingFedExAccountNumber         = this.AccountNumberField.Text.Trim();
            MyPage.MTApp.CurrentStore.Settings.ShippingFedExMeterNumber           = this.MeterNumberField.Text.Trim();
            MyPage.MTApp.CurrentStore.Settings.ShippingFedExDefaultPackaging      = int.Parse(this.lstDefaultPackaging.SelectedValue);
            MyPage.MTApp.CurrentStore.Settings.ShippingFedExDropOffType           = int.Parse(this.lstDropOffType.SelectedValue);
            MyPage.MTApp.CurrentStore.Settings.ShippingFedExForceResidentialRates = this.chkResidential.Checked;
            MyPage.MTApp.CurrentStore.Settings.ShippingFedExUseListRates          = this.chkListRates.Checked;
            MyPage.MTApp.CurrentStore.Settings.ShippingFedExDiagnostics           = this.chkDiagnostics.Checked;
        }
Exemplo n.º 2
0
        private void SaveData()
        {
            ShippingMethod.Name           = NameField.Text.Trim();
            ShippingMethod.ZoneId         = long.Parse(lstZones.SelectedValue);
            ShippingMethod.AdjustmentType =
                (ShippingMethodAdjustmentType)int.Parse(AdjustmentDropDownList.SelectedValue);
            ShippingMethod.Adjustment = decimal.Parse(AdjustmentTextBox.Text, NumberStyles.Currency);

            if (ShippingMethod.AdjustmentType == ShippingMethodAdjustmentType.Amount)
            {
                ShippingMethod.Adjustment = Money.RoundCurrency(ShippingMethod.Adjustment);
            }

            // Method Settings
            var Settings = new FedExServiceSettings();

            Settings.Merge(ShippingMethod.Settings);
            Settings.ServiceCode           = int.Parse(lstServiceCode.SelectedValue);
            Settings.Packaging             = int.Parse(lstPackaging.SelectedValue);
            Settings["highlight"]          = lstHighlights.SelectedValue;
            Settings["UseNegotiatedRates"] = chkNegotiatedRates.Checked.ToString();
            ShippingMethod.Settings.Merge(Settings);

            // Globals
            HccApp.CurrentStore.Settings.ShippingFedExKey                      = KeyField.Text.Trim();
            HccApp.CurrentStore.Settings.ShippingFedExPassword                 = PasswordField.Text.Trim();
            HccApp.CurrentStore.Settings.ShippingFedExAccountNumber            = AccountNumberField.Text.Trim();
            HccApp.CurrentStore.Settings.ShippingFedExMeterNumber              = MeterNumberField.Text.Trim();
            HccApp.CurrentStore.Settings.ShippingFedExDefaultPackaging         = int.Parse(lstDefaultPackaging.SelectedValue);
            HccApp.CurrentStore.Settings.ShippingFedExDropOffType              = int.Parse(lstDropOffType.SelectedValue);
            HccApp.CurrentStore.Settings.ShippingFedExForceResidentialRates    = chkResidential.Checked;
            HccApp.CurrentStore.Settings.ShippingFedExDiagnostics              = chkDiagnostics.Checked;
            HccApp.CurrentStore.Settings.ShippingFedExUseDevelopmentServiceUrl = chkDevelopmentUrl.Checked;

            HccApp.UpdateCurrentStore();
        }
Exemplo n.º 3
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;
            }
        }
Exemplo n.º 4
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;
            }
        }