Created
February 21, 2013 22:44
-
-
Save skinny/5009097 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public IEnumerable<GeneralLedger> GetUnprocessedEntriesForOrganizationUnit(OrganizationUnit ou) | |
{ | |
using (var conn = _dapper.OpenConnection()) | |
{ | |
var query = string.Format(@" | |
SELECT GL.*, A.*, BOU.* | |
FROM GeneralLedger GL | |
INNER JOIN Accounts A ON (A.ID = GL.AccountID) | |
LEFT JOIN OrganizationUnits BOU ON (BOU.ID = A.BookOnOrganizationUnitID) | |
WHERE GL.OrganizationUnitID = @orgID | |
AND GL.IsProcessed = 0 | |
", (int)FinancialPeriodStatus.Closed); | |
var results = conn.QueryMultiple(query, new { @orgID = ou.ID }); | |
var records = results.Read<GeneralLedger, Account, OrganizationUnit, GeneralLedger>((gl, a, o) => | |
{ | |
a.BookOnOrganizationUnit = o; | |
gl.Account = a; | |
return gl; | |
}).ToList(); | |
return records; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment