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.

111 lines
4.8 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 System;
  5. using System.Data;
  6. using System.IO;
  7. using System.Text;
  8. using System.Web.UI;
  9. namespace JMEAgentSystem.WebPages.CustomerRegistration
  10. {
  11. public partial class PrintDetails : System.Web.UI.Page
  12. {
  13. private readonly ICustomerServices _customerServices = AutoFacContainer.Resolve<ICustomerServices>();
  14. protected void Page_Load(object sender, EventArgs e)
  15. {
  16. if (!IsPostBack)
  17. {
  18. GetStatic.PrintMessage(this.Page);
  19. LoadCustomerDetails();
  20. todaysDate.InnerText = DateTime.Now.ToString("dd-MM-yyyy");
  21. SavePDF();
  22. }
  23. }
  24. private void SavePDF()
  25. {
  26. var result = _customerServices.GetCustomerDetailsForPDFSave(GetMembershipId(), GetStatic.ReadQueryString("customerId", ""), "customer").Split('|');
  27. if (result[0] != "0")
  28. {
  29. return;
  30. }
  31. var customerId = result[1];
  32. var membershipId = result[2];
  33. var registerDate = result[3];
  34. var fileNameSignature = result[4];
  35. string path = GetStatic.GetCustomerFilePath() + "CustomerDocument\\" + registerDate.Replace("-", "\\") + "\\" + membershipId + "\\";
  36. var sb = new StringBuilder();
  37. downloadDivPDF.RenderControl(new HtmlTextWriter(new StringWriter(sb)));
  38. string s = sb.ToString();
  39. string replaceText = "/WebPages/GetFileView.ashx?registerDate=" + Convert.ToDateTime(registerDate).ToString("yyyy-MM-dd") + "&customerId=" + customerId + "&membershipNo=" + membershipId + "&fileName=" + fileNameSignature;
  40. s = s.Replace(replaceText, path + fileNameSignature);
  41. string fileName = GetStatic.HTMLToPDF(s, GetStatic.GetUser(), path, "customer-req-form");
  42. _customerServices.AddCustomerPDFUpload(customerId, GetStatic.GetUser(), fileName, "customer", customerId);
  43. }
  44. protected void approve_Click(object sender, EventArgs e)
  45. {
  46. }
  47. private void LoadCustomerDetails()
  48. {
  49. var membershipId = GetMembershipId();
  50. // var receiverId = GetReceiverId();
  51. if (membershipId == "")
  52. {
  53. return;
  54. }
  55. var dataSet = _customerServices.GetCustomerInfoFromMembershiId(GetStatic.GetUser(), membershipId,"", "");
  56. //set customer details
  57. SetCustomerDetails(dataSet.Tables[1].Rows[0]);
  58. }
  59. private string GetMembershipId()
  60. {
  61. return GetStatic.ReadQueryString("membershipId", "");
  62. }
  63. private void SetCustomerDetails(DataRow dr)
  64. {
  65. hdnCustomerId.Value = dr["customerId"].ToString();
  66. txtCustomerType.InnerText = dr["customerType"].ToString();
  67. txtFullName.InnerText = dr["fullName"].ToString();
  68. customerName.InnerText = dr["fullName"].ToString();
  69. membershiId.InnerText = dr["membershipId"].ToString();
  70. hdnAccountName.Value = txtFullName.InnerText;
  71. txtGender.InnerText = dr["gender"].ToString();
  72. txtCountry.InnerText = dr["country"].ToString();
  73. txtAddress.InnerText = dr["address"].ToString();
  74. txtZipcCode.InnerText = dr["zipcode"].ToString();
  75. txtCity.InnerText = dr["city"].ToString();
  76. txtEmailId.InnerText = dr["email"].ToString();
  77. txtTelephoneNo.InnerText = dr["telNo"].ToString();
  78. txtMobileNo.InnerText = dr["mobile"].ToString();
  79. txtNativeCountry.InnerText = dr["nativeCountry"].ToString();
  80. txtDateOfBirth.InnerText = dr["dob"].ToString();
  81. txtOccupation.InnerText = dr["occupation"].ToString();
  82. txtOtherOccupation.InnerText = dr["occupationOther"].ToString();
  83. txtIssueDate.InnerText = dr["idIssueDate"].ToString();
  84. txtExpireDate.InnerText = dr["idExpiryDate"].ToString();
  85. txtIdType.InnerText = dr["idType"].ToString();
  86. txtIdNumber.InnerText = dr["idNumber"].ToString();
  87. txtVisaStatus.InnerText = dr["visaStatus"].ToString();
  88. txtEmployeeBusinessType.InnerText = dr["employeeBusinessType"].ToString();
  89. txtNameOfEmployer.InnerText = dr["nameOfEmployeer"].ToString();
  90. txtMonthlyIncome.InnerText = dr["monthlyIncome"].ToString();
  91. txtRemittanceAllowed.InnerText = dr["remittanceAllowed"].ToString();
  92. txtOnlineLoginAllowed.InnerText = dr["onlineUser"].ToString();
  93. txtRemarks.InnerText = dr["remarks"].ToString();
  94. txtSourceOfFund.InnerText = dr["sourceOfFund"].ToString();
  95. }
  96. }
  97. }