protected void NextButton_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         USPS provider = new USPS();
         provider.UserId       = UserId.Text;
         provider.UserIdActive = true;
         ShipGateway gateway = new ShipGateway();
         gateway.Name    = provider.Name;
         gateway.ClassId = Misc.GetClassId(typeof(USPS));
         gateway.UpdateConfigData(provider.GetConfigData());
         gateway.Enabled = true;
         gateway.Save();
         Response.Redirect("Configure.aspx?ShipGatewayId=" + gateway.Id);
     }
 }
        private void SaveGateWayUSPS()
        {
            USPS provider = (USPS)_ShipGateway.GetProviderInstance();

            provider.UseDebugMode            = UseDebugMode.Checked;
            provider.UseTestMode             = UseTestMode.Checked;
            provider.UserId                  = UserId.Text;
            provider.LiveModeUrl             = LiveServerURL.Text;
            provider.TestModeUrl             = TestServerURL.Text;
            provider.TrackingUrl             = TrackingURL.Text;
            provider.MaxPackageWeight        = AlwaysConvert.ToDecimal(MaxWeight.Text, (decimal)provider.MaxPackageWeight);
            provider.MinPackageWeight        = AlwaysConvert.ToDecimal(MinWeight.Text, (decimal)provider.MinPackageWeight);
            provider.EnablePackageBreakup    = EnablePackaging.Checked;
            provider.EnableAddressValidation = EnableAddressValidation.Checked;
            provider.AddressServiceUrl       = AddressServiceUrl.Text;
            provider.UseOnlineRate           = UseOnlineRates.Checked;
            provider.IntlMailType            = IntlMailType.SelectedValue;
            _ShipGateway.UpdateConfigData(provider.GetConfigData());
            _ShipGateway.Save();
        }