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.

69 lines
2.5 KiB

  1. using Swift.DAL.OnlineAgent;
  2. using Swift.web.Library;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Data;
  6. using System.IO;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Web;
  10. using System.Web.UI;
  11. using System.Web.UI.WebControls;
  12. namespace Swift.web.Remit.Administration.OnlineCustomer
  13. {
  14. public partial class LetterForCustomerFromMobile : System.Web.UI.Page
  15. {
  16. OnlineCustomerDao _cd = new OnlineCustomerDao();
  17. private readonly SwiftLibrary sl = new SwiftLibrary();
  18. protected void Page_Load(object sender, EventArgs e)
  19. {
  20. sl.CheckSession();
  21. PopulateInfo();
  22. SavePDF();
  23. }
  24. private void PopulateInfo()
  25. {
  26. DataRow result = _cd.GetDetailsWithPinNo(GetCustomerId(),GetStatic.GetUser());
  27. customerName.InnerText = result["FullName"].ToString();
  28. customerName1.InnerText = result["FullName"].ToString();
  29. customerAddress1.InnerText = result["Address1"].ToString();
  30. customerAddress2.InnerText = result["Address2"].ToString();
  31. additionalAddress.InnerText = result["additionalAddress"].ToString();
  32. pinNO.InnerText = result["pinNo"].ToString();
  33. userName.InnerText = result["userName"].ToString();
  34. }
  35. private string GetCustomerId()
  36. {
  37. return GetStatic.ReadQueryString("customerId", "");
  38. }
  39. private void SavePDF()
  40. {
  41. var result = _cd.GetCustomerDetailsForLetterPDFSave(GetMembershipId(), GetCustomerId(), "letter").Split('|');
  42. if (result[0] != "0")
  43. {
  44. return;
  45. }
  46. var customerId = result[1];
  47. var membershipId = result[2];
  48. var registerDate = result[3];
  49. string path = GetStatic.GetCustomerFilePath() + "CustomerDocument\\" + registerDate.Replace("-", "\\") + "\\" + membershipId + "\\";
  50. var sb = new StringBuilder();
  51. downloadDivPDF.RenderControl(new HtmlTextWriter(new StringWriter(sb)));
  52. string s = sb.ToString();
  53. string fileName = GetStatic.HTMLToPDF(s, GetStatic.GetUser(), path, "letter");
  54. _cd.AddCustomerLetterPDFUpload(customerId, GetStatic.GetUser(), fileName, "letter", customerId);
  55. }
  56. private string GetMembershipId()
  57. {
  58. return GetStatic.ReadQueryString("membershipId", "");
  59. }
  60. private string GetRowId()
  61. {
  62. return GetStatic.ReadQueryString("customerId", "");
  63. }
  64. }
  65. }