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.

116 lines
5.0 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. using Business.Configuration;
  2. using Business.Customer;
  3. using Common.Helper;
  4. using JMEAgentSystem.WebPages.CustomerRegistration;
  5. using System;
  6. using System.Data;
  7. using System.IO;
  8. using System.Text;
  9. using System.Web;
  10. using System.Web.UI;
  11. namespace JMEAgentSystem.WebPages.BenificiaryRegistration
  12. {
  13. public partial class PrintBeneficiaryDetails : System.Web.UI.Page
  14. {
  15. private readonly ICustomerServices _customerServices = AutoFacContainer.Resolve<ICustomerServices>();
  16. protected void Page_Load(object sender, EventArgs e)
  17. {
  18. if (!IsPostBack)
  19. {
  20. GetStatic.PrintMessage(this.Page);
  21. LoadCustomerDetails();
  22. todaysDate.InnerText = DateTime.Now.ToString("dd-MM-yyyy");
  23. SavePDF();
  24. }
  25. }
  26. private void SavePDF()
  27. {
  28. var result = _customerServices.GetCustomerDetailsForPDFSave(GetMembershipId(), GetReceiverId(), "receiver").Split('|');
  29. if (result[0] != "0")
  30. {
  31. return;
  32. }
  33. var customerId = result[1];
  34. var membershipId = result[2];
  35. var registerDate = result[3];
  36. var fileNameSignature = result[4];
  37. string path = GetStatic.GetCustomerFilePath() + "CustomerDocument\\" + registerDate.Replace("-", "\\") + "\\" + membershipId + "\\";
  38. var sb = new StringBuilder();
  39. downloadDivPDF.RenderControl(new HtmlTextWriter(new StringWriter(sb)));
  40. string s = sb.ToString();
  41. string replaceText = "/WebPages/GetFileView.ashx?registerDate=" + Convert.ToDateTime(registerDate).ToString("yyyy-MM-dd") + "&customerId=" + customerId + "&membershipNo=" + membershipId + "&fileName=" + fileNameSignature;
  42. s = s.Replace(replaceText, path + fileNameSignature);
  43. //s = s + "<img src=\"E:\\JMEFiles\\CustomerDocument\\2020\\09\\07\\AGT031733\\48305_signature_15249_2020_09_07.png\" />";
  44. String originalPath = new Uri(HttpContext.Current.Request.Url.AbsoluteUri).OriginalString;
  45. string fileName = GetStatic.HTMLToPDF(s, GetStatic.GetUser(), path, "bene-reg-form");
  46. _customerServices.AddCustomerPDFUpload(customerId, GetStatic.GetUser(), fileName, "receiver", GetReceiverId());
  47. }
  48. protected void approve_Click(object sender, EventArgs e)
  49. {
  50. }
  51. private void LoadCustomerDetails()
  52. {
  53. var membershipId = GetMembershipId();
  54. var receiverId = GetReceiverId();
  55. if(receiverId == "")
  56. {
  57. return;
  58. }
  59. var dataSet = _customerServices.GetCustomerInfoFromMembershiId(GetStatic.GetUser(), membershipId, receiverId, "");
  60. SetCustomerDetails(dataSet.Tables[1].Rows[0]);
  61. //set receiver dettails
  62. SetReceiverDetails(dataSet.Tables[2].Rows[0]);
  63. PrintDetails pd = new PrintDetails();
  64. docDiv.InnerHtml = pd.GetSignatrueHtml(dataSet, "Staff Visit - Bene. Reg(Customer Signature)", dataSet.Tables[2].Rows[0]["receiverId"].ToString());
  65. }
  66. private string GetMembershipId()
  67. {
  68. return GetStatic.ReadQueryString("membershipId", "");
  69. }
  70. private string GetReceiverId()
  71. {
  72. return GetStatic.ReadQueryString("receiverId", "");
  73. }
  74. private void SetReceiverDetails(DataRow dr)
  75. {
  76. recCountry.InnerText = dr["country"].ToString();
  77. recBeneficiaryType.InnerText = dr["receiverType"].ToString();
  78. recFullName.InnerText = dr["customerName"].ToString();
  79. recNativeCountry.InnerText = dr["NativeCountry"].ToString();
  80. recAddress.InnerText = dr["address"].ToString();
  81. recCity.InnerText = dr["city"].ToString();
  82. recMobile.InnerText = dr["mobile"].ToString();
  83. recIdType.InnerText = dr["idType"].ToString();
  84. recIdNumber.InnerText = dr["idNumber"].ToString();
  85. recPlaceOfIssue.InnerText = dr["placeOfIssue"].ToString();
  86. recRelationship.InnerText = dr["relationship"].ToString();
  87. recOtherRelationDescription.InnerText = dr["otherRelationDesc"].ToString();
  88. recPurposeOfRemittance.InnerText = dr["purposeOfRemit"].ToString();
  89. otherPurpose.InnerText = dr["otherPurpose"].ToString();
  90. recPaymentMode.InnerText = dr["paymentMode"].ToString();
  91. pagent.InnerText = dr["payOutPartner"].ToString();
  92. recAccountNumber.InnerText = dr["receiverAccountNo"].ToString();
  93. pBranch.InnerText = dr["bankBranchName"].ToString();
  94. recRemarks.InnerText = dr["remarks"].ToString();
  95. }
  96. private void SetCustomerDetails(DataRow dr)
  97. {
  98. customerName.InnerText = dr["fullName"].ToString();
  99. membershiId.InnerText = dr["membershipId"].ToString();
  100. }
  101. }
  102. }