public int CreateBatchDetail( TransactionChoice connType , string LedgerType , BatchDetailDTO batchDetailDTO) { int result = 0; switch (LedgerType) { case "PayerAccountsReceivable": result = CreateFeeBatchDetail( connType , batchDetailDTO); break; default: //no nothing for now; will implement other ledgers in another phase break; } return result; }
private int CreateFeeBatchDetail(TransactionChoice connType , BatchDetailDTO batchDetailDTO) { IDataManager manager = SqlDataManager.UniqueInstance; IList<SqlParameter> parameters = new List<SqlParameter>(); parameters = AddSqlParameter(parameters, "@InsBatHdrKey", batchDetailDTO.BatchHeaderKey.ToString(), SqlDbType.Int, "in"); parameters = AddSqlParameter(parameters, "@InsClmHdrKey", batchDetailDTO.ClaimHeaderKey.ToString(), SqlDbType.Int, "in"); parameters = AddSqlParameter(parameters, "@InsCorrKey", batchDetailDTO.CorrectionKey.ToString(), SqlDbType.Int, "in"); parameters = AddSqlParameter(parameters, "@InsUndKey", batchDetailDTO.UnidentifiedKey.ToString(), SqlDbType.Int, "in"); parameters = AddSqlParameter(parameters, "@TxType", batchDetailDTO.TransactionType, SqlDbType.VarChar, "in"); parameters = AddSqlParameter(parameters, "@TxCtgy", batchDetailDTO.TransactionCategory, SqlDbType.VarChar, "in"); parameters = AddSqlParameter(parameters, "@TxCode", batchDetailDTO.TransactionCode, SqlDbType.VarChar, "in"); parameters = AddSqlParameter(parameters, "@InsBatTxDate", batchDetailDTO.BatchTransactionDate.ToString(), SqlDbType.Date, "in"); parameters = AddSqlParameter(parameters, "@InsBatTxAmt", batchDetailDTO.BatchTransactionAmount.ToString(), SqlDbType.Money, "in"); parameters = AddSqlParameter(parameters, "@InsChkAmt", batchDetailDTO.PayerCheckAmount.ToString(), SqlDbType.Money, "in"); parameters = AddSqlParameter(parameters, "@InsChkDate", batchDetailDTO.PayerCheckDate.ToString(), SqlDbType.Date, "in"); parameters = AddSqlParameter(parameters, "@InsCheckNo", batchDetailDTO.PayerCheckNumber, SqlDbType.VarChar, "in"); parameters = AddSqlParameter(parameters, "@InsBulkChk", batchDetailDTO.IsPayerBulkCheck.ToString(), SqlDbType.Bit, "in"); parameters = AddSqlParameter(parameters, "@Unidentified", batchDetailDTO.IsUnidentified.ToString(), SqlDbType.Bit, "in"); parameters = AddSqlParameter(parameters, "@UserAdded", batchDetailDTO.UserAdded, SqlDbType.VarChar, "in"); ExecuteOutcome outcome; string outcomeMessage; int headerKey = (int)manager.Execute( connType , CommandType.StoredProcedure , "corInsClmBatchDetINS" , ExecuteType.ExecuteScaler , parameters , out outcome, out outcomeMessage); EvaluateOutcome(outcome, outcomeMessage, "CreateFeeBatchDetail"); int result = headerKey; return result; }
/// <summary> /// Creates the Batch Detail for an identified claim ready for fee payment. /// </summary> /// <param name="ledgerType"></param> /// <param name="payment"></param> /// <returns></returns> private int CreateBatchDetail(string ledgerType, ITransaction payment) { int result; BatchDetailDTO batchDetailDTO = new BatchDetailDTO( _batchHeaderDTO.Key , payment.ClaimHeaderKey, 0, payment.UnidentifiedKey , payment.TransactionType.ToString(), payment.TransactionCategory.ToString() , payment.TransactionCode.ToString(), payment.ArDate , payment.Amount, _batchHeaderDTO.PayerCheckAmount , _batchHeaderDTO.PayerCheckDate , _batchHeaderDTO.PayerCheckNumber , _batchHeaderDTO.UserAdded ); try { result = _dataAccess.CreateBatchDetail( AimHealth.Safari.BulkPosting.Data.TransactionChoice.WithTransaction , ledgerType , batchDetailDTO); if (!EvaluateResult(result)) { string message = CreateMessage("Error creating batch detail for {0}", batchDetailDTO.ClaimHeaderKey); throw new BatchNotCreatedException(message); } } catch (Exception ex) { string message = CreateMessage("Error creating batch detail for {0}", batchDetailDTO.ClaimHeaderKey); throw new BatchNotCreatedException(message, ex); } return result; }
/// <summary> /// Create the Batch Detail for an unidentifed claim or a claim not ready for fee payment /// </summary> /// <param name="ledgerType"></param> /// <param name="money"></param> /// <returns></returns> private int CreateBatchDetail(string ledgerType, IUnidentifiedMoney money) { TransactionCode transactionCode = money.IsOpenCredit ? TransactionCode.OC : TransactionCode.UND; BatchDetailDTO batchDetailDTO = new BatchDetailDTO( _batchHeaderDTO.Key , 0, 0, money.Key , TransactionType.P.ToString(), TransactionCategory.PYMT.ToString() , transactionCode.ToString(), DateTime.Now , money.Amount, _batchHeaderDTO.PayerCheckAmount , _batchHeaderDTO.PayerCheckDate, _batchHeaderDTO.PayerCheckNumber , _batchHeaderDTO.UserAdded ); int result = _dataAccess.CreateBatchDetail( TransactionChoice.WithTransaction , ledgerType , batchDetailDTO); return result; }