示例#1
0
        /*************************************
        *  Created by:   Tuan Tran
        *  Created on:   Mar 5, 2017
        *  Function:     WebMultiPaymentSelect
        *  Purpose:      WebMultiPaymentSelect
        *  Inputs:       batchId,MultiPaymentDTO
        *  Returns:      MultiPaymentResponse
        *************************************/
        public async Task <MultiPaymentResponse> WebMultiPaymentSelect(string batchId, MultiPayment multiPayment)
        {
            Logger.Info("Invoking WebMultiPaymentSelect function");
            var response = new MultiPaymentResponse()
            {
                Status = ResponseStatus.Failure,
            };

            try
            {
                using (var scope = Container.BeginLifetimeScope())
                {
                    var multiPaymentOpDAO = scope.Resolve <IMultiPaymentOpDAO>();
                    var multi             = Mapper.Map <MultiPayment, MultiPaymentDTO>(multiPayment);
                    var result            = await multiPaymentOpDAO.WebMultiPaymentSelect(batchId, multi);

                    var             txnList       = new List <MultipleTxnRecordDTO>();
                    MultiPaymentDTO multilPayment = new MultiPaymentDTO();
                    if (result.Count() > 0)
                    {
                        foreach (var item in result)
                        {
                            MultipleTxnRecordDTO multipleTxtRecord = new MultipleTxnRecordDTO();
                            multipleTxtRecord.AcctNo        = Convert.ToInt32(item.AcctNo.ToString());
                            multipleTxtRecord.TxnAmt        = Convert.ToString(decimal.Round(item.TxnAmt, 2, MidpointRounding.AwayFromZero));
                            multipleTxtRecord.TxnDescp      = item.Descp;
                            multipleTxtRecord.SelectedSts   = item.Sts;
                            multipleTxtRecord.ChequeNo      = Convert.ToString(item.ChequeNo);
                            multipleTxtRecord.CreationDate  = CardTrend.Common.Extensions.NumberExtensions.DateConverter(item.CreationDate);
                            multipleTxtRecord.SelectedOwner = item.Owner;
                            multipleTxtRecord.TxnId         = item.TxnId;
                            multipleTxtRecord.AcctName      = item.AccountName;
                            txnList.Add(multipleTxtRecord);
                            //-----------
                            multilPayment.TxnId        = item.TxnId;
                            multilPayment.TxnDate      = item.TxnDate;
                            multilPayment.DueDate      = item.DueDate;
                            multilPayment.RefNo        = item.RefNo;
                            multilPayment.TxnCd        = item.TxnCd;
                            multilPayment.TxnCdDescp   = Convert.ToString(item.TxnCd);
                            multilPayment.ChequeNo     = item.ChequeNo;
                            multilPayment.ChequeAmt    = item.ChequeAmt;
                            multilPayment.CreationDate = item.CreationDate;
                            multilPayment.Owner        = item.Owner;
                            multilPayment.IssuingBank  = item.IssuingBank;
                            multilPayment.SlipNo       = item.SlipNo;
                            multilPayment.Sts          = item.Sts;
                            multilPayment.PymtType     = item.PymtType;
                            multilPayment.SettleVal    = item.SettleVal;
                        }
                    }
                    multilPayment.MultipleTxnRecordList = txnList;
                    response.multiPayment = Mapper.Map <MultiPaymentDTO, MultiPayment>(multilPayment);
                }
                response.Status = ResponseStatus.Success;
            }
            catch (Exception ex)
            {
                string msg = string.Format("Error in WebMultiPaymentSelect: detail:{0}", ex.Message);
                Logger.Error(msg, ex);
                response.Status  = ResponseStatus.Exception;
                response.Message = msg;
            }
            return(response);
        }
示例#2
0
        public async Task <IList <MultiPaymentDTO> > WebMultiPaymentSelect(string batchId, MultiPaymentDTO multiPayment)
        {
            using (var cardtrendentities = new pdb_ccmsContext(_connectionString))
            {
                var parameters    = new object[] { Common.Helpers.Common.GetIssueNo(), batchId, multiPayment.RefKey };
                var paramNameList = new[]
                {
                    "@IssNo",
                    "@BatchId",
                    "@RefKey"
                };
                var outPutParameter = new object[] { new ColumnInfo {
                                                         FieldName = "@TxnAmt", DataType = "money"
                                                     } };
                var paramCollection = BuildParameterListWithOutPutAndRrn(parameters, outPutParameter, paramNameList);
                var result          = await cardtrendentities.Database.SqlQuery <MultiPaymentDTO>
                                          (BuildSqlCommand("WebMultiPaymentSelect", paramCollection), paramCollection.ToArray()).ToListAsync();

                return(result);
            }
        }