示例#1
0
 public void UpdateUser(MUser user)
 {
     using (var session = NHIbernateHelper.OpenSession()){
         using (var tran = session.BeginTransaction())
         {
             session.Update(user);
             tran.Commit();
         }
     }
 }
示例#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());
         }
     }
 }
示例#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();
         }
     }
 }
示例#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());
         }
     }
 }