BlueCollar.SQLiteRepository.GetWorkingForWorker C# (CSharp) Method

GetWorkingForWorker() public method

Gets a collection of working records that belong to the given worker ID.
public GetWorkingForWorker ( long workerId, long excludingId, IDbTransaction transaction ) : IEnumerable
workerId long The ID of the worker to get working records for.
excludingId long The ID of the working record to exclude, if applicable.
transaction IDbTransaction The transaction to use, if applicable.
return IEnumerable
        public IEnumerable<WorkingRecord> GetWorkingForWorker(long workerId, long? excludingId, IDbTransaction transaction)
        {
            StringBuilder sb = new StringBuilder(
            @"SELECT *
            FROM [BlueCollarWorking]
            WHERE
            [WorkerId] = @WorkerId");

            if (excludingId != null)
            {
                sb.Append("\n    AND [Id] != @ExcludingId");
            }

            sb.Append(";");

            return this.connection.Query<WorkingRecord>(
                sb.ToString(),
                new { WorkerId = workerId, ExcludingId = excludingId },
                transaction,
                true,
                null,
                null);
        }