Example #1
0
 public void UpdateUser(MUser user)
 {
     using (var session = NHIbernateHelper.OpenSession()){
         using (var tran = session.BeginTransaction())
         {
             session.Update(user);
             tran.Commit();
         }
     }
 }
Example #2
0
 public IList <MUser> GetAllUser()
 {
     using (var session = NHIbernateHelper.OpenSession())
     {
         using (var tran = session.BeginTransaction())
         {
             IQueryOver <MUser, MUser> userlist = session.QueryOver <MUser>();
             tran.Commit();
             return(userlist.List());
         }
     }
 }
Example #3
0
 public void DelUserById(int id)
 {
     using (var session = NHIbernateHelper.OpenSession()){
         using (var tran = session.BeginTransaction())
         {
             var user = new MUser();
             user.Id = id;
             session.Delete(user);
             tran.Commit();
         }
     }
 }
Example #4
0
 public IList <MUser> GetUserByName(string name)
 {
     using (var session = NHIbernateHelper.OpenSession())
     {
         using (var tran = session.BeginTransaction())
         {
             IQueryOver <MUser, MUser> userlist = session.QueryOver <MUser>().Where(p => p.UserName == name);
             tran.Commit();
             return(userlist.List());
         }
     }
 }