Exemplo n.º 1
0
        public void RejectAccountFriend()
        {
            ManagedAccount a = new ManagedAccount(Session);
            ManagedAccount b = new ManagedAccount(Session);

            try
            {
                a.Create("Test User 1", "testpassword", "*****@*****.**", DateTime.UtcNow, AdminSecurityContext);
                a.VerifyAllEmails();

                b.Create("Test User 2", "testpassword", "*****@*****.**", DateTime.UtcNow, AdminSecurityContext);
                b.VerifyAllEmails();

                ManagedAccountFriendRequest r = new ManagedAccountFriendRequest(Session, a.CreateAccountFriendRequest(
                                                                                    AdminSecurityContext,
                                                                                    b.Id,
                                                                                    "Please be my friend!"));

                r.Reject(AdminSecurityContext, "no thanks!");
            }
            finally
            {
                a.Delete(a.GetSecurityContext());
                b.Delete(b.GetSecurityContext());
            }
        }
Exemplo n.º 2
0
        public void AcceptAccountFriend()
        {
            ManagedAccount a = new ManagedAccount(Session);
            ManagedAccount b = new ManagedAccount(Session);

            try
            {
                a.Create("Test User 1", "testpassword", "*****@*****.**", DateTime.UtcNow, AdminSecurityContext);
                a.VerifyAllEmails();

                b.Create("Test User 2", "testpassword", "*****@*****.**", DateTime.UtcNow, AdminSecurityContext);
                b.VerifyAllEmails();

                ManagedAccountFriendRequest r = new ManagedAccountFriendRequest(Session, a.CreateAccountFriendRequest(
                    AdminSecurityContext,
                    b.Id,
                    "Please be my friend!"));

                r.Accept(AdminSecurityContext, "thanks!");
            }
            finally
            {
                a.Delete(a.GetSecurityContext());
                b.Delete(b.GetSecurityContext());
            }
        }
Exemplo n.º 3
0
        public void RejectAccountFriendRequest(string ticket, int id, string message)
        {
            using (SnCore.Data.Hibernate.Session.OpenConnection())
            {
                ISession session           = SnCore.Data.Hibernate.Session.Current;
                ManagedSecurityContext sec = new ManagedSecurityContext(session, ticket);

                try
                {
                    ManagedAccountFriendRequest req = new ManagedAccountFriendRequest(session, id);
                    req.Reject(sec, message);
                    SnCore.Data.Hibernate.Session.Flush();
                }
                catch (NHibernate.ObjectNotFoundException)
                {
                    throw new Exception("This friend request cannot be found. You may have already rejected it.");
                }
            }
        }
Exemplo n.º 4
0
        public void RejectAccountFriendRequest(string ticket, int id, string message)
        {
            using (SnCore.Data.Hibernate.Session.OpenConnection())
            {
                ISession session = SnCore.Data.Hibernate.Session.Current;
                ManagedSecurityContext sec = new ManagedSecurityContext(session, ticket);

                try
                {
                    ManagedAccountFriendRequest req = new ManagedAccountFriendRequest(session, id);
                    req.Reject(sec, message);
                    SnCore.Data.Hibernate.Session.Flush();
                }
                catch (NHibernate.ObjectNotFoundException)
                {
                    throw new Exception("This friend request cannot be found. You may have already rejected it.");
                }
            }
        }