예제 #1
0
        public int updateStatus(int id, Status status)
        {
            var con     = ORMConnectionFactory.getConnection();
            var updated = con.GetTable <Bug>().Where(x => x.id == id).Set(x => x.status, status).Update();

            return(updated);
        }
예제 #2
0
        public IEnumerable <Bug> getBugsByOwner(string currentUser)
        {
            var con   = ORMConnectionFactory.getConnection();
            var elems = con.GetTable <Bug>().Where(x => x.foundBy == currentUser);

            return(elems);
        }
예제 #3
0
        public IEnumerable <Bug> findAvailableBugs()
        {
            var con   = ORMConnectionFactory.getConnection();
            var elems = con.GetTable <Bug>().Where(x => x.status == Status.Unresolved || x.status == Status.WorkingOn);

            return(elems);
        }
예제 #4
0
        public int Delete(int entity)
        {
            var con     = ORMConnectionFactory.getConnection();
            var deleted = con.GetTable <Bug>().Where(x => x.id == entity).Delete();

            return(deleted);
        }
예제 #5
0
        public IEnumerable <Bug> FindAll()
        {
            var con   = ORMConnectionFactory.getConnection();
            var elems = con.GetTable <Bug>();

            return(elems);
        }
예제 #6
0
        public List <User> findAllByPosition(string programmer)
        {
            var con   = ORMConnectionFactory.getConnection();
            var elems = con.GetTable <User>().Where(x => x.position == programmer);

            con.Close();
            return(elems.ToList());
        }
예제 #7
0
        public Bug Update(Bug entity, Bug newEntity)
        {
            var con     = ORMConnectionFactory.getConnection();
            var updated = con.Update(newEntity);

            if (updated != 0)
            {
                return(newEntity);
            }
            return(null);
        }
예제 #8
0
        public Bug Delete(Bug entity)
        {
            var con     = ORMConnectionFactory.getConnection();
            var deleted = con.Delete(entity);

            if (deleted != 0)
            {
                return(entity);
            }
            return(null);
        }
예제 #9
0
        public Bug Save(Bug entity)
        {
            var con      = ORMConnectionFactory.getConnection();
            var inserted = con.Insert(entity);

            if (inserted != 0)
            {
                return(entity);
            }
            return(null);
        }
예제 #10
0
        public User findOne(string username, string password)
        {
            var con   = ORMConnectionFactory.getConnection();
            var elems = con.GetTable <User>().Where(x => x.username == username && x.password == password);

            if (elems.Count() > 0)
            {
                con.Close();
                return(elems.First());
            }
            con.Close();
            return(null);
        }