public async Task <ActionResult> GetCardDetailsList_ByAcctNoCardNo(FraudCardDetailsViewModel _FraudCardDetailsViewModel) { try { FraudCards fraudCards = _FraudCardDetailsViewModel.FraudCards[0]; var cardNoes = new List <string>(); if (_FraudCardDetailsViewModel.FraudCards.Count() > 0) { foreach (var item in _FraudCardDetailsViewModel.FraudCards) { cardNoes.Add(item.SelectedCardNo); } } var listFraudIncident = (await FraudOpService.GetFraudCardDetailsList(cardNoes, _FraudCardDetailsViewModel.AcctNo, null, fraudCards)).fraudCardDetails; var CardMonth1Date = listFraudIncident.Where(s => !string.IsNullOrEmpty(s.CardMonth1Date)).Distinct().Select(s => s.CardMonth1Date).FirstOrDefault(); var CardMonth2Date = listFraudIncident.Where(s => !string.IsNullOrEmpty(s.CardMonth2Date)).Distinct().Select(s => s.CardMonth2Date).FirstOrDefault(); var CardMonth3Date = listFraudIncident.Where(s => !string.IsNullOrEmpty(s.CardMonth3Date)).Distinct().Select(s => s.CardMonth3Date).FirstOrDefault(); var CardMonth4Date = listFraudIncident.Where(s => !string.IsNullOrEmpty(s.CardMonth4Date)).Distinct().Select(s => s.CardMonth4Date).FirstOrDefault(); var CardMonth5Date = listFraudIncident.Where(s => !string.IsNullOrEmpty(s.CardMonth5Date)).Distinct().Select(s => s.CardMonth5Date).FirstOrDefault(); var CardMonth6Date = listFraudIncident.Where(s => !string.IsNullOrEmpty(s.CardMonth6Date)).Distinct().Select(s => s.CardMonth6Date).FirstOrDefault(); var CardAvgSalesDisplay = listFraudIncident.Where(s => !string.IsNullOrEmpty(s.CardAvgSalesDisplay)).Distinct().Select(s => s.CardAvgSalesDisplay).FirstOrDefault(); return(Json( new { model = new object[] { CardMonth1Date, CardMonth2Date, CardMonth3Date, CardMonth4Date, CardMonth5Date, CardMonth6Date, CardAvgSalesDisplay }, aaData = listFraudIncident.Select(x => new object[] { x.FraudCards[0].SelectedCardNo, x.CardMonth1Amt, x.CardMonth2Amt, x.CardMonth3Amt, x.CardMonth4Amt, x.CardMonth5Amt, x.CardMonth6Amt, x.CardAvgSales, x.SingleTxn, x.DailyTxn, x.MonthlyTxn }) } , JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(null); } }
public async Task <JsonResult> FillData(string Prefix, string EventId) { try { switch (Prefix.ToLower()) { case "details": string Enum_NatureOfIncident = Convert.ToString(En.NatureOfIncident.O); //load/bind dropdown var DropdownFraudIncidentsViewModel = new FraudIncidentsViewModel { ReportedVia = await BaseService.GetRefLib("ReportVia"), NextStatus = await BaseService.GetRefLib("FraudSts"), NatureOfIncident = await BaseService.GetRefLib("NtfIncidentType"), InvestigatedBy = await FraudOpService.GetFraudDropdown((int)En.FraudSection.IncidentInvestigationTeam, "Y", null, null, null) }; var fraudMainViewModel = (await FraudOpService.GetFraudByEventId(EventId)).webFraudDetail; //get customer sale list var customerDetailsShowList = (await FraudOpService.FraudCustomerDetailsByacctNoEventId(fraudMainViewModel.FraudCustomerDetailsViewModel.AcctNo, EventId)).fraudCustomerDetails; var cardNoLst = (await FraudOpService.GetCardNoListByAcctNo((int)En.FraudSection.CardDetails, "Y", null, fraudMainViewModel.FraudCustomerDetailsViewModel.AcctNo, EventId)).fraudCard; var cardDetailsShowList = (await FraudOpService.GetFraudCardDetailsList(null, fraudMainViewModel.FraudCustomerDetailsViewModel.AcctNo, EventId, cardNoLst)).fraudCardDetails; var CardMonth1Date = cardDetailsShowList.Where(s => !string.IsNullOrEmpty(s.CardMonth1Date)).Distinct().Select(s => s.CardMonth1Date).FirstOrDefault(); var CardMonth2Date = cardDetailsShowList.Where(s => !string.IsNullOrEmpty(s.CardMonth2Date)).Distinct().Select(s => s.CardMonth2Date).FirstOrDefault(); var CardMonth3Date = cardDetailsShowList.Where(s => !string.IsNullOrEmpty(s.CardMonth3Date)).Distinct().Select(s => s.CardMonth3Date).FirstOrDefault(); var CardMonth4Date = cardDetailsShowList.Where(s => !string.IsNullOrEmpty(s.CardMonth4Date)).Distinct().Select(s => s.CardMonth4Date).FirstOrDefault(); var CardMonth5Date = cardDetailsShowList.Where(s => !string.IsNullOrEmpty(s.CardMonth5Date)).Distinct().Select(s => s.CardMonth5Date).FirstOrDefault(); var CardMonth6Date = cardDetailsShowList.Where(s => !string.IsNullOrEmpty(s.CardMonth6Date)).Distinct().Select(s => s.CardMonth6Date).FirstOrDefault(); var CardAvgSalesDisplay = cardDetailsShowList.Where(s => !string.IsNullOrEmpty(s.CardAvgSalesDisplay)).Distinct().Select(s => s.CardAvgSalesDisplay).FirstOrDefault(); return(Json(new { _FraudIncidentsViewModel = fraudMainViewModel.FraudIncidentsViewModel, _FraudCustomerDetailsViewModel = fraudMainViewModel.FraudCustomerDetailsViewModel, _FraudCardDetailsViewModel = fraudMainViewModel.FraudCardDetailsViewModel, Selects = DropdownFraudIncidentsViewModel, CardNo = cardNoLst, model = customerDetailsShowList.Select(x => new object[] { x.CmpyName1, x.AccountType, x.ClientType, x.AgeingDays, x.Month1Date, x.Month2Date, x.Month3Date, x.Month4Date, x.Month5Date, x.Month6Date, x.AvgSalesDisplay, x.SubsidyNo }).FirstOrDefault(), aaData = customerDetailsShowList.Select(x => new object[] { x.Month1Amt, x.Month2Amt, x.Month3Amt, x.Month4Amt, x.Month5Amt, x.Month6Amt, x.AvgSales }), cardModel = new object[] { CardMonth1Date, CardMonth2Date, CardMonth3Date, CardMonth4Date, CardMonth5Date, CardMonth6Date, CardAvgSalesDisplay }, cardaaData = cardDetailsShowList.Select(x => new object[] { x.FraudCards[0].SelectedCardNo, x.CardMonth1Amt, x.CardMonth2Amt, x.CardMonth3Amt, x.CardMonth4Amt, x.CardMonth5Amt, x.CardMonth6Amt, x.CardAvgSales, x.LitLimit, x.SingleTxn, x.DailyTxn, x.MonthlyTxn, x.DailyCnt, x.MonthlyCnt, x.DailyLitre, x.MonthlyLitre }), liFraudCards = cardDetailsShowList.SelectMany(x => x.FraudCards), Enum_NatureOfIncident = Enum_NatureOfIncident }, JsonRequestBehavior.AllowGet)); case "txn": var _FraudTxnDisputeViewModel = new FraudTxnDisputeViewModel { TxnCategory = await BaseService.GetTransactionCategory(), TxnCd = await BaseService.WebGetTxnCode("I") }; var json = Json(new { Selects = _FraudTxnDisputeViewModel }, JsonRequestBehavior.AllowGet); json.MaxJsonLength = int.MaxValue; return(json); default: HttpContext.Response.StatusCode = 404; return(Json(null, JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { HttpContext.Response.StatusCode = 404; return(Json(null, JsonRequestBehavior.AllowGet)); } }