From 8dd5317d8a49b9e8fcdb51e47daf73c1c63fff36 Mon Sep 17 00:00:00 2001 From: Dinesh Date: Mon, 4 Dec 2023 12:21:01 +0545 Subject: [PATCH] #22654 Filter receiver by paymentmethod --- .../ITransactionBusiness.cs | 1 + .../TransactionBusiness.cs | 5 ++ .../ITransactionRepository.cs | 1 + .../TransactionRepository.cs | 40 +++++++++++++++ .../Controllers/TransactionController.cs | 8 +++ .../Views/Transaction/SendMoney.cshtml | 51 ++++++++++++++++++- 6 files changed, 105 insertions(+), 1 deletion(-) diff --git a/CustomerOnlineV2/CustomerOnlineV2.Business/Business/TransactionBusiness/ITransactionBusiness.cs b/CustomerOnlineV2/CustomerOnlineV2.Business/Business/TransactionBusiness/ITransactionBusiness.cs index 2d01b9a..1c1e454 100644 --- a/CustomerOnlineV2/CustomerOnlineV2.Business/Business/TransactionBusiness/ITransactionBusiness.cs +++ b/CustomerOnlineV2/CustomerOnlineV2.Business/Business/TransactionBusiness/ITransactionBusiness.cs @@ -19,5 +19,6 @@ namespace CustomerOnlineV2.Business.Business.TransactionBusiness Task GetRewardPoints(LoginResponse loginDetails); Task UpdateTranDataFailed(TrustPaymentRequest request, LoginResponse loginDetails); Task GetReceiverListDetail(LoginResponse loginDetails , string receiverId); + Task GetReceiverListDDL(CommonDropDownModel model, LoginResponse loginDetails); } } diff --git a/CustomerOnlineV2/CustomerOnlineV2.Business/Business/TransactionBusiness/TransactionBusiness.cs b/CustomerOnlineV2/CustomerOnlineV2.Business/Business/TransactionBusiness/TransactionBusiness.cs index aa772dc..6fdc0b6 100644 --- a/CustomerOnlineV2/CustomerOnlineV2.Business/Business/TransactionBusiness/TransactionBusiness.cs +++ b/CustomerOnlineV2/CustomerOnlineV2.Business/Business/TransactionBusiness/TransactionBusiness.cs @@ -376,5 +376,10 @@ namespace CustomerOnlineV2.Business.Business.TransactionBusiness { return await _transactionRepo.GetReceiverListDetail(loginDetails , receiverId); } + + public async Task GetReceiverListDDL(CommonDropDownModel model, LoginResponse loginDetails) + { + return await _transactionRepo.GetReceiverListDDL(model, loginDetails); + } } } diff --git a/CustomerOnlineV2/CustomerOnlineV2.Repository/Repository/TransactionRepository/ITransactionRepository.cs b/CustomerOnlineV2/CustomerOnlineV2.Repository/Repository/TransactionRepository/ITransactionRepository.cs index e821c93..9c560d1 100644 --- a/CustomerOnlineV2/CustomerOnlineV2.Repository/Repository/TransactionRepository/ITransactionRepository.cs +++ b/CustomerOnlineV2/CustomerOnlineV2.Repository/Repository/TransactionRepository/ITransactionRepository.cs @@ -17,5 +17,6 @@ namespace CustomerOnlineV2.Repository.Repository.TransactionRepository Task GetRewardPoints(LoginResponse loginDetails); Task UpdateTranDataFailed(TrustPaymentRequest request, LoginResponse loginDetails); Task GetReceiverListDetail(LoginResponse loginDetails, string receiverId); + Task GetReceiverListDDL(CommonDropDownModel model, LoginResponse loginDetails); } } diff --git a/CustomerOnlineV2/CustomerOnlineV2.Repository/Repository/TransactionRepository/TransactionRepository.cs b/CustomerOnlineV2/CustomerOnlineV2.Repository/Repository/TransactionRepository/TransactionRepository.cs index 0adbcf6..a761e0c 100644 --- a/CustomerOnlineV2/CustomerOnlineV2.Repository/Repository/TransactionRepository/TransactionRepository.cs +++ b/CustomerOnlineV2/CustomerOnlineV2.Repository/Repository/TransactionRepository/TransactionRepository.cs @@ -633,6 +633,46 @@ namespace CustomerOnlineV2.Repository.Repository.TransactionRepository } return await Task.FromResult(_response); } + + public async Task GetReceiverListDDL(CommonDropDownModel model, LoginResponse loginDetails) + { + try + { + var sql = "EXEC PROC_DROPDOWN_LIST"; + sql += " @Flag = " + _connHelper.FilterString("receiverListPMode"); + sql += ",@customerid = " + _connHelper.FilterString(loginDetails.UserId); + sql += " ,@selectedValue1 = " + _connHelper.FilterString(model.country); + sql += " ,@paymentMode = " + _connHelper.FilterString(model.Value); + + + + _logger.LogDebug("TRANSACTIONREPOSITORY | GETRECEIVERLISTDDL | SQL | " + sql); + var dt = _connHelper.ExecuteDataTable(sql); + + if (dt == null || dt.Rows.Count <= 0) + { + return new CommonDropDownList(); + } + + List _resp = new List(); + foreach (DataRow item in dt.Rows) + { + _resp.Add(new DropDownResponse + { + Id = Utilities.GetRowCellValue(item["Id"]), + Text = Utilities.GetRowCellValue(item["Text"]) + }); + } + + return new CommonDropDownList { DropDownResponse = _resp }; + } + catch (Exception ex) + { + _logger.LogError("TRANSACTIONREPOSITORY | GETRECEIVERLISTDDL | " + ex.Message); + + return new CommonDropDownList { DropDownResponse = new List() }; + } + } } } diff --git a/CustomerOnlineV2/CustomerOnlineV2/Controllers/TransactionController.cs b/CustomerOnlineV2/CustomerOnlineV2/Controllers/TransactionController.cs index 1d46eec..b8ac17c 100644 --- a/CustomerOnlineV2/CustomerOnlineV2/Controllers/TransactionController.cs +++ b/CustomerOnlineV2/CustomerOnlineV2/Controllers/TransactionController.cs @@ -313,5 +313,13 @@ namespace CustomerOnlineV2.Controllers var loginDetails = HttpContext.GetLoginDetails(); return await _transactionBusiness.GetReceiverListDetail(loginDetails, id); } + [HttpPost] + [ValidateAntiForgeryToken] + [Authorization("GetReceiverListDDL")] + public async Task GetReceiverListDDL(CommonDropDownModel model) + { + var loginDetails = HttpContext.GetLoginDetails(); + return await _transactionBusiness.GetReceiverListDDL(model, loginDetails); + } } } diff --git a/CustomerOnlineV2/CustomerOnlineV2/Views/Transaction/SendMoney.cshtml b/CustomerOnlineV2/CustomerOnlineV2/Views/Transaction/SendMoney.cshtml index c14432d..3e23e3d 100644 --- a/CustomerOnlineV2/CustomerOnlineV2/Views/Transaction/SendMoney.cshtml +++ b/CustomerOnlineV2/CustomerOnlineV2/Views/Transaction/SendMoney.cshtml @@ -309,10 +309,25 @@ $('#ReceivingCountry').change(function () { if ($(this).val() != '') { PopulateDDL('DeliveryMethod', 'pMode', $(this).val(), true, ''); - PopulateDDL('Receiver', 'receiverList', $(this).val(), true, ''); + // PopulateDDL('Receiver', 'receiverList', $(this).val(), true, ''); } else { $('#DeliveryMethod').empty(); + //$('#Receiver').empty(); + } + }); + + + $('#DeliveryMethod').change(function () { + + + + if ($(this).val() != '') { + + PopulateReceiverListDDL(); + } + else { + $('#Receiver').empty(); } }); @@ -745,5 +760,39 @@ }); } + function PopulateReceiverListDDL() { + + + let pmode = $('#DeliveryMethod option:selected').val(); + let pCountryid = $('#ReceivingCountry option:selected').val(); + + let Data = { + Flag: 'receiverListPMode', + Country: pCountryid, + Value: pmode, + + }; + + $.ajax( + { + type: 'POST', + url: '/Transaction/GetReceiverListDDL', + data: Data, + headers: { + "RequestVerificationToken": + $('input[name="__RequestVerificationToken"]').val() + }, + async: false, + success: function (response) { + PopulateDDLMain(response, 'Receiver', true, ''); + }, + error: function () { + return null; + } + }); + + } + + } \ No newline at end of file