You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

195 lines
7.9 KiB

4 years ago
  1. using Business.Configuration;
  2. using Business.Customer;
  3. using Common.Helper;
  4. using JMEAgentSystem.Library;
  5. using Newtonsoft.Json;
  6. using Repository.DAO;
  7. using Repository.DAO.SendTxnIRHDao;
  8. using System;
  9. using System.Collections.Generic;
  10. using System.Data;
  11. using System.Linq;
  12. using System.Web;
  13. using System.Web.UI;
  14. using System.Web.UI.WebControls;
  15. namespace JMEAgentSystem.WebPages.SendTxn
  16. {
  17. public partial class SendV1 : System.Web.UI.Page
  18. {
  19. private readonly ICustomerServices _customerServices = AutoFacContainer.Resolve<ICustomerServices>();
  20. private readonly StaticDataDdl _sdd = new StaticDataDdl();
  21. private readonly SendTxnIRHDao st = new SendTxnIRHDao();
  22. RemittanceDao _rdao = new RemittanceDao();
  23. protected void Page_Load(object sender, EventArgs e)
  24. {
  25. if (!IsPostBack)
  26. {
  27. try
  28. {
  29. populateDdl();
  30. var methodName = GetStatic.ReadFormData("MethodName", "");
  31. switch (methodName)
  32. {
  33. case "GetCustomerData":
  34. GetCustomerData();
  35. break;
  36. case "SearchReceiver":
  37. SearchReceiverDetails();
  38. break;
  39. case "PaymentModePcountry":
  40. LoadDataFromDdl("pMode");
  41. break;
  42. case "loadAgentBank":
  43. LoadDataFromDdl("agentByPmode");
  44. break;
  45. case "LoadCustomerRate":
  46. LoadCustomerRate();
  47. break;
  48. case "PCurrPcountry":
  49. PCurrPcountry();
  50. break;
  51. case "PAgentChange":
  52. GetAgentSetting();
  53. break;
  54. }
  55. }
  56. catch (Exception ex)
  57. {
  58. }
  59. }
  60. }
  61. public void GetCustomerData()
  62. {
  63. string membershipId = Request.Form["MembershipId"];
  64. var dt = _customerServices.LoadCustomerDataNew(GetStatic.GetUser(), membershipId, "getCustomerFromMembershipId", GetStatic.GetCountryId(), GetStatic.GetSettlingAgent());
  65. if (dt == null)
  66. {
  67. Response.Write("");
  68. Response.End();
  69. return;
  70. }
  71. Response.ContentType = "text/plain";
  72. //string json = _rdao.DataTableToJson(dt);
  73. Response.Write(JsonConvert.SerializeObject(dt));
  74. Response.End();
  75. }
  76. public void populateDdl()
  77. {
  78. LoadReceiverCountry(ref pCountry, "", "SELECT");
  79. _sdd.SetDDL(ref sourceOfFund, "EXEC proc_online_dropDownList @flag='dropdownList',@user='" + GetStatic.GetUser() + "',@parentId=3900", "valueId", "detailTitle", "", "Select..");
  80. _sdd.SetDDL(ref occupation, "EXEC proc_online_dropDownList @flag='occupationList',@user='" + GetStatic.GetUser() + "'", "valueId", "detailTitle", "", "Select..");
  81. _sdd.SetDDL(ref relationship, "EXEC proc_online_dropDownList @flag='dropdownList',@user='" + GetStatic.GetUser() + "',@parentId=2100", "valueId", "detailTitle", "", "Select..");
  82. _sdd.SetDDL(ref purpose, "EXEC proc_online_dropDownList @flag='dropdownList',@user='" + GetStatic.GetUser() + "',@parentId=3800", "valueId", "detailTitle", "8060", "Select..");
  83. }
  84. private void SearchReceiverDetails()
  85. {
  86. string customerId = Request.Form["customerId"];
  87. //var dt = st.LoadCustomerData(searchType, searchValue, "s", GetStatic.GetCountryId(), GetStatic.GetSettlingAgent());
  88. var dt = st.LoadReceiverData(GetStatic.GetUser(), customerId);
  89. if (dt == null)
  90. {
  91. Response.Write("");
  92. Response.End();
  93. return;
  94. }
  95. Response.ContentType = "text/plain";
  96. string json = _rdao.DataTableToJson(dt);
  97. Response.Write(json);
  98. Response.End();
  99. }
  100. private void LoadDataFromDdl(string type)
  101. {
  102. var pAgentFv = Request.Form["pAgent"];
  103. var pModeFv = Request.Form["pmode"];
  104. var pCountryFv = Request.Form["pCountry"];
  105. DataTable dt = null;
  106. switch (type)
  107. {
  108. case "pMode":
  109. dt = st.LoadDataFromDdl(GetStatic.GetCountryId(), pCountryFv, pModeFv, GetStatic.GetAgent(), "recModeByCountry", GetStatic.GetUser());
  110. break;
  111. case "agentByPmode":
  112. if (string.IsNullOrWhiteSpace(pModeFv) || string.IsNullOrWhiteSpace(pCountryFv))
  113. {
  114. Response.Write(null);
  115. Response.End();
  116. return;
  117. }
  118. dt = st.LoadDataFromDdl(GetStatic.GetCountryId(), pCountryFv, pModeFv, GetStatic.GetAgent(), "recAgentByRecModeAjaxagent", GetStatic.GetUser());
  119. break;
  120. case "LoadScheme":
  121. dt = st.LoadDataFromDdl(GetStatic.GetCountryId(), pCountryFv, pModeFv, pAgentFv, "schemeBysCountryrAgent", GetStatic.GetUser());
  122. break;
  123. }
  124. Response.ContentType = "text/plain";
  125. var json = _rdao.DataTableToJson(dt);
  126. Response.Write(json);
  127. Response.End();
  128. }
  129. private void LoadCustomerRate()
  130. {
  131. var pCountryFv = GetStatic.ReadFormData("pCountry", "");
  132. var pAgentFv = GetStatic.ReadFormData("pAgent", "");
  133. var pModeFv = GetStatic.ReadFormData("pMode", "");
  134. var collCurr = GetStatic.ReadFormData("collCurr", "");
  135. var dt = st.LoadCustomerRate(GetStatic.GetUser()
  136. , GetStatic.GetCountryId()
  137. , GetStatic.GetSuperAgent()
  138. , GetStatic.GetAgent()
  139. , GetStatic.GetBranch()
  140. , collCurr
  141. , pCountryFv
  142. , pAgentFv
  143. , ""
  144. , pModeFv
  145. );
  146. Response.ContentType = "text/plain";
  147. var json = _rdao.DataTableToJson(dt);
  148. Response.Write(json);
  149. Response.End();
  150. }
  151. private void PCurrPcountry()
  152. {
  153. string pCountry = Request.Form["pCountry"];
  154. string pMode = Request.Form["pMode"];
  155. string pAgent = Request.Form["pAgent"];
  156. DataTable Dt = st.LoadPayCurr(pCountry, pMode, pAgent);
  157. Response.ContentType = "text/plain";
  158. string json = _rdao.DataTableToJson(Dt);
  159. Response.Write(json);
  160. Response.End();
  161. }
  162. private void GetAgentSetting()
  163. {
  164. var pAgentFv = Request.Form["pAgent"];
  165. var pModeFv = Request.Form["pMode"];
  166. var pCountryFv = GetStatic.ReadFormData("pCountry", "");
  167. var pBankType = GetStatic.ReadFormData("pBankType", "");
  168. var dt = st.GetAgentSetting(GetStatic.GetUser(), pCountryFv, pAgentFv, pModeFv, pBankType);
  169. Response.ContentType = "text/plain";
  170. var json = _rdao.DataTableToJson(dt);
  171. Response.Write(json);
  172. Response.End();
  173. }
  174. private void LoadReceiverCountry(ref DropDownList ddl, string defaultValue, string label)
  175. {
  176. var sql = "EXEC proc_sendPageLoadData @flag='pCountry',@countryId='" + GetStatic.GetCountryId() + "',@agentid='" + GetStatic.GetAgentId() + "'";
  177. _sdd.SetDDL(ref ddl, sql, "countryId", "countryName", defaultValue, label);
  178. }
  179. }
  180. }