Ejemplo 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);
        }
Ejemplo 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);
        }
Ejemplo 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);
        }