public async Task <TransactionDownloadLine[]> GetAllTransactionDetailsForAccountByDate(long accountId, DateTime fromDate, DateTime toDate) { var parameters = new DynamicParameters(); parameters.Add("@AccountId", accountId, DbType.Int64); parameters.Add("@fromDate", fromDate, DbType.DateTime); parameters.Add("@toDate", toDate, DbType.DateTime); var result = await _db.Value.Database.Connection.QueryAsync <TransactionDownloadLine>( sql : "[employer_financial].[GetAllTransactionDetailsForAccountByDate]", param : parameters, transaction : _db.Value.Database.CurrentTransaction.UnderlyingTransaction, commandType : CommandType.StoredProcedure); var hmrcDateService = new HmrcDateService(); var transactionDownloadLines = result as TransactionDownloadLine[] ?? result.ToArray(); foreach (var res in transactionDownloadLines) { if (!string.IsNullOrEmpty(res.PayrollYear) && res.PayrollMonth != 0) { res.PeriodEnd = hmrcDateService.GetDateFromPayrollYearMonth(res.PayrollYear, res.PayrollMonth).ToString("MMM yyyy"); } } return(transactionDownloadLines.OrderByDescending(txn => txn.DateCreated).ToArray()); }
public void Arrange() { _hmrcDateService = new HmrcDateService(); }