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.

1623 lines
66 KiB

  1. using Newtonsoft.Json;
  2. using Swift.API.Common;
  3. using Swift.API.Common.ExRate;
  4. using Swift.API.ThirdPartyApiServices;
  5. using Swift.DAL.BL.AgentPanel.Send;
  6. using Swift.DAL.Common;
  7. using Swift.DAL.Remittance;
  8. using Swift.DAL.Remittance.CustomerDeposits;
  9. using Swift.DAL.SwiftDAL;
  10. using Swift.web.Library;
  11. using System;
  12. using System.Collections.Generic;
  13. using System.Data;
  14. using System.Text;
  15. using System.Threading;
  16. using System.Web;
  17. using System.Web.Script.Serialization;
  18. using System.Web.UI.WebControls;
  19. namespace Swift.web.AgentNew.SendTxn
  20. {
  21. public partial class SendV2 : System.Web.UI.Page
  22. {
  23. private SendTranIRHDao st = new SendTranIRHDao();
  24. private readonly CustomerDepositDao _dao = new CustomerDepositDao();
  25. private readonly StaticDataDdl _sdd = new StaticDataDdl();
  26. private readonly ApplicationLogsDao _ald = new ApplicationLogsDao();
  27. private const string ViewFunctionId = "40101400";
  28. private const string ManualEditServiceCharge = "40101440";
  29. private const string NewReceiverId = "20213000";
  30. private const string AllowOnBehalf = "40101420";
  31. private const string EnableCustomerSignature = "40101430";
  32. protected string IsAllowOnBehalf = "N";
  33. protected string LogginBranch = "";
  34. protected void Page_Load(object sender, EventArgs e)
  35. {
  36. Authenticate();
  37. txtSendIdValidDate_err.Visible = false;
  38. if (_sdd.HasRight(AllowOnBehalf))
  39. {
  40. IsAllowOnBehalf = "Y";
  41. }
  42. else
  43. {
  44. LogginBranch = GetStatic.GetSettlingAgent() + "|" + GetStatic.ReadSession("isActAsBranch", "N");
  45. }
  46. _sdd.CheckSession();
  47. GetStatic.PrintMessage(Page);
  48. txtCollAmt.Attributes.Add("onkeyup", "return CalcOnEnter((event?event:evt));");
  49. txtRewardAmt.Attributes.Add("onkeyup", "return CalcOnEnter((event?event:evt));");
  50. string reqMethod = Request.Form["MethodName"];
  51. if (!string.IsNullOrEmpty(reqMethod))
  52. {
  53. if (GetStatic.GetUser() == "")
  54. {
  55. Response.ContentType = "text/plain";
  56. Response.Write("[{\"session_end\":\"1\"}]");
  57. Response.End();
  58. return;
  59. }
  60. }
  61. if (String.IsNullOrEmpty(reqMethod))
  62. {
  63. //GetCurrentBalance();
  64. Misc.MakeNumericTextbox(ref txtCollAmt);
  65. Misc.MakeNumericTextbox(ref txtPayAmt);
  66. }
  67. if (!Page.IsPostBack)
  68. {
  69. #region Ajax methods
  70. hdnAgentUser.Value = GetStatic.GetUser();
  71. switch (reqMethod)
  72. {
  73. case "SearchCustomer":
  74. CustomerSearchLoadData();
  75. break;
  76. case "SaveCDDI":
  77. SaveCDDI();
  78. break;
  79. case "getPayoutPartner":
  80. GetPayoutPartner();
  81. break;
  82. case "getPayoutPartnerSel":
  83. GetPayoutPartnerSel();
  84. break;
  85. case "SearchReceiver":
  86. SearchReceiverDetails();
  87. break;
  88. case "PopulateReceiverDDL":
  89. PopulateReceiverDDL();
  90. break;
  91. case "getLocation":
  92. GetLocationData();
  93. break;
  94. case "getExRateList":
  95. // GetExRateList();
  96. GetExRateListNew();
  97. break;
  98. case "getSubLocation":
  99. GetSubLocationData();
  100. break;
  101. case "getTownLocation":
  102. GetTownLocation();
  103. break;
  104. case "SearchRateScData":
  105. SearchRateScData();
  106. break;
  107. case "PaymentModePcountry":
  108. LoadDataFromDdl("pMode");
  109. break;
  110. case "PCurrPcountry":
  111. PCurrPcountry();
  112. break;
  113. case "CalculateTxn":
  114. Calculate();
  115. break;
  116. case "ReceiverDetailBySender":
  117. PopulateReceiverBySender();
  118. break;
  119. case "loadAgentBank":
  120. LoadDataFromDdl("agentByPmode");
  121. break;
  122. case "PAgentChange":
  123. GetAgentSetting();
  124. break;
  125. case "PBranchChange":
  126. LoadAgentByExtBranch();
  127. break;
  128. case "LoadAgentByExtAgent":
  129. LoadAgentByExtAgent();
  130. break;
  131. case "LoadSchemeByRcountry":
  132. LoadSchemeByRCountry();
  133. break;
  134. case "LoadCustomerRate":
  135. LoadCustomerRate();
  136. break;
  137. case "CheckSenderIdNumber":
  138. CheckSenderIdNumber();
  139. break;
  140. case "CheckAvialableBalance":
  141. CheckAvialableBalance();
  142. break;
  143. case "getPayerDataByBankId":
  144. GetPayerDataByBankId();
  145. break;
  146. case "getAvailableBalance":
  147. GetCurrentBalance();
  148. break;
  149. case "validateReferral":
  150. ValidateReferral();
  151. break;
  152. case "getPayerBranchDataByPayerAndCityId":
  153. GetPayerDataByPayerAndCityId();
  154. break;
  155. case "getReferralBalance":
  156. GetReferralBalance();
  157. break;
  158. case "getListData":
  159. PopulateData();
  160. break;
  161. case "MapData":
  162. ProceedMapData();
  163. break;
  164. case "getAdditionalCDDI":
  165. GetAdditionalCDDI();
  166. break;
  167. case "PopulateBranch":
  168. GetBankBranch();
  169. break;
  170. case "UnMapData":
  171. UnMapData();
  172. break;
  173. case "UpdateVisaStatus":
  174. UpdateVisaStatus();
  175. break;
  176. case "UpdateAdditionalAddress":
  177. UpdateAdditionalAddress();
  178. break;
  179. case "LoadPayoutPartner":
  180. LoadPayoutPartner();
  181. break;
  182. case "AccountValidation":
  183. AccountValidation();
  184. break;
  185. case "insertAddDocLog":
  186. InsertAdditionalDocumentLog();
  187. break;
  188. //case "checkAgentQuota":
  189. // CheckAgentQuota("customerId");
  190. // break;
  191. }
  192. #endregion Ajax methods
  193. PopulateDdl();
  194. GetRequiredField();
  195. }
  196. }
  197. private void AccountValidation()
  198. {
  199. ExchangeRateAPIService tpApiService = new ExchangeRateAPIService();
  200. string bankId = Request.Form["bankId"];
  201. AccountValidateModel _request = new AccountValidateModel
  202. {
  203. UserName = GetStatic.GetUser(),
  204. ProviderId = Request.Form["providerId"],
  205. AccountNumber = Request.Form["accountNumber"],
  206. BankCode = Request.Form["bankCode"],
  207. ReceiverName = Request.Form["receiverName"]
  208. };
  209. if (!string.IsNullOrEmpty(_request.ProviderId) && _request.ProviderId.Equals("394414"))
  210. {
  211. string pMode = Request.Form["pAVMode"];
  212. _request.PaymentMode = pMode.Equals("2") ? "AC" : "MW";
  213. }
  214. DbResult dbResult = st.GetPartnerBankCode(GetStatic.GetUser(), _request.ProviderId, bankId, Request.Form["pCountry"]);
  215. JsonResponse res = new JsonResponse();
  216. if (dbResult.ErrorCode == "0")
  217. {
  218. _request.BankCode = dbResult.Id;
  219. _request.ProviderId = dbResult.Extra;
  220. res = tpApiService.AccountValidationTP(_request);
  221. }
  222. else
  223. {
  224. res.SetResponse(dbResult.ErrorCode, dbResult.Msg, dbResult.Id);
  225. }
  226. GetStatic.JsonResponse(res, this);
  227. }
  228. private void LoadPayoutPartner()
  229. {
  230. string pCountry = Request.Form["pCountry"];
  231. string pMode = Request.Form["pMode"];
  232. DataTable Dt = st.LoadPayoutPartner(pCountry, pMode);
  233. Response.ContentType = "text/plain";
  234. string json = DataTableToJson(Dt);
  235. Response.Write(json);
  236. Response.End();
  237. }
  238. private void GetExRateList()
  239. {
  240. string pCountry = Request.Form["PCountry"];
  241. var dt = st.GetExRateList(GetStatic.GetUser(), pCountry);
  242. if (dt == null)
  243. {
  244. Response.Write("");
  245. Response.End();
  246. return;
  247. }
  248. Response.ContentType = "text/plain";
  249. string json = DataTableToJson(dt);
  250. Response.Write(json);
  251. Response.End();
  252. }
  253. private void GetExRateListNew()
  254. {
  255. ExRateRequest exRate = new ExRateRequest();
  256. ExchangeRateAPIService ExService = new ExchangeRateAPIService();
  257. string pCountry = Request.Form["PCountry"];
  258. var dt = st.GetExRateListNew(GetStatic.GetUser(), pCountry);
  259. foreach (DataRow item in dt.Rows)
  260. {
  261. if ( item["ISREALTIME"].ToString().ToLower() == "true")
  262. {
  263. exRate.UserName = GetStatic.GetUser();
  264. exRate.isExRateCalcByPartner = true;
  265. exRate.CalcBy = "P";
  266. exRate.SCountry = GetStatic.GetCountryId();
  267. exRate.SSuperAgent = GetStatic.GetSuperAgent();
  268. exRate.SAgent = GetStatic.GetAgent();
  269. exRate.SBranch = GetStatic.GetBranch();
  270. exRate.CollCurrency = "JPY";
  271. exRate.pCountryCode = item["P_COUNTRY_CODE"].ToString();
  272. exRate.payerName = item["PAYER_DETAIL"].ToString();
  273. string ProcessId = Guid.NewGuid().ToString().Replace("-", "") + ":transfast:exRate-core";
  274. exRate.RequestedBy = "core";
  275. exRate.PCountry = item["P_COUNTRY_ID"].ToString();
  276. exRate.ServiceType = Request.Form["pMode"];
  277. exRate.PaymentType = Request.Form["pModetxt"];
  278. exRate.SCurrency = "JPY";
  279. exRate.PCurrency = item["P_curr"].ToString();
  280. exRate.ProviderId = item["P_AGENT_ID"].ToString();
  281. exRate.ProcessId = ProcessId.Substring(ProcessId.Length - 40, 40);
  282. JsonResponse res = ExService.GetExchangeRate(exRate);
  283. ExRateResponse _exrate = (ExRateResponse)res.Data;
  284. var margin = Convert.ToDouble(item["MARGIN"].ToString());
  285. var exrate = Convert.ToDouble(_exrate.exRate);
  286. var customerRate = exrate - margin;
  287. item["Customer_Rate"] = customerRate;
  288. }
  289. }
  290. if (dt == null)
  291. {
  292. Response.Write("");
  293. Response.End();
  294. return;
  295. }
  296. Response.ContentType = "text/plain";
  297. string json = DataTableToJson(dt);
  298. Response.Write(json);
  299. Response.End();
  300. }
  301. private void SaveCDDI()
  302. {
  303. DbResult _dbRes = new DbResult
  304. {
  305. ErrorCode = "0"
  306. };
  307. string relation = Request.Form["relation"];
  308. string relationText = Request.Form["relationText"];
  309. string relationOther = Request.Form["relationOther"];
  310. string purpose = Request.Form["purpose"];
  311. string purposeText = Request.Form["purposeText"];
  312. string purposeOther = Request.Form["purposeOther"];
  313. string visaStatus = Request.Form["visaStatus"];
  314. string occupation = Request.Form["occupation"];
  315. string occupationText = Request.Form["occupationText"];
  316. string occupationOther = Request.Form["occupationOther"];
  317. string goodsType = Request.Form["goodsType"];
  318. string goodsOrigin = Request.Form["goodsOrigin"];
  319. string portOfShipment = Request.Form["portofShipment"];
  320. string customerId = Request.Form["customerId"];
  321. string rid = Request.Form["rid"];
  322. if (string.IsNullOrEmpty(customerId))
  323. {
  324. _dbRes.SetError("1", "Invalid or empty customer!", null);
  325. }
  326. if (string.IsNullOrEmpty(relation) || string.IsNullOrEmpty(purpose) || string.IsNullOrEmpty(visaStatus) || string.IsNullOrEmpty(occupation))
  327. {
  328. _dbRes.SetError("1", "Required fields are empty!", null);
  329. }
  330. if (relationText.ToLower() == "other (please specify)" && string.IsNullOrEmpty(relationOther))
  331. {
  332. _dbRes.SetError("1", "Relation other field can not be empty!", null);
  333. }
  334. if (purposeText.ToLower() == "other (please specify)" && string.IsNullOrEmpty(purposeOther))
  335. {
  336. _dbRes.SetError("1", "Purpose other field can not be empty!", null);
  337. }
  338. if (occupationText.ToLower() == "other (please specify)" && string.IsNullOrEmpty(occupationOther))
  339. {
  340. _dbRes.SetError("1", "Occupation other field can not be empty!", null);
  341. }
  342. if (purposeText.ToLower() == "payment of import good" && string.IsNullOrEmpty(goodsType))
  343. {
  344. _dbRes.SetError("1", "Goods Detail fields can not be empty!", null);
  345. }
  346. if (purposeText.ToLower() == "payment of import good" && string.IsNullOrEmpty(goodsOrigin))
  347. {
  348. _dbRes.SetError("1", "Goods Detail fields can not be empty!", null);
  349. }
  350. if (purposeText.ToLower() == "payment of import good" && string.IsNullOrEmpty(portOfShipment))
  351. {
  352. _dbRes.SetError("1", "Goods Detail fields can not be empty!", null);
  353. }
  354. if (_dbRes.ErrorCode == "0")
  355. {
  356. _dbRes = st.UpdateCustomerCDDI(GetStatic.GetUser(), relation, relationOther, purpose, purposeOther
  357. , visaStatus, occupation, occupationOther, rid, customerId, goodsType, goodsOrigin, portOfShipment);
  358. }
  359. GetStatic.JsonResponse(_dbRes, this);
  360. }
  361. protected void GetBankBranch()
  362. {
  363. string bank = Request.Form["Bank"];
  364. string Country = Request.Form["Country"];
  365. string searchText = Request.Form["searchText"];
  366. string page = Request.Form["page"];
  367. if (string.IsNullOrWhiteSpace(bank))
  368. {
  369. GetStatic.JsonResponse("", this);
  370. }
  371. BankSearchModel bankSearchModel = new BankSearchModel()
  372. {
  373. SearchType = "",
  374. SearchValue = searchText,
  375. PAgent = bank,
  376. PAgentType = "I",
  377. PCountryName = Country,
  378. PayoutPartner = Request.Form["payoutPartner"],
  379. PaymentMode = Request.Form["PayMode"]
  380. };
  381. IList<BranchModel> bankModelList = st.LoadBranchByAgent(bankSearchModel);
  382. GetStatic.JsonResponse(bankModelList, this);
  383. //JsonSerialize(bankModelList);
  384. }
  385. protected void GetAdditionalCDDI()
  386. {
  387. string customerId = Request.Form["customerId"];
  388. string isOnlyVisaStatusQuestionnaire = Request.Form["IsOnlyVisaStatusQuestionnaire"];
  389. //var dt = st.LoadCustomerData(searchType, searchValue, "s", GetStatic.GetCountryId(), GetStatic.GetSettlingAgent());
  390. var dt = st.GetAdditionalCDDIInfo(GetStatic.GetUser(), customerId, isOnlyVisaStatusQuestionnaire);
  391. if (dt == null)
  392. {
  393. Response.Write("");
  394. Response.End();
  395. return;
  396. }
  397. Response.ContentType = "text/plain";
  398. string json = DataTableToJson(dt);
  399. Response.Write(json);
  400. Response.End();
  401. }
  402. protected string GetCustomerId()
  403. {
  404. return GetStatic.ReadQueryString("customerId", "");
  405. }
  406. private void GetPayoutPartner()
  407. {
  408. string pCountry = Request.Form["pCountry"];
  409. string pMode = Request.Form["pMode"];
  410. //var dt = st.LoadCustomerData(searchType, searchValue, "s", GetStatic.GetCountryId(), GetStatic.GetSettlingAgent());
  411. var dt = st.GetPayoutPartner(GetStatic.GetUser(), pCountry, pMode);
  412. if (dt == null)
  413. {
  414. Response.Write("");
  415. Response.End();
  416. return;
  417. }
  418. Response.ContentType = "text/plain";
  419. string json = DataTableToJson(dt);
  420. Response.Write(json);
  421. Response.End();
  422. }
  423. private void GetPayoutPartnerSel()
  424. {
  425. string pCountry = Request.Form["pCountry"];
  426. string partner = Request.Form["Partner"];
  427. string pMode = Request.Form["pMode"];
  428. //var dt = st.LoadCustomerData(searchType, searchValue, "s", GetStatic.GetCountryId(), GetStatic.GetSettlingAgent());
  429. var dt = st.GetPayoutPartnerSel(GetStatic.GetUser(), pCountry, pMode, partner);
  430. if (dt == null)
  431. {
  432. Response.Write("");
  433. Response.End();
  434. return;
  435. }
  436. Response.ContentType = "text/plain";
  437. string json = DataTableToJson(dt);
  438. Response.Write(json);
  439. Response.End();
  440. }
  441. private void SearchReceiverDetails()
  442. {
  443. string customerId = Request.Form["customerId"];
  444. string partnerId = Request.Form["partnerId"];
  445. //var dt = st.LoadCustomerData(searchType, searchValue, "s", GetStatic.GetCountryId(), GetStatic.GetSettlingAgent());
  446. var dt = st.LoadReceiverData(GetStatic.GetUser(), customerId, partnerId);
  447. if (dt == null)
  448. {
  449. Response.Write("");
  450. Response.End();
  451. return;
  452. }
  453. Response.ContentType = "text/plain";
  454. string json = DataTableToJson(dt);
  455. Response.Write(json);
  456. Response.End();
  457. }
  458. private void PopulateReceiverDDL()
  459. {
  460. string customerId = Request.Form["customerId"];
  461. //var dt = st.LoadCustomerData(searchType, searchValue, "s", GetStatic.GetCountryId(), GetStatic.GetSettlingAgent());
  462. var dt = st.PopulateReceiverDDL(GetStatic.GetUser(), customerId);
  463. if (dt == null)
  464. {
  465. Response.Write("");
  466. Response.End();
  467. return;
  468. }
  469. Response.ContentType = "text/plain";
  470. string json = DataTableToJson(dt);
  471. Response.Write(json);
  472. Response.End();
  473. }
  474. private void GetSubLocationData()
  475. {
  476. string pLocation = Request.Form["PLocation"];
  477. DataTable dt = st.GetPayoutSubLocation(pLocation);
  478. Response.ContentType = "text/plain";
  479. var json = DataTableToJson(dt);
  480. Response.Write(json);
  481. Response.End();
  482. }
  483. private void GetTownLocation()
  484. {
  485. string subLocation = Request.Form["subLocation"];
  486. DataTable dt = st.GetPayoutTownLocation(subLocation);
  487. Response.ContentType = "text/plain";
  488. var json = DataTableToJson(dt);
  489. Response.Write(json);
  490. Response.End();
  491. }
  492. private void GetLocationData()
  493. {
  494. string pCountry = Request.Form["PCountry"];
  495. string pMode = Request.Form["PMode"];
  496. string partnerId = Request.Form["PartnerId"];
  497. DataTable dt = st.GetPayoutLocation(pCountry, pMode, partnerId);
  498. Response.ContentType = "text/plain";
  499. var json = DataTableToJson(dt);
  500. Response.Write(json);
  501. Response.End();
  502. }
  503. protected string sb = "";
  504. private void Authenticate()
  505. {
  506. _sdd.CheckAuthentication(ViewFunctionId);
  507. if (_sdd.HasRight(ManualEditServiceCharge))
  508. {
  509. editServiceCharge.Disabled = false;
  510. allowEditSC.Value = "Y";
  511. }
  512. else
  513. {
  514. allowEditSC.Value = "N";
  515. editServiceCharge.Disabled = true;
  516. lblServiceChargeAmt.Attributes.Add("readonly", "readonly");
  517. }
  518. }
  519. private void GetRequiredField()
  520. {
  521. var ds = st.GetRequiredField(GetStatic.GetCountryId(), GetStatic.GetAgent());
  522. if (ds == null)
  523. return;
  524. var dr = ds.Tables[0].Rows[0];
  525. //if (null != ds.Tables[1])
  526. //{
  527. // ManageCollMode(ds.Tables[1]);
  528. //}
  529. //Sender ID
  530. ddSenIdType_err.Visible = false;
  531. txtSendIdNo_err.Visible = false;
  532. switch (dr["id"].ToString())
  533. {
  534. case "H":
  535. trSenId.Attributes.Add("style", "display: none;");
  536. break;
  537. case "M":
  538. ddSenIdType.Attributes.Add("Class", "required");
  539. txtSendIdNo.Attributes.Add("Class", "required");
  540. ddSenIdType_err.Visible = true;
  541. txtSendIdNo_err.Visible = true;
  542. break;
  543. }
  544. //Sender ID Expiry Date
  545. //txtSendIdValidDate_err.Visible = false;
  546. switch (dr["iDValidDate"].ToString())
  547. {
  548. case "H":
  549. tdSenExpDateLbl.Attributes.Add("style", "display: none;");
  550. tdSenExpDateTxt.Attributes.Add("style", "display: none;");
  551. //Sender DOB
  552. txtSendDOB_err.Visible = false;
  553. switch (dr["dob"].ToString())
  554. {
  555. case "H":
  556. tdSenDobLbl.Attributes.Add("style", "display: none;");
  557. tdSenDobTxt.Attributes.Add("style", "display: none;");
  558. break;
  559. case "M":
  560. lblSDOB.Visible = true;
  561. txtSendDOB.Attributes.Add("Class", "required");
  562. txtSendDOB_err.Visible = true;
  563. break;
  564. }
  565. break;
  566. case "M":
  567. txtSendIdValidDate.Attributes.Add("Class", "required");
  568. //Sender DOB
  569. txtSendDOB_err.Visible = false;
  570. switch (dr["dob"].ToString())
  571. {
  572. case "H":
  573. tdSenDobLbl.Attributes.Add("style", "display: none;");
  574. tdSenDobTxt.Attributes.Add("style", "display: none;");
  575. break;
  576. case "M":
  577. lblSDOB.Visible = true;
  578. txtSendDOB.Attributes.Add("Class", "required");
  579. txtSendDOB_err.Visible = true;
  580. break;
  581. }
  582. break;
  583. default:
  584. //Sender DOB
  585. txtSendDOB_err.Visible = false;
  586. switch (dr["dob"].ToString())
  587. {
  588. case "H":
  589. tdSenDobLbl.Attributes.Add("style", "display: none;");
  590. tdSenDobTxt.Attributes.Add("style", "display: none;");
  591. break;
  592. case "M":
  593. lblSDOB.Visible = true;
  594. txtSendDOB.Attributes.Add("Class", "required");
  595. txtSendDOB_err.Visible = true;
  596. break;
  597. }
  598. break;
  599. }
  600. //Sender Mobile
  601. txtSendMobile_err.Visible = false;
  602. switch (dr["contact"].ToString())
  603. {
  604. case "H":
  605. trSenContactNo.Attributes.Add("style", "display: none;");
  606. break;
  607. case "M":
  608. txtSendMobile.Attributes.Add("Class", "required");
  609. txtSendMobile_err.Visible = true;
  610. break;
  611. }
  612. //Sender City
  613. txtSendCity_err.Visible = false;
  614. switch (dr["city"].ToString())
  615. {
  616. case "H":
  617. tdSenCityLbl.Attributes.Add("style", "display: none;");
  618. tdSenCityTxt.Attributes.Add("style", "display: none;");
  619. break;
  620. case "M":
  621. lblsCity.Visible = true;
  622. txtSendCity.Attributes.Add("Class", "required");
  623. txtSendCity_err.Visible = true;
  624. break;
  625. }
  626. //Sender Address1
  627. txtSendAdd1_err.Visible = false;
  628. switch (dr["address"].ToString())
  629. {
  630. case "H":
  631. trSenAddress1.Attributes.Add("style", "display: none;");
  632. trSenAddress2.Attributes.Add("style", "display: none;");
  633. break;
  634. case "M":
  635. txtSendAdd1.Attributes.Add("class", "required");
  636. txtSendAdd1_err.Visible = true;
  637. break;
  638. }
  639. occupation_err.Visible = false;
  640. switch (dr["occupation"].ToString())
  641. {
  642. case "H":
  643. trOccupation.Attributes.Add("style", "display: none;");
  644. break;
  645. case "M":
  646. lblOccupation.Visible = true;
  647. occupation.Attributes.Add("Class", "required");
  648. occupation_err.Visible = true;
  649. break;
  650. }
  651. companyName_err.Visible = false;
  652. switch (dr["company"].ToString())
  653. {
  654. case "H":
  655. trSenCompany.Attributes.Add("style", "display: none;");
  656. break;
  657. case "M":
  658. companyName.Attributes.Add("Class", "required");
  659. lblCompName.Visible = true;
  660. companyName_err.Visible = true;
  661. break;
  662. }
  663. //Sender Salary
  664. //ddlSalary_err.Visible = false;
  665. //switch (dr["salaryRange"].ToString())
  666. //{
  667. // case "M":
  668. // lblSalaryRange.Visible = true;
  669. // ddlSalary.Attributes.Add("Class", "required");
  670. // ddlSalary_err.Visible = true;
  671. // break;
  672. // case "H":
  673. // ddlSalary.Attributes.Add("Class", "HideControl");
  674. // lblSalaryRange.Visible = false;
  675. // trSalaryRange.Visible = false;
  676. // break;
  677. //}
  678. purpose_err.Visible = false;
  679. switch (dr["purposeofRemittance"].ToString())
  680. {
  681. case "H":
  682. trPurposeOfRemittance.Attributes.Add("style", "display: none;");
  683. break;
  684. case "M":
  685. purpose.Attributes.Add("Class", "required");
  686. purpose_err.Visible = true;
  687. break;
  688. }
  689. sourceOfFund_err.Visible = false;
  690. switch (dr["sourceofFund"].ToString())
  691. {
  692. case "H":
  693. trSourceOfFund.Attributes.Add("style", "display: none;");
  694. break;
  695. case "M":
  696. lblSof.Visible = true;
  697. sourceOfFund.Attributes.Add("Class", "required");
  698. sourceOfFund_err.Visible = true;
  699. break;
  700. }
  701. //Receiver ID
  702. ddlRecIdType_err.Attributes.Add("style", "display: none;");
  703. txtRecIdNo_err.Attributes.Add("style", "display: none;");
  704. switch (dr["rId"].ToString())
  705. {
  706. case "H":
  707. trRecId.Attributes.Add("style", "display: none;");
  708. trRecId1.Attributes.Add("style", "display: none;");
  709. break;
  710. case "M":
  711. ddlRecIdType.Attributes.Add("Class", "required");
  712. txtRecIdNo.Attributes.Add("Class", "required");
  713. ddlRecIdType_err.Attributes.Add("style", "display: block;");
  714. txtRecIdNo_err.Attributes.Add("style", "display: block;");
  715. break;
  716. }
  717. //Receiver Mobile
  718. txtRecMobile_err.Attributes.Add("style", "display: none;");
  719. switch (dr["rContact"].ToString())
  720. {
  721. case "H":
  722. trRecContactNo.Attributes.Add("style", "display: none;");
  723. break;
  724. case "M":
  725. txtRecMobile.Attributes.Add("Class", "required");
  726. txtRecMobile_err.Attributes.Remove("style");
  727. break;
  728. }
  729. //Receiver City
  730. txtRecCity_err.Visible = false;
  731. switch (dr["rcity"].ToString())
  732. {
  733. case "H":
  734. tdRecCityLbl.Attributes.Add("style", "display: none;");
  735. tdRecCityTxt.Attributes.Add("style", "display: none;");
  736. break;
  737. case "M":
  738. txtRecCity.Attributes.Add("Class", "required");
  739. txtRecCity_err.Visible = true;
  740. break;
  741. }
  742. //Receiver Address
  743. txtRecAdd1_err.Visible = false;
  744. switch (dr["raddress"].ToString())
  745. {
  746. case "H":
  747. trRecAddress1.Attributes.Add("style", "display: none;");
  748. trRecAddress2.Attributes.Add("style", "display: none;");
  749. break;
  750. case "M":
  751. txtRecAdd1.Attributes.Add("class", "required");
  752. txtRecAdd1_err.Visible = true;
  753. break;
  754. }
  755. relationship_err.Visible = false;
  756. switch (dr["rRelationShip"].ToString())
  757. {
  758. case "H":
  759. trRelWithRec.Attributes.Add("style", "display: none;");
  760. break;
  761. case "M":
  762. relationship.Attributes.Add("Class", "required");
  763. relationship_err.Visible = true;
  764. break;
  765. }
  766. hdnBeneficiaryIdReq.Value = dr["rId"].ToString();
  767. hdnBeneficiaryContactReq.Value = dr["rContact"].ToString();
  768. hdnRelationshipReq.Value = dr["rRelationShip"].ToString();
  769. }
  770. //private void ManageCollMode(DataTable dt)
  771. //{
  772. // StringBuilder sb = new StringBuilder();
  773. // foreach (DataRow item in dt.Rows)
  774. // {
  775. // string checkedOrNot = item["ISDEFAULT"].ToString() == "1" ? "checked=\"checked\"" : "";
  776. // sb.AppendLine("<input " + checkedOrNot + " type=\"checkbox\" id=\"" + item["COLLMODE"] + "\" name=\"chkCollMode\" value=\"" + item["detailTitle"] + "\" class=\"collMode-chk\">&nbsp;<label for=\"" + item["COLLMODE"] + "\">" + item["detailDesc"] + "</label>&nbsp;&nbsp;");
  777. // }
  778. // sb.AppendLine("<span style='background-color: yellow; font-weight: 600;padding: 4px; display:none;' id='availableBalSpan'> Available Bal: <label id=\"availableBal\" style=\"font-size: 14px;font-weight: 800;\"></label>&nbsp;GBP</span>");
  779. // collModeTd.InnerHtml = sb.ToString();
  780. //}
  781. private void LoadSchemeByRCountry()
  782. {
  783. string pCountryFv = Request.Form["pCountry"];
  784. string pAgentFv = Request.Form["pAgent"];
  785. string sCustomerId = Request.Form["sCustomerId"];
  786. var dt = st.LoadSchemeByRCountry(GetStatic.GetCountryId(), GetStatic.GetAgent(), GetStatic.GetBranch(), pCountryFv, pAgentFv, sCustomerId);
  787. Response.ContentType = "text/plain";
  788. var json = DataTableToJson(dt);
  789. Response.Write(json);
  790. Response.End();
  791. }
  792. //private void GetCurrentBalance()
  793. //{
  794. // var dr = st.GetAcDetail(GetStatic.GetUser());
  795. // if (dr == null)
  796. // {
  797. // availableAmt.Text = "N/A";
  798. // return;
  799. // }
  800. // availableAmt.Text = GetStatic.FormatData(dr["availableBal"].ToString(), "M");
  801. // lblPerDayLimit.Text = GetStatic.FormatData(dr["txnPerDayCustomerLimit"].ToString(), "M");
  802. // lblPerDayCustomerCurr.Text = dr["sCurr"].ToString();
  803. // lblCollCurr.Text = dr["sCurr"].ToString();
  804. // lblSendCurr.Text = dr["sCurr"].ToString();
  805. // lblServiceChargeCurr.Text = dr["sCurr"].ToString();
  806. // txnPerDayCustomerLimit.Value = dr["txnPerDayCustomerLimit"].ToString();
  807. // balCurrency.Text = dr["balCurrency"].ToString();
  808. // hdnLimitAmount.Value = dr["sCountryLimit"].ToString();
  809. //}
  810. protected long GetResendId()
  811. {
  812. return GetStatic.ReadNumericDataFromQueryString("resendId");
  813. }
  814. private void LoadAgentByExtAgent()
  815. {
  816. var pAgentFv = Request.Form["pAgent"];
  817. var dt = st.LoadAgentByExtAgent(GetStatic.GetUser(), pAgentFv);
  818. Response.ContentType = "text/plain";
  819. var json = DataTableToJson(dt);
  820. Response.Write(json);
  821. Response.End();
  822. }
  823. private void LoadAgentByExtBranch()
  824. {
  825. var pBranchFv = Request.Form["pBranch"];
  826. var dt = st.LoadAgentByExtBranch(GetStatic.GetUser(), pBranchFv);
  827. Response.ContentType = "text/plain";
  828. var json = DataTableToJson(dt);
  829. Response.Write(json);
  830. Response.End();
  831. }
  832. private void GetAgentSetting()
  833. {
  834. var pAgentFv = Request.Form["pAgent"];
  835. var pModeFv = Request.Form["pMode"];
  836. var pCountryFv = GetStatic.ReadFormData("pCountry", "");
  837. var pBankType = GetStatic.ReadFormData("pBankType", "");
  838. var dt = st.GetAgentSetting(GetStatic.GetUser(), pCountryFv, pAgentFv, pModeFv, pBankType);
  839. Response.ContentType = "text/plain";
  840. var json = DataTableToJson(dt);
  841. Response.Write(json);
  842. Response.End();
  843. }
  844. private void LoadDataFromDdl(string type)
  845. {
  846. var pAgentFv = Request.Form["pAgent"];
  847. var pModeFv = Request.Form["pmode"];
  848. var pCountryFv = Request.Form["pCountry"];
  849. var partnerId = Request.Form["partnerId"];
  850. DataTable dt = null;
  851. switch (type)
  852. {
  853. case "pMode":
  854. dt = st.LoadDataFromDdl(GetStatic.GetCountryId(), pCountryFv, pModeFv, GetStatic.GetAgent(), "recModeByCountry", GetStatic.GetUser());
  855. break;
  856. case "agentByPmode":
  857. if (string.IsNullOrWhiteSpace(pModeFv) || string.IsNullOrWhiteSpace(pCountryFv))
  858. {
  859. Response.Write(null);
  860. Response.End();
  861. return;
  862. }
  863. dt = st.LoadDataFromDdl(GetStatic.GetCountryId(), pCountryFv, pModeFv, GetStatic.GetAgent(), "recAgentByRecModeAjaxagent", GetStatic.GetUser(), partnerId);
  864. break;
  865. case "LoadScheme":
  866. dt = st.LoadDataFromDdl(GetStatic.GetCountryId(), pCountryFv, pModeFv, pAgentFv, "schemeBysCountryrAgent", GetStatic.GetUser());
  867. break;
  868. }
  869. Response.ContentType = "text/plain";
  870. var json = DataTableToJson(dt);
  871. Response.Write(json);
  872. Response.End();
  873. }
  874. private void PopulateReceiverBySender()
  875. {
  876. string recId = Request.Form["id"];
  877. string senderId = Request.Form["senderId"];
  878. DataTable dt = st.PopulateReceiverBySender(senderId, "", recId);
  879. Response.ContentType = "text/plain";
  880. string json = DataTableToJson(dt);
  881. Response.Write(json);
  882. Response.End();
  883. }
  884. private void PCurrPcountry()
  885. {
  886. string pCountry = Request.Form["pCountry"];
  887. string pMode = Request.Form["pMode"];
  888. string pAgent = Request.Form["pAgent"];
  889. DataTable Dt = st.LoadPayCurr(pCountry, pMode, pAgent);
  890. Response.ContentType = "text/plain";
  891. string json = DataTableToJson(Dt);
  892. Response.Write(json);
  893. Response.End();
  894. }
  895. private void PopulateDdl()
  896. {
  897. var natCountry = GetStatic.ReadWebConfig("localCountry", "");
  898. LoadSenderCountry(ref txtSendNativeCountry, natCountry, "SELECT COUNTRY");
  899. LoadReceiverCountry(ref pCountry, "", "SELECT");
  900. _sdd.SetDDL(ref ddSenIdType, "exec proc_sendPageLoadData @flag='idTypeBySCountry',@countryId='" + GetStatic.GetCountryId() + "'", "valueId", "detailTitle", "", "SELECT");
  901. _sdd.SetDDL(ref ddlCustomerType, "exec proc_sendPageLoadData @flag='search-cust-by'", "VALUE", "TEXT", "", "");
  902. _sdd.SetDDL(ref ddlSendCustomerType, "EXEC proc_online_dropDownList @flag='dropdownList',@parentId=4700", "valueId", "detailTitle", "", "SELECT CUSTOMER TYPE");
  903. _sdd.SetDDL(ref ddlIdIssuedCountry, "EXEC proc_sendPageLoadData @flag='idIssuedCountry'", "countryId", "countryName", "", "SELECT COUNTRY");
  904. _sdd.SetDDL(ref ddlEmpBusinessType, "EXEC proc_online_dropDownList @flag='dropdownList',@parentId=7002", "valueId", "detailTitle", "11007", "");
  905. // _sdd.SetDDL(ref custLocationDDL, "EXEC proc_online_dropDownList @flag='state',@countryId='233'", "stateId", "stateName", "", "SELECT");
  906. //_sdd.SetDDL(ref sendingAgentOnBehalfDDL, "EXEC proc_sendPageLoadData @flag='S-AGENT-BEHALF',@user='" + GetStatic.GetUser() + "',@sAgent='" + GetStatic.GetAgent() + "'", "agentId", "agentName", "", "Select Branch/Agent");
  907. _sdd.SetDDL(ref ddlRecIdType, "EXEC proc_online_dropDownList @flag='idType',@user='" + GetStatic.GetUser() + "'", "valueId", "detailTitle", "", "Select..");
  908. _sdd.SetDDL(ref sourceOfFund, "EXEC proc_online_dropDownList @flag='dropdownList',@user='" + GetStatic.GetUser() + "',@parentId=3900", "valueId", "detailTitle", "", "Select..");
  909. _sdd.SetDDL(ref purpose, "EXEC proc_online_dropDownList @flag='dropdownList',@user='" + GetStatic.GetUser() + "',@parentId=3800", "valueId", "detailTitle", "8060", "Select..");
  910. _sdd.SetDDL(ref relationship, "EXEC proc_online_dropDownList @flag='dropdownList',@user='" + GetStatic.GetUser() + "',@parentId=2100", "valueId", "detailTitle", "", "Select..");
  911. _sdd.SetDDL(ref occupation, "EXEC proc_online_dropDownList @flag='occupationList',@user='" + GetStatic.GetUser() + "'", "valueId", "detailTitle", "", "Select..");
  912. _sdd.SetDDL(ref visaStatusDdl, "EXEC proc_online_dropDownList @flag='dropdownList',@user='" + GetStatic.GetUser() + "',@parentId=7005", "valueId", "detailTitle", "", "Select..");
  913. _sdd.SetStaticDdl(ref depositedBankDDL, "7010", "", "SELECT BANK");
  914. _sdd.SetDDL(ref ddlRelation, "EXEC proc_online_dropDownList @flag='dropdownList',@user='" + GetStatic.GetUser() + "',@parentId=2100", "valueId", "detailTitle", "", "Select..");
  915. _sdd.SetDDL(ref ddlPurpose, "EXEC proc_online_dropDownList @flag='dropdownList',@user='" + GetStatic.GetUser() + "',@parentId=3800", "valueId", "detailTitle", "", "Select..");
  916. _sdd.SetDDL(ref ddlVisaStatus, "EXEC proc_online_dropDownList @flag='dropdownList',@user='" + GetStatic.GetUser() + "',@parentId=7005", "valueId", "detailTitle", "", "Select..");
  917. _sdd.SetDDL(ref ddlOccupation, "EXEC proc_online_dropDownList @flag='dropdownList',@user='" + GetStatic.GetUser() + "',@parentId=2000", "valueId", "detailTitle", "", "Select..");
  918. //_sdd.SetDDL(ref ddlPayoutPartner, "EXEC proc_sendPageLoadData @flag='choose-partner',@user='" + GetStatic.GetUser() + "'", "AGENTID", "AGENTNAME", "", "Select Partner");
  919. _sdd.SetDDL(ref ddlPaymentOption, "EXEC proc_online_dropDownList @flag='paymentMode',@user='" + GetStatic.GetUser() + "'", "detailDesc", "detailTitle", "", "Select");
  920. }
  921. private void LoadSenderCountry(ref DropDownList ddl, string defaultValue, string label)
  922. {
  923. var sql = "EXEC proc_dropDownLists @flag='country'";
  924. _sdd.SetDDL(ref ddl, sql, "countryId", "countryName", defaultValue, label);
  925. }
  926. private void LoadReceiverCountry(ref DropDownList ddl, string defaultValue, string label)
  927. {
  928. var sql = "EXEC proc_sendPageLoadData @flag='pCountry',@countryId='" + GetStatic.GetCountryId() + "',@agentid='" + GetStatic.GetAgentId() + "'";
  929. _sdd.SetDDL(ref ddl, sql, "countryId", "countryName", defaultValue, label);
  930. }
  931. private void CustomerSearchLoadData()
  932. {
  933. //string searchType = Request.Form["searchType"];
  934. //string searchValue = Request.Form["searchValue"];
  935. string customerId = Request.Form["customerId"];
  936. //var dt = st.LoadCustomerData(searchType, searchValue, "s", GetStatic.GetCountryId(), GetStatic.GetSettlingAgent());
  937. var ds = st.LoadCustomerDataNewDS(GetStatic.GetUser(), customerId, "s-new", GetStatic.GetCountryId(), GetStatic.GetSettlingAgent());
  938. if (ds == null)
  939. {
  940. Response.Write("");
  941. Response.End();
  942. return;
  943. }
  944. Response.ContentType = "text/plain";
  945. string json = GetStatic.DataSetToJSON(ds);
  946. Response.Write(json);
  947. Response.End();
  948. }
  949. private void SearchRateScData()
  950. {
  951. string serchType = Request.Form["serchType"];
  952. string serchValue = Request.Form["serchValue"];
  953. DataTable dt = st.LoadCustomerData(serchType, serchValue, "s", GetStatic.GetCountryId(), GetStatic.GetSettlingAgent());
  954. if (dt == null)
  955. {
  956. Response.Write("");
  957. Response.End();
  958. return;
  959. }
  960. Response.ContentType = "text/plain";
  961. string json = DataTableToJson(dt);
  962. Response.Write(json);
  963. Response.End();
  964. }
  965. public static string DataTableToJson(DataTable table)
  966. {
  967. if (table == null)
  968. return "";
  969. var list = new List<Dictionary<string, object>>();
  970. foreach (DataRow row in table.Rows)
  971. {
  972. var dict = new Dictionary<string, object>();
  973. foreach (DataColumn col in table.Columns)
  974. {
  975. dict[col.ColumnName] = string.IsNullOrEmpty(row[col].ToString()) ? "" : row[col];
  976. }
  977. list.Add(dict);
  978. }
  979. var serializer = new JavaScriptSerializer();
  980. string json = serializer.Serialize(list);
  981. return json;
  982. }
  983. public static string GetJsonString(DataTable dt)
  984. {
  985. var strDc = new string[dt.Columns.Count];
  986. var headStr = string.Empty;
  987. for (int i = 0; i < dt.Columns.Count; i++)
  988. {
  989. strDc[i] = dt.Columns[i].Caption;
  990. headStr += "\"" + strDc[i] + "\" : \"" + strDc[i] + i.ToString() + " " + "\",";
  991. }
  992. headStr = headStr.Substring(0, headStr.Length - 1);
  993. var sb = new StringBuilder();
  994. sb.Append("{\"" + dt.TableName + "\" : [");
  995. for (var i = 0; i < dt.Rows.Count; i++)
  996. {
  997. var tempStr = headStr;
  998. sb.Append("{");
  999. for (var j = 0; j < dt.Columns.Count; j++)
  1000. {
  1001. tempStr = tempStr.Replace(dt.Columns[j] + j.ToString() + "¾", dt.Rows[i][j].ToString());
  1002. }
  1003. sb.Append(tempStr + "},");
  1004. }
  1005. sb = new StringBuilder(sb.ToString().Substring(0, sb.ToString().Length - 1));
  1006. sb.Append("]}");
  1007. return sb.ToString();
  1008. }
  1009. protected void Calculate()
  1010. {
  1011. DataTable dt = new DataTable();
  1012. ExRateRequest exRate = new ExRateRequest();
  1013. ExchangeRateAPIService ExService = new ExchangeRateAPIService();
  1014. exRate.RequestedBy = "core";
  1015. string a = Request.Form["IsExrateFromPartner"];
  1016. exRate.isExRateCalcByPartner = (Request.Form["IsExrateFromPartner"] == "true") ? true : false;
  1017. exRate.PCountry = Request.Form["pCountry"];
  1018. exRate.pCountryName = Request.Form["pCountrytxt"];
  1019. exRate.ServiceType = Request.Form["pMode"];
  1020. exRate.PaymentType = Request.Form["pModetxt"];
  1021. exRate.PAgent = Request.Form["pAgent"];
  1022. var pAgentBranch = Request.Form["pAgentBranch"];
  1023. exRate.CAmount = Request.Form["collAmt"];
  1024. exRate.PAmount = Request.Form["payAmt"];
  1025. exRate.SCurrency = Request.Form["collCurr"];
  1026. exRate.PCurrency = Request.Form["payCurr"];
  1027. exRate.CustomerId = Request.Form["senderId"];
  1028. exRate.SchemeId = Request.Form["schemeCode"];
  1029. exRate.ForexSessionId = Request.Form["couponId"];
  1030. exRate.IsManualSc = (Request.Form["isManualSc"] == "N" ? false : true);
  1031. exRate.ManualSc = Request.Form["sc"];
  1032. exRate.CalcBy = Request.Form["calcBy"];
  1033. exRate.ProviderId = Request.Form["payoutPartner"];
  1034. exRate.Introducer = Request.Form["introducerTxt"];
  1035. exRate.TpExRate = Request.Form["tpExRate"];
  1036. exRate.RewardAmt = Request.Form["rewardAmt"];
  1037. if (exRate.isExRateCalcByPartner)
  1038. {
  1039. exRate.CalcBy = Request.Form["calcBy"] == "cAmt" ? "C" : "P";
  1040. exRate.SCountry = GetStatic.GetCountryId();
  1041. exRate.SSuperAgent = GetStatic.GetSuperAgent();
  1042. exRate.SAgent = GetStatic.GetAgent();
  1043. exRate.SBranch = GetStatic.GetBranch();
  1044. exRate.CollCurrency = Request.Form["collCurr"];
  1045. exRate.pCountryCode = Request.Form["PCountryCode"];
  1046. exRate.payerName = Request.Form["payerName"];
  1047. string ProcessId = Guid.NewGuid().ToString().Replace("-", "") + ":transfast:exRate";
  1048. exRate.ProcessId = ProcessId.Substring(ProcessId.Length - 40, 40);
  1049. exRate.UserName = exRate.CustomerId;
  1050. JsonResponse res = ExService.GetExchangeRate(exRate);
  1051. ExRateResponse _exrate = (ExRateResponse)res.Data;
  1052. dt = st.GetExRateTP(GetStatic.GetUser()
  1053. , GetStatic.GetCountryId()
  1054. , GetStatic.GetSuperAgent()
  1055. , GetStatic.GetAgent()
  1056. , GetStatic.GetBranch()
  1057. , exRate.SCurrency
  1058. , exRate.PCountry
  1059. , exRate.PAgent
  1060. , exRate.PCurrency
  1061. , exRate.ServiceType
  1062. , exRate.CAmount
  1063. , exRate.PAmount
  1064. , exRate.SchemeId
  1065. , exRate.CustomerId
  1066. , GetStatic.GetSessionId()
  1067. , exRate.ForexSessionId
  1068. , Request.Form["isManualSc"]
  1069. , exRate.ManualSc
  1070. , _exrate.exRate
  1071. , exRate.PCurrency
  1072. , exRate.CalcBy
  1073. , exRate.Introducer
  1074. , exRate.RewardAmt
  1075. , exRate.ProviderId
  1076. );
  1077. }
  1078. else
  1079. {
  1080. dt = st.GetExRate(GetStatic.GetUser()
  1081. , GetStatic.GetCountryId()
  1082. , GetStatic.GetSuperAgent()
  1083. , GetStatic.GetAgent()
  1084. , GetStatic.GetBranch()
  1085. , exRate.SCurrency
  1086. , exRate.PCountry
  1087. , exRate.PAgent
  1088. , exRate.PCurrency
  1089. , exRate.ServiceType
  1090. , exRate.CAmount
  1091. , exRate.PAmount
  1092. , exRate.SchemeId
  1093. , exRate.CustomerId
  1094. , exRate.Introducer
  1095. , GetStatic.GetSessionId()
  1096. , exRate.ForexSessionId
  1097. , exRate.TpExRate
  1098. , exRate.RewardAmt
  1099. , Request.Form["isManualSc"]
  1100. , exRate.ManualSc
  1101. , exRate.CalcBy
  1102. , exRate.ProviderId
  1103. );
  1104. }
  1105. Response.ContentType = "text/plain";
  1106. var json = DataTableToJson(dt);
  1107. Response.Write(json);
  1108. Response.End();
  1109. }
  1110. private void CheckAgentQuota(string customerId)
  1111. {
  1112. var custId = Request.Form["customerId"];
  1113. var dt = st.GetAgentQuota(custId);
  1114. Response.ContentType = "text/plain";
  1115. var json = DataTableToJson(dt);
  1116. Response.Write(json);
  1117. Response.End();
  1118. }
  1119. private void LoadCustomerRate()
  1120. {
  1121. var pCountryFv = GetStatic.ReadFormData("pCountry", "");
  1122. var pAgentFv = GetStatic.ReadFormData("pAgent", "");
  1123. var pModeFv = GetStatic.ReadFormData("pMode", "");
  1124. var collCurr = GetStatic.ReadFormData("collCurr", "");
  1125. var dt = st.LoadCustomerRate(GetStatic.GetUser()
  1126. , GetStatic.GetCountryId()
  1127. , GetStatic.GetSuperAgent()
  1128. , GetStatic.GetAgent()
  1129. , GetStatic.GetBranch()
  1130. , collCurr
  1131. , pCountryFv
  1132. , pAgentFv
  1133. , ""
  1134. , pModeFv
  1135. );
  1136. Response.ContentType = "text/plain";
  1137. var json = DataTableToJson(dt);
  1138. Response.Write(json);
  1139. Response.End();
  1140. }
  1141. private void CheckSenderIdNumber()
  1142. {
  1143. var sIdType = GetStatic.ReadQueryString("sIdType", "");
  1144. var sIdNo = GetStatic.ReadFormData("sIdNo", "");
  1145. var dt = st.CheckSenderIdNumber(GetStatic.GetUser(), sIdType, sIdNo);
  1146. Response.ContentType = "text/plain";
  1147. var json = DataTableToJson(dt);
  1148. Response.Write(json);
  1149. Response.End();
  1150. }
  1151. private void CheckAvialableBalance()
  1152. {
  1153. string collectionMode = Request.Form["collectionMode"];
  1154. string customerId = Request.Form["customerId"];
  1155. string branchId = Request.Form["branchId"];
  1156. if (string.IsNullOrEmpty(branchId) || string.IsNullOrWhiteSpace(branchId))
  1157. branchId = "";
  1158. StringBuilder sb = new StringBuilder();
  1159. var result = st.CheckAvailableBanalce(GetStatic.GetUser(), customerId, collectionMode, branchId);
  1160. if (result != null)
  1161. {
  1162. if (collectionMode == "Bank Deposit")
  1163. sb.AppendLine("<span style='background-color: yellow; font-weight: 600;padding: 4px;' id='availableBalSpan'> Available Bal: <label id=\"availableBal\" style=\"font-size: 14px;font-weight: 800;\">" + GetStatic.ShowDecimal(result.Rows[0]["avilableBalance"].ToString()) + " </label>&nbsp;JPY</span>");
  1164. else
  1165. sb.AppendLine("<span style='background-color: yellow; font-weight: 600;padding: 4px;' id='availableBalSpan'> Available Limit: <label id=\"availableBal\" style=\"font-size: 14px;font-weight: 800;\">" + GetStatic.ShowDecimal(result.Rows[0]["avilableBalance"].ToString()) + " </label>&nbsp;JPY" + " (" + result.Rows[0]["holdType"].ToString() + ")</span>");
  1166. }
  1167. else
  1168. {
  1169. sb.AppendLine("<span style='background-color: yellow; font-weight: 600;padding: 4px;' id='availableBalSpan'> Available Bal: <label id=\"availableBal\" style=\"font-size: 14px;font-weight: 800;\">Balance Not Available</label>&nbsp;JPY</span>");
  1170. }
  1171. Response.Write(sb);
  1172. Response.End();
  1173. }
  1174. private void GetPayerDataByBankId()
  1175. {
  1176. SendTransactionServices GetPayer = new SendTransactionServices();
  1177. string bankCode = Request.Form["bankCode"];
  1178. string bankId = Request.Form["bankId"];
  1179. string partnerId = Request.Form["partnerId"];
  1180. string pMode = (Request.Form["pMode"] == "1" ? "2" : "C");
  1181. string PCountryCode = Request.Form["PCountryCode"];
  1182. string pCountryId = Request.Form["countryId"];
  1183. string payCurr = Request.Form["payCurr"];
  1184. string isSyncPayerData = Request.Form["isSyncPayerData"];
  1185. PayerDataRequest request = new PayerDataRequest()
  1186. {
  1187. CountryIsoCode = PCountryCode,
  1188. ProviderId = partnerId,
  1189. PaymentModeId = pMode,
  1190. SourceCurrencyIsoCode = "JPY",
  1191. ReceiveCurrencyIsoCode = payCurr,
  1192. BankId = bankCode,
  1193. CityId = 0,
  1194. FeeProduct = "B",
  1195. UserName = "By scheduler"
  1196. };
  1197. JsonResponse _resp = new JsonResponse();
  1198. string xml = "";
  1199. if (isSyncPayerData == "Y")
  1200. {
  1201. _resp = GetPayer.GetPayerData(request);
  1202. if (_resp.ResponseCode == "0")
  1203. {
  1204. List<PayerDetailsResults> payerDetailsResultsList = new List<PayerDetailsResults>();
  1205. var data = JsonConvert.DeserializeObject<List<TFPayerMasterResults>>(_resp.Data.ToString());
  1206. foreach (TFPayerMasterResults item in data)
  1207. {
  1208. foreach (PayerDetailsResults payerDetailsList in item.PayerDetailsResults)
  1209. {
  1210. payerDetailsResultsList.Add(payerDetailsList);
  1211. }
  1212. }
  1213. xml = GetStatic.ObjectToXML(payerDetailsResultsList);
  1214. }
  1215. }
  1216. DataTable dt = st.GetPayersByAgent(bankId, partnerId, Request.Form["pMode"], pCountryId, xml);
  1217. Response.ContentType = "text/plain";
  1218. string json = DataTableToJson(dt);
  1219. Response.Write(json);
  1220. Response.End();
  1221. }
  1222. private void GetPayerDataByPayerAndCityId()
  1223. {
  1224. string bankId = Request.Form["payerId"];
  1225. string partnerId = Request.Form["partnerId"];
  1226. string cityId = Request.Form["CityId"];
  1227. DataTable dt = st.GetPayerBranchDataByPayerAndCityId(bankId, cityId, partnerId);
  1228. Response.ContentType = "text/plain";
  1229. string json = DataTableToJson(dt);
  1230. Response.Write(json);
  1231. Response.End();
  1232. }
  1233. private void GetReferralBalance()
  1234. {
  1235. var referralCode = Request.Form["referralCode"];
  1236. var result = st.GetReferralBal(GetStatic.GetUser(), referralCode);
  1237. StringBuilder sb = new StringBuilder();
  1238. if (result != null)
  1239. {
  1240. sb.AppendLine("<span style='background-color: yellow; font-weight: 600;padding: 4px;' id='availableBalSpanReferral'>Introducer Available Limit: <label id=\"availableBalReferral\" style=\"font-size: 14px;font-weight: 800;\">" + GetStatic.ShowDecimal(result.Rows[0]["availableLimit"].ToString()) + " </label>&nbsp;JPY</span>");
  1241. }
  1242. else
  1243. {
  1244. sb.AppendLine("<span style='background-color: yellow; font-weight: 600;padding: 4px;' id='availableBalSpanReferral'>Introducer Available Limit <label id=\"availableBalReferral\" style=\"font-size: 14px;font-weight: 800;\">Balance Not Available</label>&nbsp;JPY</span>");
  1245. }
  1246. Response.ContentType = "text/plain";
  1247. Response.Write(sb);
  1248. Response.End();
  1249. }
  1250. private void GetCurrentBalance()
  1251. {
  1252. var branchId = Request.Form["branchId"];
  1253. var dr = st.GetAcDetailByBranchIdNew(GetStatic.GetUser(), branchId);
  1254. //if (dr == null)
  1255. //{
  1256. // availableAmt.Text = "N/A";
  1257. // return;
  1258. //}
  1259. //availableAmt.Text = GetStatic.FormatData(dr["availableBal"].ToString(), "M");
  1260. //lblPerDayLimit.Text = GetStatic.FormatData(dr["txnPerDayCustomerLimit"].ToString(), "M");
  1261. //lblPerDayCustomerCurr.Text = dr["sCurr"].ToString();
  1262. //lblCollCurr.Text = dr["sCurr"].ToString();
  1263. //lblSendCurr.Text = dr["sCurr"].ToString();
  1264. //lblServiceChargeCurr.Text = dr["sCurr"].ToString();
  1265. //txnPerDayCustomerLimit.Value = dr["txnPerDayCustomerLimit"].ToString();
  1266. //balCurrency.Text = dr["balCurrency"].ToString();
  1267. //hdnLimitAmount.Value = dr["sCountryLimit"].ToString();
  1268. Response.ContentType = "text/plain";
  1269. string json = DataTableToJson(dr);
  1270. Response.Write(json);
  1271. Response.End();
  1272. }
  1273. public void ValidateReferral()
  1274. {
  1275. var referralCode = Request.Form["referralCode"];
  1276. var dr = st.ValidateReferral(GetStatic.GetUser(), referralCode);
  1277. Response.ContentType = "text/plain";
  1278. string json = DataTableToJson(dr);
  1279. Response.Write(json);
  1280. Response.End();
  1281. }
  1282. private void PopulateData()
  1283. {
  1284. try
  1285. {
  1286. string trnDate = Request.Form["tranDate"];
  1287. string particulars = Request.Form["particulars"];
  1288. string customerId = Request.Form["customerId"];
  1289. string amount = Request.Form["amount"];
  1290. DataSet dt = _dao.GetDataForSendMapping(GetStatic.GetUser(), trnDate, particulars, customerId, amount);
  1291. StringBuilder sb = new StringBuilder();
  1292. StringBuilder sb1 = new StringBuilder();
  1293. if (null == dt)
  1294. {
  1295. Response.ContentType = "application/text";
  1296. Response.Write("<tr><td colspan = \"7\" align=\"center\">No Data To Display</td></tr>[[<<>>]]<tr><td colspan = \"7\" align=\"center\">No Data To Display</td></tr>");
  1297. HttpContext.Current.Response.Flush();
  1298. HttpContext.Current.Response.SuppressContent = true;
  1299. HttpContext.Current.ApplicationInstance.CompleteRequest();
  1300. return;
  1301. }
  1302. if (dt.Tables[0].Rows.Count == 0)
  1303. {
  1304. sb.AppendLine("<tr><td colspan = \"7\" align=\"center\">No Data To Display</td></tr>");
  1305. }
  1306. if (dt.Tables[1].Rows.Count == 0)
  1307. {
  1308. sb1.AppendLine("<tr><td colspan = \"7\" align=\"center\">No Data To Display</td></tr>");
  1309. }
  1310. int sNo = 1;
  1311. int sNo1 = 1;
  1312. foreach (DataRow item in dt.Tables[0].Rows)
  1313. {
  1314. sb.AppendLine("<tr>");
  1315. sb.AppendLine("<td><input type='checkbox' class='unmapped' name='chkDepositMapping' id='chkDepositMapping" + item["tranId"].ToString() + "' value='" + item["tranId"].ToString() + "' /></td>");
  1316. sb.AppendLine("<td>" + item["particulars"].ToString() + "</td>");
  1317. sb.AppendLine("<td>" + item["tranDate"].ToString() + "</td>");
  1318. sb.AppendLine("<td align='right'>" + GetStatic.ShowDecimal(item["depositAmount"].ToString()) + "</td>");
  1319. sb.AppendLine("<td align='right'>" + GetStatic.ShowDecimal(item["paymentAmount"].ToString()) + "</td>");
  1320. sb.AppendLine("</tr>");
  1321. sb.AppendLine("<tr id=\"addModel" + item["tranId"].ToString() + "\"></tr>");
  1322. sNo++;
  1323. }
  1324. foreach (DataRow item in dt.Tables[1].Rows)
  1325. {
  1326. sb1.AppendLine("<tr>");
  1327. sb1.AppendLine("<td><input type='checkbox' class='unapproved' name='chkDepositMappingUnmap' id='chkDepositMappingUnmap" + item["tranId"].ToString() + "' value='" + item["tranId"].ToString() + "'/></td>");
  1328. sb1.AppendLine("<td>" + item["particulars"].ToString() + "</td>");
  1329. sb1.AppendLine("<td>" + item["tranDate"].ToString() + "</td>");
  1330. sb1.AppendLine("<td align='right'>" + GetStatic.ShowDecimal(item["depositAmount"].ToString()) + "</td>");
  1331. sb1.AppendLine("<td align='right'>" + GetStatic.ShowDecimal(item["paymentAmount"].ToString()) + "</td>");
  1332. sb1.AppendLine("</tr>");
  1333. sb1.AppendLine("<tr id=\"addModel" + item["tranId"].ToString() + "\"></tr>");
  1334. sNo1++;
  1335. }
  1336. string data = sb + "[[<<>>]]" + sb1;
  1337. Response.ContentType = "application/text";
  1338. Response.Write(data);
  1339. HttpContext.Current.Response.Flush(); // Sends all currently buffered output to the client.
  1340. HttpContext.Current.Response.SuppressContent = true; // Gets or sets a value indicating whether to send HTTP content to the client.
  1341. HttpContext.Current.ApplicationInstance.CompleteRequest(); // Causes ASP.NET to bypass all events and filtering in the HTTP pipeline chain of execution and directly execute the EndRequest event.
  1342. }
  1343. catch (ThreadAbortException ex)
  1344. {
  1345. string msg = ex.Message;
  1346. }
  1347. }
  1348. protected void ProceedMapData()
  1349. {
  1350. var Ids = Request.Form["tranIds[]"];
  1351. var customerId = Request.Form["customerId"];
  1352. DbResult _res = new DbResult();
  1353. if (!string.IsNullOrEmpty(Ids))
  1354. {
  1355. _res = _dao.SaveMultipleCustomerDeposit(GetStatic.GetUser(), Ids, customerId);
  1356. }
  1357. else
  1358. {
  1359. GetStatic.AlertMessage(this, "Please choose at least on record!");
  1360. }
  1361. Response.ContentType = "text/plain";
  1362. Response.Write(JsonConvert.SerializeObject(_res));
  1363. Response.End();
  1364. }
  1365. protected void UnMapData()
  1366. {
  1367. var Ids = Request.Form["tranIds[]"];
  1368. var customerId = Request.Form["customerId"];
  1369. DbResult _res = new DbResult();
  1370. if (!string.IsNullOrEmpty(Ids))
  1371. {
  1372. _res = _dao.UnMapCustomerDeposit(GetStatic.GetUser(), Ids, customerId);
  1373. }
  1374. else
  1375. {
  1376. GetStatic.AlertMessage(this, "Please choose at least on record!");
  1377. }
  1378. Response.ContentType = "text/plain";
  1379. Response.Write(JsonConvert.SerializeObject(_res));
  1380. Response.End();
  1381. }
  1382. protected void UpdateVisaStatus()
  1383. {
  1384. var visaStatusId = Request.Form["visaStatusId"];
  1385. var customerId = Request.Form["customerId"];
  1386. DbResult _res = new DbResult();
  1387. if (!string.IsNullOrEmpty(visaStatusId))
  1388. {
  1389. _res = _dao.UpdateVisaStatus(GetStatic.GetUser(), visaStatusId, customerId);
  1390. }
  1391. else
  1392. {
  1393. GetStatic.AlertMessage(this, "Please choose visa status!");
  1394. }
  1395. Response.ContentType = "text/plain";
  1396. Response.Write(JsonConvert.SerializeObject(_res));
  1397. Response.End();
  1398. }
  1399. protected void UpdateAdditionalAddress()
  1400. {
  1401. var additionalAddress = Request.Form["additionalAddress"];
  1402. var customerId = Request.Form["customerId"];
  1403. DbResult _res = new DbResult();
  1404. if (!string.IsNullOrEmpty(additionalAddress))
  1405. {
  1406. _res = _dao.UpdateAdditionalAddress(GetStatic.GetUser(), additionalAddress, customerId);
  1407. }
  1408. else
  1409. {
  1410. GetStatic.AlertMessage(this, "Please choose visa status!");
  1411. }
  1412. Response.ContentType = "text/plain";
  1413. Response.Write(JsonConvert.SerializeObject(_res));
  1414. Response.End();
  1415. }
  1416. protected string GetData()
  1417. {
  1418. var data = GetStatic.ReadQueryString("data", "");
  1419. return data;
  1420. }
  1421. protected void InsertAdditionalDocumentLog()
  1422. {
  1423. var customerId = Request.Form["customerId"];
  1424. var isAdditionalDocRequired = Request.Form["isAdditionalDocRequired"];
  1425. DbResult _res = new DbResult();
  1426. _res = _ald.InsertAdditionalDocumentLog(GetStatic.GetUser(), customerId, isAdditionalDocRequired);
  1427. Response.ContentType = "text/plain";
  1428. Response.Write(JsonConvert.SerializeObject(_res));
  1429. Response.End();
  1430. }
  1431. }
  1432. }