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.

140 lines
5.7 KiB

  1. using System;
  2. using System.Data;
  3. using Swift.DAL.BL.Remit.Administration.Agent;
  4. using Swift.DAL.BL.Remit.Administration.Customer;
  5. using Swift.DAL.BL.Remit.CreditRiskManagement.CreditSecurity;
  6. using Swift.web.Library;
  7. using Swift.DAL.BL.Remit.Reconciliation;
  8. using Swift.DAL.BL.System.GeneralSettings;
  9. namespace Swift.web
  10. {
  11. public partial class ShowFile : System.Web.UI.Page
  12. {
  13. private const string AgentFunctionId = "40121000";
  14. private const string BranchFunctionId = "20101000";
  15. private const string CustomerFunctionId = "20821800,20822000";
  16. private const string CustomerAgentFunctionId = "20101100";
  17. private const string CreditSecurityFunctionId = "20181400";
  18. private const string KycCustomerFunctionId = "20832000";
  19. private const string KycCustomerAgentFunctionId = "40134000";
  20. private const string ReconTxnUploadFunctionId = "20182130";
  21. private const string PopupMessage = "10111100";
  22. protected void Page_Load(object sender, EventArgs e)
  23. {
  24. DisplayFile();
  25. }
  26. private static string GetId()
  27. {
  28. return GetStatic.ReadNumericDataFromQueryString("id").ToString();
  29. }
  30. private static string GetFunctionId()
  31. {
  32. return GetStatic.ReadQueryString("functionId", "");
  33. }
  34. private void DisplayFile()
  35. {
  36. try
  37. {
  38. var thisFunctionId = GetFunctionId();
  39. var url = GetStatic.GetUrlRoot();
  40. if (thisFunctionId == AgentFunctionId)
  41. {
  42. var obj = new AgentDocumentDao();
  43. var dr = obj.SelectById(GetStatic.GetUser(), GetId());
  44. if (dr == null)
  45. return;
  46. url = "img.ashx?id=" + dr["fileName"].ToString();
  47. Response.Redirect(url);
  48. }
  49. if (thisFunctionId == BranchFunctionId)
  50. {
  51. var obj = new AgentDocumentDao();
  52. var dr = obj.SelectById(GetStatic.GetUser(), GetId());
  53. if (dr == null)
  54. return;
  55. url = "img.ashx?id=" + dr["fileName"].ToString();
  56. Response.Redirect(url);
  57. }
  58. if (thisFunctionId == CustomerFunctionId)
  59. {
  60. var obj = new CustomerDocumentDao();
  61. var dr = obj.SelectById(GetStatic.GetUser(), GetId());
  62. if (dr == null)
  63. return;
  64. url = "img.ashx?id=" + dr["fileName"].ToString();
  65. Response.Redirect(url);
  66. }
  67. if (thisFunctionId == KycCustomerFunctionId)
  68. {
  69. var obj = new CustomerDocumentDao();
  70. var dr = obj.SelectById(GetStatic.GetUser(), GetId());
  71. if (dr == null)
  72. return;
  73. url = "img.ashx?id=" + dr["fileName"].ToString();
  74. Response.Redirect(url);
  75. }
  76. if (thisFunctionId == KycCustomerAgentFunctionId)
  77. {
  78. var obj = new CustomerDocumentDao();
  79. var dr = obj.SelectById(GetStatic.GetUser(), GetId());
  80. if (dr == null)
  81. return;
  82. url = "img.ashx?id=" + dr["fileName"].ToString();
  83. Response.Redirect(url);
  84. }
  85. if (thisFunctionId == CreditSecurityFunctionId)
  86. {
  87. //var obj = new CreditSecurityDocDao();
  88. //var dr = obj.SelectById(GetStatic.GetUser(), GetId());
  89. //if (dr == null)
  90. // return;
  91. //url = "img.ashx?functionId=20181400&id=" + dr["fileName"].ToString();
  92. //Response.Redirect(url);
  93. var obj = new CreditSecurityDocDao();
  94. DataRow dr = obj.SelectById(GetStatic.GetUser(), GetId());
  95. if (dr == null)
  96. return;
  97. Response.Redirect(url + "/doc/" + dr["fileName"].ToString());
  98. }
  99. if (thisFunctionId == CustomerAgentFunctionId)
  100. {
  101. var obj = new CustomerDocumentDao();
  102. var dr = obj.SelectById(GetStatic.GetUser(), GetId());
  103. if (dr == null)
  104. return;
  105. url = "img.ashx?id=" + dr["fileName"].ToString();
  106. Response.Redirect(url);
  107. }
  108. if (thisFunctionId == ReconTxnUploadFunctionId)
  109. {
  110. var obj = new TxnDocumentsDao();
  111. var dr = obj.SelectByIdTxn(GetStatic.GetUser(), GetId());
  112. if (dr == null)
  113. return;
  114. url = "img.ashx?id=" + dr["fileName"].ToString() + "&functionId=" + ReconTxnUploadFunctionId + "&year=" + dr["year"].ToString() + "&agent=" + dr["agentId"].ToString();
  115. Response.Redirect(url);
  116. }
  117. if (thisFunctionId == PopupMessage)
  118. {
  119. var _obj = new DynamicPopupMessageDao();
  120. var dr = _obj.SelectByIdTxn(GetStatic.GetUser(), GetId());
  121. if (dr == null)
  122. return;
  123. url = "img.ashx?id=" + dr["fileName"].ToString() + "&functionId=" + PopupMessage;
  124. Response.Redirect(url);
  125. }
  126. }
  127. catch (Exception ex)
  128. {
  129. }
  130. }
  131. }
  132. }