/// <summary>
        /// 分配角色给组
        /// </summary>
        public static void GrantRoleToGroup(ICollection ids, string groupID)
        {
            ICollection <SysRole> tents = GetRoleByIDs(ids);

            using (new SessionScope())
            {
                SysGroup group = SysGroup.Find(groupID);

                using (TransactionScope trans = new TransactionScope())
                {
                    try
                    {
                        foreach (SysRole ent in tents)
                        {
                            group.Role.Add(ent);
                        }

                        trans.VoteCommit();
                    }
                    catch (Exception ex)
                    {
                        trans.VoteRollBack();

                        throw ex;
                    }
                }
            }
        }
        /// <summary>
        /// 从组回收权限
        /// </summary>
        public static void RevokeAuthFromGroup(ICollection authIDs, string groupID)
        {
            IList authList = GetAuthList(authIDs);

            using (new SessionScope())
            {
                SysGroup group = SysGroup.Find(groupID);

                using (TransactionScope trans = new TransactionScope())
                {
                    try
                    {
                        IEnumerable <SysAuth> tAuths = group.Auth.Where(ent => authList.Contains(ent.AuthID));
                        while (tAuths.Count() > 0)
                        {
                            group.Auth.Remove(tAuths.First());
                        }

                        trans.VoteCommit();
                    }
                    catch (Exception ex)
                    {
                        trans.VoteRollBack();

                        throw ex;
                    }
                }
            }
        }
        /// <summary>
        /// 从组回收角色
        /// </summary>
        public static void RevokeRoleFromGroup(ICollection ids, string groupID)
        {
            IList list = GetRolList(ids);

            using (new SessionScope())
            {
                SysGroup group = SysGroup.Find(groupID);

                using (TransactionScope trans = new TransactionScope())
                {
                    try
                    {
                        IEnumerable <SysRole> tents = group.Role.Where(ent => list.Contains(ent.RoleID));
                        while (tents.Count() > 0)
                        {
                            group.Role.Remove(tents.First());
                        }

                        trans.VoteCommit();
                    }
                    catch (Exception ex)
                    {
                        trans.VoteRollBack();

                        throw ex;
                    }
                }
            }
        }
        /// <summary>
        /// 授权给组
        /// </summary>
        public static void GrantAuthToGroup(ICollection authIDs, string groupID)
        {
            ICollection <SysAuth> tAuths = GetAuthByIDs(authIDs);

            using (new SessionScope())
            {
                SysGroup group = SysGroup.Find(groupID);

                using (TransactionScope trans = new TransactionScope())
                {
                    try
                    {
                        foreach (SysAuth auth in tAuths)
                        {
                            group.Auth.Add(auth);
                        }

                        trans.VoteCommit();
                    }
                    catch (Exception ex)
                    {
                        trans.VoteRollBack();

                        throw ex;
                    }
                }
            }
        }