Exemple #1
0
        public PostLoginTest()
        {
            PostTest Post = new PostTest();
            AddDependentObject(Post);

            LoginTest login = new LoginTest();
            AddDependentObject(login);

            mPostLogin = new PostLogin();
            mPostLogin.Post = Post.Post;
            mPostLogin.Login = login.Login;
        }
Exemple #2
0
 public TransitPostLogin(ISession session, DBlog.Data.PostLogin o)
     : base(o.Id)
 {
     Post  = new TransitPost(session, o.Post, false);
     Login = new TransitLogin(o.Login);
 }
Exemple #3
0
        public int CreateOrUpdatePostLogin(string ticket, int post_id, TransitLogin t_login)
        {
            using (DBlog.Data.Hibernate.Session.OpenConnection(GetNewConnection()))
            {
                ISession session = DBlog.Data.Hibernate.Session.Current;
                CheckAdministrator(session, ticket);

                Post post = (Post)session.Load(typeof(Post), post_id);

                Login login = t_login.GetLogin(session);
                session.SaveOrUpdate(login);

                PostLogin post_login = session.CreateCriteria(typeof(PostLogin))
                    .Add(Expression.Eq("Post.Id", post_id))
                    .Add(Expression.Eq("Login.Id", t_login.Id))
                    .UniqueResult<PostLogin>();

                if (post_login == null)
                {
                    post_login = new PostLogin();
                    post_login.Post = post;
                    post_login.Login = login;
                    session.SaveOrUpdate(post_login);
                }

                session.Flush();
                return login.Id;
            }
        }