Exemplo n.º 1
0
        public bool isContainsTask(int taskId)
        {
            ITransaction transaction = null;

            try
            {
                using (ISession session = NHibernateHelper.OpenSession())
                {
                    using (transaction = session.BeginTransaction())
                    {
                        var queryResult = session.CreateCriteria(typeof(TaskModel))
                                          .Add(Restrictions.Eq("Id", taskId))
                                          .List <TaskModel>();
                        return(queryResult.Count > 0);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            return(true);
        }
Exemplo n.º 2
0
        public TaskModel GetTasksByTid(int tid)
        {
            ITransaction transaction = null;

            try
            {
                using (ISession session = NHibernateHelper.OpenSession())
                {
                    using (transaction = session.BeginTransaction())
                    {
                        var queryResult = session.CreateCriteria(typeof(TaskModel))
                                          .Add(Restrictions.Eq("Tid", tid))
                                          .UniqueResult <TaskModel>();
                        return(queryResult);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            return(null);
        }