コード例 #1
0
ファイル: NRRoleProvider.cs プロジェクト: webcem/daily-deal
        public override string[] GetRolesForUser(string username)
        {
            _UserRep = BootStrapper.GetCurrentUserRepository();
            _RoleRep = BootStrapper.GetCurrentRoleRepository();
            // throw new NotImplementedException();
            tUser user = _UserRep.GetSingleByUserName(username);

            if (user == null)
            {
                return new string[1] {
                           "NotFoundRole"
                }
            }
            ;
            //List<USER_ROLE> uroles = _UserRoleRep.GetListByUserID(user.UserID);
            string[] roles = new string[1];//new string[uroles.Count];
            int      i     = 0;
            //foreach (USER_ROLE item in uroles)
            //{
            //    ROLE role = _RoleRep.GetSingle(item.RoleID);
            //    roles[i] = role.RoleName;
            //    i++;
            //}
            tRole role = _RoleRep.Find(user.IDRole);

            roles[0] = role.Name;
            return(roles);
            // throw new NotImplementedException();
        }
コード例 #2
0
ファイル: NRRoleProvider.cs プロジェクト: anarbek/daily-deal
 public override string[] GetRolesForUser(string username)
 {
     _UserRep = BootStrapper.GetCurrentUserRepository();
     _RoleRep = BootStrapper.GetCurrentRoleRepository();
     // throw new NotImplementedException();
     tUser user = _UserRep.GetSingleByUserName(username);
     if (user == null) return new string[1]{"NotFoundRole"};
     //List<USER_ROLE> uroles = _UserRoleRep.GetListByUserID(user.UserID);
     string[] roles = new string[1];//new string[uroles.Count];
     int i = 0;
     //foreach (USER_ROLE item in uroles)
     //{
     //    ROLE role = _RoleRep.GetSingle(item.RoleID);
     //    roles[i] = role.RoleName;
     //    i++;
     //}
     tRole role = _RoleRep.Find(user.IDRole);
     roles[0] = role.Name;
     return roles;
     // throw new NotImplementedException();
 }
コード例 #3
0
        public static List <tRole> GetRoleObjectsForCurrentUser()
        {
            RoleProvider    _provider = (NRRoleProvider)Roles.Provider;
            IUSERRepository _UserRep  = BootStrapper.GetCurrentUserRepository();
            IROLERepository _RoleRep  = BootStrapper.GetCurrentRoleRepository();
            //IUSER_ROLERepository _UserRoleRep = BootStrapper.GetCurrentUserRoleRepository();
            // throw new NotImplementedException();
            tUser user = _UserRep.GetSingleByUserName(MembershipHelper.GetCurrenUser().UserName);
            //List<USER_ROLE> uroles = _UserRoleRep.GetListByUserID(user.UserID);
            List <tRole> roles = new List <tRole>();
            //int i = 0;
            //foreach (USER_ROLE item in uroles)
            //{
            //    ROLE role = _RoleRep.Find(item.RoleID);
            //    roles.Add(role);
            //}
            tRole role = _RoleRep.Find(user.IDRole);

            roles.Add(role);
            return(roles);
            // throw new NotImplementedException();
        }
コード例 #4
0
        public override MembershipUser GetUser(string username, bool userIsOnline)
        {
            MembershipUser membershipUser = null;
            _UserRep = BootStrapper.GetCurrentUserRepository();
            tUser user = _UserRep.GetSingleByUserName(username);
            if (user != null) {
                membershipUser = MakeMembershipUser(user);
                if (userIsOnline) {
                    //Update Last Activity Date;
                }
            }

            return membershipUser;
        }