public async Task <ActionResult> GetStatementAsync(AccountStatementQueryModel model) { if (!this.ModelState.IsValid) { return(this.InvalidModelState(this.ModelState)); } var meta = await AppUsers.GetCurrentAsync().ConfigureAwait(false); try { model.UserId = meta.UserId; model.OfficeId = meta.OfficeId; var result = await Reconciliations.GetAccountStatementAsync(this.Tenant, model).ConfigureAwait(true); return(this.Ok(result)); } catch (Exception ex) { return(this.Failed(ex.Message, HttpStatusCode.InternalServerError)); } }
public static async Task <IEnumerable <dynamic> > GetAccountStatementAsync(string tenant, AccountStatementQueryModel model) { using (var db = DbProvider.Get(FrapidDbServer.GetConnectionString(tenant), tenant).GetDatabase()) { string sql = "SELECT * FROM finance.get_account_statement(@0::date, @1::date, @2::integer, finance.get_account_id_by_account_number(@3), @4::integer) ORDER BY id;"; if (db.DatabaseType == DatabaseType.SqlServer) { sql = "SELECT * FROM finance.get_account_statement(@0, @1, @2, finance.get_account_id_by_account_number(@3), @4) ORDER BY id;"; } return(await db.SelectAsync <dynamic>(sql, model.From, model.To, model.UserId, model.AccountNumber, model.OfficeId).ConfigureAwait(false)); } }