Changed Checkout to correctly reflect cash. Minor updates.

This commit is contained in:
unknown
2011-04-11 18:25:45 +05:30
parent 7229ebc0bb
commit 0cb7d3cf09
14 changed files with 254 additions and 195 deletions

View File

@ -11,39 +11,39 @@ namespace Tanshu.Accounts.Contracts
{
public static class Session
{
private static Dictionary<string, bool> roles;
private static User currentUser;
private static Dictionary<string, bool> _roles;
private static User _currentUser;
public static bool IsAuthenticated { get; private set; }
public static User User
{
get
{
return currentUser;
return _currentUser;
}
set
{
if (value != null)
{
currentUser = value;
_currentUser = value;
IsAuthenticated = true;
}
else
{
currentUser = null;
_currentUser = null;
IsAuthenticated = false;
roles = null;
_roles = null;
}
}
}
public static bool IsAllowed(RoleConstants role)
{
if (currentUser == null)
if (_currentUser == null)
return false;
if (roles == null)
roles = new Dictionary<string, bool>();
if (!roles.ContainsKey(role.Role))
roles.Add(role.Role, MembershipBI.IsUserInRole(currentUser.UserID, role.Role));
return roles[role.Role];
if (_roles == null)
_roles = new Dictionary<string, bool>();
if (!_roles.ContainsKey(role.Role))
_roles.Add(role.Role, MembershipBI.IsUserInRole(_currentUser.UserID, role.Role));
return _roles[role.Role];
}