예제 #1
0
    protected void btnSetPPPro_Click(object sender, EventArgs e)
    {
        // Get the current configuration file.
        System.Configuration.Configuration config = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);
        PayPalProSettings section = (PayPalProSettings)config.GetSection("PayPalProSettings");

        try {
            if (section != null)
            {
                section.APIPassword = txtPPAPIPassword.Text.Trim();
                section.APIUserName = txtPPAPIAccount.Text.Trim();
                section.Signature   = txtPPAPISignature.Text.Trim();
                section.IsLive      = !chkUsePPSandbox.Checked;
                section.IsActive    = chkUsePPPro.Checked;
                config.Save();
                ResultMessage3.ShowSuccess("PayPal Pro Settings Saved");
            }
            else
            {
                throw new Exception("There is no PayPalProSettings section in the Web.Config");
            }
        }
        catch (Exception x) {
            ResultMessage3.ShowFail("Cannot write to the Web.Config file; in order to have the application update the configuration, you have to allow write access to the ASNET account (or NETWORK SERVICE) and make sure the file is not marked as Read Only");
        }
    }
예제 #2
0
 public static void Load()
 {
     // Get the current configuration file.
     System.Configuration.Configuration config = WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath);
     generalSettings    = (GeneralSettings)config.GetSection("GeneralSettings");
     ppProSettings      = (PayPalProSettings)config.GetSection("PayPalProSettings");
     ppStandardSettings = (PayPalStandardSettings)config.GetSection("PayPalStandardSettings");
     CreditCardSettings = (PaymentServiceSection)config.GetSection("PaymentService");
     TaxServiceSettings = (TaxServiceSection)config.GetSection("TaxService");
     shippingSettings   = (FulfillmentServiceSection)config.GetSection("FulfillmentService");
 }