Esempio n. 1
0
        public TblSubject getSubject(int givenID)
        {
            TblSubject tdObj = (TblSubject)NHSession.CreateCriteria(typeof(TblSubject))
                               .Add(Restrictions.Eq(Constants.allModelProperties.SubjectId, givenID))
                               .UniqueResult();

            return(tdObj);
        }
Esempio n. 2
0
        public bool deleteSubject(TblSubject s)
        {
            bool result = false;

            using (ITransaction T = NHSession.BeginTransaction())
            {
                try
                {
                    NHSession.Delete(s);
                    T.Commit();
                    result = true;
                }
                catch (Exception ex)
                {
                    T.Rollback();
                }
            }
            return(result);
        }
Esempio n. 3
0
        public bool AddSubject(TblSubject subject)
        {
            bool result = false;

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