示例#1
0
文件: DAO.cs 项目: UmarRajput/Campus
        public TblStudent getStudent(int givenID)
        {
            TblStudent objStudent = (TblStudent)NHSession.CreateCriteria(typeof(TblStudent))
                                    .Add(Restrictions.Eq(Constants.allModelProperties.StudentId, givenID))
                                    .UniqueResult();

            return(objStudent);
        }
示例#2
0
文件: DAO.cs 项目: UmarRajput/Campus
        public bool DeleteStudent(TblStudent student)
        {
            bool result = false;

            using (ITransaction T = NHSession.BeginTransaction())
            {
                try
                {
                    NHSession.Delete(student);
                    T.Commit();
                    result = true;
                }
                catch (Exception ex)
                {
                    T.Rollback();
                }
            }
            return(result);
        }