Beispiel #1
0
        //public static Collection<Role> GetbySite(int siteId)
        //{
        //    bool enforceRelatedSitesMode = false;
        //    return GetbySite(siteId, enforceRelatedSitesMode);
        //}

        public static Collection <Role> GetbySite(int siteId)
        {
            if (UseRelatedSiteMode)
            {
                siteId = RelatedSiteID;
            }

            Collection <Role> roles = new Collection <Role>();

            using (IDataReader reader = DBRoles.GetSiteRoles(siteId))
            {
                while (reader.Read())
                {
                    Role role = new Role();
                    role.roleID      = Convert.ToInt32(reader["RoleID"]);
                    role.siteID      = Convert.ToInt32(reader["SiteID"]);
                    role.displayName = reader["DisplayName"].ToString();
                    role.roleName    = reader["RoleName"].ToString();
                    role.roleGuid    = new Guid(reader["RoleGuid"].ToString());
                    role.siteGuid    = new Guid(reader["SiteGuid"].ToString());
                    role.memberCount = Convert.ToInt32(reader["MemberCount"]);

                    roles.Add(role);
                }
            }

            return(roles);
        }
Beispiel #2
0
        public static Role GetRoleByName(int siteId, string roleName)
        {
            if (UseRelatedSiteMode)
            {
                siteId = RelatedSiteID;
            }
            Role role = null;

            using (IDataReader reader = DBRoles.GetSiteRoles(siteId))
            {
                while (reader.Read())
                {
                    string foundName = reader["RoleName"].ToString();
                    if (foundName == roleName)
                    {
                        role             = new Role();
                        role.roleID      = Convert.ToInt32(reader["RoleID"]);
                        role.siteID      = Convert.ToInt32(reader["SiteID"]);
                        role.displayName = reader["DisplayName"].ToString();
                        role.roleName    = reader["RoleName"].ToString();
                        role.roleGuid    = new Guid(reader["RoleGuid"].ToString());
                        role.siteGuid    = new Guid(reader["SiteGuid"].ToString());
                    }
                }
            }

            return(role);
        }
Beispiel #3
0
        public static IDataReader GetSiteRoles(int siteId)
        {
            if (UseRelatedSiteMode)
            {
                siteId = RelatedSiteID;
            }

            return(DBRoles.GetSiteRoles(siteId));
        }