using Business.Configuration; using Business.Customer; using Common.Helper; using JMEAgentSystem.Library; using Newtonsoft.Json; using Repository.DAO; using Repository.DAO.SendTxnIRHDao; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace JMEAgentSystem.WebPages.SendTxn { public partial class SendV1 : System.Web.UI.Page { private readonly ICustomerServices _customerServices = AutoFacContainer.Resolve(); private readonly StaticDataDdl _sdd = new StaticDataDdl(); private readonly SendTxnIRHDao st = new SendTxnIRHDao(); RemittanceDao _rdao = new RemittanceDao(); protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { try { populateDdl(); var methodName = GetStatic.ReadFormData("MethodName", ""); switch (methodName) { case "GetCustomerData": GetCustomerData(); break; case "SearchReceiver": SearchReceiverDetails(); break; case "PaymentModePcountry": LoadDataFromDdl("pMode"); break; case "loadAgentBank": LoadDataFromDdl("agentByPmode"); break; case "LoadCustomerRate": LoadCustomerRate(); break; case "PCurrPcountry": PCurrPcountry(); break; case "PAgentChange": GetAgentSetting(); break; } } catch (Exception ex) { } } } public void GetCustomerData() { string membershipId = Request.Form["MembershipId"]; var dt = _customerServices.LoadCustomerDataNew(GetStatic.GetUser(), membershipId, "getCustomerFromMembershipId", GetStatic.GetCountryId(), GetStatic.GetSettlingAgent()); if (dt == null) { Response.Write(""); Response.End(); return; } Response.ContentType = "text/plain"; //string json = _rdao.DataTableToJson(dt); Response.Write(JsonConvert.SerializeObject(dt)); Response.End(); } public void populateDdl() { LoadReceiverCountry(ref pCountry, "", "SELECT"); _sdd.SetDDL(ref sourceOfFund, "EXEC proc_online_dropDownList @flag='dropdownList',@user='" + GetStatic.GetUser() + "',@parentId=3900", "valueId", "detailTitle", "", "Select.."); _sdd.SetDDL(ref occupation, "EXEC proc_online_dropDownList @flag='occupationList',@user='" + GetStatic.GetUser() + "'", "valueId", "detailTitle", "", "Select.."); _sdd.SetDDL(ref relationship, "EXEC proc_online_dropDownList @flag='dropdownList',@user='" + GetStatic.GetUser() + "',@parentId=2100", "valueId", "detailTitle", "", "Select.."); _sdd.SetDDL(ref purpose, "EXEC proc_online_dropDownList @flag='dropdownList',@user='" + GetStatic.GetUser() + "',@parentId=3800", "valueId", "detailTitle", "8060", "Select.."); } private void SearchReceiverDetails() { string customerId = Request.Form["customerId"]; //var dt = st.LoadCustomerData(searchType, searchValue, "s", GetStatic.GetCountryId(), GetStatic.GetSettlingAgent()); var dt = st.LoadReceiverData(GetStatic.GetUser(), customerId); if (dt == null) { Response.Write(""); Response.End(); return; } Response.ContentType = "text/plain"; string json = _rdao.DataTableToJson(dt); Response.Write(json); Response.End(); } private void LoadDataFromDdl(string type) { var pAgentFv = Request.Form["pAgent"]; var pModeFv = Request.Form["pmode"]; var pCountryFv = Request.Form["pCountry"]; DataTable dt = null; switch (type) { case "pMode": dt = st.LoadDataFromDdl(GetStatic.GetCountryId(), pCountryFv, pModeFv, GetStatic.GetAgent(), "recModeByCountry", GetStatic.GetUser()); break; case "agentByPmode": if (string.IsNullOrWhiteSpace(pModeFv) || string.IsNullOrWhiteSpace(pCountryFv)) { Response.Write(null); Response.End(); return; } dt = st.LoadDataFromDdl(GetStatic.GetCountryId(), pCountryFv, pModeFv, GetStatic.GetAgent(), "recAgentByRecModeAjaxagent", GetStatic.GetUser()); break; case "LoadScheme": dt = st.LoadDataFromDdl(GetStatic.GetCountryId(), pCountryFv, pModeFv, pAgentFv, "schemeBysCountryrAgent", GetStatic.GetUser()); break; } Response.ContentType = "text/plain"; var json = _rdao.DataTableToJson(dt); Response.Write(json); Response.End(); } private void LoadCustomerRate() { var pCountryFv = GetStatic.ReadFormData("pCountry", ""); var pAgentFv = GetStatic.ReadFormData("pAgent", ""); var pModeFv = GetStatic.ReadFormData("pMode", ""); var collCurr = GetStatic.ReadFormData("collCurr", ""); var dt = st.LoadCustomerRate(GetStatic.GetUser() , GetStatic.GetCountryId() , GetStatic.GetSuperAgent() , GetStatic.GetAgent() , GetStatic.GetBranch() , collCurr , pCountryFv , pAgentFv , "" , pModeFv ); Response.ContentType = "text/plain"; var json = _rdao.DataTableToJson(dt); Response.Write(json); Response.End(); } private void PCurrPcountry() { string pCountry = Request.Form["pCountry"]; string pMode = Request.Form["pMode"]; string pAgent = Request.Form["pAgent"]; DataTable Dt = st.LoadPayCurr(pCountry, pMode, pAgent); Response.ContentType = "text/plain"; string json = _rdao.DataTableToJson(Dt); Response.Write(json); Response.End(); } private void GetAgentSetting() { var pAgentFv = Request.Form["pAgent"]; var pModeFv = Request.Form["pMode"]; var pCountryFv = GetStatic.ReadFormData("pCountry", ""); var pBankType = GetStatic.ReadFormData("pBankType", ""); var dt = st.GetAgentSetting(GetStatic.GetUser(), pCountryFv, pAgentFv, pModeFv, pBankType); Response.ContentType = "text/plain"; var json = _rdao.DataTableToJson(dt); Response.Write(json); Response.End(); } private void LoadReceiverCountry(ref DropDownList ddl, string defaultValue, string label) { var sql = "EXEC proc_sendPageLoadData @flag='pCountry',@countryId='" + GetStatic.GetCountryId() + "',@agentid='" + GetStatic.GetAgentId() + "'"; _sdd.SetDDL(ref ddl, sql, "countryId", "countryName", defaultValue, label); } } }