public List <ProjectRecord> FindBy(long accountId)
        {
            const string sql = @"
select id, account_id, name, active from projects where account_id = @accountId order by name asc";

            return(_template.FindBy(sql, reader => new ProjectRecord(
                                        reader.GetInt64(0),
                                        reader.GetInt64(1),
                                        reader.GetString(2),
                                        reader.GetBoolean(3)
                                        ), "@accountId", accountId));
        }
        public List <StoryRecord> FindBy(long projectId)
        {
            const string sql = @"
select id, project_id, name from stories where project_id = @projectId";

            return(_template.FindBy(sql, reader => new StoryRecord(
                                        reader.GetInt64(0),
                                        reader.GetInt64(1),
                                        reader.GetString(2)
                                        ), "@projectId", projectId));
        }
        public UserRecord FindObjectBy(long id)
        {
            var sql = @"select id, name from users where id = @id limit 1";

            var userRecords = _template.FindBy(sql, reader => new UserRecord(
                                                   reader.GetInt64(0),
                                                   reader.GetString(1)
                                                   ), "@id", id);

            return(userRecords.Count > 0 ? userRecords.First() : null);
        }
Exemple #4
0
        public List <AccountRecord> FindBy(long ownerId)
        {
            var sql = "select id, owner_id, name from accounts where owner_id = @ownerId";

            var records = _template.FindBy(sql, reader => new AccountRecord(
                                               reader.GetInt64(0),
                                               reader.GetInt64(1),
                                               reader.GetString(2)
                                               ), "@ownerId", ownerId);

            return(records);
        }
Exemple #5
0
        public AccountRecord FindBy(long ownerId)
        {
            var sql = @"
select id, owner_id, name from accounts where owner_id = @ownerId order by name desc limit 1";

            var userRecords = _template.FindBy(sql, reader => new AccountRecord(
                                                   reader.GetInt64(0),
                                                   reader.GetInt64(1),
                                                   reader.GetString(2)
                                                   ), "@ownerId", ownerId);

            return(userRecords.Count > 0 ? userRecords.First() : null);
        }
Exemple #6
0
        public List <AllocationRecord> FindBy(long projectId)
        {
            const string sql = @"
select id, project_id, user_id, first_day, last_day from allocations where project_id = @projectId order by first_day";

            return(_template.FindBy(sql, reader => new AllocationRecord(
                                        reader.GetInt64(0),
                                        reader.GetInt64(1),
                                        reader.GetInt64(2),
                                        reader.GetDateTime(3),
                                        reader.GetDateTime(4)
                                        ), "@projectId", projectId));
        }
        public List <TimeEntryRecord> FindBy(long userId)
        {
            const string sql = @"
select id, project_id, user_id, date, hours from time_entries where user_id = @userId";

            return(_template.FindBy(sql, reader => new TimeEntryRecord(
                                        reader.GetInt64(0),
                                        reader.GetInt64(1),
                                        reader.GetInt64(2),
                                        reader.GetDateTime(3),
                                        reader.GetInt32(4)
                                        ), "@userId", userId));
        }