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.

149 lines
6.3 KiB

  1. using Swift.DAL.OnlineAgent;
  2. using Swift.web.Library;
  3. using System;
  4. using System.Data;
  5. using System.IO;
  6. using System.Text;
  7. using System.Web.UI;
  8. namespace Swift.web.AgentNew.TabletMenu
  9. {
  10. public partial class CustomerSignature : System.Web.UI.Page
  11. {
  12. private readonly OnlineCustomerDao _cd = new OnlineCustomerDao();
  13. private readonly SwiftLibrary sl = new SwiftLibrary();
  14. protected void Page_Load(object sender, EventArgs e)
  15. {
  16. sl.CheckSession();
  17. if (!IsPostBack)
  18. {
  19. GetStatic.PrintMessage(this.Page);
  20. LoadCustomerDetails();
  21. docDiv.Visible = false;
  22. dateDiv.Visible = false;
  23. //SavePDF();
  24. }
  25. }
  26. private void LoadCustomerDetails()
  27. {
  28. var customerId = GetCustomerId();
  29. var dataSet = _cd.GetCustomerInfoFromCustomerId(GetStatic.GetUser(), customerId);
  30. //set customer details
  31. SetCustomerDetails(dataSet.Rows[0]);
  32. }
  33. private string GetCustomerId()
  34. {
  35. return GetStatic.ReadQueryString("customerId", "");
  36. }
  37. private void SetCustomerDetails(DataRow dr)
  38. {
  39. //var result = dbResult.Id.Split('|');
  40. //var customerId = result[0];
  41. //var membershipId = result[1];
  42. //var registerDate = result[2];
  43. //string signatureName = GetStatic.UploadSignatureImage(hddImgURL.Value, registerDate, membershipId, customerId);
  44. //if (signatureName != "1")
  45. //{
  46. // _cd.AddCustomerSignature(customerId, GetStatic.GetUser(), signatureName, "agent-upload", customerId);
  47. //}
  48. hdnCustomerId.Value = dr["customerId"].ToString();
  49. txtCustomerType.InnerText = dr["customerType"].ToString();
  50. txtFullName.InnerText = dr["fullName"].ToString();
  51. customerName.InnerText = dr["fullName"].ToString();
  52. membershiId.InnerText = dr["membershipId"].ToString();
  53. hdnAccountName.Value = txtFullName.InnerText;
  54. txtGender.InnerText = dr["gender"].ToString();
  55. txtCountry.InnerText = dr["country"].ToString();
  56. txtAddress.InnerText = dr["address"].ToString();
  57. txtZipcCode.InnerText = dr["zipcode"].ToString();
  58. txtCity.InnerText = dr["city"].ToString();
  59. txtEmailId.InnerText = dr["email"].ToString();
  60. txtTelephoneNo.InnerText = dr["telNo"].ToString();
  61. txtMobileNo.InnerText = dr["mobile"].ToString();
  62. txtNativeCountry.InnerText = dr["nativeCountry"].ToString();
  63. txtDateOfBirth.InnerText = dr["dob"].ToString();
  64. txtOccupation.InnerText = dr["occupation"].ToString();
  65. txtOtherOccupation.InnerText = dr["occupationOther"].ToString();
  66. txtIssueDate.InnerText = dr["idIssueDate"].ToString();
  67. txtExpireDate.InnerText = dr["idExpiryDate"].ToString();
  68. txtIdType.InnerText = dr["idType"].ToString();
  69. txtIdNumber.InnerText = dr["idNumber"].ToString();
  70. txtVisaStatus.InnerText = dr["visaStatus"].ToString();
  71. txtEmployeeBusinessType.InnerText = dr["employeeBusinessType"].ToString();
  72. txtNameOfEmployer.InnerText = dr["nameOfEmployeer"].ToString();
  73. txtMonthlyIncome.InnerText = dr["monthlyIncome"].ToString();
  74. txtRemittanceAllowed.InnerText = dr["remittanceAllowed"].ToString();
  75. txtOnlineLoginAllowed.InnerText = dr["onlineUser"].ToString();
  76. txtMobileLoginAllowed.InnerText = dr["mobileUser"].ToString();
  77. txtRemarks.InnerText = dr["remarks"].ToString();
  78. txtSourceOfFund.InnerText = dr["sourceOfFund"].ToString();
  79. }
  80. protected void registerCustomerAndReceiver_Click(object sender, EventArgs e)
  81. {
  82. var ImgURL = hddImgURL.Value;
  83. if (string.IsNullOrEmpty(ImgURL))
  84. {
  85. GetStatic.AlertMessage(this, "No signature found!");
  86. return;
  87. }
  88. var customerId = GetCustomerId();
  89. var customerDetails = _cd.GetRequiredCustomerDetails(customerId, GetStatic.GetUser());
  90. string membershipId = Convert.ToString(customerDetails["membershipId"]);
  91. string registrationDate = Convert.ToString(customerDetails["createdDate"]);
  92. string signatureName = GetStatic.UploadSignatureImage(ImgURL, registrationDate, membershipId, customerId);
  93. if (signatureName != "1")
  94. {
  95. var dbRes = _cd.AddCustomerSignature(customerId, GetStatic.GetUser(), signatureName, "Counter (Customer-Signature)", customerId);
  96. GetStatic.SetMessage(dbRes);
  97. if (dbRes.ErrorCode == "0")
  98. {
  99. SavePDF();
  100. }
  101. Response.Redirect("/AgentNew/TabletMenu/CustomerPendingList.aspx");
  102. }
  103. }
  104. private void SavePDF()
  105. {
  106. customerSign.Visible = false;
  107. customerVerifyBtn.Visible = false;
  108. docDiv.Visible = true;
  109. dateDiv.Visible = true;
  110. var result = _cd.GetCustomerDetailsForPDFSave(GetCustomerId(), GetCustomerId(), "customer", "Y").Split('|');
  111. if (result[0] != "0")
  112. {
  113. return;
  114. }
  115. var customerId = result[1];
  116. var membershipId = result[2];
  117. var registerDate = result[3];
  118. var fileNameSignature = result[4];
  119. string path = GetStatic.GetCustomerFilePath() + "CustomerDocument\\" + registerDate.Replace("-", "\\") + "\\" + membershipId + "\\";
  120. docDiv.InnerHtml = "<div class=\"col-md-12\"><div class=\"form-group\"><label>Customer Signature:</label><img src=\"" + path + fileNameSignature + "\" height=\"150\" width=\"200\" /></div></div>";
  121. todaysDate.InnerText = DateTime.Now.ToString("dd-MM-yyyy");
  122. var sb = new StringBuilder();
  123. downloadDivPDF.RenderControl(new HtmlTextWriter(new StringWriter(sb)));
  124. string s = sb.ToString();
  125. string fileName = GetStatic.HTMLToPDF(s, GetStatic.GetUser(), path, "customer-reg-form");
  126. _cd.AddCustomerPDFUpload(customerId, GetStatic.GetUser(), fileName, "customer", GetCustomerId());
  127. }
  128. }
  129. }