public UserRecord Create(string name)
        {
            var sql = @"insert into users (name) values (@name)";

            return(_template.Create(sql, id => new UserRecord(id, name),
                                    new KeyValuePair <string, object>("@name", name)));
        }
Exemple #2
0
        public AccountRecord Create(long ownerId, string name)
        {
            var sql = "insert into accounts (owner_id, name) values (@ownerId, @name)";

            return(_template.Create(sql, id => new AccountRecord(id, ownerId, name),
                                    new KeyValuePair <string, object>("@ownerId", ownerId),
                                    new KeyValuePair <string, object>("@name", name)));
        }
        public ProjectRecord Create(long accountId, string name)
        {
            var sql = @"
insert into projects (account_id, name, active) values (@accountId, @name, true)";

            return(_template.Create(sql, id => new ProjectRecord(id, accountId, name, true),
                                    new KeyValuePair <string, object>("@accountId", accountId),
                                    new KeyValuePair <string, object>("@name", name)
                                    ));
        }
        public StoryRecord Create(long projectId, string name)
        {
            var sql = @"
insert into stories (project_id, name) values (@projectId, @name)";

            return(_template.Create(sql, id => new StoryRecord(id, projectId, name),
                                    new KeyValuePair <string, object>("@projectId", projectId),
                                    new KeyValuePair <string, object>("@name", name)
                                    ));
        }
Exemple #5
0
        public AllocationRecord Create(long projectId, long userId, DateTime firstDay, DateTime lastDay)
        {
            var sql = @"
insert into allocations (project_id, user_id, first_day, last_day) values (@projectId, @userId, @firstDay, @lastDay)";

            return(_template.Create(sql, id => new AllocationRecord(id, projectId, userId, firstDay, lastDay),
                                    new KeyValuePair <string, object>("@projectId", projectId),
                                    new KeyValuePair <string, object>("@userId", userId),
                                    new KeyValuePair <string, object>("@firstDay", firstDay),
                                    new KeyValuePair <string, object>("@lastDay", lastDay)
                                    ));
        }
        public TimeEntryRecord Create(long projectId, long userId, DateTime date, int hours)
        {
            var sql = @"
insert into time_entries (project_id, user_id, date, hours) values (@projectId, @userId, @date, @hours)";

            return(_template.Create(sql, id => new TimeEntryRecord(id, projectId, userId, date, hours),
                                    new KeyValuePair <string, object>("@projectId", projectId),
                                    new KeyValuePair <string, object>("@userId", userId),
                                    new KeyValuePair <string, object>("@date", date),
                                    new KeyValuePair <string, object>("@hours", hours)
                                    ));
        }