示例#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);
        }