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.

1273 lines
52 KiB

10 months ago
10 months ago
  1. using Newtonsoft.Json;
  2. using Swift.DAL.BL.AgentPanel.Send;
  3. using Swift.DAL.Domain;
  4. using Swift.DAL.SwiftDAL;
  5. using Swift.web.Library;
  6. using System;
  7. using System.Collections;
  8. using System.Collections.Generic;
  9. using System.Data;
  10. using System.IO;
  11. using System.Text;
  12. using System.Web.Script.Serialization;
  13. using System.Web.UI;
  14. using System.Web.UI.WebControls;
  15. namespace Swift.web.AgentNew.AgentSend
  16. {
  17. public partial class SendV2 : System.Web.UI.Page
  18. {
  19. private SendTranIRHDao st = new SendTranIRHDao();
  20. private readonly StaticDataDdl _sdd = new StaticDataDdl();
  21. private const string ViewFunctionId = "40101600";
  22. private const string EnableCustomerSignature = "40101610";
  23. protected void Page_Load(object sender, EventArgs e)
  24. {
  25. EnableDigitalSignature.Visible = _sdd.HasRight(EnableCustomerSignature);
  26. isDisplaySignature.Value = Convert.ToString(_sdd.HasRight(EnableCustomerSignature));
  27. lblServiceChargeCurr.Attributes.Add("readonly", "readonly");
  28. lblServiceChargeAmt.Attributes.Add("readonly", "readonly");
  29. _sdd.CheckSession();
  30. GetStatic.PrintMessage(Page);
  31. txtCollAmt.Attributes.Add("onkeyup", "return CalcOnEnter((event?event:evt));");
  32. string reqMethod = Request.Form["MethodName"];
  33. if (!string.IsNullOrEmpty(reqMethod))
  34. {
  35. if (GetStatic.GetUser() == "")
  36. {
  37. Response.ContentType = "text/plain";
  38. Response.Write("[{\"session_end\":\"1\"}]");
  39. Response.End();
  40. return;
  41. }
  42. }
  43. Authenticate();
  44. if (String.IsNullOrEmpty(reqMethod))
  45. {
  46. GetCurrentBalance();
  47. Misc.MakeNumericTextbox(ref txtPayAmt);
  48. }
  49. if (!Page.IsPostBack)
  50. {
  51. #region Ajax methods
  52. switch (reqMethod)
  53. {
  54. case "SearchCustomer":
  55. CustomerSearchLoadData();
  56. break;
  57. case "getPayoutPartner":
  58. GetPayoutPartner();
  59. break;
  60. case "SearchReceiver":
  61. SearchReceiverDetails();
  62. break;
  63. case "PopulateReceiverDDL":
  64. PopulateReceiverDDL();
  65. break;
  66. case "getLocation":
  67. GetLocationData();
  68. break;
  69. case "getSubLocation":
  70. GetSubLocationData();
  71. break;
  72. case "getTownLocation":
  73. GetTownLocation();
  74. break;
  75. case "SearchRateScData":
  76. SearchRateScData();
  77. break;
  78. case "PaymentModePcountry":
  79. LoadDataFromDdl("pMode");
  80. break;
  81. case "PCurrPcountry":
  82. PCurrPcountry();
  83. break;
  84. case "CalculateTxn":
  85. Calculate();
  86. break;
  87. case "ReceiverDetailBySender":
  88. PopulateReceiverBySender();
  89. break;
  90. case "loadAgentBank":
  91. LoadDataFromDdl("agentByPmode");
  92. break;
  93. case "PAgentChange":
  94. GetAgentSetting();
  95. break;
  96. case "PBranchChange":
  97. LoadAgentByExtBranch();
  98. break;
  99. case "LoadAgentByExtAgent":
  100. LoadAgentByExtAgent();
  101. break;
  102. case "LoadSchemeByRcountry":
  103. LoadSchemeByRCountry();
  104. break;
  105. case "LoadCustomerRate":
  106. LoadCustomerRate();
  107. break;
  108. case "CheckSenderIdNumber":
  109. CheckSenderIdNumber();
  110. break;
  111. case "CheckAvialableBalance":
  112. CheckAvialableBalance();
  113. break;
  114. case "getPayerDataByBankId":
  115. GetPayerDataByBankId();
  116. break;
  117. case "getAvailableBalance":
  118. GetCurrentBalance();
  119. break;
  120. case "getPayerBranchDataByPayerAndCityId":
  121. GetPayerDataByPayerAndCityId();
  122. break;
  123. case "Verifytxn":
  124. VerifyTransaction();
  125. break;
  126. }
  127. #endregion Ajax methods
  128. PopulateDdl();
  129. ManageCollMode();
  130. DisplayAvailableBalance();
  131. }
  132. }
  133. private void VerifyTransaction()
  134. {
  135. List<string> stringList = new List<string>();
  136. var type = Request.Form["type"];
  137. var trn = GetDataForValidation();
  138. if (type == "V")
  139. {
  140. var ds = st.ValidateTransaction(trn);
  141. if (ds == null)
  142. {
  143. Response.Write("");
  144. Response.End();
  145. return;
  146. }
  147. Response.ContentType = "text/plain";
  148. var tableList = ds.Tables;
  149. var resultTable = tableList[0];
  150. var ErrorCode = resultTable.Columns.Contains("ErrCode") ? resultTable.Rows[0]["ErrCode"].ToString() : resultTable.Rows[0]["ErrorCode"].ToString();
  151. stringList.Add(ErrorCode + "," + resultTable.Rows[0]["msg"] + "," + resultTable.Rows[0]["id"]);
  152. if (ErrorCode != "0")
  153. {
  154. string ofacError = "";
  155. string complainError = "";
  156. if (ErrorCode == "1")
  157. {
  158. string result = resultTable.Rows[0]["ErrCode"] + "," + resultTable.Rows[0]["msg"] + "," + resultTable.Rows[0]["id"];
  159. stringList.Add(result);
  160. }
  161. if (ErrorCode == "100")
  162. {
  163. if (ds.Tables[1].Rows.Count > 0)
  164. {
  165. ofacError = LoadOfacList(ds.Tables[1], trn);
  166. }
  167. if (tableList.Count > 2)
  168. if (tableList[2].Rows.Count > 0)
  169. complainError = LoadComplianceListNew(tableList[2]);
  170. }
  171. if (ErrorCode == "101")
  172. {
  173. if (ds.Tables[1].Rows.Count > 0)
  174. {
  175. complainError = LoadComplianceListNew(tableList[1]);
  176. }
  177. }
  178. if (ErrorCode == "102")
  179. {
  180. if (ds.Tables[1].Rows.Count > 0)
  181. {
  182. complainError = LoadComplianceListNew(tableList[1]);
  183. }
  184. }
  185. stringList.Add(ofacError);
  186. stringList.Add(complainError);
  187. }
  188. var json = JsonConvert.SerializeObject(stringList);
  189. Response.Write(json);
  190. Response.End();
  191. }
  192. else
  193. {
  194. trn.IsFromTabPage = "1";
  195. var db = st.SendTransactionIRH(trn);
  196. string customerSignature = Request.Form["customerSignature"];
  197. if (!string.IsNullOrEmpty(customerSignature) && (db.ErrorCode == "0" || db.ErrorCode == "100" || db.ErrorCode == "101"))
  198. {
  199. UploadImage(customerSignature, db.Id);
  200. }
  201. string result = db.ErrorCode + "," + db.Msg + "," + db.Id + "," + db.Extra + "," + db.Extra2;
  202. stringList.Add(result);
  203. var json = JsonConvert.SerializeObject(stringList);
  204. Response.ContentType = "text/plain";
  205. Response.Write(json);
  206. Response.End();
  207. }
  208. }
  209. private string LoadOfacList(DataTable dt, IRHTranDetail trn)
  210. {
  211. var confirmText = "Confirmation:\n_____________________________________";
  212. confirmText += "\n\nYou are confirming to send this OFAC/DJ suspicious transaction!!!";
  213. confirmText += "\n\nPlease note if this customer is found to be valid person from OFAC/DJ List then Teller will be charged fine from management";
  214. confirmText += "\n\n\nPlease make sure you have proper evidence that show this customer is not from OFAC/DJ List";
  215. //btnProceedCc.ConfirmText = confirmText;
  216. int cols = dt.Columns.Count;
  217. var str = new StringBuilder("<table class='TBLData' border=\"1\" cellspacing=0 cellpadding=\"3\">");
  218. str.Append("<tr>");
  219. for (int i = 0; i < cols; i++)
  220. {
  221. str.Append("<th><div align=\"left\">" + dt.Columns[i].ColumnName + "</div></th>");
  222. }
  223. str.Append("</tr>");
  224. foreach (DataRow dr in dt.Rows)
  225. {
  226. str.Append("<tr>");
  227. str.Append("<td align=\"left\">" + dr[0] + "</td>");
  228. string[] strArr = {
  229. trn.SenFirstName.ToUpper(), trn.SenMiddleName.ToUpper(), trn.SenLastName.ToUpper(),
  230. trn.RecFirstName.ToUpper(), trn.RecMiddleName.ToUpper(),trn.RecLastName.ToUpper(),
  231. };
  232. var arrlen = strArr.Length;
  233. string value = dr[1].ToString();
  234. for (int j = 0; j < arrlen; j++)
  235. {
  236. if (!string.IsNullOrWhiteSpace(strArr[j]))
  237. {
  238. value = value.ToUpper().Replace(strArr[j],
  239. GetStatic.PutRedBackGround(strArr[j]));
  240. }
  241. }
  242. str.Append("<td align=\"left\">" + value + "</td>");
  243. str.Append("</tr>");
  244. }
  245. str.Append("<tr>");
  246. str.Append("<td colspan=\"2\">OFAC Listed Customer are BLACK Listed customer or Suspicious for terrorist or Money Loundery Customer" +
  247. ", please ask for valid documentation from customer</td>");
  248. str.Append("</tr>");
  249. str.Append("</table>");
  250. return str.ToString();
  251. }
  252. private string LoadComplianceListNew(DataTable dt)
  253. {
  254. int cols = dt.Columns.Count;
  255. var str =
  256. new StringBuilder("<table class='table table-responsive table-striped table-bordered'>");
  257. str.Append("<tr>");
  258. for (int i = 2; i < cols; i++)
  259. {
  260. str.Append("<th><div align=\"left\">" + dt.Columns[i].ColumnName + "</div></th>");
  261. }
  262. str.Append("</tr>");
  263. foreach (DataRow dr in dt.Rows)
  264. {
  265. str.Append("<tr>");
  266. str.Append("<td>" + dr["S.N."].ToString() + "</td>");
  267. str.Append("<td align=\"left\"><a href=\"#\" onclick=\"OpenInNewWindow('/Remit/OFACManagement/ComplianceDetail.aspx?id=" +
  268. dr["Id"].ToString() + "&type=compNew')\">" + dr["Remarks"].ToString() + "</a></td>");
  269. str.Append("<td align='center' class='bg-danger'></strong>" + dr["Action"].ToString() + "</strong></td>");
  270. str.Append("</tr>");
  271. }
  272. str.Append("</table>");
  273. return str.ToString();
  274. }
  275. private IRHTranDetail GetDataForValidation()
  276. {
  277. #region Get Sender Details
  278. string _senderId = Request.Form["senderId"];
  279. string _senfName = Request.Form["sfName"];
  280. string _senmName = Request.Form["smName"];
  281. string _senlName = Request.Form["slName"];
  282. //string _senlName2 = Request.Form["sIdType"];
  283. string _senIdType = Request.Form["sIdType"];
  284. string _senIdNo = Request.Form["sIdNo"];
  285. string _senIdValid = Request.Form["sIdValid"];
  286. string _senGender = Request.Form["sGender"];
  287. string _sendob = Request.Form["sdob"];
  288. string _senTel = Request.Form["sTel"];
  289. string _senMobile = Request.Form["sMobile"];
  290. string _senNaCountry = Request.Form["sNaCountry"];
  291. string _sencity = Request.Form["sCity"];
  292. string _senPostCode = Request.Form["sPostCode"];
  293. string _senAdd1 = Request.Form["sAdd1"];
  294. string _senAdd2 = Request.Form["sAdd2"];
  295. string _senEmail = Request.Form["sEmail"];
  296. string _smsSend = Request.Form["smsSend"];
  297. string _memberCode = Request.Form["memberCode"];
  298. string _senCompany = Request.Form["sCompany"];
  299. #endregion Get Sender Details
  300. #region Get RECEIVER Details
  301. string _benId = Request.Form["benId"];
  302. string _recfName = Request.Form["rfName"];
  303. string _recmName = Request.Form["rmName"];
  304. string _reclName = Request.Form["rlName"];
  305. //string _reclName2 = Request.Form["senderId"];
  306. string _recIdType = Request.Form["rIdType"];
  307. string _recIdNo = Request.Form["rIdNo"];
  308. string _recIdValid = Request.Form["rIdValid"];
  309. string _recGender = Request.Form["rGender"];
  310. string _recdob = Request.Form["rdob"];
  311. string _recTel = Request.Form["rTel"];
  312. string _recMobile = Request.Form["rMobile"];
  313. string _reccity = Request.Form["rCity"];
  314. string _recPostCode = Request.Form["rPostCode"];
  315. string _recAdd1 = Request.Form["rAdd1"];
  316. string _recAdd2 = Request.Form["rAdd2"];
  317. string _recEmail = Request.Form["rEmail"];
  318. string _recaccountNo = Request.Form["accountNo"];
  319. #endregion Get RECEIVER Details
  320. #region Get Transaction Details
  321. string _pCountryName = Request.Form["pCountry"];
  322. string _pCountryId = Request.Form["payCountryId"];
  323. string _dm = Request.Form["collMode"];
  324. string _dmId = Request.Form["collModeId"];
  325. string _pBank = Request.Form["pBank"];
  326. string _pBankName = Request.Form["pBankText"];
  327. string _pBankBranch = Request.Form["pBankBranch"];
  328. string _pBankBranchName = Request.Form["pBankBranchText"];
  329. string _pBankType = Request.Form["pBankType"];
  330. string _pAgent = Request.Form["pAgent"];
  331. string _pAgentName = Request.Form["pAgentName"];
  332. string _pCurr = Request.Form["pCurr"];
  333. string _collCurr = Request.Form["collCurr"];
  334. decimal _cAmt = Request.Form["collAmt"].ToDecimal();
  335. decimal _pAmt = Request.Form["payAmt"].ToDecimal();
  336. decimal _tAmt = Request.Form["sendAmt"].ToDecimal();
  337. decimal _customerTotalAmt = Request.Form["customerTotalAmt"].ToDecimal();
  338. decimal _serviceCharge = Request.Form["scharge"].ToDecimal();
  339. decimal _discount = Request.Form["discount"].ToDecimal();
  340. decimal _customerRate = Request.Form["exRate"].ToDecimal();
  341. string _schemeType = Request.Form["accountNo"];
  342. string schemeName = Request.Form["accountNo"];
  343. string scDiscount = Request.Form["scDiscount"];
  344. string exRateOffer = Request.Form["exRateOffer"];
  345. //string _couponId = Request.Form["accountNo"];
  346. string _pLocation = Request.Form["pLocation"];
  347. string _pLocationText = Request.Form["pLocationText"];
  348. string _pSubLocation = Request.Form["pSubLocation"];
  349. string _pSubLocationText = Request.Form["pSubLocationText"];
  350. string _payerId = Request.Form["payerId"];
  351. string _payerBranchId = Request.Form["payerBranchId"];
  352. //tpExRate
  353. #endregion Get Transaction Details
  354. string _por = Request.Form["por"];
  355. string _sof = Request.Form["sof"];
  356. string _rel = Request.Form["rel"];
  357. string _occupation = Request.Form["occupation"];
  358. string _payMsg = Request.Form["payMsg"];
  359. string _company = Request.Form["company"];
  360. string _nCust = Request.Form["newCustomer"];
  361. string _eCust = Request.Form["EnrollCustomer"];
  362. string _cancelrequestId = Request.Form["cancelrequestId"];
  363. string _pSuperAgent = Request.Form["accountNo"];
  364. string _salary = Request.Form["salary"];
  365. // _hdnreqAgent
  366. string _hdnreqBranch = Request.Form["hdnreqBranch"];
  367. string _isManualSC = Request.Form["isManualSC"];
  368. string _manualSC = Request.Form["manualSC"];
  369. string _sCustStreet = Request.Form["sCustStreet"];
  370. string _sCustLocation = Request.Form["sCustLocation"];
  371. string _sCustomerType = Request.Form["sCustomerType"];
  372. string _sCustBusinessType = Request.Form["sCustBusinessType"];
  373. string _sCustIdIssuedCountry = Request.Form["sCustIdIssuedCountry"];
  374. string _sCustIdIssuedDate = Request.Form["sCustIdIssuedDate"];
  375. string _receiverId = Request.Form["receiverId"];
  376. string _payoutPartnerId = Request.Form["payoutPartnerId"];
  377. string _cashCollMode = Request.Form["cashCollMode"];
  378. string _customerDepositedBank = Request.Form["customerDepositedBank"];
  379. string _introducerTxt = Request.Form["introducerTxt"];
  380. #region additional information for branch
  381. string _branchId = GetStatic.ReadQueryString("branchId", "");
  382. string _branchName = GetStatic.ReadQueryString("branchName", "");
  383. #endregion additional information for branch
  384. #region Confirm txn Details
  385. string _txnPwd = Request.Form["txnPwd"];
  386. #endregion Confirm txn Details
  387. var trn = new IRHTranDetail();
  388. var randObj = new Random();
  389. var agentRefId = randObj.Next(1000000000, 1999999999).ToString();
  390. hdnAgentRefId.Value = agentRefId;
  391. trn.AgentRefId = agentRefId;
  392. trn.User = GetStatic.GetUser();
  393. trn.SessionId = GetStatic.GetSessionId();
  394. trn.SenderId = _senderId.ToString();
  395. trn.SenFirstName = _senfName;
  396. trn.SenMiddleName = _senmName;
  397. trn.SenLastName = _senlName;
  398. //trn.SenLastName2 = _senlName2;
  399. trn.SenGender = _senGender;
  400. trn.SenIdType = _senIdType;
  401. trn.SenIdNo = _senIdNo;
  402. trn.SenIdValid = _senIdValid;
  403. trn.SenDob = _sendob;
  404. trn.SenEmail = _senEmail;
  405. trn.SenTel = _senTel;
  406. trn.SenMobile = _senMobile;
  407. trn.SenNaCountry = _senNaCountry;
  408. trn.SenCity = _sencity;
  409. trn.SenPostCode = _senPostCode;
  410. trn.SenAdd1 = _senAdd1;
  411. trn.SenAdd2 = _senAdd2;
  412. trn.SenEmail = _senEmail;
  413. trn.SmsSend = _smsSend;
  414. trn.ReceiverId = _benId.ToString();
  415. trn.RecFirstName = _recfName;
  416. trn.RecMiddleName = _recmName;
  417. trn.RecLastName = _reclName;
  418. //trn.RecLastName2 = _reclName2;
  419. trn.RecGender = _recGender;
  420. trn.RecIdType = _recIdType;
  421. trn.RecIdNo = _recIdNo;
  422. trn.RecIdValid = _recIdValid;
  423. trn.RecDob = _recdob;
  424. trn.RecTel = _recTel;
  425. trn.RecMobile = _recMobile;
  426. trn.RecNaCountry = "";
  427. trn.RecCity = _reccity;
  428. trn.RecPostCode = _recPostCode;
  429. trn.RecAdd1 = _recAdd1;
  430. trn.RecAdd2 = _recAdd2;
  431. trn.RecEmail = _recEmail;
  432. trn.RecAccountNo = _recaccountNo;
  433. trn.RecCountryId = _pCountryId.ToString();
  434. trn.RecCountry = _pCountryName;
  435. trn.DeliveryMethod = _dm;
  436. trn.DeliveryMethodId = _dmId.ToString();
  437. trn.PBank = _pBank;
  438. trn.PBankName = _pBankName;
  439. trn.PBankBranch = _pBankBranch;
  440. trn.PBankBranchName = _pBankBranchName;
  441. trn.PBankType = _pBankType;
  442. trn.PAgent = _pAgent;
  443. trn.PAgentName = _pAgentName;
  444. trn.PBankType = _pBankType;
  445. trn.PCurr = _pCurr;
  446. trn.CollCurr = _collCurr;
  447. trn.CollAmt = _cAmt.ToString();
  448. trn.PayoutAmt = _pAmt.ToString();
  449. trn.TransferAmt = _tAmt.ToString();
  450. trn.ServiceCharge = _serviceCharge.ToString();
  451. trn.Discount = _discount.ToString();
  452. trn.ExRate = _customerRate.ToString();
  453. trn.SchemeCode = _schemeType;
  454. //trn.CouponTranNo = _couponId;
  455. trn.PurposeOfRemittance = _por;
  456. trn.SourceOfFund = _sof;
  457. trn.RelWithSender = _rel;
  458. trn.Occupation = _occupation;
  459. trn.PayoutMsg = _payMsg;
  460. trn.Company = _company;
  461. trn.NCustomer = _nCust;
  462. trn.ECustomer = _eCust;
  463. trn.MemberCode = _memberCode;
  464. trn.SBranch = GetStatic.GetBranch();
  465. trn.SBranchName = GetStatic.GetBranchName();
  466. trn.SAgent = GetStatic.GetAgent();
  467. trn.SAgentName = GetStatic.GetAgentName();
  468. trn.SSuperAgent = GetStatic.GetSuperAgent();
  469. trn.SSuperAgentName = GetStatic.GetSuperAgentName();
  470. trn.SettlingAgent = GetStatic.GetSettlingAgent();
  471. trn.SCountry = GetStatic.GetCountry();
  472. trn.SCountryId = GetStatic.GetCountryId();
  473. trn.pStateId = _pLocation;
  474. trn.pStateName = _pLocationText;
  475. trn.pCityId = _pSubLocation;
  476. trn.pCityName = _pSubLocationText;
  477. //trn.CwPwd = cwPwd.Text;
  478. //trn.TtName = ttName.Text;
  479. trn.isManualSC = _isManualSC;
  480. trn.manualSC = _manualSC;
  481. trn.sCustStreet = _sCustStreet;
  482. trn.sCustLocation = _sCustLocation;
  483. trn.sCustomerType = _sCustomerType;
  484. trn.sCustBusinessType = _sCustBusinessType;
  485. trn.sCustIdIssuedCountry = _sCustIdIssuedCountry;
  486. trn.sCustIdIssuedDate = _sCustIdIssuedDate;
  487. trn.receiverId = _receiverId;
  488. trn.payoutPartner = _payoutPartnerId;
  489. trn.cashCollMode = _cashCollMode;
  490. trn.customerDepositedBank = _customerDepositedBank;
  491. trn.introducer = _introducerTxt;
  492. //trn.tpExRate = _tpExRate;
  493. trn.PayerId = _payerId;
  494. trn.PayerBranchId = _payerBranchId;
  495. trn.CustomerPassword = Request.Form["customerPassword"];
  496. //Confirm Details
  497. trn.TxnPassword = _txnPwd;
  498. //trn.CustomerPassword = Request.Form["customerPassword"];
  499. return trn;
  500. }
  501. protected string GetCustomerId()
  502. {
  503. return GetStatic.ReadQueryString("customerId", "");
  504. }
  505. private void GetPayoutPartner()
  506. {
  507. string pCountry = Request.Form["pCountry"];
  508. string pMode = Request.Form["pMode"];
  509. var dt = st.GetPayoutPartner(GetStatic.GetUser(), pCountry, pMode);
  510. if (dt == null)
  511. {
  512. Response.Write("");
  513. Response.End();
  514. return;
  515. }
  516. Response.ContentType = "text/plain";
  517. string json = DataTableToJson(dt);
  518. Response.Write(json);
  519. Response.End();
  520. }
  521. private void SearchReceiverDetails()
  522. {
  523. string customerId = Request.Form["customerId"];
  524. var dt = st.LoadReceiverData(GetStatic.GetUser(), customerId);
  525. if (dt == null)
  526. {
  527. Response.Write("");
  528. Response.End();
  529. return;
  530. }
  531. Response.ContentType = "text/plain";
  532. string json = DataTableToJson(dt);
  533. Response.Write(json);
  534. Response.End();
  535. }
  536. private void PopulateReceiverDDL()
  537. {
  538. string customerId = Request.Form["customerId"];
  539. var dt = st.PopulateReceiverDDL(GetStatic.GetUser(), customerId);
  540. if (dt == null)
  541. {
  542. Response.Write("");
  543. Response.End();
  544. return;
  545. }
  546. Response.ContentType = "text/plain";
  547. string json = DataTableToJson(dt);
  548. Response.Write(json);
  549. Response.End();
  550. }
  551. private void GetSubLocationData()
  552. {
  553. string pLocation = Request.Form["PLocation"];
  554. DataTable dt = st.GetPayoutSubLocation(pLocation);
  555. Response.ContentType = "text/plain";
  556. var json = DataTableToJson(dt);
  557. Response.Write(json);
  558. Response.End();
  559. }
  560. private void GetTownLocation()
  561. {
  562. string subLocation = Request.Form["subLocation"];
  563. DataTable dt = st.GetPayoutTownLocation(subLocation);
  564. Response.ContentType = "text/plain";
  565. var json = DataTableToJson(dt);
  566. Response.Write(json);
  567. Response.End();
  568. }
  569. private void GetLocationData()
  570. {
  571. string pCountry = Request.Form["PCountry"];
  572. string pMode = Request.Form["PMode"];
  573. string partnerId = Request.Form["PartnerId"];
  574. DataTable dt = st.GetPayoutLocation(pCountry, pMode, partnerId);
  575. Response.ContentType = "text/plain";
  576. var json = DataTableToJson(dt);
  577. Response.Write(json);
  578. Response.End();
  579. }
  580. protected string sb = "";
  581. private void Authenticate()
  582. {
  583. _sdd.CheckAuthentication(ViewFunctionId);
  584. }
  585. private void ManageCollMode()
  586. {
  587. var dt = st.GetCollModeData(GetStatic.GetCountryId(), GetStatic.GetAgent());
  588. StringBuilder sb = new StringBuilder();
  589. foreach (DataRow item in dt.Rows)
  590. {
  591. string checkedOrNot = item["ISDEFAULT"].ToString() == "1" ? "checked=\"checked\"" : "";
  592. sb.AppendLine("<input " + checkedOrNot + " type=\"checkbox\" id=\"" + item["COLLMODE"] + "\" name=\"chkCollMode\" value=\"" + item["detailTitle"] + "\" class=\"collMode-chk\">&nbsp;<label for=\"" + item["COLLMODE"] + "\">" + item["detailTitle"] + "</label>&nbsp;&nbsp;");
  593. }
  594. 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;JPY</span>");
  595. collModeTd.InnerHtml = sb.ToString();
  596. }
  597. private void DisplayAvailableBalance()
  598. {
  599. var dr = st.GetAcDetailByBranchIdNew(GetStatic.GetUser(), GetStatic.GetAgent());
  600. string amountDetails = "";
  601. if (dr == null || dr.Rows.Count == 0)
  602. {
  603. amountDetails = "N/A";
  604. }
  605. else
  606. {
  607. amountDetails = GetStatic.FormatData(dr.Rows[0]["availableBal"].ToString(), "M") + " " + dr.Rows[0]["balCurrency"];
  608. }
  609. availableAmountDetails.InnerText = amountDetails;
  610. }
  611. private void LoadSchemeByRCountry()
  612. {
  613. string pCountryFv = Request.Form["pCountry"];
  614. string pAgentFv = Request.Form["pAgent"];
  615. string sCustomerId = Request.Form["sCustomerId"];
  616. var dt = st.LoadSchemeByRCountry(GetStatic.GetCountryId(), GetStatic.GetAgent(), GetStatic.GetBranch(), pCountryFv, pAgentFv, sCustomerId);
  617. Response.ContentType = "text/plain";
  618. var json = DataTableToJson(dt);
  619. Response.Write(json);
  620. Response.End();
  621. }
  622. private void GetCurrentBalance()
  623. {
  624. var result = st.GetAcDetailByBranchIdNew(GetStatic.GetUser(), GetStatic.GetAgent());
  625. if (result == null)
  626. {
  627. availableAmt.Text = "N/A";
  628. return;
  629. }
  630. DataRow dr = result.Rows[0];
  631. availableAmt.Text = GetStatic.FormatData(dr["availableBal"].ToString(), "M");
  632. //lblPerDayLimit.Text = GetStatic.FormatData(dr["txnPerDayCustomerLimit"].ToString(), "M");
  633. //lblPerDayCustomerCurr.Text = dr["sCurr"].ToString();
  634. lblCollCurr.Text = dr["balCurrency"].ToString();
  635. lblSendCurr.Text = dr["sCurr"].ToString();
  636. lblServiceChargeCurr.Text = dr["sCurr"].ToString();
  637. txnPerDayCustomerLimit.Value = dr["txnPerDayCustomerLimit"].ToString();
  638. balCurrency.Text = dr["balCurrency"].ToString();
  639. hdnLimitAmount.Value = dr["sCountryLimit"].ToString();
  640. }
  641. protected long GetResendId()
  642. {
  643. return GetStatic.ReadNumericDataFromQueryString("resendId");
  644. }
  645. private void LoadAgentByExtAgent()
  646. {
  647. var pAgentFv = Request.Form["pAgent"];
  648. var dt = st.LoadAgentByExtAgent(GetStatic.GetUser(), pAgentFv);
  649. Response.ContentType = "text/plain";
  650. var json = DataTableToJson(dt);
  651. Response.Write(json);
  652. Response.End();
  653. }
  654. private void LoadAgentByExtBranch()
  655. {
  656. var pBranchFv = Request.Form["pBranch"];
  657. var dt = st.LoadAgentByExtBranch(GetStatic.GetUser(), pBranchFv);
  658. Response.ContentType = "text/plain";
  659. var json = DataTableToJson(dt);
  660. Response.Write(json);
  661. Response.End();
  662. }
  663. private void GetAgentSetting()
  664. {
  665. var pAgentFv = Request.Form["pAgent"];
  666. var pModeFv = Request.Form["pMode"];
  667. var pCountryFv = GetStatic.ReadFormData("pCountry", "");
  668. var pBankType = GetStatic.ReadFormData("pBankType", "");
  669. var dt = st.GetAgentSetting(GetStatic.GetUser(), pCountryFv, pAgentFv, pModeFv, pBankType);
  670. Response.ContentType = "text/plain";
  671. var json = DataTableToJson(dt);
  672. Response.Write(json);
  673. Response.End();
  674. }
  675. private void LoadDataFromDdl(string type)
  676. {
  677. var pAgentFv = Request.Form["pAgent"];
  678. var pModeFv = Request.Form["pmode"];
  679. var pCountryFv = Request.Form["pCountry"];
  680. DataTable dt = null;
  681. switch (type)
  682. {
  683. case "pMode":
  684. dt = st.LoadDataFromDdl(GetStatic.GetCountryId(), pCountryFv, pModeFv, GetStatic.GetAgent(), "recModeByCountry", GetStatic.GetUser());
  685. break;
  686. case "agentByPmode":
  687. if (string.IsNullOrWhiteSpace(pModeFv) || string.IsNullOrWhiteSpace(pCountryFv))
  688. {
  689. Response.Write(null);
  690. Response.End();
  691. return;
  692. }
  693. dt = st.LoadDataFromDdl(GetStatic.GetCountryId(), pCountryFv, pModeFv, GetStatic.GetAgent(), "recAgentByRecModeAjaxagent", GetStatic.GetUser());
  694. break;
  695. case "LoadScheme":
  696. dt = st.LoadDataFromDdl(GetStatic.GetCountryId(), pCountryFv, pModeFv, pAgentFv, "schemeBysCountryrAgent", GetStatic.GetUser());
  697. break;
  698. }
  699. Response.ContentType = "text/plain";
  700. var json = DataTableToJson(dt);
  701. Response.Write(json);
  702. Response.End();
  703. }
  704. private void PopulateReceiverBySender()
  705. {
  706. string recId = Request.Form["id"];
  707. string senderId = Request.Form["senderId"];
  708. DataTable dt = st.PopulateReceiverBySender(senderId, "", recId);
  709. Response.ContentType = "text/plain";
  710. string json = DataTableToJson(dt);
  711. Response.Write(json);
  712. Response.End();
  713. }
  714. private void PCurrPcountry()
  715. {
  716. string pCountry = Request.Form["pCountry"];
  717. string pMode = Request.Form["pMode"];
  718. string pAgent = Request.Form["pAgent"];
  719. DataTable Dt = st.LoadPayCurr(pCountry, pMode, pAgent);
  720. Response.ContentType = "text/plain";
  721. string json = DataTableToJson(Dt);
  722. Response.Write(json);
  723. Response.End();
  724. }
  725. private void PopulateDdl()
  726. {
  727. var natCountry = GetStatic.ReadWebConfig("localCountry", "");
  728. LoadSenderCountry(ref txtSendNativeCountry, natCountry, "SELECT COUNTRY");
  729. LoadReceiverCountry(ref pCountry, "", "SELECT");
  730. _sdd.SetDDL(ref ddSenIdType, "exec proc_sendPageLoadData @flag='idTypeBySCountry',@countryId='" + GetStatic.GetCountryId() + "'", "valueId", "detailTitle", "", "SELECT");
  731. _sdd.SetDDL(ref ddlCustomerType, "exec proc_sendPageLoadData @flag='search-cust-by'", "VALUE", "TEXT", "", "");
  732. _sdd.SetDDL(ref ddlSendCustomerType, "EXEC proc_online_dropDownList @flag='dropdownList',@parentId=4700", "valueId", "detailTitle", "", "SELECT CUSTOMER TYPE");
  733. _sdd.SetDDL(ref ddlIdIssuedCountry, "EXEC proc_sendPageLoadData @flag='idIssuedCountry'", "countryId", "countryName", "", "SELECT COUNTRY");
  734. _sdd.SetDDL(ref ddlEmpBusinessType, "EXEC proc_online_dropDownList @flag='dropdownList',@parentId=7002", "valueId", "detailTitle", "11007", "");
  735. _sdd.SetDDL(ref custLocationDDL, "EXEC proc_online_dropDownList @flag='state',@countryId='113'", "stateId", "stateName", "", "SELECT");
  736. _sdd.SetDDL(ref ddlRecIdType, "EXEC proc_online_dropDownList @flag='idType',@user='" + GetStatic.GetUser() + "'", "valueId", "detailTitle", "", "Select..");
  737. _sdd.SetDDL(ref sourceOfFund, "EXEC proc_online_dropDownList @flag='dropdownList',@user='" + GetStatic.GetUser() + "',@parentId=3900", "valueId", "detailTitle", "", "Select..");
  738. _sdd.SetDDL(ref purpose, "EXEC proc_online_dropDownList @flag='dropdownList',@user='" + GetStatic.GetUser() + "',@parentId=3800", "valueId", "detailTitle", "8060", "Select..");
  739. _sdd.SetDDL(ref relationship, "EXEC proc_online_dropDownList @flag='dropdownList',@user='" + GetStatic.GetUser() + "',@parentId=2100", "valueId", "detailTitle", "", "Select..");
  740. _sdd.SetDDL(ref occupation, "EXEC proc_online_dropDownList @flag='occupationList',@user='" + GetStatic.GetUser() + "'", "valueId", "detailTitle", "", "Select..");
  741. }
  742. private void LoadSenderCountry(ref DropDownList ddl, string defaultValue, string label)
  743. {
  744. var sql = "EXEC proc_dropDownLists @flag='country'";
  745. _sdd.SetDDL(ref ddl, sql, "countryId", "countryName", defaultValue, label);
  746. }
  747. private void LoadReceiverCountry(ref DropDownList ddl, string defaultValue, string label)
  748. {
  749. var sql = "EXEC proc_sendPageLoadData @flag='pCountry',@countryId='" + GetStatic.GetCountryId() + "',@agentid='" + GetStatic.GetAgentId() + "'";
  750. _sdd.SetDDL(ref ddl, sql, "countryId", "countryName", defaultValue, label);
  751. }
  752. private void CustomerSearchLoadData()
  753. {
  754. string customerId = Request.Form["customerId"];
  755. var dt = st.LoadCustomerDataNew(GetStatic.GetUser(), customerId, "s-new", GetStatic.GetCountryId(), GetStatic.GetSettlingAgent());
  756. if (dt == null)
  757. {
  758. Response.Write("");
  759. Response.End();
  760. return;
  761. }
  762. Response.ContentType = "text/plain";
  763. string json = DataTableToJson(dt);
  764. Response.Write(json);
  765. Response.End();
  766. }
  767. private void SearchRateScData()
  768. {
  769. string serchType = Request.Form["serchType"];
  770. string serchValue = Request.Form["serchValue"];
  771. DataTable dt = st.LoadCustomerData(serchType, serchValue, "s", GetStatic.GetCountryId(), GetStatic.GetSettlingAgent());
  772. if (dt == null)
  773. {
  774. Response.Write("");
  775. Response.End();
  776. return;
  777. }
  778. Response.ContentType = "text/plain";
  779. string json = DataTableToJson(dt);
  780. Response.Write(json);
  781. Response.End();
  782. }
  783. public static string DataSetToJSON(DataSet ds)
  784. {
  785. if (ds == null)
  786. return "";
  787. JavaScriptSerializer serializer = new JavaScriptSerializer();
  788. ArrayList root = new ArrayList();
  789. List<Dictionary<string, object>> table;
  790. Dictionary<string, object> data;
  791. foreach (DataTable dt in ds.Tables)
  792. {
  793. table = new List<Dictionary<string, object>>();
  794. foreach (DataRow dr in dt.Rows)
  795. {
  796. data = new Dictionary<string, object>();
  797. foreach (DataColumn col in dt.Columns)
  798. {
  799. data.Add(col.ColumnName, dr[col]);
  800. }
  801. table.Add(data);
  802. }
  803. root.Add(table);
  804. }
  805. return serializer.Serialize(root);
  806. }
  807. public static string DataTableToJson(DataTable table)
  808. {
  809. if (table == null)
  810. return "";
  811. var list = new List<Dictionary<string, object>>();
  812. foreach (DataRow row in table.Rows)
  813. {
  814. var dict = new Dictionary<string, object>();
  815. foreach (DataColumn col in table.Columns)
  816. {
  817. dict[col.ColumnName] = string.IsNullOrEmpty(row[col].ToString()) ? "" : row[col];
  818. }
  819. list.Add(dict);
  820. }
  821. var serializer = new JavaScriptSerializer();
  822. string json = serializer.Serialize(list);
  823. return json;
  824. }
  825. public static string GetJsonString(DataTable dt)
  826. {
  827. var strDc = new string[dt.Columns.Count];
  828. var headStr = string.Empty;
  829. for (int i = 0; i < dt.Columns.Count; i++)
  830. {
  831. strDc[i] = dt.Columns[i].Caption;
  832. headStr += "\"" + strDc[i] + "\" : \"" + strDc[i] + i.ToString() + " " + "\",";
  833. }
  834. headStr = headStr.Substring(0, headStr.Length - 1);
  835. var sb = new StringBuilder();
  836. sb.Append("{\"" + dt.TableName + "\" : [");
  837. for (var i = 0; i < dt.Rows.Count; i++)
  838. {
  839. var tempStr = headStr;
  840. sb.Append("{");
  841. for (var j = 0; j < dt.Columns.Count; j++)
  842. {
  843. tempStr = tempStr.Replace(dt.Columns[j] + j.ToString() + "¾", dt.Rows[i][j].ToString());
  844. }
  845. sb.Append(tempStr + "},");
  846. }
  847. sb = new StringBuilder(sb.ToString().Substring(0, sb.ToString().Length - 1));
  848. sb.Append("]}");
  849. return sb.ToString();
  850. }
  851. protected void Calculate()
  852. {
  853. DataTable dt = new DataTable();
  854. var pCountryFv = Request.Form["pCountry"];
  855. var pcountrytxt = Request.Form["pCountrytxt"];
  856. var pModeFv = Request.Form["pMode"];
  857. var pModetxt = Request.Form["pModetxt"];
  858. var pAgentFv = Request.Form["pAgent"];
  859. var pAgentBranch = Request.Form["pAgentBranch"];
  860. var collAmt = Request.Form["collAmt"];
  861. var payAmt = Request.Form["payAmt"];
  862. var collCurr = Request.Form["collCurr"];
  863. var payCurr = Request.Form["payCurr"];
  864. var senderId = Request.Form["senderId"];
  865. var schemeCode = Request.Form["schemeCode"];
  866. var couponId = Request.Form["couponId"];
  867. var isManualSc = Request.Form["isManualSc"];
  868. var sc = Request.Form["sc"];
  869. var rewardAmt = Request.Form["rewardAmt"];
  870. dt = st.GetExRate(GetStatic.GetUser()
  871. , GetStatic.GetCountryId()
  872. , GetStatic.GetSuperAgent()
  873. , GetStatic.GetAgent()
  874. , GetStatic.GetBranch()
  875. , collCurr
  876. , pCountryFv
  877. , pAgentFv
  878. , payCurr
  879. , pModeFv
  880. , collAmt
  881. , payAmt
  882. , schemeCode
  883. , senderId
  884. , GetStatic.GetSessionId()
  885. , couponId
  886. , rewardAmt
  887. ,""
  888. , isManualSc
  889. , sc);
  890. Response.ContentType = "text/plain";
  891. var json = DataTableToJson(dt);
  892. Response.Write(json);
  893. Response.End();
  894. }
  895. private void LoadCustomerRate()
  896. {
  897. var pCountryFv = GetStatic.ReadFormData("pCountry", "");
  898. var pAgentFv = GetStatic.ReadFormData("pAgent", "");
  899. var pModeFv = GetStatic.ReadFormData("pMode", "");
  900. var collCurr = GetStatic.ReadFormData("collCurr", "");
  901. var dt = st.LoadCustomerRate(GetStatic.GetUser()
  902. , GetStatic.GetCountryId()
  903. , GetStatic.GetSuperAgent()
  904. , GetStatic.GetAgent()
  905. , GetStatic.GetBranch()
  906. , collCurr
  907. , pCountryFv
  908. , pAgentFv
  909. , ""
  910. , pModeFv
  911. );
  912. Response.ContentType = "text/plain";
  913. var json = DataTableToJson(dt);
  914. Response.Write(json);
  915. Response.End();
  916. }
  917. private void CheckSenderIdNumber()
  918. {
  919. var sIdType = GetStatic.ReadQueryString("sIdType", "");
  920. var sIdNo = GetStatic.ReadFormData("sIdNo", "");
  921. var dt = st.CheckSenderIdNumber(GetStatic.GetUser(), sIdType, sIdNo);
  922. Response.ContentType = "text/plain";
  923. var json = DataTableToJson(dt);
  924. Response.Write(json);
  925. Response.End();
  926. }
  927. private void CheckAvialableBalance()
  928. {
  929. string collectionMode = Request.Form["collectionMode"];
  930. string customerId = Request.Form["customerId"];
  931. StringBuilder sb = new StringBuilder();
  932. var result = st.CheckAvailableBanalce(GetStatic.GetUser(), customerId, collectionMode, "");
  933. if (result != null)
  934. {
  935. if (collectionMode == "Bank Deposit")
  936. 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>");
  937. else
  938. 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>");
  939. }
  940. else
  941. {
  942. 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>");
  943. }
  944. Response.Write(sb);
  945. Response.End();
  946. }
  947. private void GetPayerDataByBankId()
  948. {
  949. string bankId = Request.Form["bankId"];
  950. string partnerId = Request.Form["partnerId"];
  951. DataTable dt = st.GetPayersByAgent(bankId, partnerId);
  952. Response.ContentType = "text/plain";
  953. string json = DataTableToJson(dt);
  954. Response.Write(json);
  955. Response.End();
  956. }
  957. private void GetPayerDataByPayerAndCityId()
  958. {
  959. string bankId = Request.Form["payerId"];
  960. string partnerId = Request.Form["partnerId"];
  961. string cityId = Request.Form["CityId"];
  962. DataTable dt = st.GetPayerBranchDataByPayerAndCityId(bankId, cityId, partnerId);
  963. Response.ContentType = "text/plain";
  964. string json = DataTableToJson(dt);
  965. Response.Write(json);
  966. Response.End();
  967. }
  968. protected void register_Click(object sender, EventArgs e)
  969. {
  970. //ucTranDetails.tD = SetTxnData();
  971. //complete.Attributes.Add("Class", "active");
  972. //divTranDetails.Visible = true;
  973. //txtSenderName.InnerText = txtRecFName.Text;
  974. }
  975. private IRHTranDetail SetTxnData()
  976. {
  977. var trn = new IRHTranDetail();
  978. var randObj = new Random();
  979. var agentRefId = randObj.Next(1000000000, 1999999999).ToString();
  980. trn.AgentRefId = agentRefId;
  981. trn.User = GetStatic.GetUser();
  982. trn.SessionId = GetStatic.GetSessionId();
  983. //trn.SenderId = finalSenderId.InnerText;
  984. trn.SenFirstName = txtSendFirstName.Text;
  985. trn.SenMiddleName = txtSendMidName.Text;
  986. trn.SenLastName = txtSendLastName.Text;
  987. trn.SenGender = ddlSenGender.SelectedValue;
  988. trn.SenIdType = ddSenIdType.SelectedValue;
  989. trn.SenIdNo = txtSendIdNo.Text;
  990. trn.SenIdValid = txtSendIdValidDate.Text;
  991. trn.SenDob = txtSendDOB.Text;
  992. trn.SenEmail = txtSendEmail.Text;
  993. trn.SenTel = txtSendTel.Text;
  994. trn.SenMobile = txtSendMobile.Text;
  995. trn.SenNaCountry = txtSendNativeCountry.Text;
  996. trn.SenCity = txtSendCity.Text;
  997. trn.SenPostCode = txtSendPostal.Text;
  998. trn.ReceiverId = ddlReceiver.SelectedValue;
  999. trn.RecFirstName = txtRecFName.Text;
  1000. trn.RecMiddleName = txtRecMName.Text;
  1001. trn.RecLastName = txtRecLName.Text;
  1002. trn.RecGender = ddlRecGender.SelectedValue;
  1003. trn.RecIdType = ddlRecIdType.SelectedItem.Text;
  1004. trn.RecIdNo = txtRecIdNo.Text;
  1005. trn.RecTel = txtRecTel.Text;
  1006. trn.RecMobile = txtRecMobile.Text;
  1007. trn.RecNaCountry = "";
  1008. trn.RecCity = txtRecCity.Text;
  1009. trn.RecAdd1 = txtRecAdd1.Text;
  1010. trn.RecEmail = txtRecEmail.Text;
  1011. trn.RecAccountNo = txtRecDepAcNo.Text;
  1012. trn.RecCountryId = pCountry.SelectedValue;
  1013. trn.RecCountry = pCountry.SelectedItem.Text;
  1014. trn.DeliveryMethodId = Request.Form[pMode.UniqueID];
  1015. trn.PBank = Request.Form[pAgent.UniqueID];
  1016. trn.PBankBranch = Request.Form[branch.UniqueID];
  1017. trn.PBankType = Request.Form[pAgentDetail.UniqueID];
  1018. trn.PAgent = Request.Form[pAgent.UniqueID];
  1019. trn.PCurr = lblPayCurr.Text;
  1020. trn.CollCurr = lblCollCurr.Text;
  1021. trn.CollAmt = txtCollAmt.Text;
  1022. trn.CustomerLimit = txtCustomerLimit.Value;
  1023. trn.PayoutAmt = txtPayAmt.Text;
  1024. trn.TransferAmt = lblSendAmt.Text;
  1025. trn.ServiceCharge = lblServiceChargeAmt.Text;
  1026. trn.ExRate = lblExRate.Text;
  1027. trn.PurposeOfRemittance = purpose.SelectedItem.Text;
  1028. trn.SourceOfFund = sourceOfFund.SelectedItem.Text;
  1029. trn.RelWithSender = relationship.SelectedItem.Text;
  1030. trn.Occupation = occupation.SelectedValue;
  1031. trn.PayoutMsg = txtPayMsg.Text;
  1032. trn.Company = companyName.Text;
  1033. trn.NCustomer = "N";
  1034. trn.ECustomer = "Y";
  1035. trn.SBranch = GetStatic.GetBranch();
  1036. trn.SBranchName = GetStatic.GetBranchName();
  1037. trn.SAgent = GetStatic.GetAgent();
  1038. trn.SAgentName = GetStatic.GetAgentName();
  1039. trn.SSuperAgent = GetStatic.GetSuperAgent();
  1040. trn.SSuperAgentName = GetStatic.GetSuperAgentName();
  1041. trn.SettlingAgent = GetStatic.GetSettlingAgent();
  1042. trn.SCountry = GetStatic.GetCountry();
  1043. trn.SCountryId = GetStatic.GetCountryId();
  1044. trn.manualSC = lblServiceChargeAmt.Text;
  1045. trn.sCustStreet = sCustStreet.Text;
  1046. trn.sCustLocation = custLocationDDL.SelectedValue;
  1047. trn.sCustomerType = ddlSendCustomerType.SelectedValue;
  1048. trn.sCustBusinessType = ddlEmpBusinessType.SelectedValue;
  1049. trn.sCustIdIssuedCountry = ddlIdIssuedCountry.SelectedValue;
  1050. trn.sCustIdIssuedDate = txtSendIdExpireDate.Text;
  1051. trn.receiverId = Request.Form[ddlReceiver.UniqueID];
  1052. trn.payoutPartner = hddPayoutPartner.Value;
  1053. trn.introducer = introducerTxt.Text;
  1054. trn.tpExRate = hddTPExRate.Value;
  1055. return trn;
  1056. }
  1057. private void Proceed()
  1058. {
  1059. var dbResult = Save();
  1060. if (!string.IsNullOrEmpty(hddImgURL.Value) && (dbResult.ErrorCode == "0" || dbResult.ErrorCode == "100" || dbResult.ErrorCode == "101"))
  1061. {
  1062. UploadImage(hddImgURL.Value, dbResult.Id);
  1063. }
  1064. if (dbResult.ErrorCode == "0" || dbResult.ErrorCode == "100" || dbResult.ErrorCode == "101")
  1065. {
  1066. GetStatic.SetMessage(dbResult);
  1067. ManageMessage1(dbResult);
  1068. }
  1069. else
  1070. {
  1071. GetStatic.SetMessage(dbResult);
  1072. ManageMessage1(dbResult);
  1073. }
  1074. }
  1075. private DbResult Save()
  1076. {
  1077. var trn = GetDataForValidation();
  1078. return st.SendTransactionIRH(trn);
  1079. }
  1080. private void ManageMessage1(DbResult dbResult)
  1081. {
  1082. var mes = GetStatic.ParseResultJsPrint(dbResult);
  1083. mes = mes.Replace("'", "");
  1084. mes = mes.Replace("<center>", "");
  1085. mes = mes.Replace("</center>", "");
  1086. var invPrintMode = invoicePrintMode.Text;
  1087. var scriptName = "ManageMessage";
  1088. var functionName = "ManageMessage('" + mes + "','" + invPrintMode + "');";
  1089. GetStatic.CallBackJs1(Page, scriptName, functionName);
  1090. }
  1091. public void UploadImage(string imageData, string controlNo)
  1092. {
  1093. string path = GetStatic.GetCustomerFilePath() + "Transaction\\CustomerSignature\\" + DateTime.Now.Year.ToString() + "\\" + DateTime.Now.Month.ToString() + "\\" + DateTime.Now.Day.ToString();
  1094. if (!Directory.Exists(path))
  1095. Directory.CreateDirectory(path);
  1096. string fileName = path + "\\" + controlNo + ".png";
  1097. using (FileStream fs = new FileStream(fileName, FileMode.Create))
  1098. {
  1099. using (BinaryWriter bw = new BinaryWriter(fs))
  1100. {
  1101. byte[] data = Convert.FromBase64String(imageData);
  1102. bw.Write(data);
  1103. bw.Close();
  1104. }
  1105. }
  1106. }
  1107. protected void chkMultipleTxn_CheckedChanged(object sender, EventArgs e)
  1108. {
  1109. if (!chkCdd.Visible)
  1110. if (!chkMultipleTxn.Checked)
  1111. sendTran.Attributes.Add("disabled", (true).ToString());
  1112. else
  1113. sendTran.Attributes.Remove("disabled");
  1114. else
  1115. {
  1116. if (chkMultipleTxn.Checked && chkCdd.Checked)
  1117. sendTran.Attributes.Add("disabled", (true).ToString());
  1118. else
  1119. sendTran.Attributes.Remove("disabled");
  1120. }
  1121. }
  1122. protected void chkCdd_CheckedChanged(object sender, EventArgs e)
  1123. {
  1124. if (!chkMultipleTxn.Visible)
  1125. sendTran.Attributes.Add("disabled", (!chkCdd.Checked).ToString());
  1126. else
  1127. {
  1128. if (chkMultipleTxn.Checked && chkCdd.Checked)
  1129. sendTran.Attributes.Add("disabled", (true).ToString());
  1130. else
  1131. sendTran.Attributes.Remove("disabled");
  1132. }
  1133. }
  1134. }
  1135. }