Пример #1
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            if(this.Page.User.Identity.IsAuthenticated)
            {
                Cuyahoga.Core.Domain.User currentUser = Context.User.Identity as Cuyahoga.Core.Domain.User;
                this._fUser	= base.ForumModule.GetForumUserByUserId(currentUser.Id);
                if(this._fUser == null)
                {
                    this._fUser = new ForumUser();
                    base.ForumModule.SaveForumUser(this._fUser);
                }
            }

            if(!this.Page.IsPostBack)
            {
                this.BindTopFooter();
                this.LocalizeControls();
                this.ddlTimeZone.DataSource = Utils.Utils.TimeZones();
                this.ddlTimeZone.DataBind();
                this.BindUser();
                // Add text

            }
        }
Пример #2
0
        public ForumUser GetForumUserByUserId(int tId)
        {
            ISession session = this._sessionManager.OpenSession();
            IList l;
            ForumUser user = new ForumUser();
            try
            {
                l = session.CreateQuery("from ForumUser f where f.UserId=:userId").SetInt32("userId", tId).List();
                if(l.Count == 0)
                {
                    return null;
                }
                else
                {
                    user = (ForumUser)l[0];
                }

            }
            catch (Exception ex)
            {
                throw new Exception("Unable to get user by id", ex);
            }

            return user;
        }
Пример #3
0
 public void SaveForumUser(ForumUser user)
 {
     ISession session = this._sessionManager.OpenSession();
     NHibernate.ITransaction tx = session.BeginTransaction();
     try
     {
         session.SaveOrUpdate(user);
         tx.Commit();
         session.Close();
     }
     catch (Exception ex)
     {
         tx.Rollback();
         throw new Exception("Unable to save Tag ", ex);
     }
 }
Пример #4
0
        public ForumUser GetForumUserByUserId(int tId)
        {
            ISession session = this._sessionManager.OpenSession();
            IList l;
            ForumUser user = new ForumUser();
            try
            {
                l = session.Find("from ForumUser f where f.UserId=?", tId, NHibernateUtil.Int32);
                if(l.Count == 0)
                {
                    return null;
                }
                else
                {
                    user = (ForumUser)l[0];
                }

            }
            catch (Exception ex)
            {
                throw new Exception("Unable to get user by id", ex);
            }

            return user;
        }