Ejemplo n.º 1
0
        public async Task <IssMessageDTO> SaveFraud(FraudCustomerDetailsDTO fraudCustomerDetail, FraudCardDetailDTO fraudCardDetail, WebFraudDetailDTO webFraudDetail, string userId)
        {
            using (var cardtrendentities = new pdb_ccmsContext(_connectionString))
            {
                IssMessageDTO issMessage = new IssMessageDTO();
                string        accountNo  = null;
                if (fraudCardDetail.FraudCards.Count() > 0)
                {
                    accountNo = fraudCardDetail.FraudCards[0].AcctNo;
                }
                DataTable dtCardNo = null;
                if (fraudCardDetail.FraudCards != null && fraudCardDetail.FraudCards.Count() > 0)
                {
                    dtCardNo = new DataTable();
                    dtCardNo.Columns.Add("CardNo");
                    foreach (var itm in fraudCardDetail.FraudCards)
                    {
                        if (!String.IsNullOrEmpty(itm.SelectedCardNo))
                        {
                            DataRow dr = dtCardNo.NewRow();
                            dr["CardNo"] = itm.SelectedCardNo;
                            dtCardNo.Rows.Add(dr);
                        }
                    }
                }

                var parameters = new[] {
                    new SqlParameter("@IssNo", SqlDbType.SmallInt)
                    {
                        SqlValue = Common.Helpers.Common.GetIssueNo()
                    },
                    new SqlParameter("@EventID", SqlDbType.BigInt)
                    {
                        SqlValue = (object)fraudCustomerDetail.EventID ?? DBNull.Value
                    },
                    new SqlParameter("@AcctNo", SqlDbType.BigInt)
                    {
                        SqlValue = (object)accountNo ?? DBNull.Value
                    },
                    new SqlParameter("@CardNo", SqlDbType.Structured)
                    {
                        SqlValue = dtCardNo, TypeName = "FraudCardNumbers"
                    },
                    new SqlParameter("@ReportedBy", SqlDbType.NVarChar)
                    {
                        SqlValue = (object)webFraudDetail.ReportedBy ?? DBNull.Value
                    },
                    new SqlParameter("@ReportedVia", SqlDbType.NVarChar)
                    {
                        SqlValue = (object)webFraudDetail.ReportVia ?? DBNull.Value
                    },
                    new SqlParameter("@IncidentDate", SqlDbType.DateTime)
                    {
                        SqlValue = (object)webFraudDetail.IncidentDate ?? DBNull.Value
                    },
                    new SqlParameter("@EstimatedAmountDispute", SqlDbType.Money)
                    {
                        SqlValue = (object)webFraudDetail.DisputeAmt ?? DBNull.Value
                    },
                    new SqlParameter("@NatureOfIncident", SqlDbType.VarChar)
                    {
                        SqlValue = (object)webFraudDetail.NatureOfIncident ?? DBNull.Value
                    },
                    new SqlParameter("@IfOthers", SqlDbType.NVarChar)
                    {
                        SqlValue = (object)webFraudDetail.OtherNatureOfIncident ?? DBNull.Value
                    },
                    new SqlParameter("@Description", SqlDbType.NVarChar)
                    {
                        SqlValue = (object)webFraudDetail.Descp ?? DBNull.Value
                    },

                    new SqlParameter("@InvestigatedBy", SqlDbType.NVarChar)
                    {
                        SqlValue = (object)webFraudDetail.InvestigatedBy ?? DBNull.Value
                    },
                    new SqlParameter("@InvestigateDate", SqlDbType.DateTime)
                    {
                        SqlValue = (object)webFraudDetail.InvestigationDate ?? DBNull.Value
                    },
                    new SqlParameter("@InvestigateVenue", SqlDbType.NVarChar)
                    {
                        SqlValue = (object)webFraudDetail.InvestigationVenue ?? DBNull.Value
                    },
                    new SqlParameter("@CaseBackground", SqlDbType.NVarChar)
                    {
                        SqlValue = (object)webFraudDetail.CaseBackGround ?? DBNull.Value
                    },
                    new SqlParameter("@InvestigationProcess", SqlDbType.NVarChar)
                    {
                        SqlValue = (object)webFraudDetail.InvestigationProcess ?? DBNull.Value
                    },
                    new SqlParameter("@Finding", SqlDbType.NVarChar)
                    {
                        SqlValue = (object)webFraudDetail.Findings ?? DBNull.Value
                    },
                    new SqlParameter("@ActionTaken", SqlDbType.NVarChar)
                    {
                        SqlValue = (object)webFraudDetail.ActionTaken ?? DBNull.Value
                    },
                    new SqlParameter("@RecommendationPlan", SqlDbType.NVarChar)
                    {
                        SqlValue = (object)webFraudDetail.Recommendation ?? DBNull.Value
                    },
                    new SqlParameter("@Conclusion", SqlDbType.NVarChar)
                    {
                        SqlValue = (object)webFraudDetail.Conclusion ?? DBNull.Value
                    },
                    new SqlParameter("@Status", SqlDbType.NVarChar)
                    {
                        SqlValue = (object)webFraudDetail.Sts ?? DBNull.Value
                    },

                    new SqlParameter("@PreparedByName1", SqlDbType.NVarChar)
                    {
                        SqlValue = (object)webFraudDetail.PreparedByName1 ?? DBNull.Value
                    },
                    new SqlParameter("@PreparedByPosition1", SqlDbType.NVarChar)
                    {
                        SqlValue = (object)webFraudDetail.PreparedByPosition1 ?? DBNull.Value
                    },
                    new SqlParameter("@PreparedByName2", SqlDbType.NVarChar)
                    {
                        SqlValue = (object)webFraudDetail.PreparedByName2 ?? DBNull.Value
                    },
                    new SqlParameter("@PreparedByPosition2", SqlDbType.NVarChar)
                    {
                        SqlValue = (object)webFraudDetail.PreparedByPosition2 ?? DBNull.Value
                    },
                    new SqlParameter("@ReviewerName1", SqlDbType.NVarChar)
                    {
                        SqlValue = (object)webFraudDetail.ReviewerName1 ?? DBNull.Value
                    },

                    new SqlParameter("@ReviewerPosition1", SqlDbType.NVarChar)
                    {
                        SqlValue = (object)webFraudDetail.ReviewerPosition1 ?? DBNull.Value
                    },
                    new SqlParameter("@ReviewerName2", SqlDbType.NVarChar)
                    {
                        SqlValue = (object)webFraudDetail.ReviewerName2 ?? DBNull.Value
                    },

                    new SqlParameter("@ReviewerPosition2", SqlDbType.NVarChar)
                    {
                        SqlValue = (object)webFraudDetail.ReviewerPosition2 ?? DBNull.Value
                    },

                    new SqlParameter("@EndorsedByName1", SqlDbType.NVarChar)
                    {
                        SqlValue = (object)webFraudDetail.EndorsedByName1 ?? DBNull.Value
                    },
                    new SqlParameter("@EndorsedByPosition1", SqlDbType.NVarChar)
                    {
                        SqlValue = (object)webFraudDetail.EndorsedByPosition1 ?? DBNull.Value
                    },
                    new SqlParameter("@EndorsedByName2", SqlDbType.NVarChar)
                    {
                        SqlValue = (object)webFraudDetail.EndorsedByName2 ?? DBNull.Value
                    },
                    new SqlParameter("@EndorsedByPosition2", SqlDbType.NVarChar)
                    {
                        SqlValue = (object)webFraudDetail.EndorsedByPosition2 ?? DBNull.Value
                    },
                    new SqlParameter("@ApprovedByName1", SqlDbType.NVarChar)
                    {
                        SqlValue = (object)webFraudDetail.ApprovedByName1 ?? DBNull.Value
                    },

                    new SqlParameter("@ApprovedByPosition1", SqlDbType.NVarChar)
                    {
                        SqlValue = (object)webFraudDetail.ApprovedByPosition1 ?? DBNull.Value
                    },
                    new SqlParameter("@ApprovedByName2", SqlDbType.NVarChar)
                    {
                        SqlValue = (object)webFraudDetail.ApprovedByName2 ?? DBNull.Value
                    },
                    new SqlParameter("@ApprovedByPosition2", SqlDbType.NVarChar)
                    {
                        SqlValue = (object)webFraudDetail.ApprovedByPosition2 ?? DBNull.Value
                    },

                    new SqlParameter("@Remarks", SqlDbType.NVarChar)
                    {
                        SqlValue = (object)webFraudDetail.Remarks ?? DBNull.Value
                    },
                    new SqlParameter("@UserID", SqlDbType.NVarChar)
                    {
                        SqlValue = userId
                    },
                    new SqlParameter("@OutputID", SqlDbType.BigInt)
                    {
                        Direction = ParameterDirection.Output
                    },
                    new SqlParameter("@RETURN_VALUE", SqlDbType.BigInt)
                    {
                        Direction = ParameterDirection.Output
                    }
                };

                await cardtrendentities.Database.ExecuteSqlCommandAsync("exec @RETURN_VALUE = WebFraudIncidentReportMaint @IssNo,@EventID,@AcctNo,@CardNo,@ReportedBy," +
                                                                        "@ReportedVia,@IncidentDate,@EstimatedAmountDispute,@NatureOfIncident,@IfOthers,@Description," +
                                                                        "@InvestigatedBy,@InvestigateDate,@InvestigateVenue,@CaseBackground,@InvestigationProcess,@Finding," +
                                                                        "@ActionTaken,@RecommendationPlan,@Conclusion,@Status,@PreparedByName1,@PreparedByPosition1,@PreparedByName2," +
                                                                        "@PreparedByPosition2,@ReviewerName1,@ReviewerPosition1,@ReviewerName2,@ReviewerPosition2,@EndorsedByName1," +
                                                                        "@EndorsedByPosition1,@EndorsedByName2,@EndorsedByPosition2,@ApprovedByName1,@ApprovedByPosition1,@ApprovedByName2,@ApprovedByPosition2,@Remarks,@UserID,@OutputID OUT", parameters);

                var resultCode = parameters.Where(x => x.ParameterName == "@RETURN_VALUE").FirstOrDefault().Value;
                var eventId    = parameters.Where(x => x.ParameterName == "@OutputID").FirstOrDefault().Value;
                return(new IssMessageDTO()
                {
                    Flag = Convert.ToInt32(resultCode),
                    paraOut = { BatchId = Convert.ToString(eventId) }
                });
            }
        }
Ejemplo 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);
        }