public TOrderStatus GetOrderType(long orderStatusId) { TOrderStatus orderStatus = null; using (ISession session = _sessions.OpenSession()) using (ITransaction tx = session.BeginTransaction()) { orderStatus = session.Load <TOrderStatus>(orderStatusId); tx.Commit(); } return(orderStatus); }
public List <TOrderStatus> GetAllOrderStatus() { List <TOrderStatus> result = new List <TOrderStatus> (); using (ISession session = _sessions.OpenSession()) using (ITransaction tx = session.BeginTransaction()) { IQuery q = session.CreateQuery( "from TOrderStatus as orderStatus" ); for (int i = 0; i < q.List().Count; i++) { TOrderStatus order = (TOrderStatus)q.List()[i]; result.Add(order); } tx.Commit(); } return(result); }