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.

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