Пример #1
0
        private bool Create()
        {
            int newID = 0;

            // role name never changes after creation
            // only display name is allowed to change
            // otherwise permissions to view pages
            // and edit modules would be orphaned when
            // a role was re-named

            if (UseRelatedSiteMode)
            {
                SiteId = RelatedSiteID;
            }

            if (Exists(this.SiteId, this.RoleName))
            {
                //string errorMessage = ConfigurationManager.AppSettings["RoleExistsError"];
                //throw new Exception(errorMessage);
                // do nothing instead of  throwing an exception
            }
            else
            {
                this.RoleGuid = Guid.NewGuid();


                newID = DBRoles.RoleCreate(
                    RoleGuid,
                    SiteGuid,
                    SiteId,
                    RoleName,
                    DisplayName);
            }

            if (newID > 0)
            {
                RoleId = newID;
                //this.roleName = this.displayName;
                return(true);
            }
            else
            {
                return(false);
            }
        }