Esempio n. 1
0
        /*************************************
        *  Created by:   Tuan Tran
        *  Created on:   May 15, 2017
        *  Function:     GetCardNoByAcctNo
        *  Purpose:      GetCardNoByAcctNo
        *  Inputs:       ind,dropDown,showList,acctNo,eventId
        *  Returns:      FraudResponse
        *************************************/
        public async Task <FraudResponse> GetCardNoByAcctNo(int ind, string dropDown, string showList, string acctNo, string eventId)
        {
            Logger.Info("Invoking GetCardNoByAcctNo fuction use EF to call SP");
            var response = new FraudResponse()
            {
                Status = ResponseStatus.Failure,
            };

            try
            {
                using (var scope = Container.BeginLifetimeScope())
                {
                    var pukalAcctDAO = scope.Resolve <IFraudOpDAO>();
                    var fraudDetail  = await pukalAcctDAO.GetCardNoByAcctNo(ind, dropDown, showList, acctNo, eventId);

                    FraudCardDTO fraudCardDTO = new FraudCardDTO();
                    var          liCardNo     = new List <string>();
                    if (fraudDetail.Count() > 0)
                    {
                        foreach (var fraud in fraudDetail)
                        {
                            liCardNo.Add(Convert.ToString(fraud.CardNo));
                        }
                    }
                    fraudCardDTO.CardNo = liCardNo;
                    if (fraudCardDTO != null)
                    {
                        response.fraudCard = Mapper.Map <FraudCardDTO, FraudCards>(fraudCardDTO);
                    }
                }
                response.Status = ResponseStatus.Success;
            }
            catch (Exception ex)
            {
                string msg = string.Format("Error in GetCardNoByAcctNo: detail:{0}", ex.Message);
                Logger.Error(msg, ex);
                response.Status  = ResponseStatus.Exception;
                response.Message = msg;
            }
            return(response);
        }
Esempio n. 2
0
        /*************************************
        *  Created by:   Dandy Boy
        *  Created on:   May 12, 2017
        *  Function:     GetFraudCardDetailsList
        *  Purpose:      GetFraudCardDetailsList
        *  Inputs:       fraudCards,account,eventId,fraudCardPr
        *  Returns:      FraudResponse
        *************************************/
        public async Task <FraudResponse> GetFraudCardDetailsList(List <string> fraudCards, string account, string eventId, FraudCards fraudCardModel)
        {
            Logger.Info("Invoking GetFraudCardDetailsList fuction use EF to call SP");
            var response = new FraudResponse()
            {
                Status = ResponseStatus.Failure,
            };

            try
            {
                using (var scope = Container.BeginLifetimeScope())
                {
                    var pukalAcctDAO     = scope.Resolve <IFraudOpDAO>();
                    var fraudCardPr      = Mapper.Map <FraudCards, FraudCardDTO>(fraudCardModel);
                    var fraudCardDetails = await pukalAcctDAO.FraudCardDetailsList(fraudCards, account, eventId);

                    var fraudCardDetailModels = new List <FraudCardDetailDTO>();
                    if (fraudCardDetails.Count() > 0)
                    {
                        foreach (var fraud in fraudCardDetails)
                        {
                            var avgSales = ((Convert.ToDecimal(fraud.Month1Amount) + Convert.ToDecimal(fraud.Month2Amount) + Convert.ToDecimal(fraud.Month3Amount) + Convert.ToDecimal(fraud.Month4Amount) + Convert.ToDecimal(fraud.Month5Amount) + Convert.ToDecimal(fraud.Month6Amount)) / 6);
                            FraudCardDetailDTO fraudCardDetail = new FraudCardDetailDTO();
                            FraudCardDTO       fraudCard       = new FraudCardDTO();
                            fraudCard.SelectedCardNo = Convert.ToString(fraud.CardNo);
                            fraudCard.AcctNo         = account;
                            fraudCard.EventId        = Convert.ToString(eventId);
                            fraudCard.CardNo         = fraudCardPr.CardNo;
                            fraudCardDetail.AvgSales = avgSales;
                            fraudCardDetail.FraudCards.Add(fraudCard);
                            fraudCardDetail.Month1Amount = fraud.Month1Amount;
                            fraudCardDetail.Month1Date   = fraud.Month1Date;
                            fraudCardDetail.Month2Amount = fraud.Month2Amount;
                            fraudCardDetail.Month2Date   = fraud.Month2Date;
                            fraudCardDetail.Month3Amount = fraud.Month3Amount;
                            fraudCardDetail.Month3Date   = fraud.Month3Date;
                            fraudCardDetail.Month4Amount = fraud.Month4Amount;
                            fraudCardDetail.Month4Date   = fraud.Month4Date;
                            fraudCardDetail.Month5Amount = fraud.Month5Amount;
                            fraudCardDetail.Month5Date   = fraud.Month5Date;
                            fraudCardDetail.Month6Amount = fraud.Month6Amount;
                            fraudCardDetail.Month6Date   = fraud.Month6Date;

                            fraudCardDetail.CardAvgSalesDisplay = !String.IsNullOrEmpty((avgSales).ToString("0.00")) ? "Average Sales" : string.Empty;
                            fraudCardDetail.SingleTxn           = fraud.SingleTxn;
                            fraudCardDetail.LitLimit            = fraud.LitLimit;

                            fraudCardDetail.DailyTxn   = fraud.DailyTxn;
                            fraudCardDetail.DailyLitre = fraud.DailyLitre;
                            fraudCardDetail.DailyCnt   = fraud.DailyCnt;

                            fraudCardDetail.MonthlyTxn   = fraud.MonthlyTxn;
                            fraudCardDetail.MonthlyLitre = fraud.MonthlyLitre;
                            fraudCardDetail.MonthlyCnt   = fraud.MonthlyCnt;

                            fraudCardDetailModels.Add(fraudCardDetail);
                        }
                        response.fraudCardDetails = Mapper.Map <IList <FraudCardDetailDTO>, IList <FraudCardDetailsViewModel> >(fraudCardDetailModels);
                    }
                }
            }
            catch (Exception ex)
            {
                string msg = string.Format("Error in GetFraudCardDetailsList: detail:{0}", ex.Message);
                Logger.Error(msg, ex);
                response.Status  = ResponseStatus.Exception;
                response.Message = msg;
            }
            return(response);
        }