System.Web.HttpContext httpContext = System.Web.HttpContext.Current;
Hashtable departmentSalary = (Hashtable)httpContext.Application["DepartmentSalary"];
try
{
if (departmentSalary != null && departmentSalary.ContainsValue(KEYID))
{
throw ServiceException.NewException(MethodBase.GetCurrentMethod().Name + ":该XXXX已有人操作");
}
departmentSalary = new Hashtable();
departmentSalary[httpContext.Session.SessionID] = KEYID; //初始化当前用户的 sessionid
httpContext.Application.Lock();
httpContext.Application["DepartmentSalary"] = departmentSalary;
httpContext.Application.UnLock();
调用wcf接口
}
catch (Exception)
{

throw;
}
finally
{
departmentSalary.Remove(httpContext.Session.SessionID);
httpContext.Application.Lock();
httpContext.Application["DepartmentSalary"] = departmentSalary;
httpContext.Application.UnLock();
}

04-14 07:30