You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

38 lines
995 B

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
namespace Bwp.ABCClient2.Core
{
public class MerchantScope:IDisposable
{
volatile static object mLocker = new object();
bool enterScope = false;
public MerchantScope(string merchantID,string trustPayConnectMethod,string trustPayServerName,int trustPayServerPort,string trustPayTrxURL)
{
if (!Monitor.TryEnter(mLocker))
{
throw new Exception("另外一个商户的业务正在进行");
}
else
{
enterScope = true;
ABCClientConfig.mMerchantID = merchantID;
ABCClientConfig.mTrustPayConnectMethod = trustPayConnectMethod;
ABCClientConfig.mTrustPayServerName = trustPayServerName;
ABCClientConfig.mTrustPayTrxURL = trustPayTrxURL;
ABCClientConfig.mTrustPayServerPort = trustPayServerPort;
}
}
public void Dispose()
{
if (enterScope)
{
Monitor.Exit(mLocker);
}
}
}
}