📄 siteconfiguration.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public class SiteConfiguration
{
public SiteConfiguration()
{
}
public static double SimpleTaxRate
{
get
{
string sSetting = GetSetting("SimpleTaxRate");
return Convert.ToDouble(sSetting);
}
}
public static string CurrencyCode {
get {
return GetSetting("CurrencyCode");
}
}
public static string SecureURL
{
get
{
return GetSetting("SecureURL");
}
}
public static bool UsePayPalPaymentsStandard
{
get
{
bool bOut = false;
try
{
bOut = Convert.ToBoolean(GetSetting("UsePayPalPaymentsStandard"));
}
catch
{
}
return bOut;
}
}
public static bool UseBuyNow
{
get
{
bool bOut = false;
try
{
bOut = Convert.ToBoolean(GetSetting("UseBuyNow"));
}
catch
{
}
return bOut;
}
}
public static bool ShowZeroInventoryItems {
get {
bool bOut = false;
try {
bOut = Convert.ToBoolean(GetSetting("ShowZeroInventoryItems"));
} catch {
}
return bOut;
}
}
public static bool RequireShipping
{
get
{
bool bOut = false;
try
{
bOut = Convert.ToBoolean(GetSetting("RequireShipping"));
}
catch
{
}
return bOut;
}
}
public static string SiteURL
{
get
{
return GetSetting("SiteURL");
}
}
public static string MailServer
{
get
{
return GetSetting("MailServer");
}
}
public static string RequireLogin
{
get
{
return GetSetting("RequireLogin");
}
}
#region PayPal Bits
public static string BusinessEmail {
get {
return GetSetting("BusinessEmail");
}
}
public static bool UseSandbox {
get {
bool bOut = false;
try {
bOut = Convert.ToBoolean(GetSetting("UseSandbox"));
} catch {
}
return bOut;
}
}
public static string PayPalAPIReturnURL
{
get
{
return GetSetting("PayPalAPIReturnURL");
}
}
public static string PayPalAPICancelUrl {
get {
return GetSetting("PayPalAPICancelUrl");
}
}
public static string PayPalAPIAccountName {
get {
return GetSetting("PayPalAPIAccountName");
}
}
public static string PayPalAPIAccountPassword {
get {
return GetSetting("PayPalAPIAccountPassword");
}
}
public static string PayPalAPICertificationPath {
get {
string certFile = GetSetting("PayPalAPICertificate");
string thisAppPath = System.Web.HttpContext.Current.Request.ApplicationPath;
if (thisAppPath == "/")
thisAppPath = "";
string filePath = System.Web.HttpContext.Current.Server.MapPath(thisAppPath+"/App_Data/" + certFile);
return filePath;
}
}
public static string PayPalAPICertificationPassword {
get {
return GetSetting("PayPalAPICertificationPassword");
}
}
public static string EncryptionPassword {
get {
return GetSetting("EncryptionPassword");
}
}
public static bool UseDirectPay {
get {
bool bOut = false;
try {
bOut = Convert.ToBoolean(GetSetting("UseDirectPay"));
} catch {
}
return bOut;
}
}
#endregion
static string GetSetting(string key)
{
try
{
return System.Configuration.ConfigurationSettings.AppSettings[key].ToString();
}
catch
{
throw new Exception("No " + key + " setting in the web.config.");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -