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.

213 lines
10 KiB

10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
  1. using Swift.API.Common;
  2. using Swift.API.Common.SMS;
  3. using Swift.API.ThirdPartyApiServices;
  4. using Swift.DAL.BL.Remit.Transaction;
  5. using Swift.DAL.SwiftDAL;
  6. using Swift.web.Library;
  7. using System;
  8. using System.Data;
  9. namespace Swift.web.AgentNew.SendTxn
  10. {
  11. public partial class WebForm1 : System.Web.UI.Page
  12. {
  13. private readonly ReceiptDao obj = new ReceiptDao();
  14. private readonly SwiftLibrary sl = new SwiftLibrary();
  15. protected void Page_Load(object sender, EventArgs e)
  16. {
  17. sl.CheckSession();
  18. var methodName = Request.Form["MethodName"];
  19. if (methodName == "SendSMS")
  20. SendSMS();
  21. if (!IsPostBack)
  22. {
  23. ShowData();
  24. ShowMultipleReceipt();
  25. }
  26. GetStatic.AlertMessage(this.Page);
  27. }
  28. private void ShowMultipleReceipt()
  29. {
  30. if (GetInvoicePrintMode() != "")
  31. {
  32. if (GetInvoicePrintMode() == "s")
  33. {
  34. divInvoiceSecond.Attributes.Add("style", "margin: 15px 0; display: none;");
  35. divInvoiceSecond1.Attributes.Add("style", "display: none;");
  36. }
  37. }
  38. }
  39. private string GetControlNo()
  40. {
  41. return GetStatic.ReadQueryString("controlNo", "");
  42. }
  43. private string GetInvoicePrintMode()
  44. {
  45. return GetStatic.ReadQueryString("invoicePrint", "");
  46. }
  47. protected void ShowData()
  48. {
  49. //lblControlNo.Text = GetStatic.GetTranNoName();
  50. DataSet ds = obj.GetSendIntlReceipt(GetControlNo(), GetStatic.GetUser(), "S");
  51. if (ds.Tables.Count >= 1)
  52. {
  53. if (ds.Tables[0].Rows.Count > 0)
  54. {
  55. //Load Sender Information
  56. DataRow sRow = ds.Tables[0].Rows[0];
  57. senderName.Text = sRow["senderName"].ToString();
  58. sMemId.Text = sRow["sMemId"].ToString();
  59. sAddress.Text = sRow["sAddress"].ToString();
  60. sNativeCountry.Text = sRow["sNativeCountry"].ToString();
  61. purpose.Text = sRow["purpose"].ToString();
  62. sDob.Text = sRow["sDob"].ToString();
  63. sContactNo.Text = sRow["sContactNo"].ToString();
  64. visaStatus.Text = sRow["visaStatus"].ToString();
  65. txnSenderMobile.Text = sRow["sContactNo"].ToString();
  66. smsToSend.Text = GetSMSText(sRow);
  67. //Load Receiver Information
  68. receiverName.Text = sRow["receiverName"].ToString();
  69. pAgentCountry.Text = sRow["pAgentCountry"].ToString();
  70. paymentMode.Text = sRow["paymentMode"].ToString();
  71. rContactNo.Text = sRow["rContactNo"].ToString();
  72. pBankName.Text = sRow["pBankName"].ToString();
  73. relationShip.Text = sRow["relwithSender"].ToString();
  74. senderDepositType.Text = sRow["depositType"].ToString();
  75. serial1.Text = sRow["tranId"].ToString();
  76. serial2.Text = sRow["tranId"].ToString();
  77. //comment by gunn
  78. //pBranchName.Text = sRow["pBranchName"].ToString();
  79. pBranchName.Text = sRow["BranchName"].ToString();
  80. accountNo.Text = sRow["accountNo"].ToString();
  81. controlNo.Text = sRow["controlNo"].ToString();
  82. createdBy.Text = sRow["companyaddress"].ToString();
  83. approvedDate.Text = DateTime.Parse(sRow["createdDate"].ToString()).ToString("yyyy-MM-dd hh:mm:ss tt");
  84. cAmt.Text = GetStatic.ShowDecimal(sRow["cAmt"].ToString()) + "&nbsp" + sRow["collCurr"].ToString();
  85. serviceCharge.Text = GetStatic.ShowTwoDecimal(sRow["serviceCharge"].ToString()) + "&nbsp" + sRow["collCurr"].ToString();
  86. tAmt.Text = GetStatic.ShowDecimal(sRow["tAmt"].ToString()) + "&nbsp" + sRow["collCurr"].ToString();
  87. exRate.Text = sRow["exRate"].ToString() + "&nbsp" + sRow["payoutCurr"].ToString();
  88. pAmt.Text = GetStatic.ShowDecimal(sRow["pAmt"].ToString()) + "&nbsp" + sRow["payoutCurr"].ToString();
  89. depositType.Text = sRow["collMode"].ToString();
  90. depositType1.Text = sRow["collMode"].ToString();
  91. //operator1.Text = sRow["createdBy"].ToString();
  92. //for second from
  93. //Load Sender Information
  94. senderName1.Text = sRow["senderName"].ToString();
  95. sMemId1.Text = sRow["sMemId"].ToString();
  96. sAddress1.Text = sRow["sAddress"].ToString();
  97. sNativeCountry1.Text = sRow["sNativeCountry"].ToString();
  98. purpose1.Text = sRow["purpose"].ToString();
  99. sContactNo1.Text = sRow["sContactNo"].ToString();
  100. lblOccupation.Text = sRow["occupation"].ToString();
  101. lblOccupation1.Text = sRow["occupation"].ToString();
  102. //Load Receiver Information
  103. receiverName1.Text = sRow["receiverName"].ToString();
  104. pAgentCountry1.Text = sRow["pAgentCountry"].ToString();
  105. paymentMode1.Text = sRow["paymentMode"].ToString();
  106. rContactNo1.Text = sRow["rContactNo"].ToString();
  107. pBankName1.Text = sRow["pBankName"].ToString();
  108. relationship1.Text = sRow["relwithSender"].ToString();
  109. senderDepositType1.Text = sRow["depositType"].ToString();
  110. pBranchName1.Text = sRow["BranchName"].ToString();
  111. accountNo1.Text = sRow["accountNo"].ToString();
  112. controlNo1.Text = sRow["controlNo"].ToString();
  113. createdBy1.Text = sRow["companyaddress"].ToString();
  114. approvedDate1.Text = DateTime.Parse(sRow["createdDate"].ToString()).ToString("yyyy-MM-dd hh:mm:ss tt");
  115. cAmt1.Text = GetStatic.ShowWithoutDecimal(sRow["cAmt"].ToString()) + "&nbsp" + sRow["collCurr"].ToString();
  116. serviceCharge1.Text = GetStatic.ShowWithoutDecimal(sRow["serviceCharge"].ToString()) + "&nbsp" + sRow["collCurr"].ToString();
  117. tAmt1.Text = GetStatic.ShowWithoutDecimal(sRow["tAmt"].ToString()) + "&nbsp" + sRow["collCurr"].ToString();
  118. exRate1.Text = sRow["exRate"].ToString() + "&nbsp" + sRow["payoutCurr"].ToString();
  119. pAmt1.Text = GetStatic.ShowDecimal(sRow["pAmt"].ToString()) + "&nbsp" + sRow["payoutCurr"].ToString();
  120. operator2.Text = sRow["createdBy"].ToString();
  121. if (sRow["paymentMethod"].ToString().ToUpper().Equals("CASH PAYMENT"))
  122. {
  123. bank3.Attributes.Add("style", "display: none;");
  124. bank4.Attributes.Add("style", "display: none;");
  125. bankAccNo.Attributes.Add("style", "display: none;");
  126. bankAccNo1.Attributes.Add("style", "display: none;");
  127. bank7.Attributes.Add("style", "display: none;");
  128. bank8.Attributes.Add("style", "display: none;");
  129. bankLabel.InnerHtml = "Cash Location";
  130. bankLabel1.InnerHtml = "Cash Location";
  131. }
  132. }
  133. }
  134. }
  135. protected string GetSMSText(DataRow sRow)
  136. {
  137. FullName _fullNameS = GetStatic.ParseName(sRow["senderName"].ToString());
  138. FullName _fullNameR = GetStatic.ParseName(sRow["receiverName"].ToString());
  139. string controlNo = sRow["controlNo"].ToString();
  140. string sms = "";
  141. if (sRow["paymentMethod"].ToString().ToLower() == "bank deposit" || sRow["paymentMethod"].ToString().ToLower() == "Mobile Wallet")
  142. {
  143. FullName _bankName = GetStatic.ParseName(sRow["pBankName"].ToString());
  144. sms += "Dear " + _fullNameS.FirstName + ", Your TXN with Reference Number " + controlNo + " has been completed. If you have already deposited the amount to us your Receiver account will be credited within 1 Working Hour.";
  145. sms += "\nThank you!";
  146. }
  147. else
  148. {
  149. sms += "Dear " + _fullNameS.FirstName + ", Your TXN with Reference Number " + controlNo + " has been completed.If you have already deposited the amount to us your Receiver can collect the transaction from any payout location within 1 hour.";
  150. sms += "\nThank you!";
  151. }
  152. return sms;
  153. }
  154. public void SendSMS()
  155. {
  156. JsonResponse _resp = new JsonResponse();
  157. DbResult _dbRes = obj.CheckForSMSSend(GetStatic.GetUser(), GetControlNo());
  158. if (_dbRes.ErrorCode != "0")
  159. {
  160. _resp.ResponseCode = "1";
  161. _resp.Msg = _dbRes.Msg;
  162. GetStatic.JsonResponse(_resp, this);
  163. return;
  164. }
  165. string ProcessId = Guid.NewGuid().ToString().Replace("-", "") + ":sendSms";
  166. SendSMSApiService _sendAPI = new SendSMSApiService();
  167. //GetSMSTextForTxn
  168. SMSRequestModel _req = new SMSRequestModel
  169. {
  170. ProviderId = "onewaysms",
  171. MobileNumber = Request.Form["mobileNumber"].Trim().Replace("+", ""),
  172. SMSBody = Request.Form["smsToSend"],
  173. ProcessId = ProcessId.Substring(ProcessId.Length - 40, 40),
  174. RequestedBy = GetStatic.GetUser(),
  175. UserName = GetStatic.GetUser(),
  176. method = "send",
  177. ControlNo = GetControlNo()
  178. };
  179. _resp = _sendAPI.SMSTPApi(_req);
  180. string isSuccess = (_resp.ResponseCode == "0") ? "1" : "0";
  181. obj.LogSMS(GetControlNo(), GetStatic.GetUser(), Request.Form["smsToSend"], Request.Form["mobileNumber"].Trim().Replace("+", ""),
  182. ProcessId, _resp.Extra, isSuccess);
  183. GetStatic.JsonResponse(_resp, this);
  184. }
  185. }
  186. }