/// <summary> /// Updates the given scheduled job. /// </summary> /// <param name="record">The scheduled job record to update.</param> /// <param name="transaction">The transaction to use, if applicable.</param> /// <returns>The updated record.</returns> public ScheduledJobRecord UpdateScheduledJob(ScheduledJobRecord record, IDbTransaction transaction) { const string Sql = @"UPDATE [BlueCollarScheduledJob] SET [Data] = @Data, [JobType] = @JobType WHERE [Id] = @Id;"; this.connection.Execute( Sql, record, transaction, null, null); return record; }
public ScheduledJobRecord CreateScheduledJob(ScheduledJobRecord record, IDbTransaction transaction) { const string Sql = @"INSERT INTO [BlueCollarScheduledJob]([ScheduleId],[Number],[JobType],[Data]) SELECT @ScheduleId, COALESCE((SELECT MAX([Number]) FROM [BlueCollarScheduledJob] WHERE [ScheduleId] = @ScheduleId), 0) + 1, @JobType, @Data; SELECT CAST(SCOPE_IDENTITY() AS bigint);"; record.Id = this.connection.Query<long>( Sql, record, transaction, true, null, null).First(); return record; }
public ScheduledJobRecord CreateScheduledJob(ScheduledJobRecord record, IDbTransaction transaction) { const string Sql = @"INSERT INTO [BlueCollarScheduledJob]([ScheduleId],[Number],[JobType],[Data]) SELECT @ScheduleId, coalesce((SELECT MAX([Number]) FROM [BlueCollarScheduledJob] WHERE [ScheduleId] = @ScheduleId), 0) + 1, @JobType, @Data; SELECT last_insert_rowid();"; record.Id = this.connection.Query<long>( Sql, record, transaction, true, null, null).First(); return record; }