Пример #1
0
        // AddUserToCardHolderRole


        public void AddUserToCardHolderRole(String username)
        {
            IRolesDAO RoleRepository = new RolesDAO();

            if (!RoleRepository.RoleExists(CardHolderRole, _provider.ApplicationName))
            {
                throw new Exception("Missing Role - " + CardHolderRole);
            }

            IUserInRolesDAO UsersInRoles = new UserInRolesDAO();

            UsersInRoles.AddUserToRole(username, CardHolderRole, _provider.ApplicationName);
        }
        // AddUserToClerkRole

        public void AddUserToClerkRole(String username)
        {
            MembershipProvider _provider;

            _provider = Membership.Providers["GiftUserMembershipProvider"];

            IRolesDAO RoleDAO = new RolesDAO();

            if (!RoleDAO.RoleExists(ClerkRole, _provider.ApplicationName))
            {
                throw new Exception("Missing Role - " + ClerkRole);
            }

            IUserInRolesDAO UsersInRoles = new UserInRolesDAO();

            UsersInRoles.AddUserToRole(username, ClerkRole, _provider.ApplicationName);
        }